From fc0f5f8ebf24a9f6c8b1ca98d1343bda60fe8e77 Mon Sep 17 00:00:00 2001 From: Prateek Shourya Date: Fri, 23 May 2025 03:54:58 +0530 Subject: [PATCH 01/10] refactor: move web utils to packages --- packages/constants/src/auth.ts | 4 +- packages/constants/src/endpoints.ts | 20 +- .../constants/src}/estimates.ts | 2 +- packages/constants/src/index.ts | 3 +- .../constants/src/{inbox.ts => intake.ts} | 29 ++ packages/types/src/calendar.d.ts | 25 + packages/types/src/cycle/cycle.d.ts | 13 + packages/types/src/index.d.ts | 3 +- .../types/src/layout/gantt.d.ts | 0 packages/types/src/layout/index.ts | 1 + packages/types/src/project/projects.d.ts | 4 + packages/utils/src/auth.ts | 72 +-- .../utils/src/calendar.ts | 54 +- packages/utils/src/color.ts | 139 ++++- packages/utils/src/common.ts | 2 + .../utils/src/cycle.ts | 69 ++- packages/utils/src/datetime.ts | 430 ++++++++++------ .../utils/src/distribution-update.ts | 3 +- .../utils/src/editor.ts | 4 +- packages/utils/src/emoji.ts | 46 +- .../utils/src}/estimates.ts | 2 +- packages/utils/src/file.ts | 64 +++ .../utils/src/filter.ts | 7 +- packages/utils/src/index.ts | 14 +- .../utils/src/intake.ts | 47 +- packages/utils/src/issue.ts | 37 -- packages/utils/src/math.ts | 2 + .../utils/src/module.ts | 7 +- .../utils/src/notification.ts | 2 +- .../utils/src/page.ts | 8 +- packages/utils/src/permission/index.ts | 1 + .../utils/src/permission/role.ts | 1 + .../utils/src/project-views.ts | 10 +- .../utils/src/project.ts | 13 +- .../utils/src/router.ts | 0 packages/utils/src/state.ts | 13 - packages/utils/src/string.ts | 172 ++++--- .../utils/src/tab-indices.ts | 1 + packages/utils/src/theme.ts | 122 +++++ .../utils/src/work-item/base.ts | 33 +- packages/utils/src/work-item/index.ts | 2 + packages/utils/src/work-item/modal.ts | 15 + .../utils/src/work-item/state.ts | 1 - .../(projects)/analytics/header.tsx | 8 +- .../(projects)/extended-project-sidebar.tsx | 3 +- .../(projects)/profile/[userId]/header.tsx | 5 +- .../profile/[userId]/mobile-header.tsx | 2 +- .../cycles/(detail)/[cycleId]/page.tsx | 2 +- .../[projectId]/cycles/(detail)/header.tsx | 15 +- .../cycles/(detail)/mobile-header.tsx | 2 +- .../[projectId]/cycles/(list)/page.tsx | 4 +- .../[projectId]/draft-issues/header.tsx | 2 +- .../(detail)/[projectId]/intake/page.tsx | 5 +- .../issues/(list)/mobile-header.tsx | 2 +- .../modules/(detail)/[moduleId]/page.tsx | 2 +- .../[projectId]/modules/(detail)/header.tsx | 3 +- .../modules/(detail)/mobile-header.tsx | 2 +- .../[projectId]/modules/(list)/page.tsx | 4 +- .../[projectId]/pages/(detail)/header.tsx | 2 +- .../views/(detail)/[viewId]/header.tsx | 2 +- .../[projectId]/views/(list)/page.tsx | 4 +- .../[workspaceSlug]/(projects)/sidebar.tsx | 2 +- .../(projects)/workspace-views/header.tsx | 2 +- .../settings/(workspace)/exports/page.tsx | 5 +- .../settings/(workspace)/members/page.tsx | 3 +- .../(all)/accounts/forgot-password/page.tsx | 3 +- .../(all)/accounts/reset-password/page.tsx | 4 +- web/app/(all)/accounts/set-password/page.tsx | 5 +- web/app/(all)/invitations/page.tsx | 3 +- web/app/(all)/profile/appearance/page.tsx | 2 +- web/app/(all)/profile/security/page.tsx | 7 +- web/app/(all)/profile/sidebar.tsx | 3 +- web/app/error.tsx | 2 +- web/app/provider.tsx | 2 +- .../workspace-active-cycles-upgrade.tsx | 2 +- web/ce/components/command-palette/helpers.tsx | 2 +- web/ce/components/comments/comment-block.tsx | 4 +- .../cycles/analytics-sidebar/base.tsx | 2 +- .../blockDraggables/left-draggable.tsx | 2 +- .../blockDraggables/right-draggable.tsx | 2 +- .../global/product-updates-header.tsx | 2 +- web/ce/components/issues/header.tsx | 3 +- .../issues/issue-details/issue-identifier.tsx | 2 +- .../pages/editor/ai/ask-pi-menu.tsx | 2 +- web/ce/components/pages/editor/ai/menu.tsx | 2 +- .../editor/embed/issue-embed-upgrade-card.tsx | 2 +- .../components/projects/create/attributes.tsx | 2 +- web/ce/components/projects/mobile-header.tsx | 2 +- web/ce/components/workspace/edition-badge.tsx | 2 +- .../workspace/sidebar/app-search.tsx | 2 +- web/ce/components/workspace/upgrade-badge.tsx | 2 +- web/ce/services/project/estimate.service.ts | 2 +- web/ce/services/project/view.service.ts | 3 +- web/ce/services/workspace.service.ts | 3 +- web/ce/store/timeline/base-timeline.store.ts | 4 +- .../components/account/auth-forms/email.tsx | 4 +- .../account/auth-forms/password.tsx | 4 +- .../account/auth-forms/unique-code.tsx | 3 +- .../account/oauth/github-button.tsx | 2 +- .../account/oauth/gitlab-button.tsx | 2 +- .../account/oauth/google-button.tsx | 2 +- .../account/password-strength-meter.tsx | 2 +- .../analytics-v2/select/select-y-axis.tsx | 4 +- .../analytics-v2/total-insights.tsx | 2 +- .../custom-analytics/custom-analytics.tsx | 2 +- .../custom-analytics/graph/index.tsx | 3 +- .../custom-analytics/select/y-axis.tsx | 4 +- .../sidebar/projects-list.tsx | 2 +- .../sidebar/sidebar-header.tsx | 2 +- .../custom-analytics/sidebar/sidebar.tsx | 3 +- .../analytics/custom-analytics/table.tsx | 2 +- .../scope-and-demand/leaderboard.tsx | 2 +- .../analytics/scope-and-demand/scope.tsx | 2 +- .../api-token/modal/create-token-modal.tsx | 3 +- web/core/components/api-token/modal/form.tsx | 4 +- .../modal/generated-token-details.tsx | 3 +- .../components/api-token/token-list-item.tsx | 2 +- .../automation/auto-archive-automation.tsx | 2 +- web/core/components/chart/utils.ts | 4 +- .../actions/issue-actions/actions-list.tsx | 2 +- .../actions/issue-actions/change-assignee.tsx | 2 +- .../command-palette/command-modal.tsx | 3 +- .../command-palette/command-palette.tsx | 2 +- .../shortcuts-modal/commands-list.tsx | 2 +- web/core/components/comments/comment-card.tsx | 2 +- .../components/comments/comment-create.tsx | 3 +- .../components/comments/comment-reaction.tsx | 2 +- .../common/activity/activity-block.tsx | 2 +- .../common/applied-filters/date.tsx | 4 +- .../common/applied-filters/members.tsx | 2 +- web/core/components/common/count-chip.tsx | 2 +- .../components/common/filters/created-at.tsx | 2 +- .../components/common/filters/created-by.tsx | 2 +- web/core/components/common/logo.tsx | 2 +- web/core/components/common/pro-icon.tsx | 2 +- web/core/components/common/switcher-label.tsx | 3 +- web/core/components/core/activity.tsx | 4 +- web/core/components/core/content-wrapper.tsx | 2 +- .../core/filters/date-filter-modal.tsx | 2 +- .../components/core/image-picker-popover.tsx | 2 +- web/core/components/core/list/list-item.tsx | 2 +- .../modals/existing-issues-list-modal.tsx | 3 +- .../core/modals/user-image-upload-modal.tsx | 3 +- .../modals/workspace-image-upload-modal.tsx | 3 +- .../multiple-select/entity-select-action.tsx | 2 +- .../multiple-select/group-select-action.tsx | 2 +- .../components/core/render-if-visible-HOC.tsx | 2 +- .../core/sidebar/progress-chart.tsx | 2 +- .../cycles/active-cycle/cycle-stats.tsx | 4 +- .../analytics-sidebar/issue-progress.tsx | 2 +- .../analytics-sidebar/progress-stats.tsx | 3 +- .../analytics-sidebar/sidebar-details.tsx | 4 +- .../analytics-sidebar/sidebar-header.tsx | 11 +- .../cycles/applied-filters/date.tsx | 3 +- .../cycles/applied-filters/root.tsx | 2 +- .../cycles/applied-filters/status.tsx | 2 +- .../cycles/archived-cycles/header.tsx | 3 +- .../cycles/archived-cycles/root.tsx | 2 +- .../components/cycles/cycle-peek-overview.tsx | 2 +- .../components/cycles/cycles-view-header.tsx | 3 +- .../cycles/dropdowns/filters/end-date.tsx | 2 +- .../cycles/dropdowns/filters/start-date.tsx | 2 +- web/core/components/cycles/form.tsx | 5 +- .../cycles/list/cycle-list-group-header.tsx | 2 +- .../cycles/list/cycle-list-item-action.tsx | 4 +- .../list/cycle-list-project-group-header.tsx | 2 +- .../cycles/list/cycles-list-item.tsx | 2 +- web/core/components/cycles/quick-actions.tsx | 3 +- .../widgets/issue-panels/issue-list-item.tsx | 4 +- .../widgets/issue-panels/issues-list.tsx | 2 +- .../widgets/issue-panels/tabs-list.tsx | 2 +- .../dashboard/widgets/overview-stats.tsx | 3 +- .../dashboard/widgets/recent-activity.tsx | 4 +- .../collaborators-list.tsx | 2 +- .../dashboard/widgets/recent-projects.tsx | 2 +- web/core/components/dropdowns/buttons.tsx | 2 +- web/core/components/dropdowns/cycle/index.tsx | 2 +- web/core/components/dropdowns/date-range.tsx | 3 +- web/core/components/dropdowns/date.tsx | 3 +- web/core/components/dropdowns/estimate.tsx | 3 +- .../components/dropdowns/member/avatar.tsx | 3 +- .../components/dropdowns/member/index.tsx | 2 +- .../dropdowns/member/member-options.tsx | 3 +- .../components/dropdowns/module/index.tsx | 2 +- .../dropdowns/module/module-options.tsx | 2 +- web/core/components/dropdowns/priority.tsx | 2 +- web/core/components/dropdowns/project.tsx | 2 +- web/core/components/dropdowns/state.tsx | 2 +- .../editor/embeds/mentions/user.tsx | 3 +- .../lite-text-editor/lite-text-editor.tsx | 3 +- .../lite-text-read-only-editor.tsx | 2 +- .../editor/lite-text-editor/toolbar.tsx | 2 +- .../rich-text-editor/rich-text-editor.tsx | 2 +- .../rich-text-read-only-editor.tsx | 2 +- .../editor/sticky-editor/editor.tsx | 2 +- .../editor/sticky-editor/toolbar.tsx | 2 +- .../components/estimates/create/modal.tsx | 2 +- .../components/estimates/create/stage-one.tsx | 2 +- .../estimates/estimate-list-item.tsx | 5 +- .../estimates/points/create-root.tsx | 2 +- .../components/estimates/points/create.tsx | 5 +- .../components/estimates/points/preview.tsx | 2 +- .../components/estimates/points/update.tsx | 5 +- .../components/estimates/radio-select.tsx | 2 +- .../components/exporter/single-export.tsx | 2 +- .../gantt-chart/blocks/block-row-list.tsx | 2 +- .../gantt-chart/blocks/block-row.tsx | 4 +- .../components/gantt-chart/blocks/block.tsx | 4 +- .../gantt-chart/blocks/blocks-list.tsx | 2 +- .../components/gantt-chart/chart/header.tsx | 4 +- .../gantt-chart/chart/main-content.tsx | 3 +- .../components/gantt-chart/chart/root.tsx | 4 +- .../gantt-chart/chart/views/month.tsx | 2 +- web/core/components/gantt-chart/data/index.ts | 2 +- .../gantt-chart/helpers/add-block.tsx | 4 +- .../blockResizables/left-resizable.tsx | 4 +- .../blockResizables/right-resizable.tsx | 4 +- .../blockResizables/use-gantt-resizable.ts | 2 +- .../gantt-chart/helpers/draggable.tsx | 4 +- web/core/components/gantt-chart/root.tsx | 2 +- .../gantt-chart/sidebar/issues/block.tsx | 4 +- .../gantt-chart/sidebar/issues/sidebar.tsx | 2 +- .../gantt-chart/sidebar/modules/block.tsx | 2 +- .../gantt-chart/sidebar/modules/sidebar.tsx | 2 +- .../components/gantt-chart/sidebar/root.tsx | 4 +- .../components/gantt-chart/sidebar/utils.ts | 2 +- .../components/gantt-chart/views/helpers.ts | 4 +- .../gantt-chart/views/month-view.ts | 2 +- .../gantt-chart/views/quarter-view.ts | 2 +- .../components/gantt-chart/views/week-view.ts | 2 +- .../global/product-updates/footer.tsx | 2 +- .../components/graphs/issues-by-priority.tsx | 2 +- web/core/components/home/root.tsx | 2 +- .../home/widgets/empty-states/no-projects.tsx | 3 +- .../manage/widget-item-drag-handle.tsx | 2 +- .../components/home/widgets/recents/issue.tsx | 3 +- .../components/home/widgets/recents/page.tsx | 5 +- .../home/widgets/recents/project.tsx | 2 +- .../inbox/content/inbox-issue-header.tsx | 8 +- .../content/inbox-issue-mobile-header.tsx | 4 +- .../inbox/content/issue-properties.tsx | 3 +- .../components/inbox/content/issue-root.tsx | 2 +- .../inbox-filter/applied-filters/date.tsx | 4 +- .../inbox-filter/applied-filters/member.tsx | 2 +- .../inbox/inbox-filter/filters/date.tsx | 2 +- .../inbox/inbox-filter/filters/members.tsx | 2 +- .../inbox/inbox-filter/sorting/order-by.tsx | 2 +- .../components/inbox/inbox-issue-status.tsx | 3 +- .../inbox/modals/create-modal/create-root.tsx | 3 +- .../modals/create-modal/issue-description.tsx | 3 +- .../modals/create-modal/issue-properties.tsx | 3 +- .../inbox/modals/create-modal/issue-title.tsx | 2 +- web/core/components/inbox/root.tsx | 4 +- .../inbox/sidebar/inbox-list-item.tsx | 4 +- web/core/components/inbox/sidebar/root.tsx | 5 +- .../components/instance/not-ready-view.tsx | 2 +- .../integration/github/import-data.tsx | 2 +- .../integration/github/select-repository.tsx | 2 +- .../integration/github/single-user-select.tsx | 2 +- .../integration/jira/give-details.tsx | 2 +- .../integration/jira/import-users.tsx | 2 +- .../components/integration/single-import.tsx | 2 +- .../issues/archived-issues-header.tsx | 2 +- .../issues/attachment/attachment-detail.tsx | 6 +- .../attachment/attachment-list-item.tsx | 5 +- .../attachment-list-upload-item.tsx | 2 +- .../attachment/attachment-upload-details.tsx | 5 +- .../attachment/delete-attachment-modal.tsx | 2 +- .../issues/bulk-operations/upgrade-banner.tsx | 2 +- .../create-issue-toast-action-items.tsx | 3 +- .../components/issues/description-input.tsx | 2 +- web/core/components/issues/filters.tsx | 2 +- .../sub-issues/issues-list/list-item.tsx | 3 +- .../sub-issues/issues-list/properties.tsx | 2 +- .../issue-detail-widgets/widget-button.tsx | 2 +- .../issues/issue-detail/cycle-select.tsx | 2 +- .../issue-activity/activity-filter.tsx | 2 +- .../actions/helpers/activity-block.tsx | 2 +- .../activity/actions/helpers/issue-link.tsx | 2 +- .../activity/actions/start_date.tsx | 2 +- .../activity/actions/target_date.tsx | 2 +- .../issue-activity/activity/activity-list.tsx | 2 +- .../issue-detail/issue-activity/helper.tsx | 2 +- .../issue-detail-quick-actions.tsx | 4 +- .../label/select/label-select.tsx | 2 +- .../issues/issue-detail/links/link-detail.tsx | 5 +- .../issues/issue-detail/links/link-item.tsx | 3 +- .../issues/issue-detail/main-content.tsx | 2 +- .../issues/issue-detail/module-select.tsx | 2 +- .../issues/issue-detail/parent-select.tsx | 2 +- .../issues/issue-detail/parent/root.tsx | 2 +- .../issue-detail/parent/sibling-item.tsx | 2 +- .../issue-detail/reactions/issue-comment.tsx | 3 +- .../issues/issue-detail/reactions/issue.tsx | 3 +- .../issues/issue-detail/relation-select.tsx | 3 +- .../issues/issue-detail/sidebar.tsx | 4 +- .../issue-layouts/calendar/calendar.tsx | 5 +- .../issue-layouts/calendar/day-tile.tsx | 7 +- .../calendar/dropdowns/months-dropdown.tsx | 2 +- .../issue-layouts/calendar/issue-block.tsx | 3 +- .../issue-layouts/calendar/issue-blocks.tsx | 2 +- .../calendar/quick-add-issue-actions.tsx | 2 +- .../issues/issue-layouts/calendar/types.d.ts | 24 - .../issue-layouts/calendar/week-days.tsx | 9 +- .../issue-layouts/calendar/week-header.tsx | 2 +- .../filters/applied-filters/date.tsx | 3 +- .../filters/applied-filters/filters-list.tsx | 2 +- .../filters/applied-filters/members.tsx | 2 +- .../roots/global-view-root.tsx | 2 +- .../filters/applied-filters/state.tsx | 2 +- .../filters/header/filters/assignee.tsx | 2 +- .../filters/header/filters/created-by.tsx | 2 +- .../filters/header/filters/mentions.tsx | 2 +- .../issue-layouts/gantt/base-gantt-root.tsx | 7 +- .../issues/issue-layouts/gantt/blocks.tsx | 3 +- .../issue-layouts/group-drag-overlay.tsx | 2 +- .../issues/issue-layouts/kanban/block.tsx | 3 +- .../issue-layouts/kanban/kanban-group.tsx | 2 +- .../issues/issue-layouts/list/block.tsx | 3 +- .../list/headers/group-by-card.tsx | 2 +- .../properties/all-properties.tsx | 4 +- .../quick-action-dropdowns/all-issue.tsx | 4 +- .../quick-action-dropdowns/archived-issue.tsx | 3 +- .../quick-action-dropdowns/cycle-issue.tsx | 4 +- .../quick-action-dropdowns/draft-issue.tsx | 4 +- .../quick-action-dropdowns/module-issue.tsx | 4 +- .../quick-action-dropdowns/project-issue.tsx | 4 +- .../issue-layouts/quick-add/form/gantt.tsx | 2 +- .../issues/issue-layouts/quick-add/root.tsx | 3 +- .../spreadsheet/columns/created-on-column.tsx | 2 +- .../spreadsheet/columns/due-date-column.tsx | 4 +- .../spreadsheet/columns/start-date-column.tsx | 2 +- .../spreadsheet/columns/sub-issue-column.tsx | 2 +- .../spreadsheet/columns/updated-on-column.tsx | 2 +- .../issue-layouts/spreadsheet/issue-row.tsx | 3 +- .../spreadsheet/spreadsheet-header.tsx | 2 +- .../components/issues/issue-layouts/utils.tsx | 3 +- .../components/default-properties.tsx | 3 +- .../components/description-editor.tsx | 3 +- .../issue-modal/components/parent-tag.tsx | 2 +- .../issue-modal/components/project-select.tsx | 3 +- .../issue-modal/components/title-input.tsx | 2 +- .../context/issue-modal-context.tsx | 2 +- .../issues/issue-modal/draft-issue-layout.tsx | 2 +- .../components/issues/issue-modal/form.tsx | 6 +- .../issues/parent-issues-list-modal.tsx | 3 +- .../issues/peek-overview/header.tsx | 4 +- .../issues/peek-overview/issue-detail.tsx | 2 +- .../issues/peek-overview/properties.tsx | 4 +- .../components/issues/peek-overview/view.tsx | 2 +- .../issues/relations/issue-list-item.tsx | 2 +- web/core/components/issues/select/label.tsx | 2 +- web/core/components/issues/title-input.tsx | 2 +- .../workspace-draft/draft-issue-block.tsx | 2 +- .../draft-issue-properties.tsx | 3 +- .../issues/workspace-draft/quick-action.tsx | 2 +- .../issues/workspace-draft/root.tsx | 2 +- .../components/labels/create-label-modal.tsx | 2 +- .../labels/label-block/label-item-block.tsx | 2 +- .../license/modal/card/free-plan.tsx | 2 +- .../analytics-sidebar/issue-progress.tsx | 10 +- .../analytics-sidebar/progress-stats.tsx | 3 +- .../modules/analytics-sidebar/root.tsx | 16 +- .../modules/applied-filters/date.tsx | 3 +- .../modules/applied-filters/members.tsx | 2 +- .../modules/applied-filters/root.tsx | 2 +- .../modules/archived-modules/header.tsx | 3 +- .../modules/archived-modules/root.tsx | 2 +- .../modules/dropdowns/filters/lead.tsx | 2 +- .../modules/dropdowns/filters/members.tsx | 2 +- .../modules/dropdowns/filters/start-date.tsx | 2 +- .../modules/dropdowns/filters/target-date.tsx | 2 +- .../components/modules/dropdowns/order-by.tsx | 2 +- web/core/components/modules/form.tsx | 4 +- .../components/modules/links/list-item.tsx | 5 +- .../components/modules/module-card-item.tsx | 3 +- .../modules/module-list-item-action.tsx | 2 +- .../components/modules/module-list-item.tsx | 2 +- .../modules/module-peek-overview.tsx | 2 +- .../components/modules/module-view-header.tsx | 3 +- web/core/components/modules/quick-actions.tsx | 3 +- .../components/onboarding/invitations.tsx | 3 +- .../components/onboarding/invite-members.tsx | 2 +- .../components/onboarding/profile-setup.tsx | 5 +- .../components/onboarding/step-indicator.tsx | 2 +- .../onboarding/switch-account-dropdown.tsx | 3 +- .../page-views/workspace-dashboard.tsx | 2 +- .../components/pages/dropdowns/actions.tsx | 2 +- .../components/pages/editor/editor-body.tsx | 7 +- web/core/components/pages/editor/title.tsx | 3 +- .../pages/editor/toolbar/color-dropdown.tsx | 2 +- .../pages/editor/toolbar/info-popover.tsx | 6 +- .../pages/editor/toolbar/options-dropdown.tsx | 2 +- .../components/pages/editor/toolbar/root.tsx | 2 +- .../pages/editor/toolbar/toolbar.tsx | 2 +- web/core/components/pages/header/root.tsx | 2 +- .../pages/list/applied-filters/root.tsx | 2 +- .../pages/list/block-item-action.tsx | 3 +- web/core/components/pages/list/block.tsx | 2 +- web/core/components/pages/list/order-by.tsx | 2 +- .../components/pages/list/search-input.tsx | 2 +- .../components/pages/list/tab-navigation.tsx | 2 +- .../components/pages/modals/page-form.tsx | 3 +- .../components/pages/version/main-content.tsx | 2 +- web/core/components/pages/version/root.tsx | 2 +- .../pages/version/sidebar-list-item.tsx | 4 +- .../components/pages/version/sidebar-list.tsx | 2 +- .../profile/activity/activity-list.tsx | 3 +- .../profile/activity/download-button.tsx | 2 +- .../activity/profile-activity-list.tsx | 3 +- web/core/components/profile/form.tsx | 3 +- .../components/profile/overview/activity.tsx | 3 +- .../overview/priority-distribution.tsx | 2 +- .../profile/overview/state-distribution.tsx | 2 +- .../profile/profile-issues-filter.tsx | 2 +- .../profile-setting-content-wrapper.tsx | 2 +- web/core/components/profile/sidebar.tsx | 4 +- .../components/project-states/state-item.tsx | 4 +- .../project/applied-filters/date.tsx | 3 +- .../project/applied-filters/members.tsx | 2 +- .../project/applied-filters/root.tsx | 2 +- web/core/components/project/card.tsx | 12 +- .../project/create-project-modal.tsx | 5 +- .../project/create/common-attributes.tsx | 4 +- web/core/components/project/create/header.tsx | 4 +- .../project/create/project-create-buttons.tsx | 2 +- .../project/dropdowns/filters/created-at.tsx | 2 +- .../project/dropdowns/filters/lead.tsx | 2 +- .../project/dropdowns/filters/members.tsx | 2 +- .../components/project/dropdowns/order-by.tsx | 2 +- web/core/components/project/filters.tsx | 3 +- web/core/components/project/form.tsx | 4 +- web/core/components/project/member-select.tsx | 2 +- .../components/project/multi-select-modal.tsx | 2 +- .../project/publish-project/modal.tsx | 4 +- web/core/components/project/root.tsx | 4 +- .../components/project/search-projects.tsx | 2 +- .../project/send-project-invitation-modal.tsx | 2 +- .../components/sidebar/sidebar-navigation.tsx | 2 +- web/core/components/stickies/modal/search.tsx | 2 +- .../sticky/sticky-item-drag-handle.tsx | 2 +- .../components/views/applied-filters/root.tsx | 2 +- web/core/components/views/form.tsx | 4 +- web/core/components/views/quick-actions.tsx | 3 +- .../components/views/view-list-header.tsx | 2 +- .../views/view-list-item-action.tsx | 3 +- .../web-hooks/create-webhook-modal.tsx | 2 +- .../components/web-hooks/form/secret-key.tsx | 3 +- web/core/components/web-hooks/utils.ts | 2 +- .../notification-app-sidebar-option.tsx | 6 +- .../workspace-notifications/root.tsx | 5 +- .../sidebar/filters/menu/menu-option-item.tsx | 2 +- .../header/options/menu-option/menu-item.tsx | 2 +- .../sidebar/notification-card/content.tsx | 6 +- .../sidebar/notification-card/item.tsx | 4 +- .../notification-card/options/button.tsx | 2 +- .../notification-card/options/root.tsx | 2 +- .../options/snooze/modal.tsx | 2 +- .../notification-card/options/snooze/root.tsx | 2 +- web/core/components/workspace/logo.tsx | 5 +- .../workspace/settings/member-columns.tsx | 2 +- .../workspace/settings/workspace-details.tsx | 3 +- .../workspace/sidebar/dropdown-item.tsx | 3 +- .../components/workspace/sidebar/dropdown.tsx | 4 +- .../sidebar/favorites/favorite-folder.tsx | 2 +- .../common/favorite-item-drag-handle.tsx | 2 +- .../common/favorite-item-quick-action.tsx | 2 +- .../common/favorite-item-wrapper.tsx | 2 +- .../sidebar/favorites/favorites-menu.tsx | 2 +- .../workspace/sidebar/help-section.tsx | 2 +- .../workspace/sidebar/projects-list-item.tsx | 4 +- .../workspace/sidebar/projects-list.tsx | 4 +- .../workspace/sidebar/quick-actions.tsx | 2 +- .../workspace/sidebar/user-menu.tsx | 2 +- .../workspace/sidebar/workspace-menu.tsx | 2 +- .../views/default-view-list-item.tsx | 2 +- .../views/default-view-quick-action.tsx | 4 +- web/core/components/workspace/views/form.tsx | 2 +- .../workspace/views/quick-action.tsx | 4 +- .../workspace/views/view-list-item.tsx | 3 +- web/core/constants/editor.ts | 6 +- web/core/hooks/editor/use-editor-config.ts | 2 +- web/core/hooks/editor/use-editor-mention.tsx | 2 +- web/core/hooks/use-comment-reaction.tsx | 2 +- web/core/hooks/use-favorite-item-details.tsx | 2 +- .../use-issue-peek-overview-redirection.tsx | 2 +- web/core/hooks/use-parse-editor-content.ts | 2 +- web/core/lib/posthog-provider.tsx | 2 +- web/core/lib/wrappers/store-wrapper.tsx | 2 +- web/core/local-db/utils/load-workspace.ts | 2 +- web/core/services/ai.service.ts | 2 +- web/core/services/analytics.service.ts | 2 +- web/core/services/api_token.service.ts | 2 +- web/core/services/app_config.service.ts | 2 +- web/core/services/app_installation.service.ts | 2 +- web/core/services/auth.service.ts | 2 +- web/core/services/cycle.service.ts | 2 +- web/core/services/cycle_archive.service.ts | 2 +- web/core/services/dashboard.service.ts | 2 +- .../services/favorite/favorite.service.ts | 2 +- web/core/services/file.service.ts | 4 +- .../services/inbox/inbox-issue.service.ts | 3 +- .../inbox/intake-work_item_version.service.ts | 2 +- web/core/services/instance.service.ts | 2 +- .../services/integrations/github.service.ts | 2 +- .../integrations/integration.service.ts | 2 +- .../services/integrations/jira.service.ts | 2 +- web/core/services/issue/issue.service.ts | 5 +- .../services/issue/issue_activity.service.ts | 3 +- .../services/issue/issue_archive.service.ts | 3 +- .../issue/issue_attachment.service.ts | 5 +- .../services/issue/issue_comment.service.ts | 5 +- .../services/issue/issue_draft.service.ts | 2 +- .../services/issue/issue_label.service.ts | 2 +- .../services/issue/issue_reaction.service.ts | 3 +- .../services/issue/issue_relation.service.ts | 2 +- .../issue/work_item_version.service.ts | 3 +- .../services/issue/workspace_draft.service.ts | 2 +- web/core/services/issue_filter.service.ts | 2 +- web/core/services/module.service.ts | 2 +- web/core/services/module_archive.service.ts | 2 +- .../page/project-page-version.service.ts | 2 +- .../services/page/project-page.service.ts | 2 +- .../project/project-archive.service.ts | 2 +- .../project/project-export.service.ts | 2 +- .../project/project-member.service.ts | 2 +- .../project/project-publish.service.ts | 2 +- .../services/project/project-state.service.ts | 2 +- web/core/services/project/project.service.ts | 2 +- web/core/services/sticky.service.ts | 3 +- web/core/services/timezone.service.ts | 2 +- web/core/services/user.service.ts | 2 +- web/core/services/webhook.service.ts | 2 +- .../workspace-notification.service.ts | 2 +- web/core/store/cycle.store.ts | 4 +- web/core/store/inbox/inbox-issue.store.ts | 3 +- web/core/store/inbox/project-inbox.store.ts | 4 +- web/core/store/issue/archived/filter.store.ts | 2 +- web/core/store/issue/cycle/filter.store.ts | 2 +- web/core/store/issue/cycle/issue.store.ts | 2 +- web/core/store/issue/draft/filter.store.ts | 2 +- .../store/issue/helpers/base-issues-utils.ts | 3 +- .../store/issue/helpers/base-issues.store.ts | 5 +- .../helpers/issue-filter-helper.store.ts | 2 +- .../issue-details/comment_reaction.store.ts | 2 +- .../issue/issue-details/reaction.store.ts | 2 +- web/core/store/issue/issue.store.ts | 2 +- .../store/issue/issue_calendar_view.store.ts | 6 +- .../store/issue/issue_gantt_view.store.ts | 2 +- web/core/store/issue/module/filter.store.ts | 2 +- web/core/store/issue/module/issue.store.ts | 2 +- web/core/store/issue/profile/filter.store.ts | 2 +- .../store/issue/project-views/filter.store.ts | 2 +- web/core/store/issue/project/filter.store.ts | 2 +- .../issue/workspace-draft/filter.store.ts | 2 +- .../issue/workspace-draft/issue.store.ts | 2 +- .../store/issue/workspace/filter.store.ts | 2 +- web/core/store/label.store.ts | 2 +- web/core/store/module.store.ts | 3 +- .../workspace-notifications.store.ts | 2 +- web/core/store/pages/project-page.store.ts | 2 +- web/core/store/project-view.store.ts | 2 +- web/core/store/project/project.store.ts | 2 +- web/core/store/state.store.ts | 2 +- web/core/store/user/index.ts | 7 +- web/helpers/analytics.helper.ts | 4 +- web/helpers/array.helper.ts | 119 ----- web/helpers/attachment.helper.ts | 32 -- web/helpers/authentication.helper.tsx | 4 +- web/helpers/color.helper.ts | 144 ------ web/helpers/command-palette.ts | 1 - web/helpers/common.helper.ts | 44 -- web/helpers/dashboard.helper.ts | 4 +- web/helpers/date-time.helper.ts | 477 ------------------ web/helpers/download.helper.ts | 14 - web/helpers/emoji.helper.tsx | 66 +-- web/helpers/file.helper.ts | 96 ---- web/helpers/graph.helper.ts | 2 + web/helpers/issue-modal.helper.ts | 16 - web/helpers/password.helper.ts | 67 --- web/helpers/string.helper.ts | 265 ---------- web/helpers/theme.helper.ts | 123 ----- 582 files changed, 1619 insertions(+), 2838 deletions(-) rename {web/ce/constants => packages/constants/src}/estimates.ts (99%) rename packages/constants/src/{inbox.ts => intake.ts} (81%) rename web/core/components/gantt-chart/types/index.ts => packages/types/src/layout/gantt.d.ts (100%) create mode 100644 packages/types/src/layout/index.ts rename web/helpers/calendar.helper.ts => packages/utils/src/calendar.ts (66%) rename web/helpers/cycle.helper.ts => packages/utils/src/cycle.ts (77%) rename web/helpers/distribution-update.helper.ts => packages/utils/src/distribution-update.ts (99%) rename web/helpers/editor.helper.ts => packages/utils/src/editor.ts (94%) rename {web/helpers => packages/utils/src}/estimates.ts (94%) rename web/helpers/filter.helper.ts => packages/utils/src/filter.ts (95%) rename web/helpers/inbox.helper.ts => packages/utils/src/intake.ts (57%) delete mode 100644 packages/utils/src/issue.ts create mode 100644 packages/utils/src/math.ts rename web/helpers/module.helper.ts => packages/utils/src/module.ts (96%) rename web/helpers/notification.helper.ts => packages/utils/src/notification.ts (82%) rename web/helpers/page.helper.ts => packages/utils/src/page.ts (95%) create mode 100644 packages/utils/src/permission/index.ts rename web/helpers/user.helper.ts => packages/utils/src/permission/role.ts (95%) rename web/helpers/project-views.helpers.ts => packages/utils/src/project-views.ts (94%) rename web/helpers/project.helper.ts => packages/utils/src/project.ts (93%) rename web/helpers/router.helper.ts => packages/utils/src/router.ts (100%) delete mode 100644 packages/utils/src/state.ts rename web/helpers/tab-indices.helper.ts => packages/utils/src/tab-indices.ts (95%) rename web/helpers/issue.helper.ts => packages/utils/src/work-item/base.ts (92%) rename web/helpers/state.helper.ts => packages/utils/src/work-item/state.ts (99%) delete mode 100644 web/core/components/issues/issue-layouts/calendar/types.d.ts delete mode 100644 web/helpers/array.helper.ts delete mode 100644 web/helpers/attachment.helper.ts delete mode 100644 web/helpers/color.helper.ts delete mode 100644 web/helpers/command-palette.ts delete mode 100644 web/helpers/common.helper.ts delete mode 100644 web/helpers/date-time.helper.ts delete mode 100644 web/helpers/download.helper.ts delete mode 100644 web/helpers/file.helper.ts delete mode 100644 web/helpers/issue-modal.helper.ts delete mode 100644 web/helpers/password.helper.ts delete mode 100644 web/helpers/string.helper.ts delete mode 100644 web/helpers/theme.helper.ts diff --git a/packages/constants/src/auth.ts b/packages/constants/src/auth.ts index bcdda31b4d4..390313bf710 100644 --- a/packages/constants/src/auth.ts +++ b/packages/constants/src/auth.ts @@ -69,9 +69,9 @@ export enum EErrorAlertType { export type TAuthErrorInfo = { type: EErrorAlertType; - code: EAdminAuthErrorCodes; + code: EAuthErrorCodes; title: string; - message: any; + message: React.ReactNode; }; export enum EAdminAuthErrorCodes { diff --git a/packages/constants/src/endpoints.ts b/packages/constants/src/endpoints.ts index cd1c08d7a41..f7f79a6c1fb 100644 --- a/packages/constants/src/endpoints.ts +++ b/packages/constants/src/endpoints.ts @@ -1,22 +1,22 @@ export const API_BASE_URL = process.env.NEXT_PUBLIC_API_BASE_URL || ""; -export const API_BASE_PATH = process.env.NEXT_PUBLIC_API_BASE_PATH || "/"; -export const API_URL = encodeURI(`${API_BASE_URL}${API_BASE_PATH}`); +export const API_BASE_PATH = process.env.NEXT_PUBLIC_API_BASE_PATH || ""; +export const API_URL = encodeURI(`${API_BASE_URL}${API_BASE_PATH}/`); // God Mode Admin App Base Url export const ADMIN_BASE_URL = process.env.NEXT_PUBLIC_ADMIN_BASE_URL || ""; -export const ADMIN_BASE_PATH = process.env.NEXT_PUBLIC_ADMIN_BASE_PATH || "/"; -export const GOD_MODE_URL = encodeURI(`${ADMIN_BASE_URL}${ADMIN_BASE_PATH}`); +export const ADMIN_BASE_PATH = process.env.NEXT_PUBLIC_ADMIN_BASE_PATH || ""; +export const GOD_MODE_URL = encodeURI(`${ADMIN_BASE_URL}${ADMIN_BASE_PATH}/`); // Publish App Base Url export const SPACE_BASE_URL = process.env.NEXT_PUBLIC_SPACE_BASE_URL || ""; -export const SPACE_BASE_PATH = process.env.NEXT_PUBLIC_SPACE_BASE_PATH || "/"; -export const SITES_URL = encodeURI(`${SPACE_BASE_URL}${SPACE_BASE_PATH}`); +export const SPACE_BASE_PATH = process.env.NEXT_PUBLIC_SPACE_BASE_PATH || ""; +export const SITES_URL = encodeURI(`${SPACE_BASE_URL}${SPACE_BASE_PATH}/`); // Live App Base Url export const LIVE_BASE_URL = process.env.NEXT_PUBLIC_LIVE_BASE_URL || ""; -export const LIVE_BASE_PATH = process.env.NEXT_PUBLIC_LIVE_BASE_PATH || "/"; -export const LIVE_URL = encodeURI(`${LIVE_BASE_URL}${LIVE_BASE_PATH}`); +export const LIVE_BASE_PATH = process.env.NEXT_PUBLIC_LIVE_BASE_PATH || ""; +export const LIVE_URL = encodeURI(`${LIVE_BASE_URL}${LIVE_BASE_PATH}/`); // Web App Base Url export const WEB_BASE_URL = process.env.NEXT_PUBLIC_WEB_BASE_URL || ""; -export const WEB_BASE_PATH = process.env.NEXT_PUBLIC_WEB_BASE_PATH || "/"; -export const WEB_URL = encodeURI(`${WEB_BASE_URL}${WEB_BASE_PATH}`); +export const WEB_BASE_PATH = process.env.NEXT_PUBLIC_WEB_BASE_PATH || ""; +export const WEB_URL = encodeURI(`${WEB_BASE_URL}${WEB_BASE_PATH}/`); // plane website url export const WEBSITE_URL = process.env.NEXT_PUBLIC_WEBSITE_URL || "https://plane.so"; diff --git a/web/ce/constants/estimates.ts b/packages/constants/src/estimates.ts similarity index 99% rename from web/ce/constants/estimates.ts rename to packages/constants/src/estimates.ts index 2cba8ac837a..34e04e562f4 100644 --- a/web/ce/constants/estimates.ts +++ b/packages/constants/src/estimates.ts @@ -1,4 +1,4 @@ -// types +// plane imports import { TEstimateSystems } from "@plane/types"; export const MAX_ESTIMATE_POINT_INPUT_LENGTH = 20; diff --git a/packages/constants/src/index.ts b/packages/constants/src/index.ts index 58b51ed723a..a9da528c327 100644 --- a/packages/constants/src/index.ts +++ b/packages/constants/src/index.ts @@ -22,7 +22,7 @@ export * from "./module"; export * from "./project"; export * from "./views"; export * from "./themes"; -export * from "./inbox"; +export * from "./intake"; export * from "./profile"; export * from "./workspace-drafts"; export * from "./label"; @@ -35,3 +35,4 @@ export * from "./subscription"; export * from "./settings"; export * from "./icon"; export * from "./analytics-v2"; +export * from "./estimates"; diff --git a/packages/constants/src/inbox.ts b/packages/constants/src/intake.ts similarity index 81% rename from packages/constants/src/inbox.ts rename to packages/constants/src/intake.ts index 2d94c1f04c2..be8c6ffe379 100644 --- a/packages/constants/src/inbox.ts +++ b/packages/constants/src/intake.ts @@ -95,3 +95,32 @@ export const INBOX_ISSUE_SORT_BY_OPTIONS = [ i18n_label: "common.sort.desc", }, ]; + +export enum EPastDurationFilters { + TODAY = "today", + YESTERDAY = "yesterday", + LAST_7_DAYS = "last_7_days", + LAST_30_DAYS = "last_30_days", +} + +export const PAST_DURATION_FILTER_OPTIONS: { + name: string; + value: string; +}[] = [ + { + name: "Today", + value: EPastDurationFilters.TODAY, + }, + { + name: "Yesterday", + value: EPastDurationFilters.YESTERDAY, + }, + { + name: "Last 7 days", + value: EPastDurationFilters.LAST_7_DAYS, + }, + { + name: "Last 30 days", + value: EPastDurationFilters.LAST_30_DAYS, + }, +]; diff --git a/packages/types/src/calendar.d.ts b/packages/types/src/calendar.d.ts index cb27e2d1085..348d93b1fd8 100644 --- a/packages/types/src/calendar.d.ts +++ b/packages/types/src/calendar.d.ts @@ -2,3 +2,28 @@ export interface ICalendarRange { startDate: Date; endDate: Date; } + +export interface ICalendarDate { + date: Date; + year: number; + month: number; + day: number; + week: number; // week number wrt year, eg- 51, 52 + is_current_month: boolean; + is_current_week: boolean; + is_today: boolean; +} + +export interface ICalendarWeek { + [date: string]: ICalendarDate; +} + +export interface ICalendarMonth { + [monthIndex: string]: { + [weekNumber: string]: ICalendarWeek; + }; +} + +export interface ICalendarPayload { + [year: string]: ICalendarMonth; +} diff --git a/packages/types/src/cycle/cycle.d.ts b/packages/types/src/cycle/cycle.d.ts index 638d974e641..2182199145c 100644 --- a/packages/types/src/cycle/cycle.d.ts +++ b/packages/types/src/cycle/cycle.d.ts @@ -136,3 +136,16 @@ export type TPublicCycle = { name: string; status: string; }; + +export type TProgressChartData = { + date: string; + scope: number; + completed: number; + backlog: number; + started: number; + unstarted: number; + cancelled: number; + pending: number; + ideal: number; + actual: number; +}[]; diff --git a/packages/types/src/index.d.ts b/packages/types/src/index.d.ts index 0ac656fc69f..1cf78a07a63 100644 --- a/packages/types/src/index.d.ts +++ b/packages/types/src/index.d.ts @@ -43,4 +43,5 @@ export * from "./home"; export * from "./stickies"; export * from "./utils"; export * from "./payment"; -export * from "./analytics-v2"; \ No newline at end of file +export * from "./analytics-v2"; +export * from "./layout"; diff --git a/web/core/components/gantt-chart/types/index.ts b/packages/types/src/layout/gantt.d.ts similarity index 100% rename from web/core/components/gantt-chart/types/index.ts rename to packages/types/src/layout/gantt.d.ts diff --git a/packages/types/src/layout/index.ts b/packages/types/src/layout/index.ts new file mode 100644 index 00000000000..88de77a542c --- /dev/null +++ b/packages/types/src/layout/index.ts @@ -0,0 +1 @@ +export * from "./gantt"; diff --git a/packages/types/src/project/projects.d.ts b/packages/types/src/project/projects.d.ts index ae1897d3071..8a93b290a4e 100644 --- a/packages/types/src/project/projects.d.ts +++ b/packages/types/src/project/projects.d.ts @@ -140,3 +140,7 @@ export interface ISearchIssueResponse { workspace__slug: string; type_id: string; } + +export type TPartialProject = IPartialProject; + +export type TProject = TPartialProject & IProject; diff --git a/packages/utils/src/auth.ts b/packages/utils/src/auth.ts index 297b4c9ed17..9d857e4dff5 100644 --- a/packages/utils/src/auth.ts +++ b/packages/utils/src/auth.ts @@ -1,11 +1,12 @@ import { ReactNode } from "react"; import zxcvbn from "zxcvbn"; +// plane imports import { E_PASSWORD_STRENGTH, - SPACE_PASSWORD_CRITERIA, PASSWORD_MIN_LENGTH, EErrorAlertType, EAuthErrorCodes, + TAuthErrorInfo, } from "@plane/constants"; /** @@ -30,50 +31,29 @@ export type PasswordCriterion = { /** * @description Password strength criteria */ -export const PASSWORD_CRITERIA: PasswordCriterion[] = [ - { regex: /[a-z]/, description: "lowercase" }, - { regex: /[A-Z]/, description: "uppercase" }, - { regex: /[0-9]/, description: "number" }, - { regex: /[^a-zA-Z0-9]/, description: "special character" }, +export const PASSWORD_CRITERIA = [ + { + key: "min_8_char", + label: "Min 8 characters", + isCriteriaValid: (password: string) => password.length >= PASSWORD_MIN_LENGTH, + }, + // { + // key: "min_1_upper_case", + // label: "Min 1 upper-case letter", + // isCriteriaValid: (password: string) => PASSWORD_NUMBER_REGEX.test(password), + // }, + // { + // key: "min_1_number", + // label: "Min 1 number", + // isCriteriaValid: (password: string) => PASSWORD_CHAR_CAPS_REGEX.test(password), + // }, + // { + // key: "min_1_special_char", + // label: "Min 1 special character", + // isCriteriaValid: (password: string) => PASSWORD_SPECIAL_CHAR_REGEX.test(password), + // }, ]; -/** - * @description Checks if password meets all criteria - * @param {string} password - Password to check - * @returns {boolean} Whether password meets all criteria - */ -export const checkPasswordCriteria = (password: string): boolean => - PASSWORD_CRITERIA.every((criterion) => criterion.regex.test(password)); - -/** - * @description Checks password strength against criteria - * @param {string} password - Password to check - * @returns {PasswordStrength} Password strength level - * @example - * checkPasswordStrength("abc") // returns PasswordStrength.WEAK - * checkPasswordStrength("Abc123!@#") // returns PasswordStrength.STRONG - */ -export const checkPasswordStrength = (password: string): PasswordStrength => { - if (!password || password.length === 0) return PasswordStrength.EMPTY; - if (password.length < PASSWORD_MIN_LENGTH) return PasswordStrength.WEAK; - - const criteriaCount = PASSWORD_CRITERIA.filter((criterion) => criterion.regex.test(password)).length; - - const zxcvbnScore = zxcvbn(password).score; - - if (criteriaCount <= 1 || zxcvbnScore <= 1) return PasswordStrength.WEAK; - if (criteriaCount === 2 || zxcvbnScore === 2) return PasswordStrength.FAIR; - if (criteriaCount === 3 || zxcvbnScore === 3) return PasswordStrength.GOOD; - return PasswordStrength.STRONG; -}; - -export type TAuthErrorInfo = { - type: EErrorAlertType; - code: EAuthErrorCodes; - title: string; - message: ReactNode; -}; - // Password strength check export const getPasswordStrength = (password: string): E_PASSWORD_STRENGTH => { let passwordStrength: E_PASSWORD_STRENGTH = E_PASSWORD_STRENGTH.EMPTY; @@ -89,9 +69,9 @@ export const getPasswordStrength = (password: string): E_PASSWORD_STRENGTH => { return passwordStrength; } - const passwordCriteriaValidation = SPACE_PASSWORD_CRITERIA.map((criteria) => - criteria.isCriteriaValid(password) - ).every((criterion) => criterion); + const passwordCriteriaValidation = PASSWORD_CRITERIA.map((criteria) => criteria.isCriteriaValid(password)).every( + (criterion) => criterion + ); const passwordStrengthScore = zxcvbn(password).score; if (passwordCriteriaValidation === false || passwordStrengthScore <= 2) { diff --git a/web/helpers/calendar.helper.ts b/packages/utils/src/calendar.ts similarity index 66% rename from web/helpers/calendar.helper.ts rename to packages/utils/src/calendar.ts index 709cf9c9610..f4217ea41b1 100644 --- a/web/helpers/calendar.helper.ts +++ b/packages/utils/src/calendar.ts @@ -1,46 +1,8 @@ +// plane imports import { EStartOfTheWeek } from "@plane/constants"; -// helpers -import { ICalendarDate, ICalendarPayload } from "@/components/issues"; -import { DAYS_LIST } from "@/constants/calendar"; -import { getWeekNumberOfDate, renderFormattedPayloadDate } from "@/helpers/date-time.helper"; -// types - -export const formatDate = (date: Date, format: string): string => { - const day = date.getDate(); - const month = date.getMonth() + 1; - const year = date.getFullYear(); - const hours = date.getHours(); - const minutes = date.getMinutes(); - const seconds = date.getSeconds(); - const daysOfWeek = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]; - const monthsOfYear = [ - "January", - "February", - "March", - "April", - "May", - "June", - "July", - "August", - "September", - "October", - "November", - "December", - ]; - - const formattedDate = format - .replace("dd", day.toString().padStart(2, "0")) - .replace("d", day.toString()) - .replace("eee", daysOfWeek[date.getDay()]) - .replace("Month", monthsOfYear[month - 1]) - .replace("yyyy", year.toString()) - .replace("yyy", year.toString().slice(-3)) - .replace("hh", hours.toString().padStart(2, "0")) - .replace("mm", minutes.toString().padStart(2, "0")) - .replace("ss", seconds.toString().padStart(2, "0")); - - return formattedDate; -}; +import { ICalendarDate, ICalendarPayload } from "@plane/types"; +// local imports +import { getWeekNumberOfDate, renderFormattedPayloadDate } from "./datetime"; /** * @returns {ICalendarPayload} calendar payload to render the calendar @@ -101,14 +63,12 @@ export const generateCalendarData = (currentStructure: ICalendarPayload | null, * @param getDayIndex Function to get the day index (0-6) from an item. * @param startOfWeek The day to start the week on. */ -export function getOrderedDays( +export const getOrderedDays = ( items: T[], getDayIndex: (item: T) => number, startOfWeek: EStartOfTheWeek = EStartOfTheWeek.SUNDAY -): T[] { - return [...items].sort((a, b) => { +): T[] => [...items].sort((a, b) => { const dayA = (7 + getDayIndex(a) - startOfWeek) % 7; const dayB = (7 + getDayIndex(b) - startOfWeek) % 7; return dayA - dayB; - }); -} + }) diff --git a/packages/utils/src/color.ts b/packages/utils/src/color.ts index f97910efa08..4f1194c62eb 100644 --- a/packages/utils/src/color.ts +++ b/packages/utils/src/color.ts @@ -1,13 +1,13 @@ /** * Represents an RGB color with numeric values for red, green, and blue components - * @typedef {Object} RGB + * @typedef {Object} TRgb * @property {number} r - Red component (0-255) * @property {number} g - Green component (0-255) * @property {number} b - Blue component (0-255) */ -export type RGB = { r: number; g: number; b: number }; +export type TRgb = { r: number; g: number; b: number }; -export type HSL = { h: number; s: number; l: number }; +export type THsl = { h: number; s: number; l: number }; /** * @description Validates and clamps color values to RGB range (0-255) @@ -40,7 +40,7 @@ export const toHex = (value: number) => validateColor(value).toString(16).padSta * hexToRgb("#00ff00") // returns { r: 0, g: 255, b: 0 } * hexToRgb("#0000ff") // returns { r: 0, g: 0, b: 255 } */ -export const hexToRgb = (hex: string): RGB => { +export const hexToRgb = (hex: string): TRgb => { const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex.trim()); return result ? { @@ -63,7 +63,7 @@ export const hexToRgb = (hex: string): RGB => { * rgbToHex({ r: 0, g: 255, b: 0 }) // returns "#00ff00" * rgbToHex({ r: 0, g: 0, b: 255 }) // returns "#0000ff" */ -export const rgbToHex = ({ r, g, b }: RGB): string => `#${toHex(r)}${toHex(g)}${toHex(b)}`; +export const rgbToHex = ({ r, g, b }: TRgb): string => `#${toHex(r)}${toHex(g)}${toHex(b)}`; /** * Converts Hex values to HSL values @@ -74,7 +74,7 @@ export const rgbToHex = ({ r, g, b }: RGB): string => `#${toHex(r)}${toHex(g)}${ * hexToHsl("#00ff00") // returns { h: 120, s: 100, l: 50 } * hexToHsl("#0000ff") // returns { h: 240, s: 100, l: 50 } */ -export const hexToHsl = (hex: string): HSL => { +export const hexToHsl = (hex: string): THsl => { // return default value for invalid hex if (!/^#[0-9A-Fa-f]{6}$/.test(hex)) return { h: 0, s: 0, l: 0 }; @@ -124,7 +124,7 @@ export const hexToHsl = (hex: string): HSL => { * hslToHex({ h: 120, s: 100, l: 50 }) // returns "#00ff00" * hslToHex({ h: 240, s: 100, l: 50 }) // returns "#0000ff" */ -export const hslToHex = ({ h, s, l }: HSL): string => { +export const hslToHex = ({ h, s, l }: THsl): string => { if (h < 0 || h > 360) return "#000000"; if (s < 0 || s > 100) return "#000000"; if (l < 0 || l > 100) return "#000000"; @@ -142,3 +142,128 @@ export const hslToHex = ({ h, s, l }: HSL): string => { return `#${f(0)}${f(8)}${f(4)}`; }; + +/** + * Calculate relative luminance of a color according to WCAG + * @param {Object} rgb - RGB color object with r, g, b properties + * @returns {number} Relative luminance value + */ +export const getLuminance = ({ r, g, b }: TRgb) => { + // Convert RGB to sRGB + const sR = r / 255; + const sG = g / 255; + const sB = b / 255; + + // Convert sRGB to linear RGB with gamma correction + const R = sR <= 0.03928 ? sR / 12.92 : Math.pow((sR + 0.055) / 1.055, 2.4); + const G = sG <= 0.03928 ? sG / 12.92 : Math.pow((sG + 0.055) / 1.055, 2.4); + const B = sB <= 0.03928 ? sB / 12.92 : Math.pow((sB + 0.055) / 1.055, 2.4); + + // Calculate luminance + return 0.2126 * R + 0.7152 * G + 0.0722 * B; +}; + +/** + * Calculate contrast ratio between two colors + * @param {Object} rgb1 - First RGB color object + * @param {Object} rgb2 - Second RGB color object + * @returns {number} Contrast ratio between the colors + */ +export function getContrastRatio(rgb1: { r: number; g: number; b: number }, rgb2: { r: number; g: number; b: number }) { + const luminance1 = getLuminance(rgb1); + const luminance2 = getLuminance(rgb2); + + const lighter = Math.max(luminance1, luminance2); + const darker = Math.min(luminance1, luminance2); + + return (lighter + 0.05) / (darker + 0.05); +} + +/** + * Lighten a color by a specified amount + * @param {Object} rgb - RGB color object + * @param {number} amount - Amount to lighten (0-1) + * @returns {Object} Lightened RGB color + */ +export function lightenColor(rgb: { r: number; g: number; b: number }, amount: number) { + return { + r: rgb.r + (255 - rgb.r) * amount, + g: rgb.g + (255 - rgb.g) * amount, + b: rgb.b + (255 - rgb.b) * amount, + }; +} + +/** + * Darken a color by a specified amount + * @param {Object} rgb - RGB color object + * @param {number} amount - Amount to darken (0-1) + * @returns {Object} Darkened RGB color + */ +export function darkenColor(rgb: { r: number; g: number; b: number }, amount: number) { + return { + r: rgb.r * (1 - amount), + g: rgb.g * (1 - amount), + b: rgb.b * (1 - amount), + }; +} + +/** + * Generate appropriate foreground and background colors based on input color + * @param {string} color - Input color in hex format + * @returns {Object} Object containing foreground and background colors in hex format + */ +export function generateIconColors(color: string) { + // Parse input color + const rgbColor = hexToRgb(color); + const luminance = getLuminance(rgbColor); + + // Initialize output colors + let foregroundColor = rgbColor; + + // Constants for color adjustment + const MIN_CONTRAST_RATIO = 3.0; // Minimum acceptable contrast ratio + + // For light colors, use as foreground and darken for background + if (luminance > 0.5) { + // Make sure the foreground color is dark enough for visibility + let adjustedForeground = foregroundColor; + const whiteContrast = getContrastRatio(foregroundColor, { r: 255, g: 255, b: 255 }); + + if (whiteContrast < MIN_CONTRAST_RATIO) { + // Darken the foreground color until it has enough contrast + let darkenAmount = 0.1; + while (darkenAmount <= 0.9) { + adjustedForeground = darkenColor(foregroundColor, darkenAmount); + if (getContrastRatio(adjustedForeground, { r: 255, g: 255, b: 255 }) >= MIN_CONTRAST_RATIO) { + break; + } + darkenAmount += 0.1; + } + foregroundColor = adjustedForeground; + } + } + // For dark colors, use as foreground and lighten for background + else { + // Make sure the foreground color is light enough for visibility + let adjustedForeground = foregroundColor; + const blackContrast = getContrastRatio(foregroundColor, { r: 0, g: 0, b: 0 }); + + if (blackContrast < MIN_CONTRAST_RATIO) { + // Lighten the foreground color until it has enough contrast + let lightenAmount = 0.1; + while (lightenAmount <= 0.9) { + adjustedForeground = lightenColor(foregroundColor, lightenAmount); + if (getContrastRatio(adjustedForeground, { r: 0, g: 0, b: 0 }) >= MIN_CONTRAST_RATIO) { + break; + } + lightenAmount += 0.1; + } + foregroundColor = adjustedForeground; + } + } + + return { + foreground: rgbToHex({ r: foregroundColor.r, g: foregroundColor.g, b: foregroundColor.b }), + background: `rgba(${foregroundColor.r}, ${foregroundColor.g}, ${foregroundColor.b}, 0.25)`, + }; +} diff --git a/packages/utils/src/common.ts b/packages/utils/src/common.ts index d2d02c299a0..a65d62cfbbd 100644 --- a/packages/utils/src/common.ts +++ b/packages/utils/src/common.ts @@ -58,3 +58,5 @@ export const isComplete = (obj: CompleteOrEmpty): obj is T => { // Check if it has any own properties return Object.keys(obj).length > 0; }; + +export const convertRemToPixel = (rem: number): number => rem * 0.9 * 16; diff --git a/web/helpers/cycle.helper.ts b/packages/utils/src/cycle.ts similarity index 77% rename from web/helpers/cycle.helper.ts rename to packages/utils/src/cycle.ts index 6e62c3a04a1..66002c740e3 100644 --- a/web/helpers/cycle.helper.ts +++ b/packages/utils/src/cycle.ts @@ -1,28 +1,19 @@ import { startOfToday, format } from "date-fns"; -import { isEmpty, orderBy, uniqBy } from "lodash"; +import isEmpty from "lodash/isEmpty"; +import orderBy from "lodash/orderBy"; import sortBy from "lodash/sortBy"; +import uniqBy from "lodash/uniqBy"; +// plane imports import { ICycle, TCycleFilters } from "@plane/types"; -// helpers -import { findTotalDaysInRange, generateDateArray, getDate } from "@/helpers/date-time.helper"; -import { satisfiesDateFilter } from "@/helpers/filter.helper"; - -export type TProgressChartData = { - date: string; - scope: number; - completed: number; - backlog: number; - started: number; - unstarted: number; - cancelled: number; - pending: number; - ideal: number; - actual: number; -}[]; +// local imports +import { findTotalDaysInRange, generateDateArray, getDate } from "./datetime"; +import { satisfiesDateFilter } from "./filter"; /** - * @description orders cycles based on their status - * @param {ICycle[]} cycles - * @returns {ICycle[]} + * Orders cycles based on their status + * @param {ICycle[]} cycles - Array of cycles to be ordered + * @param {boolean} sortByManual - Whether to sort by manual order + * @returns {ICycle[]} Ordered array of cycles */ export const orderCycles = (cycles: ICycle[], sortByManual: boolean): ICycle[] => { if (cycles.length === 0) return []; @@ -48,10 +39,10 @@ export const orderCycles = (cycles: ICycle[], sortByManual: boolean): ICycle[] = }; /** - * @description filters cycles based on the filter - * @param {ICycle} cycle - * @param {TCycleFilters} filter - * @returns {boolean} + * Filters cycles based on provided filter criteria + * @param {ICycle} cycle - The cycle to be filtered + * @param {TCycleFilters} filter - Filter criteria to apply + * @returns {boolean} Whether the cycle passes the filter */ export const shouldFilterCycle = (cycle: ICycle, filter: TCycleFilters): boolean => { let fallsInFilters = true; @@ -76,7 +67,21 @@ export const shouldFilterCycle = (cycle: ICycle, filter: TCycleFilters): boolean return fallsInFilters; }; +/** + * Calculates the scope based on whether it's an issue or estimate points + * @param {any} p - Progress data + * @param {boolean} isTypeIssue - Whether the type is an issue + * @returns {number} Calculated scope + */ const scope = (p: any, isTypeIssue: boolean) => (isTypeIssue ? p.total_issues : p.total_estimate_points); + +/** + * Calculates the ideal progress value + * @param {string} date - Current date + * @param {number} scope - Total scope + * @param {ICycle} cycle - Cycle data + * @returns {number} Ideal progress value + */ const ideal = (date: string, scope: number, cycle: ICycle) => Math.floor( ((findTotalDaysInRange(date, cycle.end_date) || 0) / @@ -84,6 +89,14 @@ const ideal = (date: string, scope: number, cycle: ICycle) => scope ); +/** + * Formats cycle data for version 1 + * @param {boolean} isTypeIssue - Whether the type is an issue + * @param {ICycle} cycle - Cycle data + * @param {boolean} isBurnDown - Whether it's a burn down chart + * @param {Date|string} endDate - End date + * @returns {TProgressChartData} Formatted progress data + */ const formatV1Data = (isTypeIssue: boolean, cycle: ICycle, isBurnDown: boolean, endDate: Date | string) => { const today = format(startOfToday(), "yyyy-MM-dd"); const data = isTypeIssue ? cycle.distribution : cycle.estimate_distribution; @@ -117,6 +130,14 @@ const formatV1Data = (isTypeIssue: boolean, cycle: ICycle, isBurnDown: boolean, return progress; }; +/** + * Formats cycle data for version 2 + * @param {boolean} isTypeIssue - Whether the type is an issue + * @param {ICycle} cycle - Cycle data + * @param {boolean} isBurnDown - Whether it's a burn down chart + * @param {Date|string} endDate - End date + * @returns {TProgressChartData} Formatted progress data + */ const formatV2Data = (isTypeIssue: boolean, cycle: ICycle, isBurnDown: boolean, endDate: Date | string) => { if (!cycle.progress) return []; let today: Date | string = startOfToday(); diff --git a/packages/utils/src/datetime.ts b/packages/utils/src/datetime.ts index 0a12a227084..cff0da2c2df 100644 --- a/packages/utils/src/datetime.ts +++ b/packages/utils/src/datetime.ts @@ -1,45 +1,15 @@ import { differenceInDays, format, formatDistanceToNow, isAfter, isEqual, isValid, parseISO } from "date-fns"; +import isNumber from "lodash/isNumber"; +// Format Date Helpers /** - * This method returns a date from string of type yyyy-mm-dd - * This method is recommended to use instead of new Date() as this does not introduce any timezone offsets - * @param date - * @returns date or undefined - */ -export const getDate = (date: string | Date | undefined | null): Date | undefined => { - try { - if (!date || date === "") return; - - if (typeof date !== "string" && !(date instanceof String)) return date; - - const [yearString, monthString, dayString] = date.substring(0, 10).split("-"); - const year = parseInt(yearString); - const month = parseInt(monthString); - const day = parseInt(dayString); - // Using Number.isInteger instead of lodash's isNumber for better specificity and no external dependency - if (!Number.isInteger(year) || !Number.isInteger(month) || !Number.isInteger(day)) return; - - return new Date(year, month - 1, day); - } catch (e) { - return undefined; - } -}; - -/** - * @returns {string | null} formatted date in the format of MMM dd, yyyy + * @returns {string | null} formatted date in the desired format or platform default format (MMM dd, yyyy) * @description Returns date in the formatted format * @param {Date | string} date + * @param {string} formatToken (optional) // default MMM dd, yyyy + * @example renderFormattedDate("2024-01-01", "MM-DD-YYYY") // Jan 01, 2024 * @example renderFormattedDate("2024-01-01") // Jan 01, 2024 */ -/** - * @description Returns date in the formatted format - * @param {Date | string} date Date to format - * @param {string} formatToken Format token (optional, default: MMM dd, yyyy) - * @returns {string | undefined} Formatted date in the desired format - * @example - * renderFormattedDate("2024-01-01") // returns "Jan 01, 2024" - * renderFormattedDate("2024-01-01", "MM-DD-YYYY") // returns "01-01-2024" - */ export const renderFormattedDate = ( date: string | Date | undefined | null, formatToken: string = "MMM dd, yyyy" @@ -49,7 +19,7 @@ export const renderFormattedDate = ( // return if undefined if (!parsedDate) return; // Check if the parsed date is valid before formatting - if (!isValid(parsedDate)) return; // Return undefined for invalid dates + if (!isValid(parsedDate)) return; // Return null for invalid dates let formattedDate; try { // Format the date in the format provided or default format (MMM dd, yyyy) @@ -62,13 +32,75 @@ export const renderFormattedDate = ( }; /** + * @returns {string} formatted date in the format of MMM dd + * @description Returns date in the formatted format + * @param {string | Date} date + * @example renderShortDateFormat("2024-01-01") // Jan 01 + */ +export const renderFormattedDateWithoutYear = (date: string | Date): string => { + // Parse the date to check if it is valid + const parsedDate = getDate(date); + // return if undefined + if (!parsedDate) return ""; + // Check if the parsed date is valid before formatting + if (!isValid(parsedDate)) return ""; // Return empty string for invalid dates + // Format the date in short format (MMM dd) + const formattedDate = format(parsedDate, "MMM dd"); + return formattedDate; +}; + +/** + * @returns {string | null} formatted date in the format of yyyy-mm-dd to be used in payload + * @description Returns date in the formatted format to be used in payload + * @param {Date | string} date + * @example renderFormattedPayloadDate("Jan 01, 20224") // "2024-01-01" + */ +export const renderFormattedPayloadDate = (date: Date | string | undefined | null): string | undefined => { + // Parse the date to check if it is valid + const parsedDate = getDate(date); + // return if undefined + if (!parsedDate) return; + // Check if the parsed date is valid before formatting + if (!isValid(parsedDate)) return; // Return null for invalid dates + // Format the date in payload format (yyyy-mm-dd) + const formattedDate = format(parsedDate, "yyyy-MM-dd"); + return formattedDate; +}; + +// Format Time Helpers +/** + * @returns {string} formatted date in the format of hh:mm a or HH:mm + * @description Returns date in 12 hour format if in12HourFormat is true else 24 hour format + * @param {string | Date} date + * @param {boolean} timeFormat (optional) // default 24 hour + * @example renderFormattedTime("2024-01-01 13:00:00") // 13:00 + * @example renderFormattedTime("2024-01-01 13:00:00", "12-hour") // 01:00 PM + */ +export const renderFormattedTime = (date: string | Date, timeFormat: "12-hour" | "24-hour" = "24-hour"): string => { + // Parse the date to check if it is valid + const parsedDate = new Date(date); + // return if undefined + if (!parsedDate) return ""; + // Check if the parsed date is valid + if (!isValid(parsedDate)) return ""; // Return empty string for invalid dates + // Format the date in 12 hour format if in12HourFormat is true + if (timeFormat === "12-hour") { + const formattedTime = format(parsedDate, "hh:mm a"); + return formattedTime; + } + // Format the date in 24 hour format + const formattedTime = format(parsedDate, "HH:mm"); + return formattedTime; +}; + +// Date Difference Helpers +/** + * @returns {number} total number of days in range * @description Returns total number of days in range - * @param {string | Date} startDate - Start date - * @param {string | Date} endDate - End date - * @param {boolean} inclusive - Include start and end dates (optional, default: true) - * @returns {number | undefined} Total number of days - * @example - * findTotalDaysInRange("2024-01-01", "2024-01-08") // returns 8 + * @param {string} startDate + * @param {string} endDate + * @param {boolean} inclusive + * @example checkIfStringIsDate("2021-01-01", "2021-01-08") // 8 */ export const findTotalDaysInRange = ( startDate: Date | string | undefined | null, @@ -89,118 +121,139 @@ export const findTotalDaysInRange = ( }; /** - * @description Add number of days to the provided date - * @param {string | Date} startDate - Start date - * @param {number} numberOfDays - Number of days to add - * @returns {Date | undefined} Resulting date - * @example - * addDaysToDate("2024-01-01", 7) // returns Date(2024-01-08) + * Add number of days to the provided date and return a resulting new date + * @param startDate + * @param numberOfDays + * @returns */ -export const addDaysToDate = (startDate: Date | string | undefined | null, numberOfDays: number): Date | undefined => { +export const addDaysToDate = (startDate: Date | string | undefined | null, numberOfDays: number) => { // Parse the dates to check if they are valid const parsedStartDate = getDate(startDate); + // return if undefined if (!parsedStartDate) return; + const newDate = new Date(parsedStartDate); newDate.setDate(newDate.getDate() + numberOfDays); + return newDate; }; /** + * @returns {number} number of days left from today * @description Returns number of days left from today - * @param {string | Date} date - Target date - * @param {boolean} inclusive - Include today (optional, default: true) - * @returns {number | undefined} Number of days left - * @example - * findHowManyDaysLeft("2024-01-08") // returns days between today and Jan 8, 2024 + * @param {string | Date} date + * @param {boolean} inclusive (optional) // default true + * @example findHowManyDaysLeft("2024-01-01") // 3 */ export const findHowManyDaysLeft = ( date: Date | string | undefined | null, inclusive: boolean = true ): number | undefined => { if (!date) return undefined; + // Pass the date to findTotalDaysInRange function to find the total number of days in range from today return findTotalDaysInRange(new Date(), date, inclusive); }; +// Time Difference Helpers /** + * @returns {string} formatted date in the form of amount of time passed since the event happened * @description Returns time passed since the event happened - * @param {string | number | Date} time - Time to calculate from - * @returns {string} Formatted time ago string - * @example - * calculateTimeAgo("2023-01-01") // returns "1 year ago" + * @param {string | Date} time + * @example calculateTimeAgo("2023-01-01") // 1 year ago */ export const calculateTimeAgo = (time: string | number | Date | null): string => { if (!time) return ""; + // Parse the time to check if it is valid const parsedTime = typeof time === "string" || typeof time === "number" ? parseISO(String(time)) : time; - if (!parsedTime) return ""; + // return if undefined + if (!parsedTime) return ""; // Return empty string for invalid dates + // Format the time in the form of amount of time passed since the event happened const distance = formatDistanceToNow(parsedTime, { addSuffix: true }); return distance; }; -/** - * @description Returns short form of time passed (e.g., 1y, 2mo, 3d) - * @param {string | number | Date} date - Date to calculate from - * @returns {string} Short form time ago - * @example - * calculateTimeAgoShort("2023-01-01") // returns "1y" - */ -export const calculateTimeAgoShort = (date: string | number | Date | null): string => { - if (!date) return ""; +export function calculateTimeAgoShort(date: string | number | Date | null): string { + if (!date) { + return ""; + } const parsedDate = typeof date === "string" ? parseISO(date) : new Date(date); const now = new Date(); const diffInSeconds = (now.getTime() - parsedDate.getTime()) / 1000; - if (diffInSeconds < 60) return `${Math.floor(diffInSeconds)}s`; + if (diffInSeconds < 60) { + return `${Math.floor(diffInSeconds)}s`; + } + const diffInMinutes = diffInSeconds / 60; - if (diffInMinutes < 60) return `${Math.floor(diffInMinutes)}m`; + if (diffInMinutes < 60) { + return `${Math.floor(diffInMinutes)}m`; + } + const diffInHours = diffInMinutes / 60; - if (diffInHours < 24) return `${Math.floor(diffInHours)}h`; + if (diffInHours < 24) { + return `${Math.floor(diffInHours)}h`; + } + const diffInDays = diffInHours / 24; - if (diffInDays < 30) return `${Math.floor(diffInDays)}d`; + if (diffInDays < 30) { + return `${Math.floor(diffInDays)}d`; + } + const diffInMonths = diffInDays / 30; - if (diffInMonths < 12) return `${Math.floor(diffInMonths)}mo`; + if (diffInMonths < 12) { + return `${Math.floor(diffInMonths)}mo`; + } + const diffInYears = diffInMonths / 12; return `${Math.floor(diffInYears)}y`; -}; +} +// Date Validation Helpers /** - * @description Checks if a date is greater than today - * @param {string} dateStr - Date string to check - * @returns {boolean} True if date is greater than today - * @example - * isDateGreaterThanToday("2024-12-31") // returns true + * @returns {string} boolean value depending on whether the date is greater than today + * @description Returns boolean value depending on whether the date is greater than today + * @param {string} dateStr + * @example isDateGreaterThanToday("2024-01-01") // true */ export const isDateGreaterThanToday = (dateStr: string): boolean => { + // Return false if dateStr is not present if (!dateStr) return false; + // Parse the date to check if it is valid const date = parseISO(dateStr); const today = new Date(); - if (!isValid(date)) return false; + // Check if the parsed date is valid + if (!isValid(date)) return false; // Return false for invalid dates + // Return true if the date is greater than today return isAfter(date, today); }; +// Week Related Helpers /** + * @returns {number} week number of date * @description Returns week number of date - * @param {Date} date - Date to get week number from - * @returns {number} Week number (1-52) - * @example - * getWeekNumberOfDate(new Date("2023-09-01")) // returns 35 + * @param {Date} date + * @example getWeekNumber(new Date("2023-09-01")) // 35 */ export const getWeekNumberOfDate = (date: Date): number => { const currentDate = date; + // Adjust the starting day to Sunday (0) instead of Monday (1) const startDate = new Date(currentDate.getFullYear(), 0, 1); + // Calculate the number of days between currentDate and startDate const days = Math.floor((currentDate.getTime() - startDate.getTime()) / (24 * 60 * 60 * 1000)); + // Adjust the calculation for weekNumber const weekNumber = Math.ceil((days + 1) / 7); return weekNumber; }; /** - * @description Checks if two dates are equal - * @param {Date | string} date1 - First date - * @param {Date | string} date2 - Second date - * @returns {boolean} True if dates are equal - * @example - * checkIfDatesAreEqual("2024-01-01", "2024-01-01") // returns true + * @returns {boolean} boolean value depending on whether the dates are equal + * @description Returns boolean value depending on whether the dates are equal + * @param date1 + * @param date2 + * @example checkIfDatesAreEqual("2024-01-01", "2024-01-01") // true + * @example checkIfDatesAreEqual("2024-01-01", "2024-01-02") // false */ export const checkIfDatesAreEqual = ( date1: Date | string | null | undefined, @@ -208,101 +261,115 @@ export const checkIfDatesAreEqual = ( ): boolean => { const parsedDate1 = getDate(date1); const parsedDate2 = getDate(date2); + // return if undefined if (!parsedDate1 && !parsedDate2) return true; if (!parsedDate1 || !parsedDate2) return false; + return isEqual(parsedDate1, parsedDate2); }; /** - * @description Checks if a string matches date format YYYY-MM-DD - * @param {string} date - Date string to check - * @returns {boolean} True if string matches date format - * @example - * isInDateFormat("2024-01-01") // returns true + * This method returns a date from string of type yyyy-mm-dd + * This method is recommended to use instead of new Date() as this does not introduce any timezone offsets + * @param date + * @returns date or undefined */ -export const isInDateFormat = (date: string): boolean => { +export const getDate = (date: string | Date | undefined | null): Date | undefined => { + try { + if (!date || date === "") return; + + if (typeof date !== "string" && !(date instanceof String)) return date; + + const [yearString, monthString, dayString] = date.substring(0, 10).split("-"); + const year = parseInt(yearString); + const month = parseInt(monthString); + const day = parseInt(dayString); + if (!isNumber(year) || !isNumber(month) || !isNumber(day)) return; + + return new Date(year, month - 1, day); + } catch (e) { + return undefined; + } +}; + +export const isInDateFormat = (date: string) => { const datePattern = /^\d{4}-\d{2}-\d{2}$/; return datePattern.test(date); }; /** - * @description Converts date string to ISO format - * @param {string} dateString - Date string to convert - * @returns {string | undefined} ISO date string - * @example - * convertToISODateString("2024-01-01") // returns "2024-01-01T00:00:00.000Z" + * returns the date string in ISO format regardless of the timezone in input date string + * @param dateString + * @returns */ -export const convertToISODateString = (dateString: string | undefined): string | undefined => { +export const convertToISODateString = (dateString: string | undefined) => { if (!dateString) return dateString; + const date = new Date(dateString); return date.toISOString(); }; /** - * @description Converts date string to epoch timestamp - * @param {string} dateString - Date string to convert - * @returns {number | undefined} Epoch timestamp - * @example - * convertToEpoch("2024-01-01") // returns 1704067200000 + * returns the date string in Epoch regardless of the timezone in input date string + * @param dateString + * @returns */ -export const convertToEpoch = (dateString: string | undefined): number | undefined => { - if (!dateString) return undefined; +export const convertToEpoch = (dateString: string | undefined) => { + if (!dateString) return dateString; + const date = new Date(dateString); return date.getTime(); }; /** - * @description Gets current date time in ISO format - * @returns {string} Current date time in ISO format - * @example - * getCurrentDateTimeInISO() // returns "2024-01-01T12:00:00.000Z" + * get current Date time in UTC ISO format + * @returns */ -export const getCurrentDateTimeInISO = (): string => { +export const getCurrentDateTimeInISO = () => { const date = new Date(); return date.toISOString(); }; /** - * @description Converts hours and minutes to total minutes - * @param {number} hours - Number of hours - * @param {number} minutes - Number of minutes - * @returns {number} Total minutes - * @example - * convertHoursMinutesToMinutes(2, 30) // returns 150 + * @description converts hours and minutes to minutes + * @param { number } hours + * @param { number } minutes + * @returns { number } minutes + * @example convertHoursMinutesToMinutes(2, 30) // Output: 150 */ export const convertHoursMinutesToMinutes = (hours: number, minutes: number): number => hours * 60 + minutes; /** - * @description Converts total minutes to hours and minutes - * @param {number} mins - Total minutes - * @returns {{ hours: number; minutes: number }} Hours and minutes - * @example - * convertMinutesToHoursAndMinutes(150) // returns { hours: 2, minutes: 30 } + * @description converts minutes to hours and minutes + * @param { number } mins + * @returns { number, number } hours and minutes + * @example convertMinutesToHoursAndMinutes(150) // Output: { hours: 2, minutes: 30 } */ export const convertMinutesToHoursAndMinutes = (mins: number): { hours: number; minutes: number } => { const hours = Math.floor(mins / 60); const minutes = Math.floor(mins % 60); - return { hours, minutes }; + + return { hours: hours, minutes: minutes }; }; /** - * @description Converts minutes to hours and minutes string - * @param {number} totalMinutes - Total minutes - * @returns {string} Formatted string (e.g., "2h 30m") - * @example - * convertMinutesToHoursMinutesString(150) // returns "2h 30m" + * @description converts minutes to hours and minutes string + * @param { number } totalMinutes + * @returns { string } 0h 0m + * @example convertMinutesToHoursAndMinutes(150) // Output: 2h 10m */ export const convertMinutesToHoursMinutesString = (totalMinutes: number): string => { const { hours, minutes } = convertMinutesToHoursAndMinutes(totalMinutes); + return `${hours ? `${hours}h ` : ``}${minutes ? `${minutes}m ` : ``}`; }; /** - * @description Calculates read time in seconds from word count - * @param {number} wordsCount - Number of words - * @returns {number} Read time in seconds - * @example - * getReadTimeFromWordsCount(400) // returns 120 + * @description calculates the read time for a document using the words count + * @param {number} wordsCount + * @returns {number} total number of seconds + * @example getReadTimeFromWordsCount(400) // Output: 120 + * @example getReadTimeFromWordsCount(100) // Output: 30s */ export const getReadTimeFromWordsCount = (wordsCount: number): number => { const wordsPerMinute = 200; @@ -311,25 +378,100 @@ export const getReadTimeFromWordsCount = (wordsCount: number): number => { }; /** - * @description Generates array of dates between start and end dates - * @param {string | Date} startDate - Start date - * @param {string | Date} endDate - End date - * @returns {Array<{ date: string }>} Array of dates - * @example - * generateDateArray("2024-01-01", "2024-01-03") - * // returns [{ date: "2024-01-02" }, { date: "2024-01-03" }] + * @description generates an array of dates between the start and end dates + * @param startDate + * @param endDate + * @returns */ -export const generateDateArray = (startDate: string | Date, endDate: string | Date): Array<{ date: string }> => { +export const generateDateArray = (startDate: string | Date, endDate: string | Date) => { + // Convert the start and end dates to Date objects if they aren't already const start = new Date(startDate); + // start.setDate(start.getDate() + 1); const end = new Date(endDate); end.setDate(end.getDate() + 1); + // Create an empty array to store the dates const dateArray = []; + + // Use a while loop to generate dates between the range while (start <= end) { + // Increment the date by 1 day (86400000 milliseconds) start.setDate(start.getDate() + 1); + // Push the current date (converted to ISO string for consistency) dateArray.push({ date: new Date(start).toISOString().split("T")[0], }); } + return dateArray; }; + +/** + * Processes relative date strings like "1_weeks", "2_months" etc and returns a Date + * @param value The relative date string (e.g., "1_weeks", "2_months") + * @returns Date object representing the calculated date + */ +export const processRelativeDate = (value: string): Date => { + const [amountStr, unit] = value.split("_"); + const amount = parseInt(amountStr, 10); + if (isNaN(amount)) { + throw new Error(`Invalid relative amount: ${amountStr}`); + } + const date = new Date(); + + switch (unit) { + case "days": + date.setDate(date.getDate() + amount); + break; + case "weeks": + date.setDate(date.getDate() + amount * 7); + break; + case "months": + date.setMonth(date.getMonth() + amount); + break; + default: + throw new Error(`Unsupported time unit: ${unit}`); + } + + return date; +}; + +/** + * Parses a date filter string and returns the comparison type and date + * @param filterValue The date filter string (e.g., "1_weeks;after;fromnow" or "2024-12-01;after") + * @returns Object containing the comparison type and target date + */ +export const parseDateFilter = (filterValue: string): { type: "after" | "before"; date: Date } => { + const parts = filterValue.split(";"); + const dateStr = parts[0]; + const type = parts[1] as "after" | "before"; + + let date: Date; + if (dateStr.includes("_")) { + // Handle relative dates (e.g., "1_weeks;after;fromnow") + date = processRelativeDate(dateStr); + } else { + // Handle absolute dates (e.g., "2024-12-01;after") + date = new Date(dateStr); + } + + return { type, date }; +}; + +/** + * Checks if a date meets the filter criteria + * @param dateToCheck The date to check + * @param filterDate The filter date to compare against + * @param type The type of comparison ('after' or 'before') + * @returns boolean indicating if the date meets the criteria + */ +export const checkDateCriteria = (dateToCheck: Date | null, filterDate: Date, type: "after" | "before"): boolean => { + if (!dateToCheck) return false; + + const checkDate = new Date(dateToCheck); + const normalizedCheck = new Date(checkDate.setHours(0, 0, 0, 0)); + const normalizedFilter = new Date(filterDate.getTime()); + normalizedFilter.setHours(0, 0, 0, 0); + + return type === "after" ? normalizedCheck >= normalizedFilter : normalizedCheck <= normalizedFilter; +}; diff --git a/web/helpers/distribution-update.helper.ts b/packages/utils/src/distribution-update.ts similarity index 99% rename from web/helpers/distribution-update.helper.ts rename to packages/utils/src/distribution-update.ts index b640bf33cf5..fe25cae4fdb 100644 --- a/web/helpers/distribution-update.helper.ts +++ b/packages/utils/src/distribution-update.ts @@ -3,10 +3,9 @@ import get from "lodash/get"; import set from "lodash/set"; // plane imports import { STATE_GROUPS, COMPLETED_STATE_GROUPS } from "@plane/constants"; -// types import { ICycle, IEstimatePoint, IModule, IState, TIssue } from "@plane/types"; // helper -import { getDate } from "./date-time.helper"; +import { getDate } from "@plane/utils"; export type DistributionObjectUpdate = { id: string; diff --git a/web/helpers/editor.helper.ts b/packages/utils/src/editor.ts similarity index 94% rename from web/helpers/editor.helper.ts rename to packages/utils/src/editor.ts index 17e170493a1..1bdf3a50419 100644 --- a/web/helpers/editor.helper.ts +++ b/packages/utils/src/editor.ts @@ -1,5 +1,5 @@ -// helpers -import { getFileURL } from "@/helpers/file.helper"; +// local imports +import { getFileURL } from "./file"; type TEditorSrcArgs = { assetId: string; diff --git a/packages/utils/src/emoji.ts b/packages/utils/src/emoji.ts index 9b796575a8b..1f83e592e72 100644 --- a/packages/utils/src/emoji.ts +++ b/packages/utils/src/emoji.ts @@ -1,3 +1,7 @@ +// plane imports +import { RANDOM_EMOJI_CODES } from "@plane/constants"; +import { LUCIDE_ICONS_LIST } from "@plane/ui"; + /** * Converts a hyphen-separated hexadecimal emoji code to its decimal representation * @param {string} emojiUnified - The unified emoji code in hexadecimal format (e.g., "1f600" or "1f1e6-1f1e8") @@ -41,24 +45,46 @@ export const emojiCodeToUnicode = (emoji: string): string => { /** * Groups reactions by a specified key - * @param {T[]} reactions - Array of reaction objects + * @param {any[]} reactions - Array of reaction objects * @param {string} key - Key to group reactions by * @returns {Object} Object with reactions grouped by the specified key - * @example - * const reactions = [{ reaction: "👍", id: 1 }, { reaction: "👍", id: 2 }, { reaction: "❤️", id: 3 }]; - * groupReactions(reactions, "reaction") // returns { "👍": [{ reaction: "👍", id: 1 }, { reaction: "👍", id: 2 }], "❤️": [{ reaction: "❤️", id: 3 }] } */ -export const groupReactions = (reactions: T[], key: string): { [key: string]: T[] } => { +export const groupReactions: (reactions: any[], key: string) => { [key: string]: any[] } = ( + reactions: any, + key: string +) => { + if (!Array.isArray(reactions)) { + console.error("Expected an array of reactions, but got:", reactions); + return {}; + } + const groupedReactions = reactions.reduce( - (acc: { [key: string]: T[] }, reaction: T) => { - if (!acc[reaction[key as keyof T] as string]) { - acc[reaction[key as keyof T] as string] = []; + (acc: any, reaction: any) => { + if (!reaction || typeof reaction !== "object" || !Object.prototype.hasOwnProperty.call(reaction, key)) { + console.warn("Skipping undefined reaction or missing key:", reaction); + return acc; // Skip undefined reactions or those without the specified key } - acc[reaction[key as keyof T] as string].push(reaction); + + if (!acc[reaction[key]]) { + acc[reaction[key]] = []; + } + acc[reaction[key]].push(reaction); return acc; }, - {} as { [key: string]: T[] } + {} as { [key: string]: any[] } ); return groupedReactions; }; + +/** + * Returns a random emoji code from the RANDOM_EMOJI_CODES array + * @returns {string} A random emoji code + */ +export const getRandomEmoji = (): string => RANDOM_EMOJI_CODES[Math.floor(Math.random() * RANDOM_EMOJI_CODES.length)]; + +/** + * Returns a random icon name from the LUCIDE_ICONS_LIST array + */ +export const getRandomIconName = (): string => + LUCIDE_ICONS_LIST[Math.floor(Math.random() * LUCIDE_ICONS_LIST.length)].name; diff --git a/web/helpers/estimates.ts b/packages/utils/src/estimates.ts similarity index 94% rename from web/helpers/estimates.ts rename to packages/utils/src/estimates.ts index 62676503de1..0a9b3772803 100644 --- a/web/helpers/estimates.ts +++ b/packages/utils/src/estimates.ts @@ -1,5 +1,5 @@ // plane web constants -import { EEstimateSystem } from "@/plane-web/constants/estimates"; +import { EEstimateSystem } from "@plane/constants"; export const isEstimatePointValuesRepeated = ( estimatePoints: string[], diff --git a/packages/utils/src/file.ts b/packages/utils/src/file.ts index 42b52bf48fa..d119ecc18c1 100644 --- a/packages/utils/src/file.ts +++ b/packages/utils/src/file.ts @@ -1,3 +1,4 @@ +// plane imports import { API_BASE_URL } from "@plane/constants"; import { TFileMetaDataLite, TFileSignedURLResponse } from "@plane/types"; @@ -47,3 +48,66 @@ export const getAssetIdFromUrl = (src: string): string => { const assetUrl = sourcePaths[sourcePaths.length - 1]; return assetUrl; }; + +/** + * @description encode image via URL to base64 + * @param {string} url + * @returns + */ +export const getBase64Image = async (url: string): Promise => { + if (!url || typeof url !== "string") { + throw new Error("Invalid URL provided"); + } + + // Try to create a URL object to validate the URL + try { + new URL(url); + } catch { + throw new Error("Invalid URL format"); + } + + const response = await fetch(url); + // check if the response is OK + if (!response.ok) { + throw new Error(`Failed to fetch image: ${response.statusText}`); + } + + const blob = await response.blob(); + return new Promise((resolve, reject) => { + const reader = new FileReader(); + + reader.onloadend = () => { + if (reader.result) { + resolve(reader.result as string); + } else { + reject(new Error("Failed to convert image to base64.")); + } + }; + + reader.onerror = () => { + reject(new Error("Failed to read the image file.")); + }; + + reader.readAsDataURL(blob); + }); +}; + +/** + * @description downloads a CSV file + * @param {Array> | { [key: string]: string }} data - The data to be exported to CSV + * @param {string} name - The name of the file to be downloaded + */ +export const csvDownload = (data: Array> | { [key: string]: string }, name: string) => { + const rows = Array.isArray(data) ? [...data] : [Object.keys(data), Object.values(data)]; + + const csvContent = "data:text/csv;charset=utf-8," + rows.map((e) => e.join(",")).join("\n"); + const encodedUri = encodeURI(csvContent); + + const link = document.createElement("a"); + link.href = encodedUri; + link.download = `${name}.csv`; + + document.body.appendChild(link); + link.click(); + document.body.removeChild(link); +}; diff --git a/web/helpers/filter.helper.ts b/packages/utils/src/filter.ts similarity index 95% rename from web/helpers/filter.helper.ts rename to packages/utils/src/filter.ts index 403aea4bf33..4052d34773a 100644 --- a/web/helpers/filter.helper.ts +++ b/packages/utils/src/filter.ts @@ -1,8 +1,8 @@ import { differenceInCalendarDays } from "date-fns/differenceInCalendarDays"; -// helpers +// plane imports import { IIssueFilters } from "@plane/types"; -import { getDate } from "./date-time.helper"; -// import { IIssueFilterOptions } from "@plane/types"; +// local imports +import { getDate } from "./datetime"; /** * @description calculates the total number of filters applied @@ -21,6 +21,7 @@ export const calculateTotalFilters = (filters: T): number => }) .reduce((curr, prev) => curr + prev, 0) : 0; + /** * @description checks if the date satisfies the filter * @param {Date} date diff --git a/packages/utils/src/index.ts b/packages/utils/src/index.ts index 30f06b8c4cf..0bd45321098 100644 --- a/packages/utils/src/index.ts +++ b/packages/utils/src/index.ts @@ -1,17 +1,25 @@ export * from "./array"; export * from "./attachment"; export * from "./auth"; +export * from "./calendar"; export * from "./color"; export * from "./common"; export * from "./datetime"; +export * from "./distribution-update"; +export * from "./editor"; export * from "./emoji"; export * from "./file"; +export * from "./filter"; export * from "./get-icon-for-link"; -export * from "./issue"; +export * from "./intake"; +export * from "./math"; +export * from "./notification"; +export * from "./page"; export * from "./permission"; -export * from "./state"; +export * from "./project"; +export * from "./project-views"; export * from "./string"; export * from "./subscription"; export * from "./theme"; export * from "./work-item"; -export * from "./workspace"; \ No newline at end of file +export * from "./workspace"; diff --git a/web/helpers/inbox.helper.ts b/packages/utils/src/intake.ts similarity index 57% rename from web/helpers/inbox.helper.ts rename to packages/utils/src/intake.ts index 52a85b0ba29..12e59f9accb 100644 --- a/web/helpers/inbox.helper.ts +++ b/packages/utils/src/intake.ts @@ -1,25 +1,8 @@ import { subDays } from "date-fns"; -import { renderFormattedPayloadDate } from "./date-time.helper"; - -export enum EInboxIssueCurrentTab { - OPEN = "open", - CLOSED = "closed", -} - -export enum EInboxIssueStatus { - PENDING = -2, - DECLINED = -1, - SNOOZED = 0, - ACCEPTED = 1, - DUPLICATE = 2, -} - -export enum EPastDurationFilters { - TODAY = "today", - YESTERDAY = "yesterday", - LAST_7_DAYS = "last_7_days", - LAST_30_DAYS = "last_30_days", -} +// plane imports +import { EPastDurationFilters } from "@plane/constants"; +// local imports +import { renderFormattedPayloadDate } from "./datetime"; export const getCustomDates = (duration: EPastDurationFilters): string => { const today = new Date(); @@ -49,25 +32,3 @@ export const getCustomDates = (duration: EPastDurationFilters): string => { } } }; - -export const PAST_DURATION_FILTER_OPTIONS: { - name: string; - value: string; -}[] = [ - { - name: "Today", - value: EPastDurationFilters.TODAY, - }, - { - name: "Yesterday", - value: EPastDurationFilters.YESTERDAY, - }, - { - name: "Last 7 days", - value: EPastDurationFilters.LAST_7_DAYS, - }, - { - name: "Last 30 days", - value: EPastDurationFilters.LAST_30_DAYS, - }, -]; diff --git a/packages/utils/src/issue.ts b/packages/utils/src/issue.ts deleted file mode 100644 index 0fc5d526188..00000000000 --- a/packages/utils/src/issue.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { differenceInCalendarDays } from "date-fns/differenceInCalendarDays"; -import { ISSUE_PRIORITY_FILTERS, STATE_GROUPS, TIssuePriorities, TIssueFilterPriorityObject } from "@plane/constants"; -import { TStateGroups } from "@plane/types"; -import { getDate } from "./datetime"; - -export const getIssuePriorityFilters = (priorityKey: TIssuePriorities): TIssueFilterPriorityObject | undefined => { - const currentIssuePriority: TIssueFilterPriorityObject | undefined = - ISSUE_PRIORITY_FILTERS && ISSUE_PRIORITY_FILTERS.length > 0 - ? ISSUE_PRIORITY_FILTERS.find((_priority) => _priority.key === priorityKey) - : undefined; - - if (currentIssuePriority) return currentIssuePriority; - return undefined; -}; - -/** - * @description check if the issue due date should be highlighted - * @param date - * @param stateGroup - * @returns boolean - */ -export const shouldHighlightIssueDueDate = ( - date: string | Date | null, - stateGroup: TStateGroups | undefined -): boolean => { - if (!date || !stateGroup) return false; - // if the issue is completed or cancelled, don't highlight the due date - if ([STATE_GROUPS.completed.key, STATE_GROUPS.cancelled.key].includes(stateGroup)) return false; - - const parsedDate = getDate(date); - if (!parsedDate) return false; - - const targetDateDistance = differenceInCalendarDays(parsedDate, new Date()); - - // if the issue is overdue, highlight the due date - return targetDateDistance <= 0; -}; diff --git a/packages/utils/src/math.ts b/packages/utils/src/math.ts new file mode 100644 index 00000000000..88e4040a044 --- /dev/null +++ b/packages/utils/src/math.ts @@ -0,0 +1,2 @@ +export const getProgress = (completed: number | undefined, total: number | undefined) => + total && total > 0 ? Math.round(((completed ?? 0) / total) * 100) : 0; diff --git a/web/helpers/module.helper.ts b/packages/utils/src/module.ts similarity index 96% rename from web/helpers/module.helper.ts rename to packages/utils/src/module.ts index 456cdfc8bb6..b1e9f314db5 100644 --- a/web/helpers/module.helper.ts +++ b/packages/utils/src/module.ts @@ -1,8 +1,9 @@ import sortBy from "lodash/sortBy"; +// plane imports import { IModule, TModuleDisplayFilters, TModuleFilters, TModuleOrderByOptions } from "@plane/types"; -// helpers -import { getDate } from "@/helpers/date-time.helper"; -import { satisfiesDateFilter } from "@/helpers/filter.helper"; +// local imports +import { getDate } from "./datetime"; +import { satisfiesDateFilter } from "./filter"; /** * @description orders modules based on their status diff --git a/web/helpers/notification.helper.ts b/packages/utils/src/notification.ts similarity index 82% rename from web/helpers/notification.helper.ts rename to packages/utils/src/notification.ts index fbc77d21bf1..b4bc9cbd9bf 100644 --- a/web/helpers/notification.helper.ts +++ b/packages/utils/src/notification.ts @@ -1,4 +1,4 @@ -import { stripAndTruncateHTML } from "./string.helper"; +import { stripAndTruncateHTML } from "./string"; export const sanitizeCommentForNotification = (mentionContent: string | undefined) => mentionContent diff --git a/web/helpers/page.helper.ts b/packages/utils/src/page.ts similarity index 95% rename from web/helpers/page.helper.ts rename to packages/utils/src/page.ts index d1b0271047f..2501bc5226f 100644 --- a/web/helpers/page.helper.ts +++ b/packages/utils/src/page.ts @@ -1,8 +1,9 @@ import sortBy from "lodash/sortBy"; +// plane imports import { TPage, TPageFilterProps, TPageFiltersSortBy, TPageFiltersSortKey, TPageNavigationTabs } from "@plane/types"; -// helpers -import { getDate } from "@/helpers/date-time.helper"; -import { satisfiesDateFilter } from "@/helpers/filter.helper"; +// local imports +import { getDate } from "./datetime"; +import { satisfiesDateFilter } from "./filter"; /** * @description filters pages based on the page type @@ -83,3 +84,4 @@ export const getPageName = (name: string | undefined) => { if (!name || name.trim() === "") return "Untitled"; return name; }; + diff --git a/packages/utils/src/permission/index.ts b/packages/utils/src/permission/index.ts new file mode 100644 index 00000000000..807babea747 --- /dev/null +++ b/packages/utils/src/permission/index.ts @@ -0,0 +1 @@ +export * from "./role"; diff --git a/web/helpers/user.helper.ts b/packages/utils/src/permission/role.ts similarity index 95% rename from web/helpers/user.helper.ts rename to packages/utils/src/permission/role.ts index 7d0637afb0f..f741f91c8cc 100644 --- a/web/helpers/user.helper.ts +++ b/packages/utils/src/permission/role.ts @@ -1,3 +1,4 @@ +// plane imports import { EUserProjectRoles, EUserWorkspaceRoles, EUserPermissions } from "@plane/constants"; export const getUserRole = (role: EUserPermissions | EUserWorkspaceRoles | EUserProjectRoles) => { diff --git a/web/helpers/project-views.helpers.ts b/packages/utils/src/project-views.ts similarity index 94% rename from web/helpers/project-views.helpers.ts rename to packages/utils/src/project-views.ts index 0de90196de0..5263d709888 100644 --- a/web/helpers/project-views.helpers.ts +++ b/packages/utils/src/project-views.ts @@ -1,9 +1,11 @@ import isNil from "lodash/isNil"; import orderBy from "lodash/orderBy"; +// plane imports +import { SPACE_BASE_PATH, SPACE_BASE_URL } from "@plane/constants"; import { IProjectView, TViewFilterProps, TViewFiltersSortBy, TViewFiltersSortKey } from "@plane/types"; -import { getDate } from "@/helpers/date-time.helper"; -import { SPACE_BASE_PATH, SPACE_BASE_URL } from "./common.helper"; -import { satisfiesDateFilter } from "./filter.helper"; +// local imports +import { getDate } from "./datetime"; +import { satisfiesDateFilter } from "./filter"; /** * order views base on TViewFiltersSortKey @@ -100,4 +102,4 @@ export const getPublishViewLink = (anchor: string | undefined) => { const SPACE_APP_URL = (SPACE_BASE_URL.trim() === "" ? window.location.origin : SPACE_BASE_URL) + SPACE_BASE_PATH; return `${SPACE_APP_URL}/views/${anchor}`; -}; \ No newline at end of file +}; diff --git a/web/helpers/project.helper.ts b/packages/utils/src/project.ts similarity index 93% rename from web/helpers/project.helper.ts rename to packages/utils/src/project.ts index e8bdb5514a4..735b363d29e 100644 --- a/web/helpers/project.helper.ts +++ b/packages/utils/src/project.ts @@ -1,13 +1,10 @@ import sortBy from "lodash/sortBy"; -// types +// plane imports import { EUserPermissions } from "@plane/constants"; -import { TProjectDisplayFilters, TProjectFilters, TProjectOrderByOptions } from "@plane/types"; -// helpers -import { getDate } from "@/helpers/date-time.helper"; -import { satisfiesDateFilter } from "@/helpers/filter.helper"; -// plane web constants -// types -import { TProject } from "@/plane-web/types"; +import { TProject, TProjectDisplayFilters, TProjectFilters, TProjectOrderByOptions } from "@plane/types"; +// local imports +import { getDate } from "./datetime"; +import { satisfiesDateFilter } from "./filter"; /** * Updates the sort order of the project. diff --git a/web/helpers/router.helper.ts b/packages/utils/src/router.ts similarity index 100% rename from web/helpers/router.helper.ts rename to packages/utils/src/router.ts diff --git a/packages/utils/src/state.ts b/packages/utils/src/state.ts deleted file mode 100644 index 8d97c39f617..00000000000 --- a/packages/utils/src/state.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { STATE_GROUPS } from "@plane/constants"; -import { IState } from "@plane/types"; - -export const sortStates = (states: IState[]) => { - if (!states || states.length === 0) return; - - return states.sort((stateA, stateB) => { - if (stateA.group === stateB.group) { - return stateA.sequence - stateB.sequence; - } - return Object.keys(STATE_GROUPS).indexOf(stateA.group) - Object.keys(STATE_GROUPS).indexOf(stateB.group); - }); -}; diff --git a/packages/utils/src/string.ts b/packages/utils/src/string.ts index d663c49c9b0..1bb23c81d8a 100644 --- a/packages/utils/src/string.ts +++ b/packages/utils/src/string.ts @@ -55,22 +55,6 @@ export const createSimilarString = (str: string) => { return shuffled; }; -/** - * @description Copies text to clipboard - * @param {string} text - Text to copy - * @returns {Promise} Promise that resolves when copying is complete - * @example - * await copyTextToClipboard("Hello, World!") // copies "Hello, World!" to clipboard - */ -export const copyTextToClipboard = async (text: string): Promise => { - if (typeof navigator === "undefined") return; - try { - await navigator.clipboard.writeText(text); - } catch (err) { - console.error("Failed to copy text: ", err); - } -}; - /** * @description Copies full URL (origin + path) to clipboard * @param {string} path - URL path to copy @@ -146,39 +130,30 @@ export const objToQueryParams = (obj: any) => { export const capitalizeFirstLetter = (str: string) => str.charAt(0).toUpperCase() + str.slice(1); /** - * @description: This function will remove all the HTML tags from the string + * @description : This function will remove all the HTML tags from the string + * @param {string} htmlString + * @return {string} + * @example : + * const html = "

Some text

"; +const text = stripHTML(html); +console.log(text); // Some text + */ +export const sanitizeHTML = (htmlString: string) => { + const sanitizedText = DOMPurify.sanitize(htmlString, { ALLOWED_TAGS: [] }); // sanitize the string to remove all HTML tags + return sanitizedText.trim(); // trim the string to remove leading and trailing whitespaces +}; + +/** + * @description: This function will remove all the HTML tags from the string and truncate the string to the specified length * @param {string} html + * @param {number} length * @return {string} * @example: * const html = "

Some text

"; - * const text = stripHTML(html); + * const text = stripAndTruncateHTML(html); * console.log(text); // Some text */ -/** - * @description Sanitizes HTML string by removing tags and properly escaping entities - * @param {string} htmlString - HTML string to sanitize - * @returns {string} Sanitized string with escaped HTML entities - * @example - * sanitizeHTML("

Hello & 'world'

") // returns "Hello & 'world'" - */ -export const sanitizeHTML = (htmlString: string) => { - if (!htmlString) return ""; - - // First use DOMPurify to remove all HTML tags while preserving text content - const sanitizedText = DOMPurify.sanitize(htmlString, { - ALLOWED_TAGS: [], - ALLOWED_ATTR: [], - USE_PROFILES: { - html: false, - svg: false, - svgFilters: false, - mathMl: false, - }, - }); - - // Additional escaping for quotes and apostrophes - return sanitizedText.trim().replace(/'/g, "'").replace(/"/g, """); -}; +export const stripAndTruncateHTML = (html: string, length: number = 55) => truncateText(sanitizeHTML(html), length); /** * @returns {boolean} true if email is valid, false otherwise @@ -272,43 +247,74 @@ export const joinWithConjunction = (array: string[], separator: string = ", ", c */ export const ensureUrlHasProtocol = (url: string): string => (url.startsWith("http") ? url : `http://${url}`); -// Browser-only clipboard functions -// let copyTextToClipboard: (text: string) => Promise; - -// if (typeof window !== "undefined") { -// const fallbackCopyTextToClipboard = (text: string) => { -// const textArea = document.createElement("textarea"); -// textArea.value = text; - -// // Avoid scrolling to bottom -// textArea.style.top = "0"; -// textArea.style.left = "0"; -// textArea.style.position = "fixed"; - -// document.body.appendChild(textArea); -// textArea.focus(); -// textArea.select(); - -// try { -// // FIXME: Even though we are using this as a fallback, execCommand is deprecated 👎. We should find a better way to do this. -// // https://developer.mozilla.org/en-US/docs/Web/API/Document/execCommand -// document.execCommand("copy"); -// } catch (err) {} - -// document.body.removeChild(textArea); -// }; - -// copyTextToClipboard = async (text: string) => { -// if (!navigator.clipboard) { -// fallbackCopyTextToClipboard(text); -// return; -// } -// await navigator.clipboard.writeText(text); -// }; -// } else { -// copyTextToClipboard = async () => { -// throw new Error("copyTextToClipboard is only available in browser environments"); -// }; -// } - -// export { copyTextToClipboard }; +/** + * @returns {boolean} true if searchQuery is substring of text in the same order, false otherwise + * @description Returns true if searchQuery is substring of text in the same order, false otherwise + * @param {string} text string to compare from + * @param {string} searchQuery + * @example substringMatch("hello world", "hlo") => true + * @example substringMatch("hello world", "hoe") => false + */ +export const substringMatch = (text: string, searchQuery: string): boolean => { + try { + let searchIndex = 0; + + for (let i = 0; i < text.length; i++) { + if (text[i].toLowerCase() === searchQuery[searchIndex]?.toLowerCase()) searchIndex++; + + // All characters of searchQuery found in order + if (searchIndex === searchQuery.length) return true; + } + + // Not all characters of searchQuery found in order + return false; + } catch (error) { + return false; + } +}; + +/** + * @description Copies text to clipboard + * @param {string} text - Text to copy + * @returns {Promise} Promise that resolves when copying is complete + * @example + * await copyTextToClipboard("Hello, World!") // copies "Hello, World!" to clipboard + */ +const fallbackCopyTextToClipboard = (text: string) => { + const textArea = document.createElement("textarea"); + textArea.value = text; + + // Avoid scrolling to bottom + textArea.style.top = "0"; + textArea.style.left = "0"; + textArea.style.position = "fixed"; + + document.body.appendChild(textArea); + textArea.focus(); + textArea.select(); + + try { + // FIXME: Even though we are using this as a fallback, execCommand is deprecated 👎. We should find a better way to do this. + // https://developer.mozilla.org/en-US/docs/Web/API/Document/execCommand + document.execCommand("copy"); + } catch (err) { + // catch fallback error + } + + document.body.removeChild(textArea); +}; + +/** + * @description Copies text to clipboard + * @param {string} text - Text to copy + * @returns {Promise} Promise that resolves when copying is complete + * @example + * await copyTextToClipboard("Hello, World!") // copies "Hello, World!" to clipboard + */ +export const copyTextToClipboard = async (text: string): Promise => { + if (!navigator.clipboard) { + fallbackCopyTextToClipboard(text); + return; + } + await navigator.clipboard.writeText(text); +}; diff --git a/web/helpers/tab-indices.helper.ts b/packages/utils/src/tab-indices.ts similarity index 95% rename from web/helpers/tab-indices.helper.ts rename to packages/utils/src/tab-indices.ts index fcf7ad391f4..ea30903c9c5 100644 --- a/web/helpers/tab-indices.helper.ts +++ b/packages/utils/src/tab-indices.ts @@ -1,3 +1,4 @@ +// plane imports import { ETabIndices, TAB_INDEX_MAP } from "@plane/constants"; export const getTabIndex = (type?: ETabIndices, isMobile: boolean = false) => { diff --git a/packages/utils/src/theme.ts b/packages/utils/src/theme.ts index 1f2c22b0249..487ceaccdf3 100644 --- a/packages/utils/src/theme.ts +++ b/packages/utils/src/theme.ts @@ -1,2 +1,124 @@ +// local imports +import { TRgb, hexToRgb } from "./color"; + +type TShades = { + 10: TRgb; + 20: TRgb; + 30: TRgb; + 40: TRgb; + 50: TRgb; + 60: TRgb; + 70: TRgb; + 80: TRgb; + 90: TRgb; + 100: TRgb; + 200: TRgb; + 300: TRgb; + 400: TRgb; + 500: TRgb; + 600: TRgb; + 700: TRgb; + 800: TRgb; + 900: TRgb; +}; + +const calculateShades = (hexValue: string): TShades => { + const shades: Partial = {}; + const { r, g, b } = hexToRgb(hexValue); + + const convertHexToSpecificShade = (shade: number): TRgb => { + if (shade <= 100) { + const decimalValue = (100 - shade) / 100; + + const newR = Math.floor(r + (255 - r) * decimalValue); + const newG = Math.floor(g + (255 - g) * decimalValue); + const newB = Math.floor(b + (255 - b) * decimalValue); + + return { + r: newR, + g: newG, + b: newB, + }; + } else { + const decimalValue = 1 - Math.ceil((shade - 100) / 100) / 10; + + const newR = Math.ceil(r * decimalValue); + const newG = Math.ceil(g * decimalValue); + const newB = Math.ceil(b * decimalValue); + + return { + r: newR, + g: newG, + b: newB, + }; + } + }; + + for (let i = 10; i <= 900; i >= 100 ? (i += 100) : (i += 10)) + shades[i as keyof TShades] = convertHexToSpecificShade(i); + + return shades as TShades; +}; + +export const applyTheme = (palette: string, isDarkPalette: boolean) => { + if (!palette) return; + const themeElement = document?.querySelector("html"); + // palette: [bg, text, primary, sidebarBg, sidebarText] + const values: string[] = palette.split(","); + values.push(isDarkPalette ? "dark" : "light"); + + const bgShades = calculateShades(values[0]); + const textShades = calculateShades(values[1]); + const primaryShades = calculateShades(values[2]); + const sidebarBackgroundShades = calculateShades(values[3]); + const sidebarTextShades = calculateShades(values[4]); + + for (let i = 10; i <= 900; i >= 100 ? (i += 100) : (i += 10)) { + const shade = i as keyof TShades; + + const bgRgbValues = `${bgShades[shade].r}, ${bgShades[shade].g}, ${bgShades[shade].b}`; + const textRgbValues = `${textShades[shade].r}, ${textShades[shade].g}, ${textShades[shade].b}`; + const primaryRgbValues = `${primaryShades[shade].r}, ${primaryShades[shade].g}, ${primaryShades[shade].b}`; + const sidebarBackgroundRgbValues = `${sidebarBackgroundShades[shade].r}, ${sidebarBackgroundShades[shade].g}, ${sidebarBackgroundShades[shade].b}`; + const sidebarTextRgbValues = `${sidebarTextShades[shade].r}, ${sidebarTextShades[shade].g}, ${sidebarTextShades[shade].b}`; + + themeElement?.style.setProperty(`--color-background-${shade}`, bgRgbValues); + themeElement?.style.setProperty(`--color-text-${shade}`, textRgbValues); + themeElement?.style.setProperty(`--color-primary-${shade}`, primaryRgbValues); + themeElement?.style.setProperty(`--color-sidebar-background-${shade}`, sidebarBackgroundRgbValues); + themeElement?.style.setProperty(`--color-sidebar-text-${shade}`, sidebarTextRgbValues); + + if (i >= 100 && i <= 400) { + const borderShade = i === 100 ? 70 : i === 200 ? 80 : i === 300 ? 90 : 100; + + themeElement?.style.setProperty( + `--color-border-${shade}`, + `${bgShades[borderShade].r}, ${bgShades[borderShade].g}, ${bgShades[borderShade].b}` + ); + themeElement?.style.setProperty( + `--color-sidebar-border-${shade}`, + `${sidebarBackgroundShades[borderShade].r}, ${sidebarBackgroundShades[borderShade].g}, ${sidebarBackgroundShades[borderShade].b}` + ); + } + } + + themeElement?.style.setProperty("--color-scheme", values[5]); +}; + +export const unsetCustomCssVariables = () => { + for (let i = 10; i <= 900; i >= 100 ? (i += 100) : (i += 10)) { + const dom = document.querySelector("[data-theme='custom']"); + + dom?.style.removeProperty(`--color-background-${i}`); + dom?.style.removeProperty(`--color-text-${i}`); + dom?.style.removeProperty(`--color-border-${i}`); + dom?.style.removeProperty(`--color-primary-${i}`); + dom?.style.removeProperty(`--color-sidebar-background-${i}`); + dom?.style.removeProperty(`--color-sidebar-text-${i}`); + dom?.style.removeProperty(`--color-sidebar-border-${i}`); + dom?.style.removeProperty("--color-scheme"); + } +}; + export const resolveGeneralTheme = (resolvedTheme: string | undefined) => resolvedTheme?.includes("light") ? "light" : resolvedTheme?.includes("dark") ? "dark" : "system"; diff --git a/web/helpers/issue.helper.ts b/packages/utils/src/work-item/base.ts similarity index 92% rename from web/helpers/issue.helper.ts rename to packages/utils/src/work-item/base.ts index 7c73cb5994b..9c37605e02a 100644 --- a/web/helpers/issue.helper.ts +++ b/packages/utils/src/work-item/base.ts @@ -1,12 +1,19 @@ import { differenceInCalendarDays } from "date-fns/differenceInCalendarDays"; import isEmpty from "lodash/isEmpty"; import { v4 as uuidv4 } from "uuid"; -// plane constants -import { EIssueLayoutTypes, ISSUE_DISPLAY_FILTERS_BY_PAGE, STATE_GROUPS } from "@plane/constants"; -// types +// plane imports +import { + EIssueLayoutTypes, + ISSUE_DISPLAY_FILTERS_BY_PAGE, + STATE_GROUPS, + TIssuePriorities, + ISSUE_PRIORITY_FILTERS, + TIssueFilterPriorityObject, +} from "@plane/constants"; import { IIssueDisplayFilterOptions, IIssueDisplayProperties, + IGanttBlock, TGroupedIssues, TIssue, TIssueGroupByOptions, @@ -16,11 +23,10 @@ import { TSubGroupedIssues, TUnGroupedIssues, } from "@plane/types"; -import { IGanttBlock } from "@/components/gantt-chart"; -// helpers -import { orderArrayBy } from "@/helpers/array.helper"; -import { getDate } from "@/helpers/date-time.helper"; -import { isEditorEmpty } from "@/helpers/editor.helper"; +// local imports +import { orderArrayBy } from "../array"; +import { getDate } from "../datetime"; +import { isEditorEmpty } from "../editor"; type THandleIssuesMutation = ( formData: Partial, @@ -171,6 +177,7 @@ export const shouldHighlightIssueDueDate = ( // if the issue is overdue, highlight the due date return targetDateDistance <= 0; }; + export const getIssueBlocksStructure = (block: TIssue): IGanttBlock => ({ data: block, id: block?.id, @@ -333,3 +340,13 @@ export const generateWorkItemLink = ({ return isArchived ? archiveIssueLink : isEpic ? epicLink : workItemLink; }; + +export const getIssuePriorityFilters = (priorityKey: TIssuePriorities): TIssueFilterPriorityObject | undefined => { + const currentIssuePriority: TIssueFilterPriorityObject | undefined = + ISSUE_PRIORITY_FILTERS && ISSUE_PRIORITY_FILTERS.length > 0 + ? ISSUE_PRIORITY_FILTERS.find((_priority) => _priority.key === priorityKey) + : undefined; + + if (currentIssuePriority) return currentIssuePriority; + return undefined; +}; diff --git a/packages/utils/src/work-item/index.ts b/packages/utils/src/work-item/index.ts index 031608e25ff..002d393b128 100644 --- a/packages/utils/src/work-item/index.ts +++ b/packages/utils/src/work-item/index.ts @@ -1 +1,3 @@ +export * from "./base"; export * from "./modal"; +export * from "./state"; diff --git a/packages/utils/src/work-item/modal.ts b/packages/utils/src/work-item/modal.ts index c70d7591fb2..74bb1063bbb 100644 --- a/packages/utils/src/work-item/modal.ts +++ b/packages/utils/src/work-item/modal.ts @@ -1,3 +1,4 @@ +import set from "lodash/set"; // plane imports import { DEFAULT_WORK_ITEM_FORM_VALUES } from "@plane/constants"; import { IPartialProject, ISearchIssueResponse, IState, TIssue } from "@plane/types"; @@ -31,3 +32,17 @@ export const convertWorkItemDataToSearchResponse = ( state__name: state?.name ?? "", workspace__slug: workspaceSlug, }); + + +export function getChangedIssuefields(formData: Partial, dirtyFields: { [key: string]: boolean | undefined }) { + const changedFields = {}; + + const dirtyFieldKeys = Object.keys(dirtyFields) as (keyof TIssue)[]; + for (const dirtyField of dirtyFieldKeys) { + if (!!dirtyFields[dirtyField]) { + set(changedFields, [dirtyField], formData[dirtyField]); + } + } + + return changedFields as Partial; +} diff --git a/web/helpers/state.helper.ts b/packages/utils/src/work-item/state.ts similarity index 99% rename from web/helpers/state.helper.ts rename to packages/utils/src/work-item/state.ts index 7d0b9de38cc..8a123d7e95e 100644 --- a/web/helpers/state.helper.ts +++ b/packages/utils/src/work-item/state.ts @@ -1,6 +1,5 @@ // plane imports import { STATE_GROUPS, TDraggableData } from "@plane/constants"; -// types import { IState, IStateResponse } from "@plane/types"; export const orderStateGroups = (unorderedStateGroups: IStateResponse | undefined): IStateResponse | undefined => { diff --git a/web/app/(all)/[workspaceSlug]/(projects)/analytics/header.tsx b/web/app/(all)/[workspaceSlug]/(projects)/analytics/header.tsx index 2c3247bd7f6..b42b9d21810 100644 --- a/web/app/(all)/[workspaceSlug]/(projects)/analytics/header.tsx +++ b/web/app/(all)/[workspaceSlug]/(projects)/analytics/header.tsx @@ -4,15 +4,15 @@ import { useEffect } from "react"; import { observer } from "mobx-react"; import { useSearchParams } from "next/navigation"; import { BarChart2, PanelRight } from "lucide-react"; +// plane imports import { useTranslation } from "@plane/i18n"; -// ui import { Breadcrumbs, Header } from "@plane/ui"; +import { cn } from "@plane/utils"; // components -import { BreadcrumbLink } from "@/components/common"; -// helpers -import { cn } from "@/helpers/common.helper"; +import { BreadcrumbLink } from "@/components/common/breadcrumb-link"; // hooks import { useAppTheme } from "@/hooks/store"; + export const WorkspaceAnalyticsHeader = observer(() => { const { t } = useTranslation(); const searchParams = useSearchParams(); diff --git a/web/app/(all)/[workspaceSlug]/(projects)/extended-project-sidebar.tsx b/web/app/(all)/[workspaceSlug]/(projects)/extended-project-sidebar.tsx index b96f008ab69..0cd87200c9f 100644 --- a/web/app/(all)/[workspaceSlug]/(projects)/extended-project-sidebar.tsx +++ b/web/app/(all)/[workspaceSlug]/(projects)/extended-project-sidebar.tsx @@ -8,12 +8,11 @@ import { Plus, Search } from "lucide-react"; import { EUserPermissions, EUserPermissionsLevel } from "@plane/constants"; import { useTranslation } from "@plane/i18n"; import { setToast, TOAST_TYPE, Tooltip } from "@plane/ui"; -import { cn, copyUrlToClipboard } from "@plane/utils"; +import { cn, copyUrlToClipboard, orderJoinedProjects } from "@plane/utils"; // components import { CreateProjectModal } from "@/components/project"; import { SidebarProjectsListItem } from "@/components/workspace"; // hooks -import { orderJoinedProjects } from "@/helpers/project.helper"; import { useAppTheme, useProject, useUserPermissions } from "@/hooks/store"; import useExtendedSidebarOutsideClickDetector from "@/hooks/use-extended-sidebar-overview-outside-click"; import { TProject } from "@/plane-web/types"; diff --git a/web/app/(all)/[workspaceSlug]/(projects)/profile/[userId]/header.tsx b/web/app/(all)/[workspaceSlug]/(projects)/profile/[userId]/header.tsx index e97b4751f3a..a0af9373830 100644 --- a/web/app/(all)/[workspaceSlug]/(projects)/profile/[userId]/header.tsx +++ b/web/app/(all)/[workspaceSlug]/(projects)/profile/[userId]/header.tsx @@ -10,10 +10,11 @@ import { PROFILE_VIEWER_TAB, PROFILE_ADMINS_TAB, EUserPermissions, EUserPermissi import { useTranslation } from "@plane/i18n"; import { IUserProfileProjectSegregation } from "@plane/types"; import { Breadcrumbs, Header, CustomMenu, UserActivityIcon } from "@plane/ui"; -import { BreadcrumbLink } from "@/components/common"; +import { cn } from "@plane/utils"; // components +import { BreadcrumbLink } from "@/components/common/breadcrumb-link"; import { ProfileIssuesFilter } from "@/components/profile"; -import { cn } from "@/helpers/common.helper"; +// hooks import { useAppTheme, useUser, useUserPermissions } from "@/hooks/store"; type TUserProfileHeader = { diff --git a/web/app/(all)/[workspaceSlug]/(projects)/profile/[userId]/mobile-header.tsx b/web/app/(all)/[workspaceSlug]/(projects)/profile/[userId]/mobile-header.tsx index 49fa5d2e5a1..60ee2c35151 100644 --- a/web/app/(all)/[workspaceSlug]/(projects)/profile/[userId]/mobile-header.tsx +++ b/web/app/(all)/[workspaceSlug]/(projects)/profile/[userId]/mobile-header.tsx @@ -20,10 +20,10 @@ import { IIssueDisplayFilterOptions, IIssueDisplayProperties, IIssueFilterOption // ui import { CustomMenu } from "@plane/ui"; // components +import { isIssueFilterActive } from "@plane/utils"; import { DisplayFiltersSelection, FilterSelection, FiltersDropdown, IssueLayoutIcon } from "@/components/issues"; // helpers -import { isIssueFilterActive } from "@/helpers/filter.helper"; // hooks import { useIssues, useLabel } from "@/hooks/store"; diff --git a/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/cycles/(detail)/[cycleId]/page.tsx b/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/cycles/(detail)/[cycleId]/page.tsx index fbe8ed85d5d..b26a063ec75 100644 --- a/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/cycles/(detail)/[cycleId]/page.tsx +++ b/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/cycles/(detail)/[cycleId]/page.tsx @@ -3,13 +3,13 @@ import { observer } from "mobx-react"; import { useParams } from "next/navigation"; // components +import { cn } from "@plane/utils"; import { EmptyState } from "@/components/common"; import { PageHead } from "@/components/core"; import { CycleDetailsSidebar } from "@/components/cycles"; import useCyclesDetails from "@/components/cycles/active-cycle/use-cycles-details"; import { CycleLayoutRoot } from "@/components/issues/issue-layouts"; // helpers -import { cn } from "@/helpers/common.helper"; // hooks import { useCycle, useProject } from "@/hooks/store"; import { useAppRouter } from "@/hooks/use-app-router"; diff --git a/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/cycles/(detail)/header.tsx b/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/cycles/(detail)/header.tsx index 07dd0fc4dfa..bb84efb9676 100644 --- a/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/cycles/(detail)/header.tsx +++ b/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/cycles/(detail)/header.tsx @@ -8,12 +8,12 @@ import { useParams } from "next/navigation"; import { PanelRight } from "lucide-react"; // plane constants import { - EIssueLayoutTypes, EIssueFilterType, + EIssueLayoutTypes, EIssuesStoreType, - ISSUE_DISPLAY_FILTERS_BY_PAGE, EUserPermissions, EUserPermissionsLevel, + ISSUE_DISPLAY_FILTERS_BY_PAGE, } from "@plane/constants"; // i18n import { useTranslation } from "@plane/i18n"; @@ -25,25 +25,24 @@ import { IIssueFilterOptions, } from "@plane/types"; // ui -import { Breadcrumbs, Button, ContrastIcon, Tooltip, Header, CustomSearchSelect } from "@plane/ui"; +import { Breadcrumbs, Button, ContrastIcon, CustomSearchSelect, Header, Tooltip } from "@plane/ui"; // components +import { cn, isIssueFilterActive } from "@plane/utils"; import { WorkItemsModal } from "@/components/analytics-v2/work-items/modal"; import { BreadcrumbLink, SwitcherLabel } from "@/components/common"; import { CycleQuickActions } from "@/components/cycles"; import { DisplayFiltersSelection, FiltersDropdown, FilterSelection, LayoutSelection } from "@/components/issues"; // helpers -import { cn } from "@/helpers/common.helper"; -import { isIssueFilterActive } from "@/helpers/filter.helper"; // hooks import { - useEventTracker, + useCommandPalette, useCycle, + useEventTracker, + useIssues, useLabel, useMember, useProject, useProjectState, - useIssues, - useCommandPalette, useUserPermissions, } from "@/hooks/store"; import { useAppRouter } from "@/hooks/use-app-router"; diff --git a/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/cycles/(detail)/mobile-header.tsx b/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/cycles/(detail)/mobile-header.tsx index 4efa986b4d9..2dedcdc48b4 100644 --- a/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/cycles/(detail)/mobile-header.tsx +++ b/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/cycles/(detail)/mobile-header.tsx @@ -19,10 +19,10 @@ import { IIssueDisplayFilterOptions, IIssueDisplayProperties, IIssueFilterOption // ui import { CustomMenu } from "@plane/ui"; // components +import { isIssueFilterActive } from "@plane/utils"; import { WorkItemsModal } from "@/components/analytics-v2/work-items/modal"; import { DisplayFiltersSelection, FilterSelection, FiltersDropdown, IssueLayoutIcon } from "@/components/issues"; // helpers -import { isIssueFilterActive } from "@/helpers/filter.helper"; // hooks import { useIssues, useCycle, useProjectState, useLabel, useMember, useProject } from "@/hooks/store"; diff --git a/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/cycles/(list)/page.tsx b/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/cycles/(list)/page.tsx index e23396f4df5..edb4e1bcf1c 100644 --- a/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/cycles/(list)/page.tsx +++ b/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/cycles/(list)/page.tsx @@ -9,12 +9,12 @@ import { useTranslation } from "@plane/i18n"; import { TCycleFilters } from "@plane/types"; // components import { Header, EHeaderVariant } from "@plane/ui"; -import { PageHead } from "@/components/core"; +import { calculateTotalFilters } from "@plane/utils"; +import { PageHead } from "@/components/core/page-title"; import { CyclesView, CycleCreateUpdateModal, CycleAppliedFiltersList } from "@/components/cycles"; import { ComicBoxButton, DetailedEmptyState } from "@/components/empty-state"; import { CycleModuleListLayout } from "@/components/ui"; // helpers -import { calculateTotalFilters } from "@/helpers/filter.helper"; // hooks import { useEventTracker, useCycle, useProject, useCycleFilter, useUserPermissions } from "@/hooks/store"; import { useAppRouter } from "@/hooks/use-app-router"; diff --git a/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/draft-issues/header.tsx b/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/draft-issues/header.tsx index 2200b31f123..a7065a1f50a 100644 --- a/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/draft-issues/header.tsx +++ b/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/draft-issues/header.tsx @@ -12,10 +12,10 @@ import { IIssueDisplayFilterOptions, IIssueDisplayProperties, IIssueFilterOption // ui import { Breadcrumbs, LayersIcon, Tooltip } from "@plane/ui"; // components +import { isIssueFilterActive } from "@plane/utils"; import { BreadcrumbLink } from "@/components/common"; import { DisplayFiltersSelection, FiltersDropdown, FilterSelection, LayoutSelection } from "@/components/issues"; // helpers -import { isIssueFilterActive } from "@/helpers/filter.helper"; // hooks import { useIssues, useLabel, useMember, useProject, useProjectState } from "@/hooks/store"; import { usePlatformOS } from "@/hooks/use-platform-os"; diff --git a/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/intake/page.tsx b/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/intake/page.tsx index 5b6ad8b5f1f..48ab4d38b1f 100644 --- a/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/intake/page.tsx +++ b/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/intake/page.tsx @@ -1,15 +1,14 @@ "use client"; import { observer } from "mobx-react"; -// components import { useParams, useSearchParams } from "next/navigation"; -import { EUserPermissionsLevel } from "@plane/constants"; +import { EUserPermissionsLevel, EInboxIssueCurrentTab } from "@plane/constants"; +// components import { EUserProjectRoles } from "@plane/constants/src/user"; import { useTranslation } from "@plane/i18n"; import { PageHead } from "@/components/core"; import { DetailedEmptyState } from "@/components/empty-state"; import { InboxIssueRoot } from "@/components/inbox"; // helpers -import { EInboxIssueCurrentTab } from "@/helpers/inbox.helper"; // hooks import { useProject, useUserPermissions } from "@/hooks/store"; import { useAppRouter } from "@/hooks/use-app-router"; diff --git a/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/issues/(list)/mobile-header.tsx b/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/issues/(list)/mobile-header.tsx index a9777ce23d5..4e22a53e46b 100644 --- a/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/issues/(list)/mobile-header.tsx +++ b/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/issues/(list)/mobile-header.tsx @@ -20,6 +20,7 @@ import { IIssueDisplayFilterOptions, IIssueDisplayProperties, IIssueFilterOption // ui import { CustomMenu } from "@plane/ui"; // components +import { isIssueFilterActive } from "@plane/utils"; import { WorkItemsModal } from "@/components/analytics-v2/work-items/modal"; import { DisplayFiltersSelection, @@ -28,7 +29,6 @@ import { IssueLayoutIcon, } from "@/components/issues/issue-layouts"; // helpers -import { isIssueFilterActive } from "@/helpers/filter.helper"; // hooks import { useIssues, useLabel, useMember, useProject, useProjectState } from "@/hooks/store"; diff --git a/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/modules/(detail)/[moduleId]/page.tsx b/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/modules/(detail)/[moduleId]/page.tsx index d35f3146549..db317130799 100644 --- a/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/modules/(detail)/[moduleId]/page.tsx +++ b/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/modules/(detail)/[moduleId]/page.tsx @@ -4,12 +4,12 @@ import { observer } from "mobx-react"; import { useParams } from "next/navigation"; import useSWR from "swr"; // components +import { cn } from "@plane/utils"; import { EmptyState } from "@/components/common"; import { PageHead } from "@/components/core"; import { ModuleLayoutRoot } from "@/components/issues"; import { ModuleAnalyticsSidebar } from "@/components/modules"; // helpers -import { cn } from "@/helpers/common.helper"; // hooks import { useModule, useProject } from "@/hooks/store"; import { useAppRouter } from "@/hooks/use-app-router"; diff --git a/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/modules/(detail)/header.tsx b/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/modules/(detail)/header.tsx index 6830b5532d9..b7f4b1b777b 100644 --- a/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/modules/(detail)/header.tsx +++ b/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/modules/(detail)/header.tsx @@ -25,13 +25,12 @@ import { // ui import { Breadcrumbs, Button, DiceIcon, Tooltip, Header, CustomSearchSelect } from "@plane/ui"; // components +import { cn, isIssueFilterActive } from "@plane/utils"; import { WorkItemsModal } from "@/components/analytics-v2/work-items/modal"; import { BreadcrumbLink, SwitcherLabel } from "@/components/common"; import { DisplayFiltersSelection, FiltersDropdown, FilterSelection, LayoutSelection } from "@/components/issues"; // helpers import { ModuleQuickActions } from "@/components/modules"; -import { cn } from "@/helpers/common.helper"; -import { isIssueFilterActive } from "@/helpers/filter.helper"; // hooks import { useEventTracker, diff --git a/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/modules/(detail)/mobile-header.tsx b/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/modules/(detail)/mobile-header.tsx index 741fe3b5391..1d183579569 100644 --- a/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/modules/(detail)/mobile-header.tsx +++ b/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/modules/(detail)/mobile-header.tsx @@ -20,6 +20,7 @@ import { IIssueDisplayFilterOptions, IIssueDisplayProperties, IIssueFilterOption // ui import { CustomMenu } from "@plane/ui"; // components +import { isIssueFilterActive } from "@plane/utils"; import { ProjectAnalyticsModal } from "@/components/analytics"; import { WorkItemsModal } from "@/components/analytics-v2/work-items/modal"; import { @@ -29,7 +30,6 @@ import { IssueLayoutIcon, } from "@/components/issues/issue-layouts"; // helpers -import { isIssueFilterActive } from "@/helpers/filter.helper"; // hooks import { useIssues, useLabel, useMember, useModule, useProject, useProjectState } from "@/hooks/store"; diff --git a/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/modules/(list)/page.tsx b/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/modules/(list)/page.tsx index 7c62a4d51ae..1a2980760ab 100644 --- a/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/modules/(list)/page.tsx +++ b/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/modules/(list)/page.tsx @@ -8,11 +8,11 @@ import { EUserPermissionsLevel, EUserProjectRoles } from "@plane/constants"; import { useTranslation } from "@plane/i18n"; import { TModuleFilters } from "@plane/types"; // components -import { PageHead } from "@/components/core"; +import { calculateTotalFilters } from "@plane/utils"; +import { PageHead } from "@/components/core/page-title"; import { DetailedEmptyState } from "@/components/empty-state"; import { ModuleAppliedFiltersList, ModulesListView } from "@/components/modules"; // helpers -import { calculateTotalFilters } from "@/helpers/filter.helper"; // hooks import { useModuleFilter, useProject, useUserPermissions } from "@/hooks/store"; import { useAppRouter } from "@/hooks/use-app-router"; diff --git a/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/pages/(detail)/header.tsx b/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/pages/(detail)/header.tsx index d939c6fe5e3..da7b902916f 100644 --- a/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/pages/(detail)/header.tsx +++ b/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/pages/(detail)/header.tsx @@ -7,10 +7,10 @@ import { ICustomSearchSelectOption } from "@plane/types"; // ui import { Breadcrumbs, Header, CustomSearchSelect } from "@plane/ui"; // components +import { getPageName } from "@plane/utils"; import { BreadcrumbLink, PageAccessIcon, SwitcherLabel } from "@/components/common"; import { PageHeaderActions } from "@/components/pages/header/actions"; // helpers -import { getPageName } from "@/helpers/page.helper"; // hooks import { useProject } from "@/hooks/store"; // plane web components diff --git a/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/views/(detail)/[viewId]/header.tsx b/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/views/(detail)/[viewId]/header.tsx index 3bc05747920..6634f0efceb 100644 --- a/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/views/(detail)/[viewId]/header.tsx +++ b/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/views/(detail)/[viewId]/header.tsx @@ -24,12 +24,12 @@ import { // ui import { Breadcrumbs, Button, Tooltip, Header, CustomSearchSelect } from "@plane/ui"; // components +import { isIssueFilterActive } from "@plane/utils"; import { BreadcrumbLink, SwitcherLabel } from "@/components/common"; import { DisplayFiltersSelection, FiltersDropdown, FilterSelection, LayoutSelection } from "@/components/issues"; // constants import { ViewQuickActions } from "@/components/views"; // helpers -import { isIssueFilterActive } from "@/helpers/filter.helper"; // hooks import { useCommandPalette, diff --git a/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/views/(list)/page.tsx b/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/views/(list)/page.tsx index 4e21defc93d..d9068966c4e 100644 --- a/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/views/(list)/page.tsx +++ b/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/views/(list)/page.tsx @@ -8,13 +8,13 @@ import { EUserPermissionsLevel, EUserProjectRoles, EViewAccess } from "@plane/co import { useTranslation } from "@plane/i18n"; import { TViewFilterProps } from "@plane/types"; import { Header, EHeaderVariant } from "@plane/ui"; -import { PageHead } from "@/components/core"; +import { calculateTotalFilters } from "@plane/utils"; +import { PageHead } from "@/components/core/page-title"; import { DetailedEmptyState } from "@/components/empty-state"; import { ProjectViewsList } from "@/components/views"; import { ViewAppliedFiltersList } from "@/components/views/applied-filters"; // constants // helpers -import { calculateTotalFilters } from "@/helpers/filter.helper"; // hooks import { useProject, useProjectView, useUserPermissions } from "@/hooks/store"; import { useAppRouter } from "@/hooks/use-app-router"; diff --git a/web/app/(all)/[workspaceSlug]/(projects)/sidebar.tsx b/web/app/(all)/[workspaceSlug]/(projects)/sidebar.tsx index 27a73137e47..39d6313ba5d 100644 --- a/web/app/(all)/[workspaceSlug]/(projects)/sidebar.tsx +++ b/web/app/(all)/[workspaceSlug]/(projects)/sidebar.tsx @@ -5,11 +5,11 @@ import { observer } from "mobx-react"; import { EUserPermissions, EUserPermissionsLevel } from "@plane/constants"; import { useOutsideClickDetector } from "@plane/hooks"; // components +import { cn } from "@plane/utils"; import { SidebarDropdown, SidebarHelpSection, SidebarProjectsList, SidebarQuickActions } from "@/components/workspace"; import { SidebarFavoritesMenu } from "@/components/workspace/sidebar/favorites/favorites-menu"; import { SidebarMenuItems } from "@/components/workspace/sidebar/sidebar-menu-items"; // helpers -import { cn } from "@/helpers/common.helper"; // hooks import { useAppTheme, useUserPermissions } from "@/hooks/store"; import { useFavorite } from "@/hooks/store/use-favorite"; diff --git a/web/app/(all)/[workspaceSlug]/(projects)/workspace-views/header.tsx b/web/app/(all)/[workspaceSlug]/(projects)/workspace-views/header.tsx index 5a5ee0a6ef9..1819ac0ee08 100644 --- a/web/app/(all)/[workspaceSlug]/(projects)/workspace-views/header.tsx +++ b/web/app/(all)/[workspaceSlug]/(projects)/workspace-views/header.tsx @@ -12,11 +12,11 @@ import { IIssueDisplayFilterOptions, IIssueDisplayProperties, IIssueFilterOption // ui import { Breadcrumbs, Button, Header } from "@plane/ui"; // components +import { isIssueFilterActive } from "@plane/utils"; import { BreadcrumbLink } from "@/components/common"; import { DisplayFiltersSelection, FiltersDropdown, FilterSelection } from "@/components/issues"; import { CreateUpdateWorkspaceViewModal } from "@/components/workspace"; // helpers -import { isIssueFilterActive } from "@/helpers/filter.helper"; // hooks import { useLabel, useMember, useIssues, useGlobalView } from "@/hooks/store"; diff --git a/web/app/(all)/[workspaceSlug]/(settings)/settings/(workspace)/exports/page.tsx b/web/app/(all)/[workspaceSlug]/(settings)/settings/(workspace)/exports/page.tsx index 9f08259c6e7..62aabb10eee 100644 --- a/web/app/(all)/[workspaceSlug]/(settings)/settings/(workspace)/exports/page.tsx +++ b/web/app/(all)/[workspaceSlug]/(settings)/settings/(workspace)/exports/page.tsx @@ -4,13 +4,14 @@ import { observer } from "mobx-react"; // components import { EUserPermissions, EUserPermissionsLevel } from "@plane/constants"; import { useTranslation } from "@plane/i18n"; +import { cn } from "@plane/utils"; import { NotAuthorizedView } from "@/components/auth-screens"; import { PageHead } from "@/components/core"; import ExportGuide from "@/components/exporter/guide"; // helpers -import { SettingsContentWrapper, SettingsHeading } from "@/components/settings"; -import { cn } from "@/helpers/common.helper"; // hooks +import { SettingsContentWrapper } from "@/components/settings/content-wrapper"; +import SettingsHeading from "@/components/settings/heading"; import { useUserPermissions, useWorkspace } from "@/hooks/store"; const ExportsPage = observer(() => { diff --git a/web/app/(all)/[workspaceSlug]/(settings)/settings/(workspace)/members/page.tsx b/web/app/(all)/[workspaceSlug]/(settings)/settings/(workspace)/members/page.tsx index 250b5bc02fc..d2c65340ea7 100644 --- a/web/app/(all)/[workspaceSlug]/(settings)/settings/(workspace)/members/page.tsx +++ b/web/app/(all)/[workspaceSlug]/(settings)/settings/(workspace)/members/page.tsx @@ -10,6 +10,7 @@ import { useTranslation } from "@plane/i18n"; import { IWorkspaceBulkInviteFormData } from "@plane/types"; // ui import { Button, TOAST_TYPE, setToast } from "@plane/ui"; +import { cn, getUserRole } from "@plane/utils"; // components import { NotAuthorizedView } from "@/components/auth-screens"; import { CountChip } from "@/components/common"; @@ -17,8 +18,6 @@ import { PageHead } from "@/components/core"; import { SettingsContentWrapper } from "@/components/settings"; import { WorkspaceMembersList } from "@/components/workspace"; // helpers -import { cn } from "@/helpers/common.helper"; -import { getUserRole } from "@/helpers/user.helper"; // hooks import { useEventTracker, useMember, useUserPermissions, useWorkspace } from "@/hooks/store"; // plane web components diff --git a/web/app/(all)/accounts/forgot-password/page.tsx b/web/app/(all)/accounts/forgot-password/page.tsx index 9ee2cc48248..8cf7eae4ad2 100644 --- a/web/app/(all)/accounts/forgot-password/page.tsx +++ b/web/app/(all)/accounts/forgot-password/page.tsx @@ -12,10 +12,9 @@ import { CircleCheck } from "lucide-react"; import { FORGOT_PASS_LINK, NAVIGATE_TO_SIGNUP } from "@plane/constants"; import { useTranslation } from "@plane/i18n"; import { Button, Input, TOAST_TYPE, getButtonStyling, setToast } from "@plane/ui"; +import { cn, checkEmailValidity } from "@plane/utils"; // helpers import { EPageTypes } from "@/helpers/authentication.helper"; -import { cn } from "@/helpers/common.helper"; -import { checkEmailValidity } from "@/helpers/string.helper"; // hooks import { useEventTracker, useInstance } from "@/hooks/store"; import useTimer from "@/hooks/use-timer"; diff --git a/web/app/(all)/accounts/reset-password/page.tsx b/web/app/(all)/accounts/reset-password/page.tsx index e0230f205f5..388e7a02da2 100644 --- a/web/app/(all)/accounts/reset-password/page.tsx +++ b/web/app/(all)/accounts/reset-password/page.tsx @@ -9,9 +9,11 @@ import { useSearchParams } from "next/navigation"; import { useTheme } from "next-themes"; import { Eye, EyeOff } from "lucide-react"; // ui +import { API_BASE_URL, E_PASSWORD_STRENGTH } from "@plane/constants"; import { useTranslation } from "@plane/i18n"; import { Button, Input } from "@plane/ui"; // components +import { getPasswordStrength } from "@plane/utils"; import { AuthBanner, PasswordStrengthMeter } from "@/components/account"; // helpers import { @@ -21,8 +23,6 @@ import { TAuthErrorInfo, authErrorHandler, } from "@/helpers/authentication.helper"; -import { API_BASE_URL } from "@/helpers/common.helper"; -import { E_PASSWORD_STRENGTH, getPasswordStrength } from "@/helpers/password.helper"; // wrappers import { AuthenticationWrapper } from "@/lib/wrappers"; // services diff --git a/web/app/(all)/accounts/set-password/page.tsx b/web/app/(all)/accounts/set-password/page.tsx index 5bfa7c08f5f..872f965dd0b 100644 --- a/web/app/(all)/accounts/set-password/page.tsx +++ b/web/app/(all)/accounts/set-password/page.tsx @@ -9,13 +9,14 @@ import { useSearchParams } from "next/navigation"; import { useTheme } from "next-themes"; import { Eye, EyeOff } from "lucide-react"; // plane imports +import { E_PASSWORD_STRENGTH } from "@plane/constants"; import { useTranslation } from "@plane/i18n"; import { Button, Input, TOAST_TYPE, setToast } from "@plane/ui"; // components -import { PasswordStrengthMeter } from "@/components/account"; +import { getPasswordStrength } from "@plane/utils"; +import { PasswordStrengthMeter } from "@/components/account/password-strength-meter"; // helpers import { EPageTypes } from "@/helpers/authentication.helper"; -import { E_PASSWORD_STRENGTH, getPasswordStrength } from "@/helpers/password.helper"; // hooks import { useUser } from "@/hooks/store"; import { useAppRouter } from "@/hooks/use-app-router"; diff --git a/web/app/(all)/invitations/page.tsx b/web/app/(all)/invitations/page.tsx index df6befa6869..38d50f2e6f6 100644 --- a/web/app/(all)/invitations/page.tsx +++ b/web/app/(all)/invitations/page.tsx @@ -15,13 +15,12 @@ import { useTranslation } from "@plane/i18n"; import type { IWorkspaceMemberInvitation } from "@plane/types"; // ui import { Button, TOAST_TYPE, setToast } from "@plane/ui"; +import { truncateText, getUserRole } from "@plane/utils"; // components import { EmptyState } from "@/components/common"; import { WorkspaceLogo } from "@/components/workspace/logo"; import { USER_WORKSPACES_LIST } from "@/constants/fetch-keys"; // helpers -import { truncateText } from "@/helpers/string.helper"; -import { getUserRole } from "@/helpers/user.helper"; // hooks import { useEventTracker, useUser, useUserProfile, useWorkspace } from "@/hooks/store"; import { useAppRouter } from "@/hooks/use-app-router"; diff --git a/web/app/(all)/profile/appearance/page.tsx b/web/app/(all)/profile/appearance/page.tsx index ac5beec3764..877dfd51170 100644 --- a/web/app/(all)/profile/appearance/page.tsx +++ b/web/app/(all)/profile/appearance/page.tsx @@ -9,11 +9,11 @@ import { useTranslation } from "@plane/i18n"; import { IUserTheme } from "@plane/types"; import { setPromiseToast } from "@plane/ui"; // components +import { applyTheme, unsetCustomCssVariables } from "@plane/utils"; import { LogoSpinner } from "@/components/common"; import { ThemeSwitch, PageHead, CustomThemeSelector } from "@/components/core"; import { ProfileSettingContentHeader, ProfileSettingContentWrapper } from "@/components/profile"; // helpers -import { applyTheme, unsetCustomCssVariables } from "@/helpers/theme.helper"; // hooks import { useUserProfile } from "@/hooks/store"; diff --git a/web/app/(all)/profile/security/page.tsx b/web/app/(all)/profile/security/page.tsx index 8477d70d9c5..eec52f994e6 100644 --- a/web/app/(all)/profile/security/page.tsx +++ b/web/app/(all)/profile/security/page.tsx @@ -4,16 +4,17 @@ import { useState } from "react"; import { observer } from "mobx-react"; import { Controller, useForm } from "react-hook-form"; import { Eye, EyeOff } from "lucide-react"; +import { E_PASSWORD_STRENGTH } from "@plane/constants"; import { useTranslation } from "@plane/i18n"; // ui import { Button, Input, TOAST_TYPE, setToast } from "@plane/ui"; // components -import { PasswordStrengthMeter } from "@/components/account"; -import { PageHead } from "@/components/core"; +import { getPasswordStrength } from "@plane/utils"; +import { PasswordStrengthMeter } from "@/components/account/password-strength-meter"; +import { PageHead } from "@/components/core/page-title"; import { ProfileSettingContentHeader, ProfileSettingContentWrapper } from "@/components/profile"; // helpers import { authErrorHandler } from "@/helpers/authentication.helper"; -import { E_PASSWORD_STRENGTH, getPasswordStrength } from "@/helpers/password.helper"; // hooks import { useUser } from "@/hooks/store"; // services diff --git a/web/app/(all)/profile/sidebar.tsx b/web/app/(all)/profile/sidebar.tsx index 59e3daa4855..07d94f040a0 100644 --- a/web/app/(all)/profile/sidebar.tsx +++ b/web/app/(all)/profile/sidebar.tsx @@ -22,12 +22,11 @@ import { PROFILE_ACTION_LINKS } from "@plane/constants"; import { useOutsideClickDetector } from "@plane/hooks"; import { useTranslation } from "@plane/i18n"; import { TOAST_TYPE, Tooltip, setToast } from "@plane/ui"; +import { cn, getFileURL } from "@plane/utils"; // components import { SidebarNavItem } from "@/components/sidebar"; // constants // helpers -import { cn } from "@/helpers/common.helper"; -import { getFileURL } from "@/helpers/file.helper"; // hooks import { useAppTheme, useUser, useUserSettings, useWorkspace } from "@/hooks/store"; import { usePlatformOS } from "@/hooks/use-platform-os"; diff --git a/web/app/error.tsx b/web/app/error.tsx index b176799b4d3..5eea1b8528b 100644 --- a/web/app/error.tsx +++ b/web/app/error.tsx @@ -1,9 +1,9 @@ "use client"; // ui +import { API_BASE_URL } from "@plane/constants"; import { Button, TOAST_TYPE, setToast } from "@plane/ui"; // helpers -import { API_BASE_URL } from "@/helpers/common.helper"; // hooks import { useAppRouter } from "@/hooks/use-app-router"; // layouts diff --git a/web/app/provider.tsx b/web/app/provider.tsx index b120882f7d1..554bf796d4f 100644 --- a/web/app/provider.tsx +++ b/web/app/provider.tsx @@ -9,7 +9,7 @@ import { WEB_SWR_CONFIG } from "@plane/constants"; import { TranslationProvider } from "@plane/i18n"; import { Toast } from "@plane/ui"; //helpers -import { resolveGeneralTheme } from "@/helpers/theme.helper"; +import { resolveGeneralTheme } from "@plane/utils"; // nprogress import { AppProgressBar } from "@/lib/n-progress"; // polyfills diff --git a/web/ce/components/active-cycles/workspace-active-cycles-upgrade.tsx b/web/ce/components/active-cycles/workspace-active-cycles-upgrade.tsx index e8a13f0361b..b82fb019e96 100644 --- a/web/ce/components/active-cycles/workspace-active-cycles-upgrade.tsx +++ b/web/ce/components/active-cycles/workspace-active-cycles-upgrade.tsx @@ -9,9 +9,9 @@ import { MARKETING_PRICING_PAGE_LINK } from "@plane/constants"; import { useTranslation } from "@plane/i18n"; import { ContentWrapper, getButtonStyling } from "@plane/ui"; // components +import { cn } from "@plane/utils"; import { ProIcon } from "@/components/common"; // helper -import { cn } from "@/helpers/common.helper"; // hooks import { useUser } from "@/hooks/store"; diff --git a/web/ce/components/command-palette/helpers.tsx b/web/ce/components/command-palette/helpers.tsx index d846ebfa061..141f65bdd59 100644 --- a/web/ce/components/command-palette/helpers.tsx +++ b/web/ce/components/command-palette/helpers.tsx @@ -12,7 +12,7 @@ import { // ui import { ContrastIcon, DiceIcon } from "@plane/ui"; // helpers -import { generateWorkItemLink } from "@/helpers/issue.helper"; +import { generateWorkItemLink } from "@plane/utils"; // plane web components import { IssueIdentifier } from "@/plane-web/components/issues"; diff --git a/web/ce/components/comments/comment-block.tsx b/web/ce/components/comments/comment-block.tsx index 72b5b7bf58d..11b98d6cb1a 100644 --- a/web/ce/components/comments/comment-block.tsx +++ b/web/ce/components/comments/comment-block.tsx @@ -4,9 +4,9 @@ import { observer } from "mobx-react"; import { useTranslation } from "@plane/i18n"; import { TIssueComment } from "@plane/types"; import { Avatar, Tooltip } from "@plane/ui"; -import { calculateTimeAgo, cn, getFileURL, renderFormattedDate } from "@plane/utils"; +import { calculateTimeAgo, cn, getFileURL, renderFormattedDate, renderFormattedTime } from "@plane/utils"; // hooks -import { renderFormattedTime } from "@/helpers/date-time.helper"; +// import { useMember } from "@/hooks/store"; type TCommentBlock = { diff --git a/web/ce/components/cycles/analytics-sidebar/base.tsx b/web/ce/components/cycles/analytics-sidebar/base.tsx index 40f098a2d03..9a15f63604f 100644 --- a/web/ce/components/cycles/analytics-sidebar/base.tsx +++ b/web/ce/components/cycles/analytics-sidebar/base.tsx @@ -6,10 +6,10 @@ import { useTranslation } from "@plane/i18n"; import { TCycleEstimateType } from "@plane/types"; import { Loader } from "@plane/ui"; // components +import { getDate } from "@plane/utils"; import ProgressChart from "@/components/core/sidebar/progress-chart"; import { EstimateTypeDropdown, validateCycleSnapshot } from "@/components/cycles"; // helpers -import { getDate } from "@/helpers/date-time.helper"; // hooks import { useCycle } from "@/hooks/store"; diff --git a/web/ce/components/gantt-chart/dependency/blockDraggables/left-draggable.tsx b/web/ce/components/gantt-chart/dependency/blockDraggables/left-draggable.tsx index ccb3780c569..cb1f33f79f8 100644 --- a/web/ce/components/gantt-chart/dependency/blockDraggables/left-draggable.tsx +++ b/web/ce/components/gantt-chart/dependency/blockDraggables/left-draggable.tsx @@ -1,5 +1,5 @@ import { RefObject } from "react"; -import { IGanttBlock } from "@/components/gantt-chart"; +import type { IGanttBlock } from "@plane/types"; type LeftDependencyDraggableProps = { block: IGanttBlock; diff --git a/web/ce/components/gantt-chart/dependency/blockDraggables/right-draggable.tsx b/web/ce/components/gantt-chart/dependency/blockDraggables/right-draggable.tsx index 3d5ac24e0db..29c731c9d19 100644 --- a/web/ce/components/gantt-chart/dependency/blockDraggables/right-draggable.tsx +++ b/web/ce/components/gantt-chart/dependency/blockDraggables/right-draggable.tsx @@ -1,5 +1,5 @@ import { RefObject } from "react"; -import { IGanttBlock } from "@/components/gantt-chart"; +import type { IGanttBlock } from "@plane/types"; type RightDependencyDraggableProps = { block: IGanttBlock; diff --git a/web/ce/components/global/product-updates-header.tsx b/web/ce/components/global/product-updates-header.tsx index 5274ab5c149..8a2a94c5b42 100644 --- a/web/ce/components/global/product-updates-header.tsx +++ b/web/ce/components/global/product-updates-header.tsx @@ -2,7 +2,7 @@ import { observer } from "mobx-react"; import Image from "next/image"; import { useTranslation } from "@plane/i18n"; // helpers -import { cn } from "@/helpers/common.helper"; +import { cn } from "@plane/utils"; // assets import PlaneLogo from "@/public/plane-logos/blue-without-text.png"; // package.json diff --git a/web/ce/components/issues/header.tsx b/web/ce/components/issues/header.tsx index abe44d506f0..7e7073cd9be 100644 --- a/web/ce/components/issues/header.tsx +++ b/web/ce/components/issues/header.tsx @@ -4,8 +4,8 @@ import { observer } from "mobx-react"; import { useParams } from "next/navigation"; // icons import { Circle, ExternalLink } from "lucide-react"; +import { EIssuesStoreType, EUserPermissions, EUserPermissionsLevel, SPACE_BASE_PATH, SPACE_BASE_URL } from "@plane/constants"; // plane constants -import { EIssuesStoreType, EUserPermissions, EUserPermissionsLevel } from "@plane/constants"; import { useTranslation } from "@plane/i18n"; // ui import { Breadcrumbs, Button, LayersIcon, Tooltip, Header } from "@plane/ui"; @@ -14,7 +14,6 @@ import { BreadcrumbLink, CountChip } from "@/components/common"; // constants import HeaderFilters from "@/components/issues/filters"; // helpers -import { SPACE_BASE_PATH, SPACE_BASE_URL } from "@/helpers/common.helper"; // hooks import { useEventTracker, useProject, useCommandPalette, useUserPermissions } from "@/hooks/store"; import { useIssues } from "@/hooks/store/use-issues"; diff --git a/web/ce/components/issues/issue-details/issue-identifier.tsx b/web/ce/components/issues/issue-details/issue-identifier.tsx index 1e87d387ec9..b806803f435 100644 --- a/web/ce/components/issues/issue-details/issue-identifier.tsx +++ b/web/ce/components/issues/issue-details/issue-identifier.tsx @@ -5,7 +5,7 @@ import { IIssueDisplayProperties } from "@plane/types"; // ui import { setToast, TOAST_TYPE, Tooltip } from "@plane/ui"; // helpers -import { cn } from "@/helpers/common.helper"; +import { cn } from "@plane/utils"; // hooks import { useIssueDetail, useProject } from "@/hooks/store"; diff --git a/web/ce/components/pages/editor/ai/ask-pi-menu.tsx b/web/ce/components/pages/editor/ai/ask-pi-menu.tsx index bd49942ef34..93d0c998a64 100644 --- a/web/ce/components/pages/editor/ai/ask-pi-menu.tsx +++ b/web/ce/components/pages/editor/ai/ask-pi-menu.tsx @@ -3,9 +3,9 @@ import { CircleArrowUp, CornerDownRight, RefreshCcw, Sparkles } from "lucide-rea // ui import { Tooltip } from "@plane/ui"; // components +import { cn } from "@plane/utils"; import { RichTextReadOnlyEditor } from "@/components/editor"; // helpers -import { cn } from "@/helpers/common.helper"; // hooks import { useWorkspace } from "@/hooks/store"; diff --git a/web/ce/components/pages/editor/ai/menu.tsx b/web/ce/components/pages/editor/ai/menu.tsx index 3c33d3f55d9..e9a98279f67 100644 --- a/web/ce/components/pages/editor/ai/menu.tsx +++ b/web/ce/components/pages/editor/ai/menu.tsx @@ -7,9 +7,9 @@ import { EditorRefApi } from "@plane/editor"; // plane ui import { Tooltip } from "@plane/ui"; // components +import { cn } from "@plane/utils"; import { RichTextReadOnlyEditor } from "@/components/editor"; // helpers -import { cn } from "@/helpers/common.helper"; // plane web constants import { AI_EDITOR_TASKS, LOADING_TEXTS } from "@/plane-web/constants/ai"; // plane web services diff --git a/web/ce/components/pages/editor/embed/issue-embed-upgrade-card.tsx b/web/ce/components/pages/editor/embed/issue-embed-upgrade-card.tsx index 1f698f0a748..4ade46da174 100644 --- a/web/ce/components/pages/editor/embed/issue-embed-upgrade-card.tsx +++ b/web/ce/components/pages/editor/embed/issue-embed-upgrade-card.tsx @@ -1,9 +1,9 @@ // plane ui import { getButtonStyling } from "@plane/ui"; // components +import { cn } from "@plane/utils"; import { ProIcon } from "@/components/common"; // helpers -import { cn } from "@/helpers/common.helper"; export const IssueEmbedUpgradeCard: React.FC = (props) => (
Promise; diff --git a/web/core/components/account/auth-forms/password.tsx b/web/core/components/account/auth-forms/password.tsx index 0692eb86d86..d0ae8940e0d 100644 --- a/web/core/components/account/auth-forms/password.tsx +++ b/web/core/components/account/auth-forms/password.tsx @@ -5,8 +5,8 @@ import { observer } from "mobx-react"; import Link from "next/link"; // icons import { Eye, EyeOff, Info, X, XCircle } from "lucide-react"; +import { FORGOT_PASSWORD, SIGN_IN_WITH_CODE, SIGN_IN_WITH_PASSWORD, SIGN_UP_WITH_PASSWORD, API_BASE_URL, E_PASSWORD_STRENGTH, getPasswordStrength } from "@plane/constants"; // plane imports -import { FORGOT_PASSWORD, SIGN_IN_WITH_CODE, SIGN_IN_WITH_PASSWORD, SIGN_UP_WITH_PASSWORD } from "@plane/constants"; import { useTranslation } from "@plane/i18n"; import { Button, Input, Spinner } from "@plane/ui"; // components @@ -14,8 +14,6 @@ import { ForgotPasswordPopover, PasswordStrengthMeter } from "@/components/accou // constants // helpers import { EAuthModes, EAuthSteps } from "@/helpers/authentication.helper"; -import { API_BASE_URL } from "@/helpers/common.helper"; -import { E_PASSWORD_STRENGTH, getPasswordStrength } from "@/helpers/password.helper"; // hooks import { useEventTracker } from "@/hooks/store"; // services diff --git a/web/core/components/account/auth-forms/unique-code.tsx b/web/core/components/account/auth-forms/unique-code.tsx index 9cd30b8cdd4..a6c06b70d11 100644 --- a/web/core/components/account/auth-forms/unique-code.tsx +++ b/web/core/components/account/auth-forms/unique-code.tsx @@ -2,13 +2,12 @@ import React, { useEffect, useState } from "react"; import { CircleCheck, XCircle } from "lucide-react"; -import { CODE_VERIFIED } from "@plane/constants"; +import { CODE_VERIFIED, API_BASE_URL } from "@plane/constants"; import { useTranslation } from "@plane/i18n"; import { Button, Input, Spinner } from "@plane/ui"; // constants // helpers import { EAuthModes } from "@/helpers/authentication.helper"; -import { API_BASE_URL } from "@/helpers/common.helper"; // hooks import { useEventTracker } from "@/hooks/store"; import useTimer from "@/hooks/use-timer"; diff --git a/web/core/components/account/oauth/github-button.tsx b/web/core/components/account/oauth/github-button.tsx index 02b5f55bd00..c5b6fe8f5bf 100644 --- a/web/core/components/account/oauth/github-button.tsx +++ b/web/core/components/account/oauth/github-button.tsx @@ -3,7 +3,7 @@ import { useSearchParams } from "next/navigation"; import Image from "next/image"; import { useTheme } from "next-themes"; // helpers -import { API_BASE_URL } from "@/helpers/common.helper"; +import { API_BASE_URL } from "@plane/constants"; // images import githubLightModeImage from "/public/logos/github-black.png"; import githubDarkModeImage from "/public/logos/github-dark.svg"; diff --git a/web/core/components/account/oauth/gitlab-button.tsx b/web/core/components/account/oauth/gitlab-button.tsx index 33221a297e9..ac861af8be8 100644 --- a/web/core/components/account/oauth/gitlab-button.tsx +++ b/web/core/components/account/oauth/gitlab-button.tsx @@ -3,7 +3,7 @@ import Image from "next/image"; import { useSearchParams } from "next/navigation"; import { useTheme } from "next-themes"; // helpers -import { API_BASE_URL } from "@/helpers/common.helper"; +import { API_BASE_URL } from "@plane/constants"; // images import GitlabLogo from "/public/logos/gitlab-logo.svg"; diff --git a/web/core/components/account/oauth/google-button.tsx b/web/core/components/account/oauth/google-button.tsx index c125589ac79..6d4665c031e 100644 --- a/web/core/components/account/oauth/google-button.tsx +++ b/web/core/components/account/oauth/google-button.tsx @@ -3,7 +3,7 @@ import { useSearchParams } from "next/navigation"; import Image from "next/image"; import { useTheme } from "next-themes"; // helpers -import { API_BASE_URL } from "@/helpers/common.helper"; +import { API_BASE_URL } from "@plane/constants"; // images import GoogleLogo from "/public/logos/google-logo.svg"; diff --git a/web/core/components/account/password-strength-meter.tsx b/web/core/components/account/password-strength-meter.tsx index 1f0abae9c91..3dc6309425a 100644 --- a/web/core/components/account/password-strength-meter.tsx +++ b/web/core/components/account/password-strength-meter.tsx @@ -4,7 +4,7 @@ import { FC, useMemo } from "react"; import { useTranslation } from "@plane/i18n"; // import { CircleCheck } from "lucide-react"; // helpers -import { cn } from "@/helpers/common.helper"; +import { cn } from "@plane/utils"; import { E_PASSWORD_STRENGTH, // PASSWORD_CRITERIA, diff --git a/web/core/components/analytics-v2/select/select-y-axis.tsx b/web/core/components/analytics-v2/select/select-y-axis.tsx index c80e2a1e47e..931b1976d72 100644 --- a/web/core/components/analytics-v2/select/select-y-axis.tsx +++ b/web/core/components/analytics-v2/select/select-y-axis.tsx @@ -3,14 +3,12 @@ import { observer } from "mobx-react"; import { useParams } from "next/navigation"; import { Briefcase } from "lucide-react"; +import { ChartYAxisMetric, EEstimateSystem } from "@plane/constants"; // plane package imports -import { ChartYAxisMetric } from "@plane/constants"; import { CustomSelect } from "@plane/ui"; // hooks import { useProjectEstimates } from "@/hooks/store"; // plane web constants -import { EEstimateSystem } from "@/plane-web/constants/estimates"; - type Props = { value: ChartYAxisMetric; onChange: (val: ChartYAxisMetric | null) => void; diff --git a/web/core/components/analytics-v2/total-insights.tsx b/web/core/components/analytics-v2/total-insights.tsx index 5fc8b2239eb..020c31767a6 100644 --- a/web/core/components/analytics-v2/total-insights.tsx +++ b/web/core/components/analytics-v2/total-insights.tsx @@ -6,7 +6,7 @@ import { insightsFields } from "@plane/constants"; import { useTranslation } from "@plane/i18n"; import { IAnalyticsResponseV2, TAnalyticsTabsV2Base } from "@plane/types"; //hooks -import { cn } from "@/helpers/common.helper"; +import { cn } from "@plane/utils"; import { useAnalyticsV2 } from "@/hooks/store/use-analytics-v2"; //services import { AnalyticsV2Service } from "@/services/analytics-v2.service"; diff --git a/web/core/components/analytics/custom-analytics/custom-analytics.tsx b/web/core/components/analytics/custom-analytics/custom-analytics.tsx index bb801616fcb..6c2c3b0bc47 100644 --- a/web/core/components/analytics/custom-analytics/custom-analytics.tsx +++ b/web/core/components/analytics/custom-analytics/custom-analytics.tsx @@ -6,11 +6,11 @@ import useSWR from "swr"; import { IAnalyticsParams } from "@plane/types"; // services // components +import { cn } from "@plane/utils"; import { CustomAnalyticsSelectBar, CustomAnalyticsMainContent, CustomAnalyticsSidebar } from "@/components/analytics"; // types // fetch-keys import { ANALYTICS } from "@/constants/fetch-keys"; -import { cn } from "@/helpers/common.helper"; import { useAppTheme } from "@/hooks/store"; import { hideFloatingBot, showFloatingBot } from "@/plane-web/helpers/pi-chat.helper"; import { AnalyticsService } from "@/services/analytics.service"; diff --git a/web/core/components/analytics/custom-analytics/graph/index.tsx b/web/core/components/analytics/custom-analytics/graph/index.tsx index 87627bba373..c6d35456002 100644 --- a/web/core/components/analytics/custom-analytics/graph/index.tsx +++ b/web/core/components/analytics/custom-analytics/graph/index.tsx @@ -5,12 +5,11 @@ import { BarDatum } from "@nivo/bar"; // components import { IAnalyticsParams, IAnalyticsResponse } from "@plane/types"; import { Tooltip } from "@plane/ui"; +import { findStringWithMostCharacters, getFileURL } from "@plane/utils"; // ui import { BarGraph } from "@/components/ui"; // helpers import { generateBarColor, generateDisplayName, renderChartDynamicLabel } from "@/helpers/analytics.helper"; -import { findStringWithMostCharacters } from "@/helpers/array.helper"; -import { getFileURL } from "@/helpers/file.helper"; // types import { CustomTooltip } from "./custom-tooltip"; diff --git a/web/core/components/analytics/custom-analytics/select/y-axis.tsx b/web/core/components/analytics/custom-analytics/select/y-axis.tsx index 42c9145e899..434969b9e15 100644 --- a/web/core/components/analytics/custom-analytics/select/y-axis.tsx +++ b/web/core/components/analytics/custom-analytics/select/y-axis.tsx @@ -2,15 +2,13 @@ import { observer } from "mobx-react"; import { useParams } from "next/navigation"; +import { ANALYTICS_Y_AXIS_VALUES, EEstimateSystem } from "@plane/constants"; // plane imports -import { ANALYTICS_Y_AXIS_VALUES } from "@plane/constants"; import { TYAxisValues } from "@plane/types"; import { CustomSelect } from "@plane/ui"; // hooks import { useProjectEstimates } from "@/hooks/store"; // plane web constants -import { EEstimateSystem } from "@/plane-web/constants/estimates"; - type Props = { value: TYAxisValues; onChange: () => void; diff --git a/web/core/components/analytics/custom-analytics/sidebar/projects-list.tsx b/web/core/components/analytics/custom-analytics/sidebar/projects-list.tsx index c07867378ad..5274bd96f0d 100644 --- a/web/core/components/analytics/custom-analytics/sidebar/projects-list.tsx +++ b/web/core/components/analytics/custom-analytics/sidebar/projects-list.tsx @@ -5,9 +5,9 @@ import { Contrast, LayoutGrid, Users, Loader as Spinner } from "lucide-react"; import { useTranslation } from "@plane/i18n"; import { Loader } from "@plane/ui"; // components +import { truncateText } from "@plane/utils"; import { Logo } from "@/components/common"; // helpers -import { truncateText } from "@/helpers/string.helper"; // hooks import { useProject } from "@/hooks/store"; diff --git a/web/core/components/analytics/custom-analytics/sidebar/sidebar-header.tsx b/web/core/components/analytics/custom-analytics/sidebar/sidebar-header.tsx index 707a149221b..77f73bd0a22 100644 --- a/web/core/components/analytics/custom-analytics/sidebar/sidebar-header.tsx +++ b/web/core/components/analytics/custom-analytics/sidebar/sidebar-header.tsx @@ -3,10 +3,10 @@ import { useParams } from "next/navigation"; // components import { NETWORK_CHOICES } from "@plane/constants"; import { useTranslation } from "@plane/i18n"; +import { renderFormattedDate } from "@plane/utils"; import { Logo } from "@/components/common"; // constants // helpers -import { renderFormattedDate } from "@/helpers/date-time.helper"; // hooks import { useCycle, useMember, useModule, useProject } from "@/hooks/store"; diff --git a/web/core/components/analytics/custom-analytics/sidebar/sidebar.tsx b/web/core/components/analytics/custom-analytics/sidebar/sidebar.tsx index 5df139205a8..fa98f07651b 100644 --- a/web/core/components/analytics/custom-analytics/sidebar/sidebar.tsx +++ b/web/core/components/analytics/custom-analytics/sidebar/sidebar.tsx @@ -11,13 +11,12 @@ import { useTranslation } from "@plane/i18n"; import { IAnalyticsParams, IAnalyticsResponse, IExportAnalyticsFormData, IWorkspace } from "@plane/types"; // ui import { Button, LayersIcon, TOAST_TYPE, setToast } from "@plane/ui"; +import { cn, renderFormattedDate } from "@plane/utils"; // components import { CustomAnalyticsSidebarHeader, CustomAnalyticsSidebarProjectsList } from "@/components/analytics"; // constants import { ANALYTICS } from "@/constants/fetch-keys"; // helpers -import { cn } from "@/helpers/common.helper"; -import { renderFormattedDate } from "@/helpers/date-time.helper"; // hooks import { useCycle, useModule, useProject, useWorkspace, useUser } from "@/hooks/store"; // services diff --git a/web/core/components/analytics/custom-analytics/table.tsx b/web/core/components/analytics/custom-analytics/table.tsx index fd580d7277d..abcf92be3cd 100644 --- a/web/core/components/analytics/custom-analytics/table.tsx +++ b/web/core/components/analytics/custom-analytics/table.tsx @@ -6,8 +6,8 @@ import { ANALYTICS_X_AXIS_VALUES, ANALYTICS_Y_AXIS_VALUES } from "@plane/constan import { IAnalyticsParams, IAnalyticsResponse, TIssuePriorities } from "@plane/types"; import { PriorityIcon, Tooltip } from "@plane/ui"; // helpers +import { cn } from "@plane/utils"; import { generateBarColor, generateDisplayName, renderChartDynamicLabel } from "@/helpers/analytics.helper"; -import { cn } from "@/helpers/common.helper"; type Props = { analytics: IAnalyticsResponse; diff --git a/web/core/components/analytics/scope-and-demand/leaderboard.tsx b/web/core/components/analytics/scope-and-demand/leaderboard.tsx index 76f96be4a27..a2b59827164 100644 --- a/web/core/components/analytics/scope-and-demand/leaderboard.tsx +++ b/web/core/components/analytics/scope-and-demand/leaderboard.tsx @@ -2,9 +2,9 @@ import { useTranslation } from "@plane/i18n"; import { Card } from "@plane/ui"; // components +import { getFileURL } from "@plane/utils"; import { ProfileEmptyState } from "@/components/ui"; // helpers -import { getFileURL } from "@/helpers/file.helper"; // image import emptyUsers from "@/public/empty-state/empty_users.svg"; diff --git a/web/core/components/analytics/scope-and-demand/scope.tsx b/web/core/components/analytics/scope-and-demand/scope.tsx index 13cd60d5661..8f6ba9c1bf1 100644 --- a/web/core/components/analytics/scope-and-demand/scope.tsx +++ b/web/core/components/analytics/scope-and-demand/scope.tsx @@ -4,9 +4,9 @@ import { IDefaultAnalyticsUser } from "@plane/types"; // plane ui import { Card } from "@plane/ui"; // components +import { getFileURL } from "@plane/utils"; import { BarGraph, ProfileEmptyState } from "@/components/ui"; // helpers -import { getFileURL } from "@/helpers/file.helper"; // image import emptyBarGraph from "@/public/empty-state/empty_bar_graph.svg"; diff --git a/web/core/components/api-token/modal/create-token-modal.tsx b/web/core/components/api-token/modal/create-token-modal.tsx index eb6d8220f54..a848520b17a 100644 --- a/web/core/components/api-token/modal/create-token-modal.tsx +++ b/web/core/components/api-token/modal/create-token-modal.tsx @@ -7,13 +7,12 @@ import { mutate } from "swr"; import { IApiToken } from "@plane/types"; // ui import { EModalPosition, EModalWidth, ModalCore, TOAST_TYPE, setToast } from "@plane/ui"; +import { renderFormattedDate, csvDownload } from "@plane/utils"; // components import { CreateApiTokenForm, GeneratedTokenDetails } from "@/components/api-token"; // fetch-keys import { API_TOKENS_LIST } from "@/constants/fetch-keys"; // helpers -import { renderFormattedDate } from "@/helpers/date-time.helper"; -import { csvDownload } from "@/helpers/download.helper"; // services import { APITokenService } from "@/services/api_token.service"; diff --git a/web/core/components/api-token/modal/form.tsx b/web/core/components/api-token/modal/form.tsx index 8bee88d9f4d..eafd3e82102 100644 --- a/web/core/components/api-token/modal/form.tsx +++ b/web/core/components/api-token/modal/form.tsx @@ -9,12 +9,10 @@ import { useTranslation } from "@plane/i18n"; import { IApiToken } from "@plane/types"; // ui import { Button, CustomSelect, Input, TextArea, ToggleSwitch, TOAST_TYPE, setToast } from "@plane/ui"; +import { cn, renderFormattedDate, renderFormattedTime } from "@plane/utils"; // components import { DateDropdown } from "@/components/dropdowns"; // helpers -import { cn } from "@/helpers/common.helper"; -import { renderFormattedDate, renderFormattedTime } from "@/helpers/date-time.helper"; - type Props = { handleClose: () => void; neverExpires: boolean; diff --git a/web/core/components/api-token/modal/generated-token-details.tsx b/web/core/components/api-token/modal/generated-token-details.tsx index e6e3d35fea5..e80ba33bf76 100644 --- a/web/core/components/api-token/modal/generated-token-details.tsx +++ b/web/core/components/api-token/modal/generated-token-details.tsx @@ -5,9 +5,8 @@ import { useTranslation } from "@plane/i18n"; import { IApiToken } from "@plane/types"; // ui import { Button, Tooltip, TOAST_TYPE, setToast } from "@plane/ui"; +import { renderFormattedDate, renderFormattedTime, copyTextToClipboard } from "@plane/utils"; // helpers -import { renderFormattedDate, renderFormattedTime } from "@/helpers/date-time.helper"; -import { copyTextToClipboard } from "@/helpers/string.helper"; // types import { usePlatformOS } from "@/hooks/use-platform-os"; // hooks diff --git a/web/core/components/api-token/token-list-item.tsx b/web/core/components/api-token/token-list-item.tsx index 6d07a79bd43..37b3549608f 100644 --- a/web/core/components/api-token/token-list-item.tsx +++ b/web/core/components/api-token/token-list-item.tsx @@ -5,8 +5,8 @@ import { XCircle } from "lucide-react"; import { IApiToken } from "@plane/types"; // components import { Tooltip } from "@plane/ui"; +import { renderFormattedDate, calculateTimeAgo, renderFormattedTime } from "@plane/utils"; import { DeleteApiTokenModal } from "@/components/api-token"; -import { renderFormattedDate, calculateTimeAgo, renderFormattedTime } from "@/helpers/date-time.helper"; import { usePlatformOS } from "@/hooks/use-platform-os"; // ui // helpers diff --git a/web/core/components/automation/auto-archive-automation.tsx b/web/core/components/automation/auto-archive-automation.tsx index 6190c9326e8..c1a8c0b7501 100644 --- a/web/core/components/automation/auto-archive-automation.tsx +++ b/web/core/components/automation/auto-archive-automation.tsx @@ -5,7 +5,7 @@ import { observer } from "mobx-react"; import { useParams } from "next/navigation"; import { ArchiveRestore } from "lucide-react"; // types -import { PROJECT_AUTOMATION_MONTHS,EUserPermissions, EUserPermissionsLevel } from "@plane/constants"; +import { PROJECT_AUTOMATION_MONTHS, EUserPermissions, EUserPermissionsLevel } from "@plane/constants"; import { useTranslation } from "@plane/i18n"; import { IProject } from "@plane/types"; // ui diff --git a/web/core/components/chart/utils.ts b/web/core/components/chart/utils.ts index 9e1d779bf8a..092cc2c21c2 100644 --- a/web/core/components/chart/utils.ts +++ b/web/core/components/chart/utils.ts @@ -1,8 +1,8 @@ import { getWeekOfMonth, isValid } from "date-fns"; import { CHART_X_AXIS_DATE_PROPERTIES, ChartXAxisDateGrouping, ChartXAxisProperty, TO_CAPITALIZE_PROPERTIES } from "@plane/constants"; import { TChart, TChartDatum } from "@plane/types"; -import { capitalizeFirstLetter, hexToHsl, hslToHex, renderFormattedDate } from "@plane/utils"; -import { renderFormattedDateWithoutYear } from "@/helpers/date-time.helper"; +import { capitalizeFirstLetter, hexToHsl, hslToHex, renderFormattedDate, renderFormattedDateWithoutYear } from "@plane/utils"; +// const getDateGroupingName = (date: string, dateGrouping: ChartXAxisDateGrouping): string => { if (!date || ["none", "null"].includes(date.toLowerCase())) return "None"; diff --git a/web/core/components/command-palette/actions/issue-actions/actions-list.tsx b/web/core/components/command-palette/actions/issue-actions/actions-list.tsx index 93813879349..812ffd9845e 100644 --- a/web/core/components/command-palette/actions/issue-actions/actions-list.tsx +++ b/web/core/components/command-palette/actions/issue-actions/actions-list.tsx @@ -9,7 +9,7 @@ import { TIssue } from "@plane/types"; // hooks import { DoubleCircleIcon, TOAST_TYPE, setToast } from "@plane/ui"; // helpers -import { copyTextToClipboard } from "@/helpers/string.helper"; +import { copyTextToClipboard } from "@plane/utils"; // hooks import { useCommandPalette, useIssueDetail, useUser } from "@/hooks/store"; diff --git a/web/core/components/command-palette/actions/issue-actions/change-assignee.tsx b/web/core/components/command-palette/actions/issue-actions/change-assignee.tsx index 66b71794d32..f4a3b09512d 100644 --- a/web/core/components/command-palette/actions/issue-actions/change-assignee.tsx +++ b/web/core/components/command-palette/actions/issue-actions/change-assignee.tsx @@ -10,7 +10,7 @@ import { TIssue } from "@plane/types"; // plane ui import { Avatar } from "@plane/ui"; // helpers -import { getFileURL } from "@/helpers/file.helper"; +import { getFileURL } from "@plane/utils"; // hooks import { useIssueDetail, useMember } from "@/hooks/store"; diff --git a/web/core/components/command-palette/command-modal.tsx b/web/core/components/command-palette/command-modal.tsx index 5cc0805041d..ce8d8528d3c 100644 --- a/web/core/components/command-palette/command-modal.tsx +++ b/web/core/components/command-palette/command-modal.tsx @@ -12,7 +12,7 @@ import { EUserPermissions, EUserPermissionsLevel, WORKSPACE_DEFAULT_SEARCH_RESUL import { useTranslation } from "@plane/i18n"; import { IWorkspaceSearchResults } from "@plane/types"; import { LayersIcon, Loader, ToggleSwitch } from "@plane/ui"; -import { cn } from "@plane/utils"; +import { cn, getTabIndex } from "@plane/utils"; // components import { ChangeIssueAssignee, @@ -27,7 +27,6 @@ import { } from "@/components/command-palette"; import { SimpleEmptyState } from "@/components/empty-state"; // helpers -import { getTabIndex } from "@/helpers/tab-indices.helper"; // hooks import { useCommandPalette, diff --git a/web/core/components/command-palette/command-palette.tsx b/web/core/components/command-palette/command-palette.tsx index 9399c52f5a4..e7557c2fd1f 100644 --- a/web/core/components/command-palette/command-palette.tsx +++ b/web/core/components/command-palette/command-palette.tsx @@ -8,9 +8,9 @@ import useSWR from "swr"; import { EUserPermissions, EUserPermissionsLevel } from "@plane/constants"; import { TOAST_TYPE, setToast } from "@plane/ui"; // components +import { copyTextToClipboard } from "@plane/utils"; import { CommandModal, ShortcutsModal } from "@/components/command-palette"; // helpers -import { copyTextToClipboard } from "@/helpers/string.helper"; // hooks import { useEventTracker, diff --git a/web/core/components/command-palette/shortcuts-modal/commands-list.tsx b/web/core/components/command-palette/shortcuts-modal/commands-list.tsx index 570cb02fa78..c01eff48f65 100644 --- a/web/core/components/command-palette/shortcuts-modal/commands-list.tsx +++ b/web/core/components/command-palette/shortcuts-modal/commands-list.tsx @@ -1,6 +1,6 @@ import { Command } from "lucide-react"; // helpers -import { substringMatch } from "@/helpers/string.helper"; +import { substringMatch } from "@plane/utils"; // hooks import { usePlatformOS } from "@/hooks/use-platform-os"; // plane web helpers diff --git a/web/core/components/comments/comment-card.tsx b/web/core/components/comments/comment-card.tsx index 1831af4a080..66dd75427ff 100644 --- a/web/core/components/comments/comment-card.tsx +++ b/web/core/components/comments/comment-card.tsx @@ -11,9 +11,9 @@ import { useTranslation } from "@plane/i18n"; import { TIssueComment, TCommentsOperations } from "@plane/types"; import { CustomMenu } from "@plane/ui"; // components +import { isCommentEmpty } from "@plane/utils"; import { LiteTextEditor, LiteTextReadOnlyEditor } from "@/components/editor"; // helpers -import { isCommentEmpty } from "@/helpers/string.helper"; // hooks import { useUser } from "@/hooks/store"; // diff --git a/web/core/components/comments/comment-create.tsx b/web/core/components/comments/comment-create.tsx index aae88c6c167..450814f519d 100644 --- a/web/core/components/comments/comment-create.tsx +++ b/web/core/components/comments/comment-create.tsx @@ -7,12 +7,11 @@ import { EIssueCommentAccessSpecifier } from "@plane/constants"; import { EditorRefApi } from "@plane/editor"; // plane types import { TIssueComment, TCommentsOperations } from "@plane/types"; +import { cn, isCommentEmpty } from "@plane/utils"; // components import { LiteTextEditor } from "@/components/editor"; // constants -import { cn } from "@/helpers/common.helper"; // helpers -import { isCommentEmpty } from "@/helpers/string.helper"; // hooks import { useWorkspace } from "@/hooks/store"; // services diff --git a/web/core/components/comments/comment-reaction.tsx b/web/core/components/comments/comment-reaction.tsx index b101c9402dd..39589414049 100644 --- a/web/core/components/comments/comment-reaction.tsx +++ b/web/core/components/comments/comment-reaction.tsx @@ -6,9 +6,9 @@ import { observer } from "mobx-react"; import { TCommentsOperations, TIssueComment } from "@plane/types"; import { Tooltip } from "@plane/ui"; // components +import { cn } from "@plane/utils"; import { ReactionSelector } from "@/components/issues"; // helpers -import { cn } from "@/helpers/common.helper"; import { renderEmoji } from "@/helpers/emoji.helper"; export type TProps = { diff --git a/web/core/components/common/activity/activity-block.tsx b/web/core/components/common/activity/activity-block.tsx index 61c1a0b7b49..b5bcf96164e 100644 --- a/web/core/components/common/activity/activity-block.tsx +++ b/web/core/components/common/activity/activity-block.tsx @@ -7,7 +7,7 @@ import { TWorkspaceBaseActivity } from "@plane/types"; // ui import { Tooltip } from "@plane/ui"; // helpers -import { renderFormattedTime, renderFormattedDate, calculateTimeAgo } from "@/helpers/date-time.helper"; +import { renderFormattedTime, renderFormattedDate, calculateTimeAgo } from "@plane/utils"; // hooks import { usePlatformOS } from "@/hooks/use-platform-os"; // local components diff --git a/web/core/components/common/applied-filters/date.tsx b/web/core/components/common/applied-filters/date.tsx index 9dcde53a439..3ecf8a540fe 100644 --- a/web/core/components/common/applied-filters/date.tsx +++ b/web/core/components/common/applied-filters/date.tsx @@ -3,10 +3,8 @@ import { observer } from "mobx-react"; import { X } from "lucide-react"; // plane constants import { DATE_BEFORE_FILTER_OPTIONS } from "@plane/constants"; +import { renderFormattedDate, capitalizeFirstLetter } from "@plane/utils"; // helpers -import { renderFormattedDate } from "@/helpers/date-time.helper"; -import { capitalizeFirstLetter } from "@/helpers/string.helper"; - type Props = { editable: boolean | undefined; handleRemove: (val: string) => void; diff --git a/web/core/components/common/applied-filters/members.tsx b/web/core/components/common/applied-filters/members.tsx index 87d3393666d..508a47f982b 100644 --- a/web/core/components/common/applied-filters/members.tsx +++ b/web/core/components/common/applied-filters/members.tsx @@ -5,7 +5,7 @@ import { X } from "lucide-react"; // plane ui import { Avatar } from "@plane/ui"; // helpers -import { getFileURL } from "@/helpers/file.helper"; +import { getFileURL } from "@plane/utils"; // types import { useMember } from "@/hooks/store"; diff --git a/web/core/components/common/count-chip.tsx b/web/core/components/common/count-chip.tsx index 0b5820d75a3..f44f349bff9 100644 --- a/web/core/components/common/count-chip.tsx +++ b/web/core/components/common/count-chip.tsx @@ -2,7 +2,7 @@ import { FC } from "react"; // -import { cn } from "@/helpers/common.helper"; +import { cn } from "@plane/utils"; type TCountChip = { count: string | number; diff --git a/web/core/components/common/filters/created-at.tsx b/web/core/components/common/filters/created-at.tsx index b1c23f70a8b..3626531bde5 100644 --- a/web/core/components/common/filters/created-at.tsx +++ b/web/core/components/common/filters/created-at.tsx @@ -2,10 +2,10 @@ import React, { useState } from "react"; import { observer } from "mobx-react"; // plane constants import { DATE_BEFORE_FILTER_OPTIONS } from "@plane/constants"; +import { isInDateFormat } from "@plane/utils"; import { DateFilterModal } from "@/components/core"; import { FilterHeader, FilterOption } from "@/components/issues"; // helpers -import { isInDateFormat } from "@/helpers/date-time.helper"; type Props = { appliedFilters: string[] | null; diff --git a/web/core/components/common/filters/created-by.tsx b/web/core/components/common/filters/created-by.tsx index 6bc75047bd0..513830e6717 100644 --- a/web/core/components/common/filters/created-by.tsx +++ b/web/core/components/common/filters/created-by.tsx @@ -6,9 +6,9 @@ import { observer } from "mobx-react"; // ui import { Avatar, Loader } from "@plane/ui"; // components +import { getFileURL } from "@plane/utils"; import { FilterHeader, FilterOption } from "@/components/issues"; // helpers -import { getFileURL } from "@/helpers/file.helper"; // hooks import { useMember, useUser } from "@/hooks/store"; diff --git a/web/core/components/common/logo.tsx b/web/core/components/common/logo.tsx index 49d4d60a128..4f1a992819a 100644 --- a/web/core/components/common/logo.tsx +++ b/web/core/components/common/logo.tsx @@ -11,7 +11,7 @@ import { TLogoProps } from "@plane/types"; // ui import { LUCIDE_ICONS_LIST } from "@plane/ui"; // helpers -import { emojiCodeToUnicode } from "@/helpers/emoji.helper"; +import { emojiCodeToUnicode } from "@plane/utils"; type Props = { logo: TLogoProps; diff --git a/web/core/components/common/pro-icon.tsx b/web/core/components/common/pro-icon.tsx index 39d4c2a9012..47300b6d6cb 100644 --- a/web/core/components/common/pro-icon.tsx +++ b/web/core/components/common/pro-icon.tsx @@ -3,7 +3,7 @@ import { FC } from "react"; import { Crown } from "lucide-react"; // helpers -import { cn } from "@/helpers/common.helper"; +import { cn } from "@plane/utils"; type TProIcon = { className?: string; diff --git a/web/core/components/common/switcher-label.tsx b/web/core/components/common/switcher-label.tsx index e1426461c98..6bb4c346f1c 100644 --- a/web/core/components/common/switcher-label.tsx +++ b/web/core/components/common/switcher-label.tsx @@ -1,8 +1,7 @@ import { FC } from "react"; import { TLogoProps } from "@plane/types"; import { ISvgIcons, Logo } from "@plane/ui"; -import { getFileURL } from "@plane/utils"; -import { truncateText } from "@/helpers/string.helper"; +import { getFileURL, truncateText } from "@plane/utils"; type TSwitcherLabelProps = { logo_props?: TLogoProps; logo_url?: string; diff --git a/web/core/components/core/activity.tsx b/web/core/components/core/activity.tsx index 0a124572545..37f041d6ebe 100644 --- a/web/core/components/core/activity.tsx +++ b/web/core/components/core/activity.tsx @@ -22,10 +22,8 @@ import { } from "lucide-react"; import { IIssueActivity } from "@plane/types"; import { Tooltip, BlockedIcon, BlockerIcon, RelatedIcon, LayersIcon, DiceIcon, Intake, EpicIcon } from "@plane/ui"; +import { renderFormattedDate, generateWorkItemLink, capitalizeFirstLetter } from "@plane/utils"; // helpers -import { renderFormattedDate } from "@/helpers/date-time.helper"; -import { generateWorkItemLink } from "@/helpers/issue.helper"; -import { capitalizeFirstLetter } from "@/helpers/string.helper"; import { useLabel } from "@/hooks/store"; import { usePlatformOS } from "@/hooks/use-platform-os"; // types diff --git a/web/core/components/core/content-wrapper.tsx b/web/core/components/core/content-wrapper.tsx index eefc96b1e0d..143ae085e97 100644 --- a/web/core/components/core/content-wrapper.tsx +++ b/web/core/components/core/content-wrapper.tsx @@ -2,7 +2,7 @@ import { ReactNode } from "react"; // helpers -import { cn } from "@/helpers/common.helper"; +import { cn } from "@plane/utils"; export interface ContentWrapperProps { className?: string; diff --git a/web/core/components/core/filters/date-filter-modal.tsx b/web/core/components/core/filters/date-filter-modal.tsx index a1c76da4b4c..2da5b2f35f3 100644 --- a/web/core/components/core/filters/date-filter-modal.tsx +++ b/web/core/components/core/filters/date-filter-modal.tsx @@ -7,7 +7,7 @@ import { Dialog, Transition } from "@headlessui/react"; import { Button, Calendar } from "@plane/ui"; -import { renderFormattedPayloadDate, renderFormattedDate, getDate } from "@/helpers/date-time.helper"; +import { renderFormattedPayloadDate, renderFormattedDate, getDate } from "@plane/utils"; import { DateFilterSelect } from "./date-filter-select"; type Props = { title: string; diff --git a/web/core/components/core/image-picker-popover.tsx b/web/core/components/core/image-picker-popover.tsx index bade076d9bb..0634a231269 100644 --- a/web/core/components/core/image-picker-popover.tsx +++ b/web/core/components/core/image-picker-popover.tsx @@ -16,7 +16,7 @@ import { EFileAssetType } from "@plane/types/src/enums"; // ui import { Button, Input, Loader, TOAST_TYPE, setToast } from "@plane/ui"; // helpers -import { getFileURL } from "@/helpers/file.helper"; +import { getFileURL } from "@plane/utils"; // hooks import { useDropdownKeyDown } from "@/hooks/use-dropdown-key-down"; // services diff --git a/web/core/components/core/list/list-item.tsx b/web/core/components/core/list/list-item.tsx index 9a29f61c0e9..7fe1cad4f24 100644 --- a/web/core/components/core/list/list-item.tsx +++ b/web/core/components/core/list/list-item.tsx @@ -3,7 +3,7 @@ import React, { FC } from "react"; // ui import { ControlLink, Row, Tooltip } from "@plane/ui"; // helpers -import { cn } from "@/helpers/common.helper"; +import { cn } from "@plane/utils"; // hooks import { useAppRouter } from "@/hooks/use-app-router"; diff --git a/web/core/components/core/modals/existing-issues-list-modal.tsx b/web/core/components/core/modals/existing-issues-list-modal.tsx index f0af7ef47c9..55c870eb306 100644 --- a/web/core/components/core/modals/existing-issues-list-modal.tsx +++ b/web/core/components/core/modals/existing-issues-list-modal.tsx @@ -9,9 +9,8 @@ import { useTranslation } from "@plane/i18n"; import { ISearchIssueResponse, TProjectIssuesSearchParams } from "@plane/types"; // ui import { Button, Loader, ToggleSwitch, Tooltip, TOAST_TYPE, setToast } from "@plane/ui"; +import { generateWorkItemLink, getTabIndex } from "@plane/utils"; // helpers -import { generateWorkItemLink } from "@/helpers/issue.helper"; -import { getTabIndex } from "@/helpers/tab-indices.helper"; // hooks import useDebounce from "@/hooks/use-debounce"; import { usePlatformOS } from "@/hooks/use-platform-os"; diff --git a/web/core/components/core/modals/user-image-upload-modal.tsx b/web/core/components/core/modals/user-image-upload-modal.tsx index c768ff2652c..a7693b8da61 100644 --- a/web/core/components/core/modals/user-image-upload-modal.tsx +++ b/web/core/components/core/modals/user-image-upload-modal.tsx @@ -9,9 +9,8 @@ import { Transition, Dialog } from "@headlessui/react"; import { ACCEPTED_AVATAR_IMAGE_MIME_TYPES_FOR_REACT_DROPZONE, MAX_FILE_SIZE } from "@plane/constants"; import { EFileAssetType } from "@plane/types/src/enums"; import { Button, TOAST_TYPE, setToast } from "@plane/ui"; +import { getAssetIdFromUrl, getFileURL, checkURLValidity } from "@plane/utils"; // helpers -import { getAssetIdFromUrl, getFileURL } from "@/helpers/file.helper"; -import { checkURLValidity } from "@/helpers/string.helper"; // services import { FileService } from "@/services/file.service"; const fileService = new FileService(); diff --git a/web/core/components/core/modals/workspace-image-upload-modal.tsx b/web/core/components/core/modals/workspace-image-upload-modal.tsx index 163e7ff297f..0bebeb65317 100644 --- a/web/core/components/core/modals/workspace-image-upload-modal.tsx +++ b/web/core/components/core/modals/workspace-image-upload-modal.tsx @@ -9,9 +9,8 @@ import { Transition, Dialog } from "@headlessui/react"; import { ACCEPTED_AVATAR_IMAGE_MIME_TYPES_FOR_REACT_DROPZONE, MAX_FILE_SIZE } from "@plane/constants"; import { EFileAssetType } from "@plane/types/src/enums"; import { Button, TOAST_TYPE, setToast } from "@plane/ui"; +import { getAssetIdFromUrl, getFileURL, checkURLValidity } from "@plane/utils"; // helpers -import { getAssetIdFromUrl, getFileURL } from "@/helpers/file.helper"; -import { checkURLValidity } from "@/helpers/string.helper"; // hooks import { useWorkspace } from "@/hooks/store"; // services diff --git a/web/core/components/core/multiple-select/entity-select-action.tsx b/web/core/components/core/multiple-select/entity-select-action.tsx index cbec2a34e24..13795db938e 100644 --- a/web/core/components/core/multiple-select/entity-select-action.tsx +++ b/web/core/components/core/multiple-select/entity-select-action.tsx @@ -4,7 +4,7 @@ import { observer } from "mobx-react"; // ui import { Checkbox } from "@plane/ui"; // helpers -import { cn } from "@/helpers/common.helper"; +import { cn } from "@plane/utils"; // hooks import { TSelectionHelper } from "@/hooks/use-multiple-select"; diff --git a/web/core/components/core/multiple-select/group-select-action.tsx b/web/core/components/core/multiple-select/group-select-action.tsx index 296e5bf3d3e..3040f2d1ece 100644 --- a/web/core/components/core/multiple-select/group-select-action.tsx +++ b/web/core/components/core/multiple-select/group-select-action.tsx @@ -2,7 +2,7 @@ // ui import { Checkbox } from "@plane/ui"; // helpers -import { cn } from "@/helpers/common.helper"; +import { cn } from "@plane/utils"; // hooks import { TSelectionHelper } from "@/hooks/use-multiple-select"; diff --git a/web/core/components/core/render-if-visible-HOC.tsx b/web/core/components/core/render-if-visible-HOC.tsx index ea3fc9c2f84..f00cf78ee0f 100644 --- a/web/core/components/core/render-if-visible-HOC.tsx +++ b/web/core/components/core/render-if-visible-HOC.tsx @@ -1,5 +1,5 @@ import React, { useState, useRef, useEffect, ReactNode, MutableRefObject } from "react"; -import { cn } from "@/helpers/common.helper"; +import { cn } from "@plane/utils"; type Props = { defaultHeight?: string; diff --git a/web/core/components/core/sidebar/progress-chart.tsx b/web/core/components/core/sidebar/progress-chart.tsx index bb4eeb49351..a8ac96ec70a 100644 --- a/web/core/components/core/sidebar/progress-chart.tsx +++ b/web/core/components/core/sidebar/progress-chart.tsx @@ -2,9 +2,9 @@ import React from "react"; import { eachDayOfInterval, isValid } from "date-fns"; import { TModuleCompletionChartDistribution } from "@plane/types"; // ui +import { getDate, renderFormattedDateWithoutYear } from "@plane/utils"; import { LineGraph } from "@/components/ui"; // helpers -import { getDate, renderFormattedDateWithoutYear } from "@/helpers/date-time.helper"; //types type Props = { diff --git a/web/core/components/cycles/active-cycle/cycle-stats.tsx b/web/core/components/cycles/active-cycle/cycle-stats.tsx index f932415c381..77e36f33464 100644 --- a/web/core/components/cycles/active-cycle/cycle-stats.tsx +++ b/web/core/components/cycles/active-cycle/cycle-stats.tsx @@ -12,14 +12,12 @@ import { useTranslation } from "@plane/i18n"; import { ICycle, IIssueFilterOptions } from "@plane/types"; // ui import { Tooltip, Loader, PriorityIcon, Avatar } from "@plane/ui"; +import { cn, renderFormattedDate, renderFormattedDateWithoutYear, getFileURL } from "@plane/utils"; // components import { SingleProgressStats } from "@/components/core"; import { StateDropdown } from "@/components/dropdowns"; import { SimpleEmptyState } from "@/components/empty-state"; // helpers -import { cn } from "@/helpers/common.helper"; -import { renderFormattedDate, renderFormattedDateWithoutYear } from "@/helpers/date-time.helper"; -import { getFileURL } from "@/helpers/file.helper"; // hooks import { useIssueDetail, useIssues } from "@/hooks/store"; import { useIntersectionObserver } from "@/hooks/use-intersection-observer"; diff --git a/web/core/components/cycles/analytics-sidebar/issue-progress.tsx b/web/core/components/cycles/analytics-sidebar/issue-progress.tsx index f911b4418ad..3b2c29250ba 100644 --- a/web/core/components/cycles/analytics-sidebar/issue-progress.tsx +++ b/web/core/components/cycles/analytics-sidebar/issue-progress.tsx @@ -11,10 +11,10 @@ import { EIssueFilterType, EIssuesStoreType } from "@plane/constants"; import { useTranslation } from "@plane/i18n"; import { ICycle, IIssueFilterOptions, TCyclePlotType, TProgressSnapshot } from "@plane/types"; // components +import { getDate } from "@plane/utils"; import { CycleProgressStats } from "@/components/cycles"; // constants // helpers -import { getDate } from "@/helpers/date-time.helper"; // hooks import { useIssues, useCycle } from "@/hooks/store"; // plane web components diff --git a/web/core/components/cycles/analytics-sidebar/progress-stats.tsx b/web/core/components/cycles/analytics-sidebar/progress-stats.tsx index 4f13b861281..7e1c378577a 100644 --- a/web/core/components/cycles/analytics-sidebar/progress-stats.tsx +++ b/web/core/components/cycles/analytics-sidebar/progress-stats.tsx @@ -14,11 +14,10 @@ import { TStateGroups, } from "@plane/types"; import { Avatar, StateGroupIcon } from "@plane/ui"; +import { cn, getFileURL } from "@plane/utils"; // components import { SingleProgressStats } from "@/components/core"; // helpers -import { cn } from "@/helpers/common.helper"; -import { getFileURL } from "@/helpers/file.helper"; // hooks import { useProjectState } from "@/hooks/store"; import useLocalStorage from "@/hooks/use-local-storage"; diff --git a/web/core/components/cycles/analytics-sidebar/sidebar-details.tsx b/web/core/components/cycles/analytics-sidebar/sidebar-details.tsx index 992d7f3ca82..b2d9db7d9ea 100644 --- a/web/core/components/cycles/analytics-sidebar/sidebar-details.tsx +++ b/web/core/components/cycles/analytics-sidebar/sidebar-details.tsx @@ -4,16 +4,16 @@ import isEmpty from "lodash/isEmpty"; import { observer } from "mobx-react"; import { LayersIcon, SquareUser, Users } from "lucide-react"; // plane types +import { EEstimateSystem } from "@plane/constants"; import { useTranslation } from "@plane/i18n"; import { ICycle } from "@plane/types"; // plane ui import { Avatar, AvatarGroup, TextArea } from "@plane/ui"; // helpers -import { getFileURL } from "@/helpers/file.helper"; +import { getFileURL } from "@plane/utils"; // hooks import { useMember, useProjectEstimates } from "@/hooks/store"; // plane web constants -import { EEstimateSystem } from "@/plane-web/constants/estimates"; type Props = { projectId: string; diff --git a/web/core/components/cycles/analytics-sidebar/sidebar-header.tsx b/web/core/components/cycles/analytics-sidebar/sidebar-header.tsx index f441b907bb1..a2e1e90c968 100644 --- a/web/core/components/cycles/analytics-sidebar/sidebar-header.tsx +++ b/web/core/components/cycles/analytics-sidebar/sidebar-header.tsx @@ -4,24 +4,19 @@ import React, { FC, useEffect, useState } from "react"; import { observer } from "mobx-react"; import { Controller, useForm } from "react-hook-form"; import { - ArchiveIcon, - ArchiveRestoreIcon, ArrowRight, ChevronRight, - EllipsisIcon, - LinkIcon, - Trash2, } from "lucide-react"; // Plane Imports import { CYCLE_STATUS, CYCLE_UPDATED, EUserPermissions, EUserPermissionsLevel } from "@plane/constants"; import { useTranslation } from "@plane/i18n"; import { ICycle } from "@plane/types"; -import { CustomMenu, setToast, TOAST_TYPE } from "@plane/ui"; -import { copyUrlToClipboard } from "@plane/utils"; +import { setToast, TOAST_TYPE } from "@plane/ui"; +import { getDate, renderFormattedPayloadDate } from "@plane/utils"; // components import { DateRangeDropdown } from "@/components/dropdowns"; // helpers -import { renderFormattedPayloadDate, getDate } from "@/helpers/date-time.helper"; +// // hooks import { useCycle, useEventTracker, useUserPermissions } from "@/hooks/store"; import { useAppRouter } from "@/hooks/use-app-router"; diff --git a/web/core/components/cycles/applied-filters/date.tsx b/web/core/components/cycles/applied-filters/date.tsx index c2ee47be524..18a5ece58ad 100644 --- a/web/core/components/cycles/applied-filters/date.tsx +++ b/web/core/components/cycles/applied-filters/date.tsx @@ -2,8 +2,7 @@ import { observer } from "mobx-react"; import { X } from "lucide-react"; // helpers import { DATE_AFTER_FILTER_OPTIONS } from "@plane/constants"; -import { renderFormattedDate } from "@/helpers/date-time.helper"; -import { capitalizeFirstLetter } from "@/helpers/string.helper"; +import { renderFormattedDate, capitalizeFirstLetter } from "@plane/utils"; // constants type Props = { diff --git a/web/core/components/cycles/applied-filters/root.tsx b/web/core/components/cycles/applied-filters/root.tsx index b53f0ab4d07..78a62238c2c 100644 --- a/web/core/components/cycles/applied-filters/root.tsx +++ b/web/core/components/cycles/applied-filters/root.tsx @@ -5,8 +5,8 @@ import { useTranslation } from "@plane/i18n"; import { TCycleFilters } from "@plane/types"; // hooks import { Tag } from "@plane/ui"; +import { replaceUnderscoreIfSnakeCase } from "@plane/utils"; import { AppliedDateFilters, AppliedStatusFilters } from "@/components/cycles"; -import { replaceUnderscoreIfSnakeCase } from "@/helpers/string.helper"; import { useUserPermissions } from "@/hooks/store"; // components diff --git a/web/core/components/cycles/applied-filters/status.tsx b/web/core/components/cycles/applied-filters/status.tsx index 7bb21925114..ef2d63b1a37 100644 --- a/web/core/components/cycles/applied-filters/status.tsx +++ b/web/core/components/cycles/applied-filters/status.tsx @@ -2,7 +2,7 @@ import { observer } from "mobx-react"; import { X } from "lucide-react"; import { CYCLE_STATUS } from "@plane/constants"; import { useTranslation } from "@plane/i18n"; -import { cn } from "@/helpers/common.helper"; +import { cn } from "@plane/utils"; type Props = { handleRemove: (val: string) => void; diff --git a/web/core/components/cycles/archived-cycles/header.tsx b/web/core/components/cycles/archived-cycles/header.tsx index cdc174b0e59..7ec368cdd48 100644 --- a/web/core/components/cycles/archived-cycles/header.tsx +++ b/web/core/components/cycles/archived-cycles/header.tsx @@ -7,13 +7,12 @@ import { ListFilter, Search, X } from "lucide-react"; import { useOutsideClickDetector } from "@plane/hooks"; // types import type { TCycleFilters } from "@plane/types"; +import { cn, calculateTotalFilters } from "@plane/utils"; // components import { ArchiveTabsList } from "@/components/archives"; import { CycleFiltersSelection } from "@/components/cycles"; import { FiltersDropdown } from "@/components/issues"; // helpers -import { cn } from "@/helpers/common.helper"; -import { calculateTotalFilters } from "@/helpers/filter.helper"; // hooks import { useCycleFilter } from "@/hooks/store"; diff --git a/web/core/components/cycles/archived-cycles/root.tsx b/web/core/components/cycles/archived-cycles/root.tsx index 165b5e4aa34..6005dfb3c6f 100644 --- a/web/core/components/cycles/archived-cycles/root.tsx +++ b/web/core/components/cycles/archived-cycles/root.tsx @@ -6,11 +6,11 @@ import useSWR from "swr"; import { useTranslation } from "@plane/i18n"; import { TCycleFilters } from "@plane/types"; // components +import { calculateTotalFilters } from "@plane/utils"; import { ArchivedCyclesView, CycleAppliedFiltersList } from "@/components/cycles"; import { DetailedEmptyState } from "@/components/empty-state"; import { CycleModuleListLayout } from "@/components/ui"; // helpers -import { calculateTotalFilters } from "@/helpers/filter.helper"; // hooks import { useCycle, useCycleFilter } from "@/hooks/store"; import { useResolvedAssetPath } from "@/hooks/use-resolved-asset-path"; diff --git a/web/core/components/cycles/cycle-peek-overview.tsx b/web/core/components/cycles/cycle-peek-overview.tsx index 187425b8d72..2baadf0c157 100644 --- a/web/core/components/cycles/cycle-peek-overview.tsx +++ b/web/core/components/cycles/cycle-peek-overview.tsx @@ -2,7 +2,7 @@ import React, { useEffect } from "react"; import { observer } from "mobx-react"; import { usePathname, useSearchParams } from "next/navigation"; // hooks -import { generateQueryParams } from "@/helpers/router.helper"; +import { generateQueryParams } from "@plane/utils"; import { useCycle } from "@/hooks/store"; import { useAppRouter } from "@/hooks/use-app-router"; // components diff --git a/web/core/components/cycles/cycles-view-header.tsx b/web/core/components/cycles/cycles-view-header.tsx index fe5b942dbf2..0ec9217540b 100644 --- a/web/core/components/cycles/cycles-view-header.tsx +++ b/web/core/components/cycles/cycles-view-header.tsx @@ -7,12 +7,11 @@ import { useOutsideClickDetector } from "@plane/hooks"; // types import { useTranslation } from "@plane/i18n"; import { TCycleFilters } from "@plane/types"; +import { cn, calculateTotalFilters } from "@plane/utils"; // components import { CycleFiltersSelection } from "@/components/cycles"; import { FiltersDropdown } from "@/components/issues"; // helpers -import { cn } from "@/helpers/common.helper"; -import { calculateTotalFilters } from "@/helpers/filter.helper"; // hooks import { useCycleFilter } from "@/hooks/store"; diff --git a/web/core/components/cycles/dropdowns/filters/end-date.tsx b/web/core/components/cycles/dropdowns/filters/end-date.tsx index f9b7d2f37b0..b836999662d 100644 --- a/web/core/components/cycles/dropdowns/filters/end-date.tsx +++ b/web/core/components/cycles/dropdowns/filters/end-date.tsx @@ -3,11 +3,11 @@ import { observer } from "mobx-react"; // constants import { DATE_AFTER_FILTER_OPTIONS } from "@plane/constants"; // components +import { isInDateFormat } from "@plane/utils"; import { DateFilterModal } from "@/components/core"; import { FilterHeader, FilterOption } from "@/components/issues"; // helpers -import { isInDateFormat } from "@/helpers/date-time.helper"; type Props = { appliedFilters: string[] | null; diff --git a/web/core/components/cycles/dropdowns/filters/start-date.tsx b/web/core/components/cycles/dropdowns/filters/start-date.tsx index eb2032edb68..19ff38bc6e4 100644 --- a/web/core/components/cycles/dropdowns/filters/start-date.tsx +++ b/web/core/components/cycles/dropdowns/filters/start-date.tsx @@ -3,11 +3,11 @@ import { observer } from "mobx-react"; // constants import { DATE_AFTER_FILTER_OPTIONS } from "@plane/constants"; // components +import { isInDateFormat } from "@plane/utils"; import { DateFilterModal } from "@/components/core"; import { FilterHeader, FilterOption } from "@/components/issues"; // helpers -import { isInDateFormat } from "@/helpers/date-time.helper"; type Props = { appliedFilters: string[] | null; diff --git a/web/core/components/cycles/form.tsx b/web/core/components/cycles/form.tsx index c5c9c918697..605681a1b0f 100644 --- a/web/core/components/cycles/form.tsx +++ b/web/core/components/cycles/form.tsx @@ -9,14 +9,11 @@ import { useTranslation } from "@plane/i18n"; import { ICycle } from "@plane/types"; // ui import { Button, Input, TextArea } from "@plane/ui"; +import { getDate, renderFormattedPayloadDate, shouldRenderProject, getTabIndex } from "@plane/utils"; // components import { DateRangeDropdown, ProjectDropdown } from "@/components/dropdowns"; // constants // helpers -import { getDate, renderFormattedPayloadDate } from "@/helpers/date-time.helper"; -import { shouldRenderProject } from "@/helpers/project.helper"; -import { getTabIndex } from "@/helpers/tab-indices.helper"; - type Props = { handleFormSubmit: (values: Partial, dirtyFields: any) => Promise; handleClose: () => void; diff --git a/web/core/components/cycles/list/cycle-list-group-header.tsx b/web/core/components/cycles/list/cycle-list-group-header.tsx index d132cc70ddb..0d51a28ee16 100644 --- a/web/core/components/cycles/list/cycle-list-group-header.tsx +++ b/web/core/components/cycles/list/cycle-list-group-header.tsx @@ -7,7 +7,7 @@ import { TCycleGroups } from "@plane/types"; // icons import { Row, CycleGroupIcon } from "@plane/ui"; // helpers -import { cn } from "@/helpers/common.helper"; +import { cn } from "@plane/utils"; type Props = { type: TCycleGroups; diff --git a/web/core/components/cycles/list/cycle-list-item-action.tsx b/web/core/components/cycles/list/cycle-list-item-action.tsx index c90ff653ea3..c9ec3969b71 100644 --- a/web/core/components/cycles/list/cycle-list-item-action.tsx +++ b/web/core/components/cycles/list/cycle-list-item-action.tsx @@ -19,14 +19,12 @@ import { useTranslation } from "@plane/i18n"; import { ICycle, TCycleGroups } from "@plane/types"; // ui import { Avatar, AvatarGroup, FavoriteStar, LayersIcon, Tooltip, TransferIcon, setPromiseToast } from "@plane/ui"; +import { getDate, getFileURL, generateQueryParams } from "@plane/utils"; // components import { CycleQuickActions, TransferIssuesModal } from "@/components/cycles"; import { DateRangeDropdown } from "@/components/dropdowns"; import { ButtonAvatars } from "@/components/dropdowns/member/avatar"; -import { getDate } from "@/helpers/date-time.helper"; -import { getFileURL } from "@/helpers/file.helper"; // hooks -import { generateQueryParams } from "@/helpers/router.helper"; import { useCycle, useEventTracker, useMember, useUserPermissions } from "@/hooks/store"; import { useAppRouter } from "@/hooks/use-app-router"; import { usePlatformOS } from "@/hooks/use-platform-os"; diff --git a/web/core/components/cycles/list/cycle-list-project-group-header.tsx b/web/core/components/cycles/list/cycle-list-project-group-header.tsx index d663eca0d86..4699dba63c6 100644 --- a/web/core/components/cycles/list/cycle-list-project-group-header.tsx +++ b/web/core/components/cycles/list/cycle-list-project-group-header.tsx @@ -6,7 +6,7 @@ import { ChevronRight } from "lucide-react"; // icons import { Row, Logo } from "@plane/ui"; // helpers -import { cn } from "@/helpers/common.helper"; +import { cn } from "@plane/utils"; import { useProject } from "@/hooks/store/use-project"; type Props = { diff --git a/web/core/components/cycles/list/cycles-list-item.tsx b/web/core/components/cycles/list/cycles-list-item.tsx index 2de4a907664..6e0bca8de85 100644 --- a/web/core/components/cycles/list/cycles-list-item.tsx +++ b/web/core/components/cycles/list/cycles-list-item.tsx @@ -10,11 +10,11 @@ import type { TCycleGroups } from "@plane/types"; // ui import { CircularProgressIndicator } from "@plane/ui"; // components +import { generateQueryParams } from "@plane/utils"; import { ListItem } from "@/components/core/list"; import { CycleQuickActions } from "@/components/cycles/"; import { CycleListItemAction } from "@/components/cycles/list"; // helpers -import { generateQueryParams } from "@/helpers/router.helper"; // hooks import { useCycle } from "@/hooks/store"; import { useAppRouter } from "@/hooks/use-app-router"; diff --git a/web/core/components/cycles/quick-actions.tsx b/web/core/components/cycles/quick-actions.tsx index 0faba55fab2..bd971f6259e 100644 --- a/web/core/components/cycles/quick-actions.tsx +++ b/web/core/components/cycles/quick-actions.tsx @@ -9,11 +9,10 @@ import { ArchiveRestoreIcon, ExternalLink, LinkIcon, Pencil, Trash2 } from "luci import { EUserPermissions, EUserPermissionsLevel } from "@plane/constants"; import { useTranslation } from "@plane/i18n"; import { ArchiveIcon, ContextMenu, CustomMenu, TContextMenuItem, TOAST_TYPE, setToast } from "@plane/ui"; -import { copyUrlToClipboard } from "@plane/utils"; +import { copyUrlToClipboard, cn } from "@plane/utils"; // components import { ArchiveCycleModal, CycleCreateUpdateModal, CycleDeleteModal } from "@/components/cycles"; // helpers -import { cn } from "@/helpers/common.helper"; // hooks import { useCycle, useEventTracker, useUserPermissions } from "@/hooks/store"; import { useAppRouter } from "@/hooks/use-app-router"; diff --git a/web/core/components/dashboard/widgets/issue-panels/issue-list-item.tsx b/web/core/components/dashboard/widgets/issue-panels/issue-list-item.tsx index 75471c6fd60..6c185308e51 100644 --- a/web/core/components/dashboard/widgets/issue-panels/issue-list-item.tsx +++ b/web/core/components/dashboard/widgets/issue-panels/issue-list-item.tsx @@ -6,10 +6,8 @@ import { observer } from "mobx-react"; import { TIssue, TWidgetIssue } from "@plane/types"; // ui import { Avatar, AvatarGroup, ControlLink, PriorityIcon } from "@plane/ui"; +import { findTotalDaysInRange, getDate, renderFormattedDate, getFileURL, generateWorkItemLink } from "@plane/utils"; // helpers -import { findTotalDaysInRange, getDate, renderFormattedDate } from "@/helpers/date-time.helper"; -import { getFileURL } from "@/helpers/file.helper"; -import { generateWorkItemLink } from "@/helpers/issue.helper"; // hooks import { useIssueDetail, useMember, useProject } from "@/hooks/store"; // plane web components diff --git a/web/core/components/dashboard/widgets/issue-panels/issues-list.tsx b/web/core/components/dashboard/widgets/issue-panels/issues-list.tsx index 925e2ee9af8..2a34f8a4e4b 100644 --- a/web/core/components/dashboard/widgets/issue-panels/issues-list.tsx +++ b/web/core/components/dashboard/widgets/issue-panels/issues-list.tsx @@ -5,6 +5,7 @@ import { TAssignedIssuesWidgetResponse, TCreatedIssuesWidgetResponse, TIssue, TI // hooks // components import { Loader, getButtonStyling } from "@plane/ui"; +import { cn } from "@plane/utils"; import { AssignedCompletedIssueListItem, AssignedIssuesEmptyState, @@ -18,7 +19,6 @@ import { } from "@/components/dashboard/widgets"; // ui // helpers -import { cn } from "@/helpers/common.helper"; import { getRedirectionFilters } from "@/helpers/dashboard.helper"; // hooks import useIssuePeekOverviewRedirection from "@/hooks/use-issue-peek-overview-redirection"; diff --git a/web/core/components/dashboard/widgets/issue-panels/tabs-list.tsx b/web/core/components/dashboard/widgets/issue-panels/tabs-list.tsx index 9df044c37b7..c6548091a21 100644 --- a/web/core/components/dashboard/widgets/issue-panels/tabs-list.tsx +++ b/web/core/components/dashboard/widgets/issue-panels/tabs-list.tsx @@ -3,7 +3,7 @@ import { Tab } from "@headlessui/react"; // helpers import { EDurationFilters, FILTERED_ISSUES_TABS_LIST, UNFILTERED_ISSUES_TABS_LIST } from "@plane/constants"; import { TIssuesListTypes } from "@plane/types"; -import { cn } from "@/helpers/common.helper"; +import { cn } from "@plane/utils"; // types // constants diff --git a/web/core/components/dashboard/widgets/overview-stats.tsx b/web/core/components/dashboard/widgets/overview-stats.tsx index 20421f33b49..2eda0e63a60 100644 --- a/web/core/components/dashboard/widgets/overview-stats.tsx +++ b/web/core/components/dashboard/widgets/overview-stats.tsx @@ -4,9 +4,8 @@ import Link from "next/link"; import { TOverviewStatsWidgetResponse } from "@plane/types"; // hooks import { Card, ECardSpacing } from "@plane/ui"; +import { cn, renderFormattedPayloadDate } from "@plane/utils"; import { WidgetLoader } from "@/components/dashboard/widgets"; -import { cn } from "@/helpers/common.helper"; -import { renderFormattedPayloadDate } from "@/helpers/date-time.helper"; import { useDashboard } from "@/hooks/store"; // components // helpers diff --git a/web/core/components/dashboard/widgets/recent-activity.tsx b/web/core/components/dashboard/widgets/recent-activity.tsx index 84ac985e10c..44b770911b0 100644 --- a/web/core/components/dashboard/widgets/recent-activity.tsx +++ b/web/core/components/dashboard/widgets/recent-activity.tsx @@ -8,12 +8,10 @@ import { History } from "lucide-react"; import { TRecentActivityWidgetResponse } from "@plane/types"; // components import { Card, Avatar, getButtonStyling } from "@plane/ui"; +import { cn, calculateTimeAgo, getFileURL } from "@plane/utils"; import { ActivityIcon, ActivityMessage, IssueLink } from "@/components/core"; import { RecentActivityEmptyState, WidgetLoader, WidgetProps } from "@/components/dashboard/widgets"; // helpers -import { cn } from "@/helpers/common.helper"; -import { calculateTimeAgo } from "@/helpers/date-time.helper"; -import { getFileURL } from "@/helpers/file.helper"; // hooks import { useDashboard, useUser } from "@/hooks/store"; diff --git a/web/core/components/dashboard/widgets/recent-collaborators/collaborators-list.tsx b/web/core/components/dashboard/widgets/recent-collaborators/collaborators-list.tsx index 415809e0433..c02410be3fb 100644 --- a/web/core/components/dashboard/widgets/recent-collaborators/collaborators-list.tsx +++ b/web/core/components/dashboard/widgets/recent-collaborators/collaborators-list.tsx @@ -9,7 +9,7 @@ import { TRecentCollaboratorsWidgetResponse } from "@plane/types"; // ui import { Avatar } from "@plane/ui"; // helpers -import { getFileURL } from "@/helpers/file.helper"; +import { getFileURL } from "@plane/utils"; // hooks import { useDashboard, useMember, useUser } from "@/hooks/store"; // components diff --git a/web/core/components/dashboard/widgets/recent-projects.tsx b/web/core/components/dashboard/widgets/recent-projects.tsx index 3e9c4e257b9..bde10917cbd 100644 --- a/web/core/components/dashboard/widgets/recent-projects.tsx +++ b/web/core/components/dashboard/widgets/recent-projects.tsx @@ -10,11 +10,11 @@ import { TRecentProjectsWidgetResponse } from "@plane/types"; // plane ui import { Avatar, AvatarGroup, Card } from "@plane/ui"; // components +import { getFileURL } from "@plane/utils"; import { Logo } from "@/components/common"; import { WidgetLoader, WidgetProps } from "@/components/dashboard/widgets"; // constants // helpers -import { getFileURL } from "@/helpers/file.helper"; // hooks import { useEventTracker, diff --git a/web/core/components/dropdowns/buttons.tsx b/web/core/components/dropdowns/buttons.tsx index a2b7c590a13..de14c11b838 100644 --- a/web/core/components/dropdowns/buttons.tsx +++ b/web/core/components/dropdowns/buttons.tsx @@ -2,7 +2,7 @@ // helpers import { Tooltip } from "@plane/ui"; -import { cn } from "@/helpers/common.helper"; +import { cn } from "@plane/utils"; // types import { usePlatformOS } from "@/hooks/use-platform-os"; import { BACKGROUND_BUTTON_VARIANTS, BORDER_BUTTON_VARIANTS } from "./constants"; diff --git a/web/core/components/dropdowns/cycle/index.tsx b/web/core/components/dropdowns/cycle/index.tsx index f06b1956dfc..7499c64e3c2 100644 --- a/web/core/components/dropdowns/cycle/index.tsx +++ b/web/core/components/dropdowns/cycle/index.tsx @@ -7,7 +7,7 @@ import { useTranslation } from "@plane/i18n"; // ui import { ComboDropDown, ContrastIcon } from "@plane/ui"; // helpers -import { cn } from "@/helpers/common.helper"; +import { cn } from "@plane/utils"; // hooks import { useCycle } from "@/hooks/store"; import { useDropdown } from "@/hooks/use-dropdown"; diff --git a/web/core/components/dropdowns/date-range.tsx b/web/core/components/dropdowns/date-range.tsx index 0ab9fd44be3..9a39f48adba 100644 --- a/web/core/components/dropdowns/date-range.tsx +++ b/web/core/components/dropdowns/date-range.tsx @@ -10,9 +10,8 @@ import { Combobox } from "@headlessui/react"; import { useTranslation } from "@plane/i18n"; // ui import { ComboDropDown, Calendar } from "@plane/ui"; +import { cn, renderFormattedDate } from "@plane/utils"; // helpers -import { cn } from "@/helpers/common.helper"; -import { renderFormattedDate } from "@/helpers/date-time.helper"; // hooks import { useDropdown } from "@/hooks/use-dropdown"; // components diff --git a/web/core/components/dropdowns/date.tsx b/web/core/components/dropdowns/date.tsx index 684d6f3ef00..bab9ff2f8bc 100644 --- a/web/core/components/dropdowns/date.tsx +++ b/web/core/components/dropdowns/date.tsx @@ -8,9 +8,8 @@ import { Combobox } from "@headlessui/react"; // ui import { EStartOfTheWeek } from "@plane/constants"; import { ComboDropDown, Calendar } from "@plane/ui"; +import { cn, renderFormattedDate, getDate } from "@plane/utils"; // helpers -import { cn } from "@/helpers/common.helper"; -import { renderFormattedDate, getDate } from "@/helpers/date-time.helper"; // hooks import { useUserProfile } from "@/hooks/store"; import { useDropdown } from "@/hooks/use-dropdown"; diff --git a/web/core/components/dropdowns/estimate.tsx b/web/core/components/dropdowns/estimate.tsx index 8c43f68b660..4f80d061bc0 100644 --- a/web/core/components/dropdowns/estimate.tsx +++ b/web/core/components/dropdowns/estimate.tsx @@ -8,9 +8,8 @@ import { Combobox } from "@headlessui/react"; import { useTranslation } from "@plane/i18n"; import { EEstimateSystem } from "@plane/types/src/enums"; import { ComboDropDown } from "@plane/ui"; +import { convertMinutesToHoursMinutesString, cn } from "@plane/utils"; // helpers -import { convertMinutesToHoursMinutesString } from "@plane/utils"; -import { cn } from "@/helpers/common.helper"; // hooks import { useEstimate, diff --git a/web/core/components/dropdowns/member/avatar.tsx b/web/core/components/dropdowns/member/avatar.tsx index 0b2189f6510..980144a190c 100644 --- a/web/core/components/dropdowns/member/avatar.tsx +++ b/web/core/components/dropdowns/member/avatar.tsx @@ -4,10 +4,9 @@ import { observer } from "mobx-react"; import { LucideIcon, Users } from "lucide-react"; // plane ui import { Avatar, AvatarGroup } from "@plane/ui"; +import { cn, getFileURL } from "@plane/utils"; // plane utils -import { cn } from "@plane/utils"; // helpers -import { getFileURL } from "@/helpers/file.helper"; // hooks import { useMember } from "@/hooks/store"; diff --git a/web/core/components/dropdowns/member/index.tsx b/web/core/components/dropdowns/member/index.tsx index d86d3153469..acfa9f46092 100644 --- a/web/core/components/dropdowns/member/index.tsx +++ b/web/core/components/dropdowns/member/index.tsx @@ -5,7 +5,7 @@ import { useTranslation } from "@plane/i18n"; // ui import { ComboDropDown } from "@plane/ui"; // helpers -import { cn } from "@/helpers/common.helper"; +import { cn } from "@plane/utils"; // hooks import { useMember } from "@/hooks/store"; import { useDropdown } from "@/hooks/use-dropdown"; diff --git a/web/core/components/dropdowns/member/member-options.tsx b/web/core/components/dropdowns/member/member-options.tsx index 28f84553f85..f2cea10faba 100644 --- a/web/core/components/dropdowns/member/member-options.tsx +++ b/web/core/components/dropdowns/member/member-options.tsx @@ -12,9 +12,8 @@ import { EUserPermissions } from "@plane/constants"; import { useTranslation } from "@plane/i18n"; // plane ui import { Avatar } from "@plane/ui"; +import { cn, getFileURL } from "@plane/utils"; // helpers -import { cn } from "@/helpers/common.helper"; -import { getFileURL } from "@/helpers/file.helper"; // hooks import { useUser, useMember } from "@/hooks/store"; import { usePlatformOS } from "@/hooks/use-platform-os"; diff --git a/web/core/components/dropdowns/module/index.tsx b/web/core/components/dropdowns/module/index.tsx index f9233e0b27c..9e789dbf4e7 100644 --- a/web/core/components/dropdowns/module/index.tsx +++ b/web/core/components/dropdowns/module/index.tsx @@ -8,7 +8,7 @@ import { useTranslation } from "@plane/i18n"; // ui import { ComboDropDown, DiceIcon, Tooltip } from "@plane/ui"; // helpers -import { cn } from "@/helpers/common.helper"; +import { cn } from "@plane/utils"; // hooks import { useModule } from "@/hooks/store"; import { useDropdown } from "@/hooks/use-dropdown"; diff --git a/web/core/components/dropdowns/module/module-options.tsx b/web/core/components/dropdowns/module/module-options.tsx index d2d3f909d2d..6b96220b4a9 100644 --- a/web/core/components/dropdowns/module/module-options.tsx +++ b/web/core/components/dropdowns/module/module-options.tsx @@ -12,7 +12,7 @@ import { useTranslation } from "@plane/i18n"; //components import { DiceIcon } from "@plane/ui"; //store -import { cn } from "@/helpers/common.helper"; +import { cn } from "@plane/utils"; import { useModule } from "@/hooks/store"; import { usePlatformOS } from "@/hooks/use-platform-os"; //hooks diff --git a/web/core/components/dropdowns/priority.tsx b/web/core/components/dropdowns/priority.tsx index dfc0ff07127..e3bc44e7371 100644 --- a/web/core/components/dropdowns/priority.tsx +++ b/web/core/components/dropdowns/priority.tsx @@ -12,7 +12,7 @@ import { TIssuePriorities } from "@plane/types"; // ui import { ComboDropDown, PriorityIcon, Tooltip } from "@plane/ui"; // helpers -import { cn } from "@/helpers/common.helper"; +import { cn } from "@plane/utils"; // hooks import { useDropdown } from "@/hooks/use-dropdown"; import { usePlatformOS } from "@/hooks/use-platform-os"; diff --git a/web/core/components/dropdowns/project.tsx b/web/core/components/dropdowns/project.tsx index 88c13bdb91e..c2d118f0129 100644 --- a/web/core/components/dropdowns/project.tsx +++ b/web/core/components/dropdowns/project.tsx @@ -7,9 +7,9 @@ import { Combobox } from "@headlessui/react"; import { useTranslation } from "@plane/i18n"; import { ComboDropDown } from "@plane/ui"; // components +import { cn } from "@plane/utils"; import { Logo } from "@/components/common"; // helpers -import { cn } from "@/helpers/common.helper"; // hooks import { useProject } from "@/hooks/store"; import { useDropdown } from "@/hooks/use-dropdown"; diff --git a/web/core/components/dropdowns/state.tsx b/web/core/components/dropdowns/state.tsx index db8cbb5c707..312eb2db379 100644 --- a/web/core/components/dropdowns/state.tsx +++ b/web/core/components/dropdowns/state.tsx @@ -10,7 +10,7 @@ import { useTranslation } from "@plane/i18n"; // ui import { ComboDropDown, Spinner, StateGroupIcon } from "@plane/ui"; // helpers -import { cn } from "@/helpers/common.helper"; +import { cn } from "@plane/utils"; // hooks import { useProjectState } from "@/hooks/store"; import { useDropdown } from "@/hooks/use-dropdown"; diff --git a/web/core/components/editor/embeds/mentions/user.tsx b/web/core/components/editor/embeds/mentions/user.tsx index a8e4a4b0b2e..83a6ee79fca 100644 --- a/web/core/components/editor/embeds/mentions/user.tsx +++ b/web/core/components/editor/embeds/mentions/user.tsx @@ -7,10 +7,9 @@ import { usePopper } from "react-popper"; import { ROLE } from "@plane/constants"; // plane ui import { Avatar } from "@plane/ui"; +import { cn, getFileURL } from "@plane/utils"; // constants // helpers -import { cn } from "@/helpers/common.helper"; -import { getFileURL } from "@/helpers/file.helper"; // hooks import { useMember, useUser } from "@/hooks/store"; diff --git a/web/core/components/editor/lite-text-editor/lite-text-editor.tsx b/web/core/components/editor/lite-text-editor/lite-text-editor.tsx index 5dda3b8dbd8..a29f84a6352 100644 --- a/web/core/components/editor/lite-text-editor/lite-text-editor.tsx +++ b/web/core/components/editor/lite-text-editor/lite-text-editor.tsx @@ -7,10 +7,9 @@ import { EditorRefApi, ILiteTextEditor, LiteTextEditorWithRef, TFileHandler } fr import { useTranslation } from "@plane/i18n"; // components import { MakeOptional } from "@plane/types"; +import { cn, isCommentEmpty } from "@plane/utils"; import { EditorMentionsRoot, IssueCommentToolbar } from "@/components/editor"; // helpers -import { cn } from "@/helpers/common.helper"; -import { isCommentEmpty } from "@/helpers/string.helper"; // hooks import { useEditorConfig, useEditorMention } from "@/hooks/editor"; // store hooks diff --git a/web/core/components/editor/lite-text-editor/lite-text-read-only-editor.tsx b/web/core/components/editor/lite-text-editor/lite-text-read-only-editor.tsx index 9ee48ba84ac..1f9a9ff49be 100644 --- a/web/core/components/editor/lite-text-editor/lite-text-read-only-editor.tsx +++ b/web/core/components/editor/lite-text-editor/lite-text-read-only-editor.tsx @@ -3,9 +3,9 @@ import React from "react"; import { EditorReadOnlyRefApi, ILiteTextReadOnlyEditor, LiteTextReadOnlyEditorWithRef } from "@plane/editor"; import { MakeOptional } from "@plane/types"; // components +import { cn } from "@plane/utils"; import { EditorMentionsRoot } from "@/components/editor"; // helpers -import { cn } from "@/helpers/common.helper"; // hooks import { useEditorConfig } from "@/hooks/editor"; // store hooks diff --git a/web/core/components/editor/lite-text-editor/toolbar.tsx b/web/core/components/editor/lite-text-editor/toolbar.tsx index 818e35fae25..13cd07c44e4 100644 --- a/web/core/components/editor/lite-text-editor/toolbar.tsx +++ b/web/core/components/editor/lite-text-editor/toolbar.tsx @@ -10,9 +10,9 @@ import { useTranslation } from "@plane/i18n"; // ui import { Button, Tooltip } from "@plane/ui"; // constants +import { cn } from "@plane/utils"; import { TOOLBAR_ITEMS, ToolbarMenuItem } from "@/constants/editor"; // helpers -import { cn } from "@/helpers/common.helper"; type Props = { accessSpecifier?: EIssueCommentAccessSpecifier; diff --git a/web/core/components/editor/rich-text-editor/rich-text-editor.tsx b/web/core/components/editor/rich-text-editor/rich-text-editor.tsx index ea27ec45d7b..e8674243104 100644 --- a/web/core/components/editor/rich-text-editor/rich-text-editor.tsx +++ b/web/core/components/editor/rich-text-editor/rich-text-editor.tsx @@ -3,9 +3,9 @@ import React, { forwardRef } from "react"; import { EditorRefApi, IRichTextEditor, RichTextEditorWithRef, TFileHandler } from "@plane/editor"; import { MakeOptional, TSearchEntityRequestPayload, TSearchResponse } from "@plane/types"; // components +import { cn } from "@plane/utils"; import { EditorMentionsRoot } from "@/components/editor"; // helpers -import { cn } from "@/helpers/common.helper"; // hooks import { useEditorConfig, useEditorMention } from "@/hooks/editor"; // store hooks diff --git a/web/core/components/editor/rich-text-editor/rich-text-read-only-editor.tsx b/web/core/components/editor/rich-text-editor/rich-text-read-only-editor.tsx index 50eb65e78e4..75260b07fd6 100644 --- a/web/core/components/editor/rich-text-editor/rich-text-read-only-editor.tsx +++ b/web/core/components/editor/rich-text-editor/rich-text-read-only-editor.tsx @@ -3,9 +3,9 @@ import React from "react"; import { EditorReadOnlyRefApi, IRichTextReadOnlyEditor, RichTextReadOnlyEditorWithRef } from "@plane/editor"; import { MakeOptional } from "@plane/types"; // components +import { cn } from "@plane/utils"; import { EditorMentionsRoot } from "@/components/editor"; // helpers -import { cn } from "@/helpers/common.helper"; // hooks import { useEditorConfig } from "@/hooks/editor"; // store hooks diff --git a/web/core/components/editor/sticky-editor/editor.tsx b/web/core/components/editor/sticky-editor/editor.tsx index de20e890270..25109612238 100644 --- a/web/core/components/editor/sticky-editor/editor.tsx +++ b/web/core/components/editor/sticky-editor/editor.tsx @@ -6,7 +6,7 @@ import { EditorRefApi, ILiteTextEditor, LiteTextEditorWithRef, TFileHandler } fr // components import { TSticky } from "@plane/types"; // helpers -import { cn } from "@/helpers/common.helper"; +import { cn } from "@plane/utils"; // hooks import { useEditorConfig } from "@/hooks/editor"; // plane web hooks diff --git a/web/core/components/editor/sticky-editor/toolbar.tsx b/web/core/components/editor/sticky-editor/toolbar.tsx index c92f7448d60..84b27226ecf 100644 --- a/web/core/components/editor/sticky-editor/toolbar.tsx +++ b/web/core/components/editor/sticky-editor/toolbar.tsx @@ -9,9 +9,9 @@ import { useOutsideClickDetector } from "@plane/hooks"; import { TSticky } from "@plane/types"; import { Tooltip } from "@plane/ui"; // constants +import { cn } from "@plane/utils"; import { TOOLBAR_ITEMS, ToolbarMenuItem } from "@/constants/editor"; // helpers -import { cn } from "@/helpers/common.helper"; import { ColorPalette } from "./color-palette"; type Props = { diff --git a/web/core/components/estimates/create/modal.tsx b/web/core/components/estimates/create/modal.tsx index c5760fb9908..531a024ab50 100644 --- a/web/core/components/estimates/create/modal.tsx +++ b/web/core/components/estimates/create/modal.tsx @@ -4,6 +4,7 @@ import { FC, useEffect, useMemo, useState } from "react"; import { observer } from "mobx-react"; import { ChevronLeft } from "lucide-react"; // types +import { EEstimateSystem, ESTIMATE_SYSTEMS } from "@plane/constants"; import { useTranslation } from "@plane/i18n"; import { IEstimateFormData, TEstimateSystemKeys, TEstimatePointsObject, TEstimateTypeError } from "@plane/types"; // ui @@ -13,7 +14,6 @@ import { EstimateCreateStageOne, EstimatePointCreateRoot } from "@/components/es // hooks import { useProjectEstimates } from "@/hooks/store"; // plane web constants -import { EEstimateSystem, ESTIMATE_SYSTEMS } from "@/plane-web/constants/estimates"; type TCreateEstimateModal = { workspaceSlug: string; diff --git a/web/core/components/estimates/create/stage-one.tsx b/web/core/components/estimates/create/stage-one.tsx index 9fcd02bfd2e..d1682736461 100644 --- a/web/core/components/estimates/create/stage-one.tsx +++ b/web/core/components/estimates/create/stage-one.tsx @@ -2,6 +2,7 @@ import { FC } from "react"; import { Info } from "lucide-react"; +import { EEstimateSystem, ESTIMATE_SYSTEMS } from "@plane/constants"; import { useTranslation } from "@plane/i18n"; import { TEstimateSystemKeys } from "@plane/types"; import { Tooltip } from "@plane/ui"; @@ -11,7 +12,6 @@ import { RadioInput } from "@/components/estimates"; // plane web constants import { isEstimateSystemEnabled } from "@/plane-web/components/estimates/helper"; import { UpgradeBadge } from "@/plane-web/components/workspace"; -import { EEstimateSystem, ESTIMATE_SYSTEMS } from "@/plane-web/constants/estimates"; type TEstimateCreateStageOne = { estimateSystem: TEstimateSystemKeys; diff --git a/web/core/components/estimates/estimate-list-item.tsx b/web/core/components/estimates/estimate-list-item.tsx index e69ab0d464e..14846c7de1c 100644 --- a/web/core/components/estimates/estimate-list-item.tsx +++ b/web/core/components/estimates/estimate-list-item.tsx @@ -1,13 +1,12 @@ import { FC } from "react"; import { observer } from "mobx-react"; +import { EEstimateSystem } from "@plane/constants"; +import { convertMinutesToHoursMinutesString, cn } from "@plane/utils"; // helpers -import { convertMinutesToHoursMinutesString } from "@plane/utils"; -import { cn } from "@/helpers/common.helper"; // hooks import { useEstimate, useProjectEstimates } from "@/hooks/store"; // plane web components import { EstimateListItemButtons } from "@/plane-web/components/estimates"; -import { EEstimateSystem } from "@/plane-web/constants/estimates"; type TEstimateListItem = { estimateId: string; diff --git a/web/core/components/estimates/points/create-root.tsx b/web/core/components/estimates/points/create-root.tsx index 33e220313b1..7c074245aae 100644 --- a/web/core/components/estimates/points/create-root.tsx +++ b/web/core/components/estimates/points/create-root.tsx @@ -3,12 +3,12 @@ import { Dispatch, FC, SetStateAction, useCallback, useState } from "react"; import { observer } from "mobx-react"; import { Plus } from "lucide-react"; +import { estimateCount } from "@plane/constants"; import { TEstimatePointsObject, TEstimateSystemKeys, TEstimateTypeError } from "@plane/types"; import { Button, Sortable } from "@plane/ui"; // components import { EstimatePointCreate, EstimatePointItemPreview } from "@/components/estimates/points"; // plane web constants -import { estimateCount } from "@/plane-web/constants/estimates"; type TEstimatePointCreateRoot = { workspaceSlug: string; diff --git a/web/core/components/estimates/points/create.tsx b/web/core/components/estimates/points/create.tsx index b9742d9b06b..5418830ac81 100644 --- a/web/core/components/estimates/points/create.tsx +++ b/web/core/components/estimates/points/create.tsx @@ -3,17 +3,16 @@ import { FC, useState, FormEvent } from "react"; import { observer } from "mobx-react"; import { Check, Info, X } from "lucide-react"; +import { EEstimateSystem, MAX_ESTIMATE_POINT_INPUT_LENGTH } from "@plane/constants"; import { useTranslation } from "@plane/i18n"; import { TEstimatePointsObject, TEstimateSystemKeys, TEstimateTypeErrorObject } from "@plane/types"; import { Spinner, TOAST_TYPE, Tooltip, setToast } from "@plane/ui"; +import { cn, isEstimatePointValuesRepeated } from "@plane/utils"; import { EstimateInputRoot } from "@/components/estimates/inputs/root"; // helpers -import { cn } from "@/helpers/common.helper"; -import { isEstimatePointValuesRepeated } from "@/helpers/estimates"; // hooks import { useEstimate } from "@/hooks/store"; // plane web constants -import { EEstimateSystem, MAX_ESTIMATE_POINT_INPUT_LENGTH } from "@/plane-web/constants/estimates"; type TEstimatePointCreate = { workspaceSlug: string; diff --git a/web/core/components/estimates/points/preview.tsx b/web/core/components/estimates/points/preview.tsx index a5d5235babf..eaac1ed990a 100644 --- a/web/core/components/estimates/points/preview.tsx +++ b/web/core/components/estimates/points/preview.tsx @@ -1,6 +1,7 @@ import { FC, useEffect, useRef, useState } from "react"; import { observer } from "mobx-react"; import { GripVertical, Pencil, Trash2 } from "lucide-react"; +import { EEstimateSystem, estimateCount } from "@plane/constants"; import { useTranslation } from "@plane/i18n"; import { TEstimatePointsObject, TEstimateSystemKeys, TEstimateTypeErrorObject } from "@plane/types"; // components @@ -9,7 +10,6 @@ import { EstimatePointUpdate } from "@/components/estimates/points"; // plane web components import { EstimatePointDelete } from "@/plane-web/components/estimates"; // plane web constants -import { EEstimateSystem, estimateCount } from "@/plane-web/constants/estimates"; type TEstimatePointItemPreview = { workspaceSlug: string; diff --git a/web/core/components/estimates/points/update.tsx b/web/core/components/estimates/points/update.tsx index 9d32ef2d91c..9924cb08ade 100644 --- a/web/core/components/estimates/points/update.tsx +++ b/web/core/components/estimates/points/update.tsx @@ -3,17 +3,16 @@ import { FC, useEffect, useState, FormEvent } from "react"; import { observer } from "mobx-react"; import { Check, Info, X } from "lucide-react"; +import { EEstimateSystem, MAX_ESTIMATE_POINT_INPUT_LENGTH } from "@plane/constants"; import { useTranslation } from "@plane/i18n"; import { TEstimatePointsObject, TEstimateSystemKeys, TEstimateTypeErrorObject } from "@plane/types"; import { Spinner, TOAST_TYPE, Tooltip, setToast } from "@plane/ui"; +import { cn, isEstimatePointValuesRepeated } from "@plane/utils"; import { EstimateInputRoot } from "@/components/estimates/inputs/root"; // helpers -import { cn } from "@/helpers/common.helper"; -import { isEstimatePointValuesRepeated } from "@/helpers/estimates"; // hooks import { useEstimatePoint } from "@/hooks/store"; // plane web constants -import { EEstimateSystem, MAX_ESTIMATE_POINT_INPUT_LENGTH } from "@/plane-web/constants/estimates"; type TEstimatePointUpdate = { workspaceSlug: string; diff --git a/web/core/components/estimates/radio-select.tsx b/web/core/components/estimates/radio-select.tsx index 0515b2c8a4b..2fd6919998f 100644 --- a/web/core/components/estimates/radio-select.tsx +++ b/web/core/components/estimates/radio-select.tsx @@ -1,6 +1,6 @@ import React from "react"; // helpers -import { cn } from "@/helpers/common.helper"; +import { cn } from "@plane/utils"; type RadioInputProps = { name?: string; diff --git a/web/core/components/exporter/single-export.tsx b/web/core/components/exporter/single-export.tsx index 8bea2ed946b..6e8dde3dacf 100644 --- a/web/core/components/exporter/single-export.tsx +++ b/web/core/components/exporter/single-export.tsx @@ -5,7 +5,7 @@ import { useState, FC } from "react"; import { IExportData } from "@plane/types"; import { Button } from "@plane/ui"; // helpers -import { getDate, renderFormattedDate } from "@/helpers/date-time.helper"; +import { getDate, renderFormattedDate } from "@plane/utils"; // types type Props = { diff --git a/web/core/components/gantt-chart/blocks/block-row-list.tsx b/web/core/components/gantt-chart/blocks/block-row-list.tsx index 183f626570d..0be3bead71e 100644 --- a/web/core/components/gantt-chart/blocks/block-row-list.tsx +++ b/web/core/components/gantt-chart/blocks/block-row-list.tsx @@ -1,11 +1,11 @@ import { FC } from "react"; // components +import type { IBlockUpdateData, IGanttBlock } from "@plane/types"; import RenderIfVisible from "@/components/core/render-if-visible-HOC"; // hooks import { TSelectionHelper } from "@/hooks/use-multiple-select"; // types import { BLOCK_HEIGHT } from "../constants"; -import { IBlockUpdateData, IGanttBlock } from "../types"; import { BlockRow } from "./block-row"; export type GanttChartBlocksProps = { diff --git a/web/core/components/gantt-chart/blocks/block-row.tsx b/web/core/components/gantt-chart/blocks/block-row.tsx index b215aee4b85..f856d201f99 100644 --- a/web/core/components/gantt-chart/blocks/block-row.tsx +++ b/web/core/components/gantt-chart/blocks/block-row.tsx @@ -2,7 +2,8 @@ import { useEffect, useState } from "react"; import { observer } from "mobx-react"; import { ArrowRight } from "lucide-react"; // helpers -import { cn } from "@/helpers/common.helper"; +import type { IBlockUpdateData, IGanttBlock } from "@plane/types"; +import { cn } from "@plane/utils"; // hooks import { useIssueDetail } from "@/hooks/store"; import { TSelectionHelper } from "@/hooks/use-multiple-select"; @@ -10,7 +11,6 @@ import { useTimeLineChartStore } from "@/hooks/use-timeline-chart"; // import { BLOCK_HEIGHT, SIDEBAR_WIDTH } from "../constants"; import { ChartAddBlock } from "../helpers"; -import { IBlockUpdateData, IGanttBlock } from "../types"; type Props = { blockId: string; diff --git a/web/core/components/gantt-chart/blocks/block.tsx b/web/core/components/gantt-chart/blocks/block.tsx index 8671993c7c9..f459a02af9f 100644 --- a/web/core/components/gantt-chart/blocks/block.tsx +++ b/web/core/components/gantt-chart/blocks/block.tsx @@ -1,9 +1,10 @@ import { RefObject, useRef } from "react"; import { observer } from "mobx-react"; // components +import type { IBlockUpdateDependencyData } from "@plane/types"; +import { cn } from "@plane/utils"; import RenderIfVisible from "@/components/core/render-if-visible-HOC"; // helpers -import { cn } from "@/helpers/common.helper"; // hooks import { useTimeLineChartStore } from "@/hooks/use-timeline-chart"; // constants @@ -11,7 +12,6 @@ import { BLOCK_HEIGHT } from "../constants"; // components import { ChartDraggable } from "../helpers"; import { useGanttResizable } from "../helpers/blockResizables/use-gantt-resizable"; -import { IBlockUpdateDependencyData } from "../types"; type Props = { blockId: string; diff --git a/web/core/components/gantt-chart/blocks/blocks-list.tsx b/web/core/components/gantt-chart/blocks/blocks-list.tsx index 8015819d753..c8644b465ed 100644 --- a/web/core/components/gantt-chart/blocks/blocks-list.tsx +++ b/web/core/components/gantt-chart/blocks/blocks-list.tsx @@ -1,6 +1,6 @@ import { FC } from "react"; // -import { IBlockUpdateDependencyData } from "../types"; +import type { IBlockUpdateDependencyData } from "@plane/types"; import { GanttChartBlock } from "./block"; export type GanttChartBlocksProps = { diff --git a/web/core/components/gantt-chart/chart/header.tsx b/web/core/components/gantt-chart/chart/header.tsx index 7eb858be35d..cc5bd9a3bda 100644 --- a/web/core/components/gantt-chart/chart/header.tsx +++ b/web/core/components/gantt-chart/chart/header.tsx @@ -2,16 +2,16 @@ import { observer } from "mobx-react"; import { Expand, Shrink } from "lucide-react"; import { useTranslation } from "@plane/i18n"; // plane +import type { TGanttViews } from "@plane/types"; import { Row } from "@plane/ui"; // components +import { cn } from "@plane/utils"; import { VIEWS_LIST } from "@/components/gantt-chart/data"; // helpers -import { cn } from "@/helpers/common.helper"; // hooks import { useTimeLineChartStore } from "@/hooks/use-timeline-chart"; // import { GANTT_BREADCRUMBS_HEIGHT } from "../constants"; -import { TGanttViews } from "../types"; type Props = { blockIds: string[]; diff --git a/web/core/components/gantt-chart/chart/main-content.tsx b/web/core/components/gantt-chart/chart/main-content.tsx index 63e01c54ea0..30b79ec9bb1 100644 --- a/web/core/components/gantt-chart/chart/main-content.tsx +++ b/web/core/components/gantt-chart/chart/main-content.tsx @@ -2,6 +2,7 @@ import { useEffect, useRef } from "react"; import { combine } from "@atlaskit/pragmatic-drag-and-drop/combine"; import { autoScrollForElements } from "@atlaskit/pragmatic-drag-and-drop-auto-scroll/element"; import { observer } from "mobx-react"; +import { cn, getDate } from "@plane/utils"; // components import { MultipleSelectGroup } from "@/components/core"; import { @@ -17,8 +18,6 @@ import { WeekChartView, } from "@/components/gantt-chart"; // helpers -import { cn } from "@/helpers/common.helper"; -import { getDate } from "@/helpers/date-time.helper"; // hooks import { useTimeLineChartStore } from "@/hooks/use-timeline-chart"; // plane web components diff --git a/web/core/components/gantt-chart/chart/root.tsx b/web/core/components/gantt-chart/chart/root.tsx index 16604d88170..2509e8d55db 100644 --- a/web/core/components/gantt-chart/chart/root.tsx +++ b/web/core/components/gantt-chart/chart/root.tsx @@ -3,16 +3,16 @@ import { observer } from "mobx-react"; // plane imports import { EStartOfTheWeek } from "@plane/constants"; // components +import type { ChartDataType, IBlockUpdateData, IBlockUpdateDependencyData, TGanttViews } from "@plane/types"; +import { cn } from "@plane/utils"; import { GanttChartHeader, GanttChartMainContent } from "@/components/gantt-chart"; // helpers -import { cn } from "@/helpers/common.helper"; // hooks import { useUserProfile } from "@/hooks/store"; import { useTimeLineChartStore } from "@/hooks/use-timeline-chart"; // import { SIDEBAR_WIDTH } from "../constants"; import { currentViewDataWithView } from "../data"; -import { ChartDataType, IBlockUpdateData, IBlockUpdateDependencyData, TGanttViews } from "../types"; import { getNumberOfDaysBetweenTwoDates, IMonthBlock, diff --git a/web/core/components/gantt-chart/chart/views/month.tsx b/web/core/components/gantt-chart/chart/views/month.tsx index bfe29b90dd8..01f6aa801ff 100644 --- a/web/core/components/gantt-chart/chart/views/month.tsx +++ b/web/core/components/gantt-chart/chart/views/month.tsx @@ -1,9 +1,9 @@ import { FC } from "react"; import { observer } from "mobx-react"; // components +import { cn } from "@plane/utils"; import { HEADER_HEIGHT, SIDEBAR_WIDTH } from "@/components/gantt-chart/constants"; // helpers -import { cn } from "@/helpers/common.helper"; // hooks import { useTimeLineChartStore } from "@/hooks/use-timeline-chart"; // types diff --git a/web/core/components/gantt-chart/data/index.ts b/web/core/components/gantt-chart/data/index.ts index 2e72810d87b..1871278f8bf 100644 --- a/web/core/components/gantt-chart/data/index.ts +++ b/web/core/components/gantt-chart/data/index.ts @@ -1,6 +1,6 @@ // types import { EStartOfTheWeek } from "@plane/constants"; -import { WeekMonthDataType, ChartDataType, TGanttViews } from "../types"; +import type { WeekMonthDataType, ChartDataType, TGanttViews } from "@plane/types"; // constants export const generateWeeks = (startOfWeek: EStartOfTheWeek = EStartOfTheWeek.SUNDAY): WeekMonthDataType[] => [ diff --git a/web/core/components/gantt-chart/helpers/add-block.tsx b/web/core/components/gantt-chart/helpers/add-block.tsx index 0c8ccdcb1df..fed218f911b 100644 --- a/web/core/components/gantt-chart/helpers/add-block.tsx +++ b/web/core/components/gantt-chart/helpers/add-block.tsx @@ -5,14 +5,14 @@ import { addDays } from "date-fns"; import { observer } from "mobx-react"; import { Plus } from "lucide-react"; // ui +import type { IBlockUpdateData, IGanttBlock } from "@plane/types"; import { Tooltip } from "@plane/ui"; // helpers -import { renderFormattedDate, renderFormattedPayloadDate } from "@/helpers/date-time.helper"; +import { renderFormattedDate, renderFormattedPayloadDate } from "@plane/utils"; // hooks import { usePlatformOS } from "@/hooks/use-platform-os"; import { useTimeLineChartStore } from "@/hooks/use-timeline-chart"; // -import { IBlockUpdateData, IGanttBlock } from "../types"; type Props = { block: IGanttBlock; diff --git a/web/core/components/gantt-chart/helpers/blockResizables/left-resizable.tsx b/web/core/components/gantt-chart/helpers/blockResizables/left-resizable.tsx index 99b96e786dc..48e7277c3bc 100644 --- a/web/core/components/gantt-chart/helpers/blockResizables/left-resizable.tsx +++ b/web/core/components/gantt-chart/helpers/blockResizables/left-resizable.tsx @@ -1,9 +1,9 @@ import { useState } from "react"; import { observer } from "mobx-react"; // plane utils -import { cn } from "@plane/utils"; +import { cn, renderFormattedDate } from "@plane/utils"; //helpers -import { renderFormattedDate } from "@/helpers/date-time.helper"; +// //hooks import { useTimeLineChartStore } from "@/hooks/use-timeline-chart"; diff --git a/web/core/components/gantt-chart/helpers/blockResizables/right-resizable.tsx b/web/core/components/gantt-chart/helpers/blockResizables/right-resizable.tsx index 8370a7630ae..8b4f0ea49b5 100644 --- a/web/core/components/gantt-chart/helpers/blockResizables/right-resizable.tsx +++ b/web/core/components/gantt-chart/helpers/blockResizables/right-resizable.tsx @@ -1,9 +1,9 @@ import { useState } from "react"; import { observer } from "mobx-react"; // plane utils -import { cn } from "@plane/utils"; +import { cn, renderFormattedDate } from "@plane/utils"; //helpers -import { renderFormattedDate } from "@/helpers/date-time.helper"; +// //hooks import { useTimeLineChartStore } from "@/hooks/use-timeline-chart"; diff --git a/web/core/components/gantt-chart/helpers/blockResizables/use-gantt-resizable.ts b/web/core/components/gantt-chart/helpers/blockResizables/use-gantt-resizable.ts index c96a2572502..b96e583907b 100644 --- a/web/core/components/gantt-chart/helpers/blockResizables/use-gantt-resizable.ts +++ b/web/core/components/gantt-chart/helpers/blockResizables/use-gantt-resizable.ts @@ -1,11 +1,11 @@ import { useRef, useState } from "react"; // Plane +import type { IBlockUpdateDependencyData, IGanttBlock } from "@plane/types"; import { setToast, TOAST_TYPE } from "@plane/ui"; // hooks import { useTimeLineChartStore } from "@/hooks/use-timeline-chart"; // import { DEFAULT_BLOCK_WIDTH, SIDEBAR_WIDTH } from "../../constants"; -import { IBlockUpdateDependencyData, IGanttBlock } from "../../types"; export const useGanttResizable = ( block: IGanttBlock, diff --git a/web/core/components/gantt-chart/helpers/draggable.tsx b/web/core/components/gantt-chart/helpers/draggable.tsx index a19b19f634e..35babf9c3ec 100644 --- a/web/core/components/gantt-chart/helpers/draggable.tsx +++ b/web/core/components/gantt-chart/helpers/draggable.tsx @@ -1,9 +1,9 @@ import React, { RefObject } from "react"; import { observer } from "mobx-react"; // hooks -import { IGanttBlock } from "@/components/gantt-chart"; +import type { IGanttBlock } from "@plane/types"; // helpers -import { cn } from "@/helpers/common.helper"; +import { cn } from "@plane/utils"; // Plane-web import { LeftDependencyDraggable, RightDependencyDraggable } from "@/plane-web/components/gantt-chart"; // diff --git a/web/core/components/gantt-chart/root.tsx b/web/core/components/gantt-chart/root.tsx index 3ed21d1440a..a88bd390563 100644 --- a/web/core/components/gantt-chart/root.tsx +++ b/web/core/components/gantt-chart/root.tsx @@ -1,7 +1,7 @@ import { FC, useEffect } from "react"; import { observer } from "mobx-react"; // components -import { ChartViewRoot, IBlockUpdateData, IBlockUpdateDependencyData } from "@/components/gantt-chart"; +import type { ChartViewRoot, IBlockUpdateData, IBlockUpdateDependencyData } from "@plane/types"; // hooks import { useTimeLineChartStore } from "@/hooks/use-timeline-chart"; diff --git a/web/core/components/gantt-chart/sidebar/issues/block.tsx b/web/core/components/gantt-chart/sidebar/issues/block.tsx index c0218aceb16..730e9c6c59a 100644 --- a/web/core/components/gantt-chart/sidebar/issues/block.tsx +++ b/web/core/components/gantt-chart/sidebar/issues/block.tsx @@ -1,10 +1,11 @@ import { observer } from "mobx-react"; // components +import type { IGanttBlock } from "@plane/types"; import { Row } from "@plane/ui"; +import { cn } from "@plane/utils"; import { MultipleSelectEntityAction } from "@/components/core"; import { IssueGanttSidebarBlock } from "@/components/issues"; // helpers -import { cn } from "@/helpers/common.helper"; // hooks import { useIssueDetail } from "@/hooks/store"; import { TSelectionHelper } from "@/hooks/use-multiple-select"; @@ -12,7 +13,6 @@ import { useTimeLineChartStore } from "@/hooks/use-timeline-chart"; // constants import { BLOCK_HEIGHT, GANTT_SELECT_GROUP } from "../../constants"; // types -import { IGanttBlock } from "../../types"; type Props = { block: IGanttBlock; diff --git a/web/core/components/gantt-chart/sidebar/issues/sidebar.tsx b/web/core/components/gantt-chart/sidebar/issues/sidebar.tsx index d2e5557ff84..30be6512b7a 100644 --- a/web/core/components/gantt-chart/sidebar/issues/sidebar.tsx +++ b/web/core/components/gantt-chart/sidebar/issues/sidebar.tsx @@ -3,10 +3,10 @@ import { RefObject, useState } from "react"; import { observer } from "mobx-react"; // ui +import type { IBlockUpdateData } from "@plane/types"; import { Loader } from "@plane/ui"; // components import RenderIfVisible from "@/components/core/render-if-visible-HOC"; -import { IBlockUpdateData } from "@/components/gantt-chart/types"; import { GanttLayoutLIstItem } from "@/components/ui"; //hooks import { useIntersectionObserver } from "@/hooks/use-intersection-observer"; diff --git a/web/core/components/gantt-chart/sidebar/modules/block.tsx b/web/core/components/gantt-chart/sidebar/modules/block.tsx index fb8eaf48183..04563db6135 100644 --- a/web/core/components/gantt-chart/sidebar/modules/block.tsx +++ b/web/core/components/gantt-chart/sidebar/modules/block.tsx @@ -2,10 +2,10 @@ import { observer } from "mobx-react"; // Plane import { Row } from "@plane/ui"; // components +import { cn } from "@plane/utils"; import { BLOCK_HEIGHT } from "@/components/gantt-chart/constants"; import { ModuleGanttSidebarBlock } from "@/components/modules"; // helpers -import { cn } from "@/helpers/common.helper"; // hooks import { useTimeLineChartStore } from "@/hooks/use-timeline-chart"; diff --git a/web/core/components/gantt-chart/sidebar/modules/sidebar.tsx b/web/core/components/gantt-chart/sidebar/modules/sidebar.tsx index 182fcefacc3..9c3715a76c8 100644 --- a/web/core/components/gantt-chart/sidebar/modules/sidebar.tsx +++ b/web/core/components/gantt-chart/sidebar/modules/sidebar.tsx @@ -2,9 +2,9 @@ import { observer } from "mobx-react"; // ui +import type { IBlockUpdateData } from "@plane/types"; import { Loader } from "@plane/ui"; // components -import { IBlockUpdateData } from "@/components/gantt-chart"; // hooks import { useTimeLineChart } from "@/hooks/use-timeline-chart"; // diff --git a/web/core/components/gantt-chart/sidebar/root.tsx b/web/core/components/gantt-chart/sidebar/root.tsx index 7f6866ad686..e4f2f8d0c7f 100644 --- a/web/core/components/gantt-chart/sidebar/root.tsx +++ b/web/core/components/gantt-chart/sidebar/root.tsx @@ -2,11 +2,11 @@ import { RefObject } from "react"; import { observer } from "mobx-react"; import { useTranslation } from "@plane/i18n"; // components +import type { ChartDataType, IBlockUpdateData, IGanttBlock } from "@plane/types"; import { Row, ERowVariant } from "@plane/ui"; +import { cn } from "@plane/utils"; import { MultipleSelectGroupAction } from "@/components/core"; -import { ChartDataType, IBlockUpdateData, IGanttBlock } from "@/components/gantt-chart"; // helpers -import { cn } from "@/helpers/common.helper"; // hooks import { TSelectionHelper } from "@/hooks/use-multiple-select"; // constants diff --git a/web/core/components/gantt-chart/sidebar/utils.ts b/web/core/components/gantt-chart/sidebar/utils.ts index 15b8e55fcda..28590e34862 100644 --- a/web/core/components/gantt-chart/sidebar/utils.ts +++ b/web/core/components/gantt-chart/sidebar/utils.ts @@ -1,4 +1,4 @@ -import { ChartDataType, IBlockUpdateData, IGanttBlock } from "../types"; +import type { ChartDataType, IBlockUpdateData, IGanttBlock } from "@plane/types"; export const handleOrderChange = ( draggingBlockId: string | undefined, diff --git a/web/core/components/gantt-chart/views/helpers.ts b/web/core/components/gantt-chart/views/helpers.ts index 81064bd4698..3a603f70bdc 100644 --- a/web/core/components/gantt-chart/views/helpers.ts +++ b/web/core/components/gantt-chart/views/helpers.ts @@ -1,6 +1,6 @@ -import { addDaysToDate, findTotalDaysInRange, getDate } from "@/helpers/date-time.helper"; +import type { ChartDataType, IGanttBlock } from "@plane/types"; +import { addDaysToDate, findTotalDaysInRange, getDate } from "@plane/utils"; import { DEFAULT_BLOCK_WIDTH } from "../constants"; -import { ChartDataType, IGanttBlock } from "../types"; /** * Generates Date by using Day, month and Year diff --git a/web/core/components/gantt-chart/views/month-view.ts b/web/core/components/gantt-chart/views/month-view.ts index 41acf14d5d7..178a68d670a 100644 --- a/web/core/components/gantt-chart/views/month-view.ts +++ b/web/core/components/gantt-chart/views/month-view.ts @@ -1,8 +1,8 @@ import cloneDeep from "lodash/cloneDeep"; import uniqBy from "lodash/uniqBy"; // +import type { ChartDataType } from "@plane/types"; import { months } from "../data"; -import { ChartDataType } from "../types"; import { getNumberOfDaysBetweenTwoDates, getNumberOfDaysInMonth } from "./helpers"; import { getWeeksBetweenTwoDates, IWeekBlock } from "./week-view"; diff --git a/web/core/components/gantt-chart/views/quarter-view.ts b/web/core/components/gantt-chart/views/quarter-view.ts index a584a26e35f..b8541bf9816 100644 --- a/web/core/components/gantt-chart/views/quarter-view.ts +++ b/web/core/components/gantt-chart/views/quarter-view.ts @@ -1,6 +1,6 @@ // +import type { ChartDataType } from "@plane/types"; import { quarters } from "../data"; -import { ChartDataType } from "../types"; import { getNumberOfDaysBetweenTwoDates } from "./helpers"; import { getMonthsBetweenTwoDates, IMonthBlock } from "./month-view"; diff --git a/web/core/components/gantt-chart/views/week-view.ts b/web/core/components/gantt-chart/views/week-view.ts index ea3d75f91b5..c7b4ce6f4e4 100644 --- a/web/core/components/gantt-chart/views/week-view.ts +++ b/web/core/components/gantt-chart/views/week-view.ts @@ -1,7 +1,7 @@ // import { EStartOfTheWeek } from "@plane/constants"; +import type { ChartDataType } from "@plane/types"; import { months, generateWeeks } from "../data"; -import { ChartDataType } from "../types"; import { getNumberOfDaysBetweenTwoDates, getWeekNumberByDate } from "./helpers"; export interface IDayBlock { date: Date; diff --git a/web/core/components/global/product-updates/footer.tsx b/web/core/components/global/product-updates/footer.tsx index 5d402e85eef..84966e6370d 100644 --- a/web/core/components/global/product-updates/footer.tsx +++ b/web/core/components/global/product-updates/footer.tsx @@ -3,7 +3,7 @@ import { useTranslation } from "@plane/i18n"; // ui import { getButtonStyling } from "@plane/ui"; // helpers -import { cn } from "@/helpers/common.helper"; +import { cn } from "@plane/utils"; // assets import PlaneLogo from "@/public/plane-logos/blue-without-text.png"; diff --git a/web/core/components/graphs/issues-by-priority.tsx b/web/core/components/graphs/issues-by-priority.tsx index faed3709ec6..152a930defe 100644 --- a/web/core/components/graphs/issues-by-priority.tsx +++ b/web/core/components/graphs/issues-by-priority.tsx @@ -3,9 +3,9 @@ import { Theme, linearGradientDef } from "@nivo/core"; import { ISSUE_PRIORITIES } from "@plane/constants"; // components import { TIssuePriorities } from "@plane/types"; +import { capitalizeFirstLetter } from "@plane/utils"; import { BarGraph } from "@/components/ui"; // helpers -import { capitalizeFirstLetter } from "@/helpers/string.helper"; // gradients for work items by priority widget graph bars export const PRIORITY_GRAPH_GRADIENTS = [ diff --git a/web/core/components/home/root.tsx b/web/core/components/home/root.tsx index b4e75ce95bc..c350d3119b8 100644 --- a/web/core/components/home/root.tsx +++ b/web/core/components/home/root.tsx @@ -4,10 +4,10 @@ import { useParams } from "next/navigation"; import useSWR from "swr"; import { PRODUCT_TOUR_COMPLETED } from "@plane/constants"; import { ContentWrapper } from "@plane/ui"; +import { cn } from "@plane/utils"; import { TourRoot } from "@/components/onboarding"; // constants // helpers -import { cn } from "@/helpers/common.helper"; // hooks import { useUserProfile, useEventTracker, useUser } from "@/hooks/store"; import { useHome } from "@/hooks/store/use-home"; diff --git a/web/core/components/home/widgets/empty-states/no-projects.tsx b/web/core/components/home/widgets/empty-states/no-projects.tsx index f3f35d5a114..be4c8af6488 100644 --- a/web/core/components/home/widgets/empty-states/no-projects.tsx +++ b/web/core/components/home/widgets/empty-states/no-projects.tsx @@ -8,9 +8,8 @@ import { Briefcase, Check, Hotel, Users, X } from "lucide-react"; import { EUserPermissions, EUserPermissionsLevel } from "@plane/constants"; import { useLocalStorage } from "@plane/hooks"; import { useTranslation } from "@plane/i18n"; +import { cn, getFileURL } from "@plane/utils"; // helpers -import { cn } from "@plane/utils"; -import { getFileURL } from "@/helpers/file.helper"; // hooks import { useCommandPalette, diff --git a/web/core/components/home/widgets/manage/widget-item-drag-handle.tsx b/web/core/components/home/widgets/manage/widget-item-drag-handle.tsx index 2995ce08651..b19f74d24c1 100644 --- a/web/core/components/home/widgets/manage/widget-item-drag-handle.tsx +++ b/web/core/components/home/widgets/manage/widget-item-drag-handle.tsx @@ -4,7 +4,7 @@ import { observer } from "mobx-react"; // ui import { DragHandle } from "@plane/ui"; // helper -import { cn } from "@/helpers/common.helper"; +import { cn } from "@plane/utils"; type Props = { sort_order: number | null; diff --git a/web/core/components/home/widgets/recents/issue.tsx b/web/core/components/home/widgets/recents/issue.tsx index d4be2f7f951..33778b64149 100644 --- a/web/core/components/home/widgets/recents/issue.tsx +++ b/web/core/components/home/widgets/recents/issue.tsx @@ -5,12 +5,11 @@ import { EIssueServiceType } from "@plane/constants"; import { TActivityEntityData, TIssueEntityData } from "@plane/types"; // plane ui import { LayersIcon, PriorityIcon, StateGroupIcon, Tooltip } from "@plane/ui"; +import { calculateTimeAgo, generateWorkItemLink } from "@plane/utils"; // components import { ListItem } from "@/components/core/list"; import { MemberDropdown } from "@/components/dropdowns"; // helpers -import { calculateTimeAgo } from "@/helpers/date-time.helper"; -import { generateWorkItemLink } from "@/helpers/issue.helper"; // hooks import { useIssueDetail, useProject, useProjectState } from "@/hooks/store"; // plane web components diff --git a/web/core/components/home/widgets/recents/page.tsx b/web/core/components/home/widgets/recents/page.tsx index 532831d3229..b1ded3f44fa 100644 --- a/web/core/components/home/widgets/recents/page.tsx +++ b/web/core/components/home/widgets/recents/page.tsx @@ -4,13 +4,12 @@ import { FileText } from "lucide-react"; import { TActivityEntityData, TPageEntityData } from "@plane/types"; // plane ui import { Avatar, Logo } from "@plane/ui"; +import { calculateTimeAgo, getFileURL, getPageName } from "@plane/utils"; // plane utils -import { getFileURL } from "@plane/utils"; // components import { ListItem } from "@/components/core/list"; // helpers -import { calculateTimeAgo } from "@/helpers/date-time.helper"; -import { getPageName } from "@/helpers/page.helper"; +// // hooks import { useMember } from "@/hooks/store"; diff --git a/web/core/components/home/widgets/recents/project.tsx b/web/core/components/home/widgets/recents/project.tsx index 9321a017f4e..4943dbde0db 100644 --- a/web/core/components/home/widgets/recents/project.tsx +++ b/web/core/components/home/widgets/recents/project.tsx @@ -4,10 +4,10 @@ import { TActivityEntityData, TProjectEntityData } from "@plane/types"; // plane ui import { Logo } from "@plane/ui"; // components +import { calculateTimeAgo } from "@plane/utils"; import { ListItem } from "@/components/core/list"; import { MemberDropdown } from "@/components/dropdowns"; // helpers -import { calculateTimeAgo } from "@/helpers/date-time.helper"; type BlockProps = { activity: TActivityEntityData; diff --git a/web/core/components/inbox/content/inbox-issue-header.tsx b/web/core/components/inbox/content/inbox-issue-header.tsx index f1ae748ebc3..16e4835cfc6 100644 --- a/web/core/components/inbox/content/inbox-issue-header.tsx +++ b/web/core/components/inbox/content/inbox-issue-header.tsx @@ -15,11 +15,11 @@ import { MoveRight, Copy, } from "lucide-react"; -import { EUserPermissions, EUserPermissionsLevel } from "@plane/constants"; +import { EUserPermissions, EUserPermissionsLevel, EInboxIssueStatus } from "@plane/constants"; import { useTranslation } from "@plane/i18n"; import { TNameDescriptionLoader } from "@plane/types"; import { Button, ControlLink, CustomMenu, Row, TOAST_TYPE, setToast } from "@plane/ui"; -import { copyUrlToClipboard } from "@plane/utils"; +import { copyUrlToClipboard, findHowManyDaysLeft, generateWorkItemLink } from "@plane/utils"; // components import { DeclineIssueModal, @@ -31,9 +31,7 @@ import { } from "@/components/inbox"; import { CreateUpdateIssueModal, NameDescriptionUpdateStatus } from "@/components/issues"; // helpers -import { findHowManyDaysLeft } from "@/helpers/date-time.helper"; -import { EInboxIssueStatus } from "@/helpers/inbox.helper"; -import { generateWorkItemLink } from "@/helpers/issue.helper"; +// // hooks import { useUser, useProjectInbox, useProject, useUserPermissions } from "@/hooks/store"; import { useAppRouter } from "@/hooks/use-app-router"; diff --git a/web/core/components/inbox/content/inbox-issue-mobile-header.tsx b/web/core/components/inbox/content/inbox-issue-mobile-header.tsx index 93b82358719..d5ade21fcb9 100644 --- a/web/core/components/inbox/content/inbox-issue-mobile-header.tsx +++ b/web/core/components/inbox/content/inbox-issue-mobile-header.tsx @@ -17,13 +17,11 @@ import { } from "lucide-react"; import { TNameDescriptionLoader } from "@plane/types"; import { Header, CustomMenu, EHeaderVariant } from "@plane/ui"; +import { cn, findHowManyDaysLeft, generateWorkItemLink } from "@plane/utils"; // components import { InboxIssueStatus } from "@/components/inbox"; import { NameDescriptionUpdateStatus } from "@/components/issues"; // helpers -import { cn } from "@/helpers/common.helper"; -import { findHowManyDaysLeft } from "@/helpers/date-time.helper"; -import { generateWorkItemLink } from "@/helpers/issue.helper"; // hooks import { useProject } from "@/hooks/store"; import { useAppRouter } from "@/hooks/use-app-router"; diff --git a/web/core/components/inbox/content/issue-properties.tsx b/web/core/components/inbox/content/issue-properties.tsx index e189df9fa5c..d5bfa4ebcc9 100644 --- a/web/core/components/inbox/content/issue-properties.tsx +++ b/web/core/components/inbox/content/issue-properties.tsx @@ -5,12 +5,11 @@ import { observer } from "mobx-react"; import { CalendarCheck2, CopyPlus, Signal, Tag, Users } from "lucide-react"; import { TInboxDuplicateIssueDetails, TIssue } from "@plane/types"; import { ControlLink, DoubleCircleIcon, Tooltip } from "@plane/ui"; +import { getDate, renderFormattedPayloadDate, generateWorkItemLink } from "@plane/utils"; // components import { DateDropdown, PriorityDropdown, MemberDropdown, StateDropdown } from "@/components/dropdowns"; import { IssueLabel, TIssueOperations } from "@/components/issues"; // helper -import { getDate, renderFormattedPayloadDate } from "@/helpers/date-time.helper"; -import { generateWorkItemLink } from "@/helpers/issue.helper"; // hooks import { useProject } from "@/hooks/store"; import { useAppRouter } from "@/hooks/use-app-router"; diff --git a/web/core/components/inbox/content/issue-root.tsx b/web/core/components/inbox/content/issue-root.tsx index 3aee2905019..e0469834382 100644 --- a/web/core/components/inbox/content/issue-root.tsx +++ b/web/core/components/inbox/content/issue-root.tsx @@ -9,6 +9,7 @@ import { EditorRefApi } from "@plane/editor"; import { TIssue, TNameDescriptionLoader } from "@plane/types"; import { Loader, TOAST_TYPE, setToast } from "@plane/ui"; // components +import { getTextContent } from "@plane/utils"; import { DescriptionVersionsRoot } from "@/components/core/description-versions"; import { InboxIssueContentProperties } from "@/components/inbox/content"; import { @@ -20,7 +21,6 @@ import { IssueAttachmentRoot, } from "@/components/issues"; // helpers -import { getTextContent } from "@/helpers/editor.helper"; // hooks import { useEventTracker, useIssueDetail, useMember, useProject, useProjectInbox, useUser } from "@/hooks/store"; import useReloadConfirmations from "@/hooks/use-reload-confirmation"; diff --git a/web/core/components/inbox/inbox-filter/applied-filters/date.tsx b/web/core/components/inbox/inbox-filter/applied-filters/date.tsx index b8673f2057d..956f75719ac 100644 --- a/web/core/components/inbox/inbox-filter/applied-filters/date.tsx +++ b/web/core/components/inbox/inbox-filter/applied-filters/date.tsx @@ -1,12 +1,12 @@ import { FC } from "react"; import { observer } from "mobx-react"; import { X } from "lucide-react"; +import { PAST_DURATION_FILTER_OPTIONS } from "@plane/constants"; import { TInboxIssueFilterDateKeys } from "@plane/types"; // helpers import { Tag } from "@plane/ui"; -import { renderFormattedDate } from "@/helpers/date-time.helper"; +import { renderFormattedDate } from "@plane/utils"; // constants -import { PAST_DURATION_FILTER_OPTIONS } from "@/helpers/inbox.helper"; // hooks import { useProjectInbox } from "@/hooks/store"; diff --git a/web/core/components/inbox/inbox-filter/applied-filters/member.tsx b/web/core/components/inbox/inbox-filter/applied-filters/member.tsx index aff556c6218..a93095579be 100644 --- a/web/core/components/inbox/inbox-filter/applied-filters/member.tsx +++ b/web/core/components/inbox/inbox-filter/applied-filters/member.tsx @@ -8,7 +8,7 @@ import { TInboxIssueFilterMemberKeys } from "@plane/types"; // plane ui import { Avatar, Tag } from "@plane/ui"; // helpers -import { getFileURL } from "@/helpers/file.helper"; +import { getFileURL } from "@plane/utils"; // hooks import { useMember, useProjectInbox } from "@/hooks/store"; diff --git a/web/core/components/inbox/inbox-filter/filters/date.tsx b/web/core/components/inbox/inbox-filter/filters/date.tsx index aee188be8d6..4eb8d9d3166 100644 --- a/web/core/components/inbox/inbox-filter/filters/date.tsx +++ b/web/core/components/inbox/inbox-filter/filters/date.tsx @@ -2,12 +2,12 @@ import { FC, useState } from "react"; import concat from "lodash/concat"; import uniq from "lodash/uniq"; import { observer } from "mobx-react"; +import { PAST_DURATION_FILTER_OPTIONS } from "@plane/constants"; import { TInboxIssueFilterDateKeys } from "@plane/types"; // components import { DateFilterModal } from "@/components/core"; import { FilterHeader, FilterOption } from "@/components/issues"; // constants -import { PAST_DURATION_FILTER_OPTIONS } from "@/helpers/inbox.helper"; // hooks import { useProjectInbox } from "@/hooks/store"; diff --git a/web/core/components/inbox/inbox-filter/filters/members.tsx b/web/core/components/inbox/inbox-filter/filters/members.tsx index 1dcf2de6830..77ce95c4eeb 100644 --- a/web/core/components/inbox/inbox-filter/filters/members.tsx +++ b/web/core/components/inbox/inbox-filter/filters/members.tsx @@ -8,9 +8,9 @@ import { TInboxIssueFilterMemberKeys } from "@plane/types"; // plane ui import { Avatar, Loader } from "@plane/ui"; // components +import { getFileURL } from "@plane/utils"; import { FilterHeader, FilterOption } from "@/components/issues"; // helpers -import { getFileURL } from "@/helpers/file.helper"; // hooks import { useMember, useProjectInbox, useUser } from "@/hooks/store"; diff --git a/web/core/components/inbox/inbox-filter/sorting/order-by.tsx b/web/core/components/inbox/inbox-filter/sorting/order-by.tsx index d3dabbf8633..b65a201609b 100644 --- a/web/core/components/inbox/inbox-filter/sorting/order-by.tsx +++ b/web/core/components/inbox/inbox-filter/sorting/order-by.tsx @@ -9,7 +9,7 @@ import { TInboxIssueSortingOrderByKeys, TInboxIssueSortingSortByKeys } from "@pl import { CustomMenu, getButtonStyling } from "@plane/ui"; // constants // helpers -import { cn } from "@/helpers/common.helper"; +import { cn } from "@plane/utils"; // hooks import { useProjectInbox } from "@/hooks/store"; import useSize from "@/hooks/use-window-size"; diff --git a/web/core/components/inbox/inbox-issue-status.tsx b/web/core/components/inbox/inbox-issue-status.tsx index 8e7867a7572..00a7d08870c 100644 --- a/web/core/components/inbox/inbox-issue-status.tsx +++ b/web/core/components/inbox/inbox-issue-status.tsx @@ -4,8 +4,7 @@ import { observer } from "mobx-react"; // helpers import { INBOX_STATUS } from "@plane/constants"; import { useTranslation } from "@plane/i18n"; -import { cn } from "@/helpers/common.helper"; -import { findHowManyDaysLeft } from "@/helpers/date-time.helper"; +import { cn, findHowManyDaysLeft } from "@plane/utils"; // store import { IInboxIssueStore } from "@/store/inbox/inbox-issue.store"; import { ICON_PROPERTIES, InboxStatusIcon } from "./inbox-status-icon"; diff --git a/web/core/components/inbox/modals/create-modal/create-root.tsx b/web/core/components/inbox/modals/create-modal/create-root.tsx index b0a7cb342b9..1afccf7e0d0 100644 --- a/web/core/components/inbox/modals/create-modal/create-root.tsx +++ b/web/core/components/inbox/modals/create-modal/create-root.tsx @@ -10,12 +10,11 @@ import { EditorRefApi } from "@plane/editor"; import { useTranslation } from "@plane/i18n"; import { TIssue } from "@plane/types"; import { Button, ToggleSwitch, TOAST_TYPE, setToast } from "@plane/ui"; +import { renderFormattedPayloadDate, getTabIndex } from "@plane/utils"; // components import { InboxIssueTitle, InboxIssueDescription, InboxIssueProperties } from "@/components/inbox/modals/create-modal"; // constants // helpers -import { renderFormattedPayloadDate } from "@/helpers/date-time.helper"; -import { getTabIndex } from "@/helpers/tab-indices.helper"; // hooks import { useEventTracker, useProject, useProjectInbox, useWorkspace } from "@/hooks/store"; import { useAppRouter } from "@/hooks/use-app-router"; diff --git a/web/core/components/inbox/modals/create-modal/issue-description.tsx b/web/core/components/inbox/modals/create-modal/issue-description.tsx index 4841f9ca1a3..b2511e5d534 100644 --- a/web/core/components/inbox/modals/create-modal/issue-description.tsx +++ b/web/core/components/inbox/modals/create-modal/issue-description.tsx @@ -13,11 +13,10 @@ import { TIssue } from "@plane/types"; import { EFileAssetType } from "@plane/types/src/enums"; // ui import { Loader } from "@plane/ui"; +import { getDescriptionPlaceholderI18n, getTabIndex } from "@plane/utils"; // components import { RichTextEditor } from "@/components/editor/rich-text-editor/rich-text-editor"; // helpers -import { getDescriptionPlaceholderI18n } from "@/helpers/issue.helper"; -import { getTabIndex } from "@/helpers/tab-indices.helper"; // hooks import { useEditorAsset, useProjectInbox } from "@/hooks/store"; import { usePlatformOS } from "@/hooks/use-platform-os"; diff --git a/web/core/components/inbox/modals/create-modal/issue-properties.tsx b/web/core/components/inbox/modals/create-modal/issue-properties.tsx index e237503f441..5f87202cda4 100644 --- a/web/core/components/inbox/modals/create-modal/issue-properties.tsx +++ b/web/core/components/inbox/modals/create-modal/issue-properties.tsx @@ -5,6 +5,7 @@ import { LayoutPanelTop } from "lucide-react"; import { ETabIndices } from "@plane/constants"; import { ISearchIssueResponse, TIssue } from "@plane/types"; import { CustomMenu } from "@plane/ui"; +import { renderFormattedPayloadDate, getDate, getTabIndex } from "@plane/utils"; // components import { CycleDropdown, @@ -18,8 +19,6 @@ import { import { ParentIssuesListModal } from "@/components/issues"; import { IssueLabelSelect } from "@/components/issues/select"; // helpers -import { renderFormattedPayloadDate, getDate } from "@/helpers/date-time.helper"; -import { getTabIndex } from "@/helpers/tab-indices.helper"; // hooks import { useProjectEstimates } from "@/hooks/store"; import { usePlatformOS } from "@/hooks/use-platform-os"; diff --git a/web/core/components/inbox/modals/create-modal/issue-title.tsx b/web/core/components/inbox/modals/create-modal/issue-title.tsx index cd645fb704a..18a38e1f5cc 100644 --- a/web/core/components/inbox/modals/create-modal/issue-title.tsx +++ b/web/core/components/inbox/modals/create-modal/issue-title.tsx @@ -8,7 +8,7 @@ import { useTranslation } from "@plane/i18n"; import { TIssue } from "@plane/types"; import { Input } from "@plane/ui"; // helpers -import { getTabIndex } from "@/helpers/tab-indices.helper"; +import { getTabIndex } from "@plane/utils"; // hooks import { usePlatformOS } from "@/hooks/use-platform-os"; diff --git a/web/core/components/inbox/root.tsx b/web/core/components/inbox/root.tsx index 010b76e96a3..17e8aefefec 100644 --- a/web/core/components/inbox/root.tsx +++ b/web/core/components/inbox/root.tsx @@ -2,15 +2,15 @@ import { FC, useEffect, useState } from "react"; import { observer } from "mobx-react"; import { PanelLeft } from "lucide-react"; // plane imports +import { EInboxIssueCurrentTab } from "@plane/constants"; import { useTranslation } from "@plane/i18n"; import { Intake } from "@plane/ui"; // components +import { cn } from "@plane/utils"; import { SimpleEmptyState } from "@/components/empty-state"; import { InboxSidebar, InboxContentRoot } from "@/components/inbox"; import { InboxLayoutLoader } from "@/components/ui"; // helpers -import { cn } from "@/helpers/common.helper"; -import { EInboxIssueCurrentTab } from "@/helpers/inbox.helper"; // hooks import { useProjectInbox } from "@/hooks/store"; import { useResolvedAssetPath } from "@/hooks/use-resolved-asset-path"; diff --git a/web/core/components/inbox/sidebar/inbox-list-item.tsx b/web/core/components/inbox/sidebar/inbox-list-item.tsx index 05fcf9f3c13..308092fee54 100644 --- a/web/core/components/inbox/sidebar/inbox-list-item.tsx +++ b/web/core/components/inbox/sidebar/inbox-list-item.tsx @@ -5,14 +5,12 @@ import { observer } from "mobx-react"; import Link from "next/link"; import { useSearchParams } from "next/navigation"; import { Tooltip, PriorityIcon, Row, Avatar } from "@plane/ui"; +import { cn, renderFormattedDate, getFileURL } from "@plane/utils"; // components import { ButtonAvatars } from "@/components/dropdowns/member/avatar"; import { InboxIssueStatus } from "@/components/inbox"; // helpers -import { cn } from "@/helpers/common.helper"; -import { renderFormattedDate } from "@/helpers/date-time.helper"; // hooks -import { getFileURL } from "@/helpers/file.helper"; import { useLabel, useMember, useProjectInbox } from "@/hooks/store"; import { usePlatformOS } from "@/hooks/use-platform-os"; import { InboxSourcePill } from "@/plane-web/components/inbox/source-pill"; diff --git a/web/core/components/inbox/sidebar/root.tsx b/web/core/components/inbox/sidebar/root.tsx index f30f5565d37..15c0410f0f4 100644 --- a/web/core/components/inbox/sidebar/root.tsx +++ b/web/core/components/inbox/sidebar/root.tsx @@ -2,17 +2,16 @@ import { FC, useCallback, useEffect, useRef, useState } from "react"; import { observer } from "mobx-react"; +import { TInboxIssueCurrentTab, EInboxIssueCurrentTab } from "@plane/constants"; // plane imports -import { TInboxIssueCurrentTab } from "@plane/constants"; import { useTranslation } from "@plane/i18n"; import { Header, Loader, EHeaderVariant } from "@plane/ui"; // components +import { cn } from "@plane/utils"; import { SimpleEmptyState } from "@/components/empty-state"; import { FiltersRoot, InboxIssueAppliedFilters, InboxIssueList } from "@/components/inbox"; import { InboxSidebarLoader } from "@/components/ui"; // helpers -import { cn } from "@/helpers/common.helper"; -import { EInboxIssueCurrentTab } from "@/helpers/inbox.helper"; // hooks import { useProject, useProjectInbox } from "@/hooks/store"; import { useAppRouter } from "@/hooks/use-app-router"; diff --git a/web/core/components/instance/not-ready-view.tsx b/web/core/components/instance/not-ready-view.tsx index 8d317634a84..1d978b7abde 100644 --- a/web/core/components/instance/not-ready-view.tsx +++ b/web/core/components/instance/not-ready-view.tsx @@ -4,9 +4,9 @@ import { FC } from "react"; import Image from "next/image"; import Link from "next/link"; import { useTheme } from "next-themes"; +import { GOD_MODE_URL } from "@plane/constants"; import { Button } from "@plane/ui"; // helpers -import { GOD_MODE_URL } from "@/helpers/common.helper"; // images // assets import PlaneBackgroundPatternDark from "@/public/auth/background-pattern-dark.svg"; diff --git a/web/core/components/integration/github/import-data.tsx b/web/core/components/integration/github/import-data.tsx index 75226e78826..d1343b523b5 100644 --- a/web/core/components/integration/github/import-data.tsx +++ b/web/core/components/integration/github/import-data.tsx @@ -7,10 +7,10 @@ import { IWorkspaceIntegration } from "@plane/types"; // hooks // components import { Button, CustomSearchSelect, ToggleSwitch } from "@plane/ui"; +import { truncateText } from "@plane/utils"; import { SelectRepository, TFormValues, TIntegrationSteps } from "@/components/integration"; // ui // helpers -import { truncateText } from "@/helpers/string.helper"; import { useProject } from "@/hooks/store"; // types diff --git a/web/core/components/integration/github/select-repository.tsx b/web/core/components/integration/github/select-repository.tsx index 122e534dfe5..05936cfa78a 100644 --- a/web/core/components/integration/github/select-repository.tsx +++ b/web/core/components/integration/github/select-repository.tsx @@ -8,7 +8,7 @@ import { IWorkspaceIntegration } from "@plane/types"; // ui import { CustomSearchSelect } from "@plane/ui"; // helpers -import { truncateText } from "@/helpers/string.helper"; +import { truncateText } from "@plane/utils"; import { ProjectService } from "@/services/project"; // types diff --git a/web/core/components/integration/github/single-user-select.tsx b/web/core/components/integration/github/single-user-select.tsx index c2ecda03e86..3b24338bceb 100644 --- a/web/core/components/integration/github/single-user-select.tsx +++ b/web/core/components/integration/github/single-user-select.tsx @@ -7,9 +7,9 @@ import { IGithubRepoCollaborator } from "@plane/types"; // plane ui import { Avatar, CustomSelect, CustomSearchSelect, Input } from "@plane/ui"; // constants +import { getFileURL } from "@plane/utils"; import { WORKSPACE_MEMBERS } from "@/constants/fetch-keys"; // helpers -import { getFileURL } from "@/helpers/file.helper"; // plane web services import { WorkspaceService } from "@/plane-web/services"; // types diff --git a/web/core/components/integration/jira/give-details.tsx b/web/core/components/integration/jira/give-details.tsx index f26318e3ac4..a9f12e709bd 100644 --- a/web/core/components/integration/jira/give-details.tsx +++ b/web/core/components/integration/jira/give-details.tsx @@ -10,7 +10,7 @@ import { IJiraImporterForm } from "@plane/types"; // components import { CustomSelect, Input } from "@plane/ui"; // helpers -import { checkEmailValidity } from "@/helpers/string.helper"; +import { checkEmailValidity } from "@plane/utils"; import { useCommandPalette, useEventTracker, useProject } from "@/hooks/store"; // types diff --git a/web/core/components/integration/jira/import-users.tsx b/web/core/components/integration/jira/import-users.tsx index 6bffece7fc3..7a35aa9d4ef 100644 --- a/web/core/components/integration/jira/import-users.tsx +++ b/web/core/components/integration/jira/import-users.tsx @@ -9,9 +9,9 @@ import { IJiraImporterForm } from "@plane/types"; // plane ui import { Avatar, CustomSelect, CustomSearchSelect, Input, ToggleSwitch } from "@plane/ui"; // constants +import { getFileURL } from "@plane/utils"; import { WORKSPACE_MEMBERS } from "@/constants/fetch-keys"; // helpers -import { getFileURL } from "@/helpers/file.helper"; // plane web services import { WorkspaceService } from "@/plane-web/services"; diff --git a/web/core/components/integration/single-import.tsx b/web/core/components/integration/single-import.tsx index 6be8c02c9ab..247fb0f8e67 100644 --- a/web/core/components/integration/single-import.tsx +++ b/web/core/components/integration/single-import.tsx @@ -10,7 +10,7 @@ import { CustomMenu } from "@plane/ui"; // icons // helpers -import { renderFormattedDate } from "@/helpers/date-time.helper"; +import { renderFormattedDate } from "@plane/utils"; // types // constants diff --git a/web/core/components/issues/archived-issues-header.tsx b/web/core/components/issues/archived-issues-header.tsx index 4e2eaebd9d4..28bc63e0896 100644 --- a/web/core/components/issues/archived-issues-header.tsx +++ b/web/core/components/issues/archived-issues-header.tsx @@ -8,10 +8,10 @@ import { useTranslation } from "@plane/i18n"; // types import type { IIssueDisplayFilterOptions, IIssueDisplayProperties, IIssueFilterOptions } from "@plane/types"; // components +import { isIssueFilterActive } from "@plane/utils"; import { ArchiveTabsList } from "@/components/archives"; import { DisplayFiltersSelection, FilterSelection, FiltersDropdown } from "@/components/issues"; // helpers -import { isIssueFilterActive } from "@/helpers/filter.helper"; // hooks import { useIssues, useLabel, useMember, useProject, useProjectState } from "@/hooks/store"; diff --git a/web/core/components/issues/attachment/attachment-detail.tsx b/web/core/components/issues/attachment/attachment-detail.tsx index 315d579f5f2..ecfc0f4c4d1 100644 --- a/web/core/components/issues/attachment/attachment-detail.tsx +++ b/web/core/components/issues/attachment/attachment-detail.tsx @@ -6,15 +6,13 @@ import Link from "next/link"; import { AlertCircle, X } from "lucide-react"; // ui import { Tooltip } from "@plane/ui"; +import { convertBytesToSize, getFileExtension, getFileName, getFileURL, renderFormattedDate, truncateText } from "@plane/utils"; // icons +// import { getFileIcon } from "@/components/icons"; // components import { IssueAttachmentDeleteModal } from "@/components/issues"; // helpers -import { convertBytesToSize, getFileExtension, getFileName } from "@/helpers/attachment.helper"; -import { renderFormattedDate } from "@/helpers/date-time.helper"; -import { getFileURL } from "@/helpers/file.helper"; -import { truncateText } from "@/helpers/string.helper"; // hooks import { useIssueDetail, useMember } from "@/hooks/store"; import { usePlatformOS } from "@/hooks/use-platform-os"; diff --git a/web/core/components/issues/attachment/attachment-list-item.tsx b/web/core/components/issues/attachment/attachment-list-item.tsx index 0458f448519..e7df230a25a 100644 --- a/web/core/components/issues/attachment/attachment-list-item.tsx +++ b/web/core/components/issues/attachment/attachment-list-item.tsx @@ -8,13 +8,12 @@ import { useTranslation } from "@plane/i18n"; import { TIssueServiceType } from "@plane/types"; // ui import { CustomMenu, Tooltip } from "@plane/ui"; +import { convertBytesToSize, getFileExtension, getFileName, getFileURL, renderFormattedDate } from "@plane/utils"; // components +// import { ButtonAvatars } from "@/components/dropdowns/member/avatar"; import { getFileIcon } from "@/components/icons"; // helpers -import { convertBytesToSize, getFileExtension, getFileName } from "@/helpers/attachment.helper"; -import { renderFormattedDate } from "@/helpers/date-time.helper"; -import { getFileURL } from "@/helpers/file.helper"; // hooks import { useIssueDetail, useMember } from "@/hooks/store"; import { usePlatformOS } from "@/hooks/use-platform-os"; diff --git a/web/core/components/issues/attachment/attachment-list-upload-item.tsx b/web/core/components/issues/attachment/attachment-list-upload-item.tsx index 8ea9d3470e2..61924a25f06 100644 --- a/web/core/components/issues/attachment/attachment-list-upload-item.tsx +++ b/web/core/components/issues/attachment/attachment-list-upload-item.tsx @@ -4,9 +4,9 @@ import { observer } from "mobx-react"; // ui import { CircularProgressIndicator, Tooltip } from "@plane/ui"; // components +import { getFileExtension } from "@plane/utils"; import { getFileIcon } from "@/components/icons"; // helpers -import { getFileExtension } from "@/helpers/attachment.helper"; // hooks import { usePlatformOS } from "@/hooks/use-platform-os"; // types diff --git a/web/core/components/issues/attachment/attachment-upload-details.tsx b/web/core/components/issues/attachment/attachment-upload-details.tsx index 6d4eca96e8b..1bc36318bbe 100644 --- a/web/core/components/issues/attachment/attachment-upload-details.tsx +++ b/web/core/components/issues/attachment/attachment-upload-details.tsx @@ -1,13 +1,12 @@ "use client"; import { observer } from "mobx-react"; -// ui import { CircularProgressIndicator, Tooltip } from "@plane/ui"; +import { getFileExtension, truncateText } from "@plane/utils"; +// ui // icons import { getFileIcon } from "@/components/icons"; // helpers -import { getFileExtension } from "@/helpers/attachment.helper"; -import { truncateText } from "@/helpers/string.helper"; // hooks import { usePlatformOS } from "@/hooks/use-platform-os"; // types diff --git a/web/core/components/issues/attachment/delete-attachment-modal.tsx b/web/core/components/issues/attachment/delete-attachment-modal.tsx index 2b2833fd3a8..046b90a5d1b 100644 --- a/web/core/components/issues/attachment/delete-attachment-modal.tsx +++ b/web/core/components/issues/attachment/delete-attachment-modal.tsx @@ -9,7 +9,7 @@ import { TIssueServiceType } from "@plane/types"; // ui import { AlertModalCore } from "@plane/ui"; // helper -import { getFileName } from "@/helpers/attachment.helper"; +import { getFileName } from "@plane/utils"; // hooks import { useIssueDetail } from "@/hooks/store"; // types diff --git a/web/core/components/issues/bulk-operations/upgrade-banner.tsx b/web/core/components/issues/bulk-operations/upgrade-banner.tsx index fef0cb6172d..b7ecc9cf99c 100644 --- a/web/core/components/issues/bulk-operations/upgrade-banner.tsx +++ b/web/core/components/issues/bulk-operations/upgrade-banner.tsx @@ -2,7 +2,7 @@ import { MARKETING_PLANE_ONE_PAGE_LINK } from "@plane/constants"; import { getButtonStyling } from "@plane/ui"; -import { cn } from "@/helpers/common.helper"; +import { cn } from "@plane/utils"; type Props = { className?: string; diff --git a/web/core/components/issues/create-issue-toast-action-items.tsx b/web/core/components/issues/create-issue-toast-action-items.tsx index f324710f216..f0a19249ecd 100644 --- a/web/core/components/issues/create-issue-toast-action-items.tsx +++ b/web/core/components/issues/create-issue-toast-action-items.tsx @@ -1,10 +1,9 @@ "use client"; import React, { FC, useState } from "react"; import { observer } from "mobx-react"; +import { copyUrlToClipboard, generateWorkItemLink } from "@plane/utils"; // plane imports -import { copyUrlToClipboard } from "@plane/utils"; // helpers -import { generateWorkItemLink } from "@/helpers/issue.helper"; // hooks import { useIssueDetail, useProject } from "@/hooks/store"; diff --git a/web/core/components/issues/description-input.tsx b/web/core/components/issues/description-input.tsx index fd8ae823e12..b12a45c509b 100644 --- a/web/core/components/issues/description-input.tsx +++ b/web/core/components/issues/description-input.tsx @@ -11,10 +11,10 @@ import { TIssue, TNameDescriptionLoader } from "@plane/types"; import { EFileAssetType } from "@plane/types/src/enums"; import { Loader } from "@plane/ui"; // components +import { getDescriptionPlaceholderI18n } from "@plane/utils"; import { RichTextEditor, RichTextReadOnlyEditor } from "@/components/editor"; import { TIssueOperations } from "@/components/issues/issue-detail"; // helpers -import { getDescriptionPlaceholderI18n } from "@/helpers/issue.helper"; // hooks import { useEditorAsset, useWorkspace } from "@/hooks/store"; // plane web services diff --git a/web/core/components/issues/filters.tsx b/web/core/components/issues/filters.tsx index a50afe50ebc..05859986c55 100644 --- a/web/core/components/issues/filters.tsx +++ b/web/core/components/issues/filters.tsx @@ -10,9 +10,9 @@ import { useTranslation } from "@plane/i18n"; import { IIssueDisplayFilterOptions, IIssueDisplayProperties, IIssueFilterOptions } from "@plane/types"; import { Button } from "@plane/ui"; // components +import { isIssueFilterActive } from "@plane/utils"; import { DisplayFiltersSelection, FiltersDropdown, FilterSelection, LayoutSelection } from "@/components/issues"; // helpers -import { isIssueFilterActive } from "@/helpers/filter.helper"; // hooks import { useLabel, useProjectState, useMember, useIssues } from "@/hooks/store"; // plane web types diff --git a/web/core/components/issues/issue-detail-widgets/sub-issues/issues-list/list-item.tsx b/web/core/components/issues/issue-detail-widgets/sub-issues/issues-list/list-item.tsx index 1d581929c31..73e5b29f02c 100644 --- a/web/core/components/issues/issue-detail-widgets/sub-issues/issues-list/list-item.tsx +++ b/web/core/components/issues/issue-detail-widgets/sub-issues/issues-list/list-item.tsx @@ -7,11 +7,10 @@ import { EIssueServiceType, EIssuesStoreType } from "@plane/constants"; import { useTranslation } from "@plane/i18n"; import { TIssue, TIssueServiceType, TSubIssueOperations } from "@plane/types"; import { ControlLink, CustomMenu, Tooltip } from "@plane/ui"; +import { cn, generateWorkItemLink } from "@plane/utils"; // helpers import { useSubIssueOperations } from "@/components/issues/issue-detail-widgets/sub-issues/helper"; import { WithDisplayPropertiesHOC } from "@/components/issues/issue-layouts/properties/with-display-properties-HOC"; -import { cn } from "@/helpers/common.helper"; -import { generateWorkItemLink } from "@/helpers/issue.helper"; // hooks import { useIssueDetail, useProject, useProjectState } from "@/hooks/store"; import useIssuePeekOverviewRedirection from "@/hooks/use-issue-peek-overview-redirection"; diff --git a/web/core/components/issues/issue-detail-widgets/sub-issues/issues-list/properties.tsx b/web/core/components/issues/issue-detail-widgets/sub-issues/issues-list/properties.tsx index a6a8fae3d79..9a7e8b4b7b9 100644 --- a/web/core/components/issues/issue-detail-widgets/sub-issues/issues-list/properties.tsx +++ b/web/core/components/issues/issue-detail-widgets/sub-issues/issues-list/properties.tsx @@ -5,10 +5,10 @@ import { CalendarClock } from "lucide-react"; import { useTranslation } from "@plane/i18n"; import { IIssueDisplayProperties, TIssue } from "@plane/types"; // components +import { getDate, renderFormattedPayloadDate } from "@plane/utils"; import { PriorityDropdown, MemberDropdown, StateDropdown, DateDropdown } from "@/components/dropdowns"; // hooks import { WithDisplayPropertiesHOC } from "@/components/issues/issue-layouts/properties/with-display-properties-HOC"; -import { getDate, renderFormattedPayloadDate } from "@/helpers/date-time.helper"; type Props = { workspaceSlug: string; diff --git a/web/core/components/issues/issue-detail-widgets/widget-button.tsx b/web/core/components/issues/issue-detail-widgets/widget-button.tsx index a683920e924..b34846b87e1 100644 --- a/web/core/components/issues/issue-detail-widgets/widget-button.tsx +++ b/web/core/components/issues/issue-detail-widgets/widget-button.tsx @@ -1,7 +1,7 @@ "use client"; import React, { FC } from "react"; // helpers -import { cn } from "@/helpers/common.helper"; +import { cn } from "@plane/utils"; type Props = { icon: JSX.Element; diff --git a/web/core/components/issues/issue-detail/cycle-select.tsx b/web/core/components/issues/issue-detail/cycle-select.tsx index c82f67102d3..cbf7493a8c3 100644 --- a/web/core/components/issues/issue-detail/cycle-select.tsx +++ b/web/core/components/issues/issue-detail/cycle-select.tsx @@ -3,10 +3,10 @@ import { observer } from "mobx-react"; import { useTranslation } from "@plane/i18n"; // hooks // components +import { cn } from "@plane/utils"; import { CycleDropdown } from "@/components/dropdowns"; // ui // helpers -import { cn } from "@/helpers/common.helper"; import { useIssueDetail } from "@/hooks/store"; // types import type { TIssueOperations } from "./root"; diff --git a/web/core/components/issues/issue-detail/issue-activity/activity-filter.tsx b/web/core/components/issues/issue-detail/issue-activity/activity-filter.tsx index 40162dc15d9..88bd2ac861f 100644 --- a/web/core/components/issues/issue-detail/issue-activity/activity-filter.tsx +++ b/web/core/components/issues/issue-detail/issue-activity/activity-filter.tsx @@ -5,7 +5,7 @@ import { TActivityFilters, TActivityFilterOption } from "@plane/constants"; import { useTranslation } from "@plane/i18n"; import { Button, PopoverMenu } from "@plane/ui"; // helper -import { cn } from "@/helpers/common.helper"; +import { cn } from "@plane/utils"; // constants type TActivityFilter = { diff --git a/web/core/components/issues/issue-detail/issue-activity/activity/actions/helpers/activity-block.tsx b/web/core/components/issues/issue-detail/issue-activity/activity/actions/helpers/activity-block.tsx index 6e3ff562c59..663d2aa2c2c 100644 --- a/web/core/components/issues/issue-detail/issue-activity/activity/actions/helpers/activity-block.tsx +++ b/web/core/components/issues/issue-detail/issue-activity/activity/actions/helpers/activity-block.tsx @@ -4,7 +4,7 @@ import { FC, ReactNode } from "react"; import { Network } from "lucide-react"; // hooks import { Tooltip } from "@plane/ui"; -import { renderFormattedTime, renderFormattedDate, calculateTimeAgo } from "@/helpers/date-time.helper"; +import { renderFormattedTime, renderFormattedDate, calculateTimeAgo } from "@plane/utils"; import { useIssueDetail } from "@/hooks/store"; import { usePlatformOS } from "@/hooks/use-platform-os"; // ui diff --git a/web/core/components/issues/issue-detail/issue-activity/activity/actions/helpers/issue-link.tsx b/web/core/components/issues/issue-detail/issue-activity/activity/actions/helpers/issue-link.tsx index 661b513ecf6..80451cb02ed 100644 --- a/web/core/components/issues/issue-detail/issue-activity/activity/actions/helpers/issue-link.tsx +++ b/web/core/components/issues/issue-detail/issue-activity/activity/actions/helpers/issue-link.tsx @@ -3,7 +3,7 @@ import { FC } from "react"; // hooks import { Tooltip } from "@plane/ui"; -import { generateWorkItemLink } from "@/helpers/issue.helper"; +import { generateWorkItemLink } from "@plane/utils"; import { useIssueDetail } from "@/hooks/store"; import { usePlatformOS } from "@/hooks/use-platform-os"; // ui diff --git a/web/core/components/issues/issue-detail/issue-activity/activity/actions/start_date.tsx b/web/core/components/issues/issue-detail/issue-activity/activity/actions/start_date.tsx index b1e0ce03ca7..a55071bf913 100644 --- a/web/core/components/issues/issue-detail/issue-activity/activity/actions/start_date.tsx +++ b/web/core/components/issues/issue-detail/issue-activity/activity/actions/start_date.tsx @@ -2,7 +2,7 @@ import { FC } from "react"; import { observer } from "mobx-react"; import { CalendarDays } from "lucide-react"; // hooks -import { renderFormattedDate } from "@/helpers/date-time.helper"; +import { renderFormattedDate } from "@plane/utils"; import { useIssueDetail } from "@/hooks/store"; // components import { IssueActivityBlockComponent, IssueLink } from "./"; diff --git a/web/core/components/issues/issue-detail/issue-activity/activity/actions/target_date.tsx b/web/core/components/issues/issue-detail/issue-activity/activity/actions/target_date.tsx index 7d0367bd88e..12457d59db3 100644 --- a/web/core/components/issues/issue-detail/issue-activity/activity/actions/target_date.tsx +++ b/web/core/components/issues/issue-detail/issue-activity/activity/actions/target_date.tsx @@ -2,7 +2,7 @@ import { FC } from "react"; import { observer } from "mobx-react"; import { CalendarDays } from "lucide-react"; // hooks -import { renderFormattedDate } from "@/helpers/date-time.helper"; +import { renderFormattedDate } from "@plane/utils"; import { useIssueDetail } from "@/hooks/store"; // components import { IssueActivityBlockComponent, IssueLink } from "./"; diff --git a/web/core/components/issues/issue-detail/issue-activity/activity/activity-list.tsx b/web/core/components/issues/issue-detail/issue-activity/activity/activity-list.tsx index b0f8b3d4f8b..32c49915c3d 100644 --- a/web/core/components/issues/issue-detail/issue-activity/activity/activity-list.tsx +++ b/web/core/components/issues/issue-detail/issue-activity/activity/activity-list.tsx @@ -1,7 +1,7 @@ import { FC } from "react"; import { observer } from "mobx-react"; // helpers -import { getValidKeysFromObject } from "@/helpers/array.helper"; +import { getValidKeysFromObject } from "@plane/utils"; // hooks import { useIssueDetail } from "@/hooks/store"; // plane web components diff --git a/web/core/components/issues/issue-detail/issue-activity/helper.tsx b/web/core/components/issues/issue-detail/issue-activity/helper.tsx index 5bd50d064fa..af30a389f61 100644 --- a/web/core/components/issues/issue-detail/issue-activity/helper.tsx +++ b/web/core/components/issues/issue-detail/issue-activity/helper.tsx @@ -3,7 +3,7 @@ import { useTranslation } from "@plane/i18n"; import { TCommentsOperations, TIssueActivity, TIssueComment } from "@plane/types"; import { EFileAssetType } from "@plane/types/src/enums"; import { setToast, TOAST_TYPE } from "@plane/ui"; -import { formatTextList } from "@/helpers/issue.helper"; +import { formatTextList } from "@plane/utils"; import { useEditorAsset, useIssueDetail, useMember, useUser } from "@/hooks/store"; export const useCommentOperations = ( diff --git a/web/core/components/issues/issue-detail/issue-detail-quick-actions.tsx b/web/core/components/issues/issue-detail/issue-detail-quick-actions.tsx index 6bf4bf75765..df536d900f6 100644 --- a/web/core/components/issues/issue-detail/issue-detail-quick-actions.tsx +++ b/web/core/components/issues/issue-detail/issue-detail-quick-actions.tsx @@ -14,12 +14,10 @@ import { } from "@plane/constants"; import { useTranslation } from "@plane/i18n"; import { TOAST_TYPE, Tooltip, setToast } from "@plane/ui"; +import { cn, generateWorkItemLink, copyTextToClipboard } from "@plane/utils"; // components import { ArchiveIssueModal, DeleteIssueModal, IssueSubscription } from "@/components/issues"; // helpers -import { cn } from "@/helpers/common.helper"; -import { generateWorkItemLink } from "@/helpers/issue.helper"; -import { copyTextToClipboard } from "@/helpers/string.helper"; // hooks import { useEventTracker, diff --git a/web/core/components/issues/issue-detail/label/select/label-select.tsx b/web/core/components/issues/issue-detail/label/select/label-select.tsx index e89cd45fcf8..e56cbe7e085 100644 --- a/web/core/components/issues/issue-detail/label/select/label-select.tsx +++ b/web/core/components/issues/issue-detail/label/select/label-select.tsx @@ -8,7 +8,7 @@ import { EUserPermissionsLevel, EUserProjectRoles, getRandomLabelColor } from "@ import { useTranslation } from "@plane/i18n"; import { IIssueLabel } from "@plane/types"; // helpers -import { getTabIndex } from "@/helpers/tab-indices.helper"; +import { getTabIndex } from "@plane/utils"; // hooks import { useLabel, useUserPermissions } from "@/hooks/store"; import { usePlatformOS } from "@/hooks/use-platform-os"; diff --git a/web/core/components/issues/issue-detail/links/link-detail.tsx b/web/core/components/issues/issue-detail/links/link-detail.tsx index 673874bb163..9a24ce5b1b5 100644 --- a/web/core/components/issues/issue-detail/links/link-detail.tsx +++ b/web/core/components/issues/issue-detail/links/link-detail.tsx @@ -5,12 +5,11 @@ import { FC } from "react"; // ui import { Pencil, Trash2, ExternalLink } from "lucide-react"; import { Tooltip, TOAST_TYPE, setToast } from "@plane/ui"; -import { getIconForLink } from "@plane/utils"; +import { getIconForLink, copyTextToClipboard, calculateTimeAgo } from "@plane/utils"; // icons // types // helpers -import { calculateTimeAgo } from "@/helpers/date-time.helper"; -import { copyTextToClipboard } from "@/helpers/string.helper"; +// import { useIssueDetail, useMember } from "@/hooks/store"; import { usePlatformOS } from "@/hooks/use-platform-os"; import { TLinkOperationsModal } from "./create-update-link-modal"; diff --git a/web/core/components/issues/issue-detail/links/link-item.tsx b/web/core/components/issues/issue-detail/links/link-item.tsx index 83ddc4a7df9..526336c732c 100644 --- a/web/core/components/issues/issue-detail/links/link-item.tsx +++ b/web/core/components/issues/issue-detail/links/link-item.tsx @@ -8,9 +8,8 @@ import { useTranslation } from "@plane/i18n"; import { TIssueServiceType } from "@plane/types"; // ui import { Tooltip, TOAST_TYPE, setToast, CustomMenu } from "@plane/ui"; -import { calculateTimeAgo, getIconForLink } from "@plane/utils"; +import { calculateTimeAgo, getIconForLink, copyTextToClipboard } from "@plane/utils"; // helpers -import { copyTextToClipboard } from "@/helpers/string.helper"; // hooks import { useIssueDetail } from "@/hooks/store"; import { usePlatformOS } from "@/hooks/use-platform-os"; diff --git a/web/core/components/issues/issue-detail/main-content.tsx b/web/core/components/issues/issue-detail/main-content.tsx index 8087bf3516d..175f03f1ede 100644 --- a/web/core/components/issues/issue-detail/main-content.tsx +++ b/web/core/components/issues/issue-detail/main-content.tsx @@ -7,6 +7,7 @@ import { EIssueServiceType } from "@plane/constants"; import { EditorRefApi } from "@plane/editor"; import { TNameDescriptionLoader } from "@plane/types"; // components +import { getTextContent } from "@plane/utils"; import { DescriptionVersionsRoot } from "@/components/core/description-versions"; import { IssueActivity, @@ -19,7 +20,6 @@ import { PeekOverviewProperties, } from "@/components/issues"; // helpers -import { getTextContent } from "@/helpers/editor.helper"; // hooks import { useIssueDetail, useMember, useProject, useUser } from "@/hooks/store"; import useReloadConfirmations from "@/hooks/use-reload-confirmation"; diff --git a/web/core/components/issues/issue-detail/module-select.tsx b/web/core/components/issues/issue-detail/module-select.tsx index d021958e89d..41b802795a5 100644 --- a/web/core/components/issues/issue-detail/module-select.tsx +++ b/web/core/components/issues/issue-detail/module-select.tsx @@ -4,10 +4,10 @@ import { observer } from "mobx-react"; import { useTranslation } from "@plane/i18n"; // hooks // components +import { cn } from "@plane/utils"; import { ModuleDropdown } from "@/components/dropdowns"; // ui // helpers -import { cn } from "@/helpers/common.helper"; import { useIssueDetail } from "@/hooks/store"; // types import type { TIssueOperations } from "./root"; diff --git a/web/core/components/issues/issue-detail/parent-select.tsx b/web/core/components/issues/issue-detail/parent-select.tsx index dc50864a926..9b2d544a9cb 100644 --- a/web/core/components/issues/issue-detail/parent-select.tsx +++ b/web/core/components/issues/issue-detail/parent-select.tsx @@ -8,9 +8,9 @@ import { useTranslation } from "@plane/i18n"; // ui import { Tooltip } from "@plane/ui"; // components +import { cn } from "@plane/utils"; import { ParentIssuesListModal } from "@/components/issues"; // helpers -import { cn } from "@/helpers/common.helper"; // hooks import { useIssueDetail, useProject } from "@/hooks/store"; import { usePlatformOS } from "@/hooks/use-platform-os"; diff --git a/web/core/components/issues/issue-detail/parent/root.tsx b/web/core/components/issues/issue-detail/parent/root.tsx index 66345b4aef8..0682d4b54e8 100644 --- a/web/core/components/issues/issue-detail/parent/root.tsx +++ b/web/core/components/issues/issue-detail/parent/root.tsx @@ -10,7 +10,7 @@ import { TIssue } from "@plane/types"; // ui import { ControlLink, CustomMenu } from "@plane/ui"; // helpers -import { generateWorkItemLink } from "@/helpers/issue.helper"; +import { generateWorkItemLink } from "@plane/utils"; // hooks import { useIssues, useProject, useProjectState } from "@/hooks/store"; import useIssuePeekOverviewRedirection from "@/hooks/use-issue-peek-overview-redirection"; diff --git a/web/core/components/issues/issue-detail/parent/sibling-item.tsx b/web/core/components/issues/issue-detail/parent/sibling-item.tsx index 2947e49dfa6..04cb3745d34 100644 --- a/web/core/components/issues/issue-detail/parent/sibling-item.tsx +++ b/web/core/components/issues/issue-detail/parent/sibling-item.tsx @@ -6,7 +6,7 @@ import Link from "next/link"; // ui import { CustomMenu } from "@plane/ui"; // helpers -import { generateWorkItemLink } from "@/helpers/issue.helper"; +import { generateWorkItemLink } from "@plane/utils"; // hooks import { useIssueDetail, useProject } from "@/hooks/store"; // plane web components diff --git a/web/core/components/issues/issue-detail/reactions/issue-comment.tsx b/web/core/components/issues/issue-detail/reactions/issue-comment.tsx index 26f50e05742..caaeb65ff68 100644 --- a/web/core/components/issues/issue-detail/reactions/issue-comment.tsx +++ b/web/core/components/issues/issue-detail/reactions/issue-comment.tsx @@ -5,10 +5,9 @@ import { observer } from "mobx-react"; import { IUser } from "@plane/types"; // components import { TOAST_TYPE, Tooltip, setToast } from "@plane/ui"; +import { cn, formatTextList } from "@plane/utils"; // helper -import { cn } from "@/helpers/common.helper"; import { renderEmoji } from "@/helpers/emoji.helper"; -import { formatTextList } from "@/helpers/issue.helper"; // hooks import { useIssueDetail, useMember } from "@/hooks/store"; // types diff --git a/web/core/components/issues/issue-detail/reactions/issue.tsx b/web/core/components/issues/issue-detail/reactions/issue.tsx index 9b723e785b9..5e5994ff39c 100644 --- a/web/core/components/issues/issue-detail/reactions/issue.tsx +++ b/web/core/components/issues/issue-detail/reactions/issue.tsx @@ -6,10 +6,9 @@ import { IUser } from "@plane/types"; // hooks // ui import { TOAST_TYPE, Tooltip, setToast } from "@plane/ui"; +import { cn, formatTextList } from "@plane/utils"; // helpers -import { cn } from "@/helpers/common.helper"; import { renderEmoji } from "@/helpers/emoji.helper"; -import { formatTextList } from "@/helpers/issue.helper"; import { useIssueDetail, useMember } from "@/hooks/store"; // types import { ReactionSelector } from "./reaction-selector"; diff --git a/web/core/components/issues/issue-detail/relation-select.tsx b/web/core/components/issues/issue-detail/relation-select.tsx index 86fde40eb3f..d7d0a694779 100644 --- a/web/core/components/issues/issue-detail/relation-select.tsx +++ b/web/core/components/issues/issue-detail/relation-select.tsx @@ -7,11 +7,10 @@ import { CircleDot, CopyPlus, Pencil, X, XCircle } from "lucide-react"; // Plane import { ISearchIssueResponse } from "@plane/types"; import { RelatedIcon, Tooltip, TOAST_TYPE, setToast } from "@plane/ui"; +import { cn, generateWorkItemLink } from "@plane/utils"; // components import { ExistingIssuesListModal } from "@/components/core"; // helpers -import { cn } from "@/helpers/common.helper"; -import { generateWorkItemLink } from "@/helpers/issue.helper"; // hooks import { useIssueDetail, useIssues, useProject } from "@/hooks/store"; import { usePlatformOS } from "@/hooks/use-platform-os"; diff --git a/web/core/components/issues/issue-detail/sidebar.tsx b/web/core/components/issues/issue-detail/sidebar.tsx index 8e7bf151bfb..c93baf884cb 100644 --- a/web/core/components/issues/issue-detail/sidebar.tsx +++ b/web/core/components/issues/issue-detail/sidebar.tsx @@ -7,6 +7,7 @@ import { CalendarCheck2, CalendarClock, LayoutPanelTop, Signal, Tag, Triangle, U import { useTranslation } from "@plane/i18n"; // ui import { ContrastIcon, DiceIcon, DoubleCircleIcon } from "@plane/ui"; +import { cn, getDate, renderFormattedPayloadDate, shouldHighlightIssueDueDate } from "@plane/utils"; // components import { DateDropdown, @@ -18,9 +19,6 @@ import { import { ButtonAvatars } from "@/components/dropdowns/member/avatar"; import { IssueCycleSelect, IssueLabel, IssueModuleSelect } from "@/components/issues"; // helpers -import { cn } from "@/helpers/common.helper"; -import { getDate, renderFormattedPayloadDate } from "@/helpers/date-time.helper"; -import { shouldHighlightIssueDueDate } from "@/helpers/issue.helper"; // hooks import { useProjectEstimates, useIssueDetail, useProject, useProjectState, useMember } from "@/hooks/store"; // plane web components diff --git a/web/core/components/issues/issue-layouts/calendar/calendar.tsx b/web/core/components/issues/issue-layouts/calendar/calendar.tsx index 9a0284f47bc..428beafc0d8 100644 --- a/web/core/components/issues/issue-layouts/calendar/calendar.tsx +++ b/web/core/components/issues/issue-layouts/calendar/calendar.tsx @@ -16,16 +16,16 @@ import type { TIssueKanbanFilters, TIssueMap, TPaginationData, + ICalendarWeek, } from "@plane/types"; // ui import { Spinner } from "@plane/ui"; +import { renderFormattedPayloadDate, cn } from "@plane/utils"; // components import { CalendarHeader, CalendarIssueBlocks, CalendarWeekDays, CalendarWeekHeader } from "@/components/issues"; // constants import { MONTHS_LIST } from "@/constants/calendar"; // helpers -import { cn } from "@/helpers/common.helper"; -import { renderFormattedPayloadDate } from "@/helpers/date-time.helper"; // hooks import { useIssues } from "@/hooks/store"; import useSize from "@/hooks/use-window-size"; @@ -38,7 +38,6 @@ import { IProjectIssuesFilter } from "@/store/issue/project"; import { IProjectViewIssuesFilter } from "@/store/issue/project-views"; import { IssueLayoutHOC } from "../issue-layout-HOC"; import { TRenderQuickActions } from "../list/list-view-types"; -import type { ICalendarWeek } from "./types"; type Props = { issuesFilterStore: diff --git a/web/core/components/issues/issue-layouts/calendar/day-tile.tsx b/web/core/components/issues/issue-layouts/calendar/day-tile.tsx index e80e629e647..b484a5c491e 100644 --- a/web/core/components/issues/issue-layouts/calendar/day-tile.tsx +++ b/web/core/components/issues/issue-layouts/calendar/day-tile.tsx @@ -5,18 +5,17 @@ import { combine } from "@atlaskit/pragmatic-drag-and-drop/combine"; import { dropTargetForElements } from "@atlaskit/pragmatic-drag-and-drop/element/adapter"; import { differenceInCalendarDays } from "date-fns/differenceInCalendarDays"; import { observer } from "mobx-react"; +import { TGroupedIssues, TIssue, TIssueMap, TPaginationData, ICalendarDate } from "@plane/types"; // types -import { TGroupedIssues, TIssue, TIssueMap, TPaginationData } from "@plane/types"; // ui import { TOAST_TYPE, setToast } from "@plane/ui"; // components -import { CalendarIssueBlocks, ICalendarDate } from "@/components/issues"; +import { cn, renderFormattedPayloadDate } from "@plane/utils"; +import { CalendarIssueBlocks } from "@/components/issues/issue-layouts/calendar"; import { highlightIssueOnDrop } from "@/components/issues/issue-layouts/utils"; // helpers import { MONTHS_LIST } from "@/constants/calendar"; // helpers -import { cn } from "@/helpers/common.helper"; -import { renderFormattedPayloadDate } from "@/helpers/date-time.helper"; // types import { IProjectEpicsFilter } from "@/plane-web/store/issue/epic"; import { ICycleIssuesFilter } from "@/store/issue/cycle"; diff --git a/web/core/components/issues/issue-layouts/calendar/dropdowns/months-dropdown.tsx b/web/core/components/issues/issue-layouts/calendar/dropdowns/months-dropdown.tsx index 05e5a163188..f0563f5ba96 100644 --- a/web/core/components/issues/issue-layouts/calendar/dropdowns/months-dropdown.tsx +++ b/web/core/components/issues/issue-layouts/calendar/dropdowns/months-dropdown.tsx @@ -6,8 +6,8 @@ import { Popover, Transition } from "@headlessui/react"; //hooks // icons // constants +import { getDate } from "@plane/utils"; import { MONTHS_LIST } from "@/constants/calendar"; -import { getDate } from "@/helpers/date-time.helper"; import { useCalendarView } from "@/hooks/store"; import { IProjectEpicsFilter } from "@/plane-web/store/issue/epic"; import { ICycleIssuesFilter } from "@/store/issue/cycle"; diff --git a/web/core/components/issues/issue-layouts/calendar/issue-block.tsx b/web/core/components/issues/issue-layouts/calendar/issue-block.tsx index 127ebfb475e..ce1181b730a 100644 --- a/web/core/components/issues/issue-layouts/calendar/issue-block.tsx +++ b/web/core/components/issues/issue-layouts/calendar/issue-block.tsx @@ -11,9 +11,8 @@ import { useOutsideClickDetector } from "@plane/hooks"; import { TIssue } from "@plane/types"; // ui import { Tooltip, ControlLink } from "@plane/ui"; +import { cn, generateWorkItemLink } from "@plane/utils"; // helpers -import { cn } from "@/helpers/common.helper"; -import { generateWorkItemLink } from "@/helpers/issue.helper"; // hooks import { useIssueDetail, useIssues, useProject, useProjectState } from "@/hooks/store"; import { useIssueStoreType } from "@/hooks/use-issue-layout-store"; diff --git a/web/core/components/issues/issue-layouts/calendar/issue-blocks.tsx b/web/core/components/issues/issue-layouts/calendar/issue-blocks.tsx index 9e7109fa33d..ff2bbe76b89 100644 --- a/web/core/components/issues/issue-layouts/calendar/issue-blocks.tsx +++ b/web/core/components/issues/issue-layouts/calendar/issue-blocks.tsx @@ -2,9 +2,9 @@ import { observer } from "mobx-react"; import { useTranslation } from "@plane/i18n"; import { TIssue, TPaginationData } from "@plane/types"; // components +import { renderFormattedPayloadDate } from "@plane/utils"; import { CalendarQuickAddIssueActions, CalendarIssueBlockRoot } from "@/components/issues"; // helpers -import { renderFormattedPayloadDate } from "@/helpers/date-time.helper"; import { useIssuesStore } from "@/hooks/use-issue-layout-store"; import { TRenderQuickActions } from "../list/list-view-types"; // types diff --git a/web/core/components/issues/issue-layouts/calendar/quick-add-issue-actions.tsx b/web/core/components/issues/issue-layouts/calendar/quick-add-issue-actions.tsx index a293d0141ce..a668e6a1167 100644 --- a/web/core/components/issues/issue-layouts/calendar/quick-add-issue-actions.tsx +++ b/web/core/components/issues/issue-layouts/calendar/quick-add-issue-actions.tsx @@ -14,10 +14,10 @@ import { ISearchIssueResponse, TIssue } from "@plane/types"; // ui import { CustomMenu, setPromiseToast } from "@plane/ui"; // components +import { cn } from "@plane/utils"; import { ExistingIssuesListModal } from "@/components/core"; import { QuickAddIssueRoot } from "@/components/issues"; // helpers -import { cn } from "@/helpers/common.helper"; // hooks import { useIssueDetail } from "@/hooks/store"; diff --git a/web/core/components/issues/issue-layouts/calendar/types.d.ts b/web/core/components/issues/issue-layouts/calendar/types.d.ts deleted file mode 100644 index 3855aeb86ea..00000000000 --- a/web/core/components/issues/issue-layouts/calendar/types.d.ts +++ /dev/null @@ -1,24 +0,0 @@ -export interface ICalendarDate { - date: Date; - year: number; - month: number; - day: number; - week: number; // week number wrt year, eg- 51, 52 - is_current_month: boolean; - is_current_week: boolean; - is_today: boolean; -} - -export interface ICalendarWeek { - [date: string]: ICalendarDate; -} - -export interface ICalendarMonth { - [monthIndex: string]: { - [weekNumber: string]: ICalendarWeek; - }; -} - -export interface ICalendarPayload { - [year: string]: ICalendarMonth; -} diff --git a/web/core/components/issues/issue-layouts/calendar/week-days.tsx b/web/core/components/issues/issue-layouts/calendar/week-days.tsx index c5ba104ee58..2f843d4d616 100644 --- a/web/core/components/issues/issue-layouts/calendar/week-days.tsx +++ b/web/core/components/issues/issue-layouts/calendar/week-days.tsx @@ -1,12 +1,10 @@ import { observer } from "mobx-react"; -import { EStartOfTheWeek } from "@plane/constants"; -import { TGroupedIssues, TIssue, TIssueMap, TPaginationData } from "@plane/types"; -import { cn } from "@plane/utils"; +import { TGroupedIssues, TIssue, TIssueMap, TPaginationData, ICalendarDate, ICalendarWeek } from "@plane/types"; +import { cn, getOrderedDays, renderFormattedPayloadDate } from "@plane/utils"; // components import { CalendarDayTile } from "@/components/issues"; // helpers -import { getOrderedDays } from "@/helpers/calendar.helper"; -import { renderFormattedPayloadDate } from "@/helpers/date-time.helper"; +// // hooks import { useUserProfile } from "@/hooks/store"; // types @@ -16,7 +14,6 @@ import { IModuleIssuesFilter } from "@/store/issue/module"; import { IProjectIssuesFilter } from "@/store/issue/project"; import { IProjectViewIssuesFilter } from "@/store/issue/project-views"; import { TRenderQuickActions } from "../list/list-view-types"; -import { ICalendarDate, ICalendarWeek } from "./types"; type Props = { issuesFilterStore: diff --git a/web/core/components/issues/issue-layouts/calendar/week-header.tsx b/web/core/components/issues/issue-layouts/calendar/week-header.tsx index d97a9340e72..dc2c9fbcf89 100644 --- a/web/core/components/issues/issue-layouts/calendar/week-header.tsx +++ b/web/core/components/issues/issue-layouts/calendar/week-header.tsx @@ -1,8 +1,8 @@ import { observer } from "mobx-react"; import { EStartOfTheWeek } from "@plane/constants"; +import { getOrderedDays } from "@plane/utils"; import { DAYS_LIST } from "@/constants/calendar"; // helpers -import { getOrderedDays } from "@/helpers/calendar.helper"; // hooks import { useUserProfile } from "@/hooks/store"; diff --git a/web/core/components/issues/issue-layouts/filters/applied-filters/date.tsx b/web/core/components/issues/issue-layouts/filters/applied-filters/date.tsx index a64626047f0..e17db764b53 100644 --- a/web/core/components/issues/issue-layouts/filters/applied-filters/date.tsx +++ b/web/core/components/issues/issue-layouts/filters/applied-filters/date.tsx @@ -3,8 +3,7 @@ import { observer } from "mobx-react"; import { X } from "lucide-react"; // helpers import { DATE_AFTER_FILTER_OPTIONS } from "@plane/constants"; -import { renderFormattedDate } from "@/helpers/date-time.helper"; -import { capitalizeFirstLetter } from "@/helpers/string.helper"; +import { renderFormattedDate, capitalizeFirstLetter } from "@plane/utils"; // constants type Props = { diff --git a/web/core/components/issues/issue-layouts/filters/applied-filters/filters-list.tsx b/web/core/components/issues/issue-layouts/filters/applied-filters/filters-list.tsx index 03b659d93e7..17fcbbfece2 100644 --- a/web/core/components/issues/issue-layouts/filters/applied-filters/filters-list.tsx +++ b/web/core/components/issues/issue-layouts/filters/applied-filters/filters-list.tsx @@ -6,6 +6,7 @@ import { useTranslation } from "@plane/i18n"; import { IIssueFilterOptions, IIssueLabel, IState } from "@plane/types"; // components import { Tag } from "@plane/ui"; +import { replaceUnderscoreIfSnakeCase } from "@plane/utils"; import { AppliedCycleFilters, AppliedDateFilters, @@ -19,7 +20,6 @@ import { } from "@/components/issues"; // constants // helpers -import { replaceUnderscoreIfSnakeCase } from "@/helpers/string.helper"; // hooks import { useUserPermissions } from "@/hooks/store"; // plane web components diff --git a/web/core/components/issues/issue-layouts/filters/applied-filters/members.tsx b/web/core/components/issues/issue-layouts/filters/applied-filters/members.tsx index ed0b6a15447..cf9dc582a5c 100644 --- a/web/core/components/issues/issue-layouts/filters/applied-filters/members.tsx +++ b/web/core/components/issues/issue-layouts/filters/applied-filters/members.tsx @@ -5,7 +5,7 @@ import { X } from "lucide-react"; // plane ui import { Avatar } from "@plane/ui"; // helpers -import { getFileURL } from "@/helpers/file.helper"; +import { getFileURL } from "@plane/utils"; // hooks import { useMember } from "@/hooks/store"; diff --git a/web/core/components/issues/issue-layouts/filters/applied-filters/roots/global-view-root.tsx b/web/core/components/issues/issue-layouts/filters/applied-filters/roots/global-view-root.tsx index 4aee53f3237..4086a5c060b 100644 --- a/web/core/components/issues/issue-layouts/filters/applied-filters/roots/global-view-root.tsx +++ b/web/core/components/issues/issue-layouts/filters/applied-filters/roots/global-view-root.tsx @@ -17,12 +17,12 @@ import { IIssueFilterOptions, TStaticViewTypes } from "@plane/types"; //ui // components import { Header, EHeaderVariant, Loader } from "@plane/ui"; +import { cn } from "@plane/utils"; import { AppliedFiltersList } from "@/components/issues"; import { UpdateViewComponent } from "@/components/views/update-view-component"; import { CreateUpdateWorkspaceViewModal } from "@/components/workspace"; // constants // helpers -import { cn } from "@/helpers/common.helper"; // hooks import { useEventTracker, useGlobalView, useIssues, useLabel, useUser, useUserPermissions } from "@/hooks/store"; import { getAreFiltersEqual } from "../../../utils"; diff --git a/web/core/components/issues/issue-layouts/filters/applied-filters/state.tsx b/web/core/components/issues/issue-layouts/filters/applied-filters/state.tsx index 65d679c6483..d02fd6dad2d 100644 --- a/web/core/components/issues/issue-layouts/filters/applied-filters/state.tsx +++ b/web/core/components/issues/issue-layouts/filters/applied-filters/state.tsx @@ -4,8 +4,8 @@ import { observer } from "mobx-react"; // icons import { X } from "lucide-react"; -import { IState } from "@plane/types"; import { EIconSize } from "@plane/constants"; +import { IState } from "@plane/types"; import { StateGroupIcon } from "@plane/ui"; // types diff --git a/web/core/components/issues/issue-layouts/filters/header/filters/assignee.tsx b/web/core/components/issues/issue-layouts/filters/header/filters/assignee.tsx index 553fd7d4184..f4a2613167e 100644 --- a/web/core/components/issues/issue-layouts/filters/header/filters/assignee.tsx +++ b/web/core/components/issues/issue-layouts/filters/header/filters/assignee.tsx @@ -6,9 +6,9 @@ import { observer } from "mobx-react"; // plane ui import { Avatar, Loader } from "@plane/ui"; // components +import { getFileURL } from "@plane/utils"; import { FilterHeader, FilterOption } from "@/components/issues"; // helpers -import { getFileURL } from "@/helpers/file.helper"; // hooks import { useMember, useUser } from "@/hooks/store"; diff --git a/web/core/components/issues/issue-layouts/filters/header/filters/created-by.tsx b/web/core/components/issues/issue-layouts/filters/header/filters/created-by.tsx index 2fbcf6233cc..9dd7c1d09d8 100644 --- a/web/core/components/issues/issue-layouts/filters/header/filters/created-by.tsx +++ b/web/core/components/issues/issue-layouts/filters/header/filters/created-by.tsx @@ -6,9 +6,9 @@ import { observer } from "mobx-react"; // plane ui import { Avatar, Loader } from "@plane/ui"; // components +import { getFileURL } from "@plane/utils"; import { FilterHeader, FilterOption } from "@/components/issues"; // helpers -import { getFileURL } from "@/helpers/file.helper"; // hooks import { useMember, useUser } from "@/hooks/store"; diff --git a/web/core/components/issues/issue-layouts/filters/header/filters/mentions.tsx b/web/core/components/issues/issue-layouts/filters/header/filters/mentions.tsx index e38f5794d8d..7e60eb5bb78 100644 --- a/web/core/components/issues/issue-layouts/filters/header/filters/mentions.tsx +++ b/web/core/components/issues/issue-layouts/filters/header/filters/mentions.tsx @@ -6,9 +6,9 @@ import { observer } from "mobx-react"; // plane ui import { Loader, Avatar } from "@plane/ui"; // components +import { getFileURL } from "@plane/utils"; import { FilterHeader, FilterOption } from "@/components/issues"; // helpers -import { getFileURL } from "@/helpers/file.helper"; // hooks import { useMember, useUser } from "@/hooks/store"; diff --git a/web/core/components/issues/issue-layouts/gantt/base-gantt-root.tsx b/web/core/components/issues/issue-layouts/gantt/base-gantt-root.tsx index 43410d13553..103b49f3517 100644 --- a/web/core/components/issues/issue-layouts/gantt/base-gantt-root.tsx +++ b/web/core/components/issues/issue-layouts/gantt/base-gantt-root.tsx @@ -10,15 +10,16 @@ import { EUserPermissionsLevel, } from "@plane/constants"; import { useTranslation } from "@plane/i18n"; -import { TIssue } from "@plane/types"; +import type { IBlockUpdateData, TIssue } from "@plane/types"; import { setToast, TOAST_TYPE } from "@plane/ui"; // hooks -import { GanttChartRoot, IBlockUpdateData, IssueGanttSidebar } from "@/components/gantt-chart"; +import { renderFormattedPayloadDate } from "@plane/utils"; import { ETimeLineTypeType, TimeLineTypeContext } from "@/components/gantt-chart/contexts"; +import { GanttChartRoot } from "@/components/gantt-chart/root"; +import { IssueGanttSidebar } from "@/components/gantt-chart/sidebar/issues/sidebar"; import { QuickAddIssueRoot, IssueGanttBlock, GanttQuickAddIssueButton } from "@/components/issues"; //constants // helpers -import { renderFormattedPayloadDate } from "@/helpers/date-time.helper"; //hooks import { useIssues, useUserPermissions } from "@/hooks/store"; import { useIssueStoreType } from "@/hooks/use-issue-layout-store"; diff --git a/web/core/components/issues/issue-layouts/gantt/blocks.tsx b/web/core/components/issues/issue-layouts/gantt/blocks.tsx index 0281e8b4984..e2babd37112 100644 --- a/web/core/components/issues/issue-layouts/gantt/blocks.tsx +++ b/web/core/components/issues/issue-layouts/gantt/blocks.tsx @@ -4,11 +4,10 @@ import { observer } from "mobx-react"; import { useParams } from "next/navigation"; // ui import { Tooltip, ControlLink } from "@plane/ui"; +import { findTotalDaysInRange, generateWorkItemLink } from "@plane/utils"; // components -import { findTotalDaysInRange } from "@plane/utils"; import { SIDEBAR_WIDTH } from "@/components/gantt-chart/constants"; // helpers -import { generateWorkItemLink } from "@/helpers/issue.helper"; // hooks import { useIssueDetail, useIssues, useProject, useProjectState } from "@/hooks/store"; import { useIssueStoreType } from "@/hooks/use-issue-layout-store"; diff --git a/web/core/components/issues/issue-layouts/group-drag-overlay.tsx b/web/core/components/issues/issue-layouts/group-drag-overlay.tsx index df62e37f622..eee5f5a3af0 100644 --- a/web/core/components/issues/issue-layouts/group-drag-overlay.tsx +++ b/web/core/components/issues/issue-layouts/group-drag-overlay.tsx @@ -5,7 +5,7 @@ import { ISSUE_ORDER_BY_OPTIONS } from "@plane/constants"; import { useTranslation } from "@plane/i18n"; import { TIssueOrderByOptions } from "@plane/types"; // helpers -import { cn } from "@/helpers/common.helper"; +import { cn } from "@plane/utils"; // plane web imports import { WorkFlowDisabledOverlay } from "@/plane-web/components/workflow"; diff --git a/web/core/components/issues/issue-layouts/kanban/block.tsx b/web/core/components/issues/issue-layouts/kanban/block.tsx index 039a616bb8a..007912609ea 100644 --- a/web/core/components/issues/issue-layouts/kanban/block.tsx +++ b/web/core/components/issues/issue-layouts/kanban/block.tsx @@ -12,12 +12,11 @@ import { useOutsideClickDetector } from "@plane/hooks"; import { TIssue, IIssueDisplayProperties, IIssueMap } from "@plane/types"; // ui import { ControlLink, DropIndicator, TOAST_TYPE, Tooltip, setToast } from "@plane/ui"; +import { cn, generateWorkItemLink } from "@plane/utils"; // components import RenderIfVisible from "@/components/core/render-if-visible-HOC"; import { HIGHLIGHT_CLASS } from "@/components/issues/issue-layouts/utils"; // helpers -import { cn } from "@/helpers/common.helper"; -import { generateWorkItemLink } from "@/helpers/issue.helper"; // hooks import { useIssueDetail, useKanbanView, useProject } from "@/hooks/store"; import useIssuePeekOverviewRedirection from "@/hooks/use-issue-peek-overview-redirection"; diff --git a/web/core/components/issues/issue-layouts/kanban/kanban-group.tsx b/web/core/components/issues/issue-layouts/kanban/kanban-group.tsx index 02ae41d6adf..988f2448674 100644 --- a/web/core/components/issues/issue-layouts/kanban/kanban-group.tsx +++ b/web/core/components/issues/issue-layouts/kanban/kanban-group.tsx @@ -20,11 +20,11 @@ import { TIssueOrderByOptions, } from "@plane/types"; import { TOAST_TYPE, setToast } from "@plane/ui"; +import { cn } from "@plane/utils"; import { KanbanQuickAddIssueButton, QuickAddIssueRoot } from "@/components/issues"; import { highlightIssueOnDrop } from "@/components/issues/issue-layouts/utils"; import { KanbanIssueBlockLoader } from "@/components/ui"; // helpers -import { cn } from "@/helpers/common.helper"; // hooks import { useProjectState } from "@/hooks/store"; import { useIntersectionObserver } from "@/hooks/use-intersection-observer"; diff --git a/web/core/components/issues/issue-layouts/list/block.tsx b/web/core/components/issues/issue-layouts/list/block.tsx index 0893fb492cf..67d282753a7 100644 --- a/web/core/components/issues/issue-layouts/list/block.tsx +++ b/web/core/components/issues/issue-layouts/list/block.tsx @@ -11,12 +11,11 @@ import { EIssueServiceType } from "@plane/constants"; import { TIssue, IIssueDisplayProperties, TIssueMap } from "@plane/types"; // ui import { Spinner, Tooltip, ControlLink, setToast, TOAST_TYPE, Row } from "@plane/ui"; +import { cn, generateWorkItemLink } from "@plane/utils"; // components import { MultipleSelectEntityAction } from "@/components/core"; import { IssueProperties } from "@/components/issues/issue-layouts/properties"; // helpers -import { cn } from "@/helpers/common.helper"; -import { generateWorkItemLink } from "@/helpers/issue.helper"; // hooks import { useAppTheme, useIssueDetail, useProject } from "@/hooks/store"; import { TSelectionHelper } from "@/hooks/use-multiple-select"; diff --git a/web/core/components/issues/issue-layouts/list/headers/group-by-card.tsx b/web/core/components/issues/issue-layouts/list/headers/group-by-card.tsx index 4ba02698918..44bc95bff46 100644 --- a/web/core/components/issues/issue-layouts/list/headers/group-by-card.tsx +++ b/web/core/components/issues/issue-layouts/list/headers/group-by-card.tsx @@ -9,11 +9,11 @@ import { TIssue, ISearchIssueResponse, TIssueGroupByOptions } from "@plane/types // ui import { CustomMenu, TOAST_TYPE, setToast } from "@plane/ui"; // components +import { cn } from "@plane/utils"; import { ExistingIssuesListModal, MultipleSelectGroupAction } from "@/components/core"; import { CreateUpdateIssueModal } from "@/components/issues"; // constants // helpers -import { cn } from "@/helpers/common.helper"; // hooks import { useEventTracker } from "@/hooks/store"; import { useIssueStoreType } from "@/hooks/use-issue-layout-store"; diff --git a/web/core/components/issues/issue-layouts/properties/all-properties.tsx b/web/core/components/issues/issue-layouts/properties/all-properties.tsx index c14922b047a..a17113c70c1 100644 --- a/web/core/components/issues/issue-layouts/properties/all-properties.tsx +++ b/web/core/components/issues/issue-layouts/properties/all-properties.tsx @@ -13,6 +13,7 @@ import { useTranslation } from "@plane/i18n"; import { TIssue, IIssueDisplayProperties, TIssuePriorities } from "@plane/types"; // ui import { Tooltip } from "@plane/ui"; +import { cn, getDate, renderFormattedPayloadDate, generateWorkItemLink, shouldHighlightIssueDueDate } from "@plane/utils"; // components import { DateDropdown, @@ -25,9 +26,6 @@ import { } from "@/components/dropdowns"; // constants // helpers -import { cn } from "@/helpers/common.helper"; -import { getDate, renderFormattedPayloadDate } from "@/helpers/date-time.helper"; -import { generateWorkItemLink, shouldHighlightIssueDueDate } from "@/helpers/issue.helper"; // hooks import { useEventTracker, useLabel, useIssues, useProjectState, useProject, useProjectEstimates } from "@/hooks/store"; import { useAppRouter } from "@/hooks/use-app-router"; diff --git a/web/core/components/issues/issue-layouts/quick-action-dropdowns/all-issue.tsx b/web/core/components/issues/issue-layouts/quick-action-dropdowns/all-issue.tsx index 752f909a75f..53f74dae8ef 100644 --- a/web/core/components/issues/issue-layouts/quick-action-dropdowns/all-issue.tsx +++ b/web/core/components/issues/issue-layouts/quick-action-dropdowns/all-issue.tsx @@ -9,12 +9,10 @@ import { Copy, ExternalLink, Link, Pencil, Trash2 } from "lucide-react"; import { ARCHIVABLE_STATE_GROUPS, EIssuesStoreType } from "@plane/constants"; import { TIssue } from "@plane/types"; import { ArchiveIcon, ContextMenu, CustomMenu, TContextMenuItem, TOAST_TYPE, setToast } from "@plane/ui"; -import { copyUrlToClipboard } from "@plane/utils"; +import { copyUrlToClipboard, cn, generateWorkItemLink } from "@plane/utils"; // components import { ArchiveIssueModal, CreateUpdateIssueModal, DeleteIssueModal } from "@/components/issues"; // helpers -import { cn } from "@/helpers/common.helper"; -import { generateWorkItemLink } from "@/helpers/issue.helper"; // hooks import { useEventTracker, useProject, useProjectState } from "@/hooks/store"; // types diff --git a/web/core/components/issues/issue-layouts/quick-action-dropdowns/archived-issue.tsx b/web/core/components/issues/issue-layouts/quick-action-dropdowns/archived-issue.tsx index 0e2d54affcb..83e52961435 100644 --- a/web/core/components/issues/issue-layouts/quick-action-dropdowns/archived-issue.tsx +++ b/web/core/components/issues/issue-layouts/quick-action-dropdowns/archived-issue.tsx @@ -8,12 +8,11 @@ import { ArchiveRestoreIcon, ExternalLink, Link, Trash2 } from "lucide-react"; // ui import { EIssuesStoreType, EUserPermissions, EUserPermissionsLevel } from "@plane/constants"; import { ContextMenu, CustomMenu, TContextMenuItem, TOAST_TYPE, setToast } from "@plane/ui"; -import { copyUrlToClipboard } from "@plane/utils"; +import { copyUrlToClipboard, cn } from "@plane/utils"; // components import { DeleteIssueModal } from "@/components/issues"; // constants // helpers -import { cn } from "@/helpers/common.helper"; // hooks import { useEventTracker, useIssues, useUserPermissions } from "@/hooks/store"; // types diff --git a/web/core/components/issues/issue-layouts/quick-action-dropdowns/cycle-issue.tsx b/web/core/components/issues/issue-layouts/quick-action-dropdowns/cycle-issue.tsx index d6af3bf1f78..7d649374123 100644 --- a/web/core/components/issues/issue-layouts/quick-action-dropdowns/cycle-issue.tsx +++ b/web/core/components/issues/issue-layouts/quick-action-dropdowns/cycle-issue.tsx @@ -9,12 +9,10 @@ import { Copy, ExternalLink, Link, Pencil, Trash2, XCircle } from "lucide-react" import { ARCHIVABLE_STATE_GROUPS, EIssuesStoreType, EUserPermissions, EUserPermissionsLevel } from "@plane/constants"; import { TIssue } from "@plane/types"; import { ArchiveIcon, ContextMenu, CustomMenu, TContextMenuItem, TOAST_TYPE, setToast } from "@plane/ui"; -import { copyUrlToClipboard } from "@plane/utils"; +import { copyUrlToClipboard, cn, generateWorkItemLink } from "@plane/utils"; // components import { ArchiveIssueModal, CreateUpdateIssueModal, DeleteIssueModal } from "@/components/issues"; // helpers -import { cn } from "@/helpers/common.helper"; -import { generateWorkItemLink } from "@/helpers/issue.helper"; // hooks import { useEventTracker, useIssues, useProject, useProjectState, useUserPermissions } from "@/hooks/store"; // types diff --git a/web/core/components/issues/issue-layouts/quick-action-dropdowns/draft-issue.tsx b/web/core/components/issues/issue-layouts/quick-action-dropdowns/draft-issue.tsx index 0a186006600..a1d84a7cb08 100644 --- a/web/core/components/issues/issue-layouts/quick-action-dropdowns/draft-issue.tsx +++ b/web/core/components/issues/issue-layouts/quick-action-dropdowns/draft-issue.tsx @@ -6,16 +6,16 @@ import { observer } from "mobx-react"; // icons import { Pencil, Trash2 } from "lucide-react"; // types -import { EIssuesStoreType,EUserPermissions, EUserPermissionsLevel } from "@plane/constants"; +import { EIssuesStoreType, EUserPermissions, EUserPermissionsLevel } from "@plane/constants"; import { useTranslation } from "@plane/i18n"; import { TIssue } from "@plane/types"; // ui import { ContextMenu, CustomMenu, TContextMenuItem } from "@plane/ui"; // components +import { cn } from "@plane/utils"; import { CreateUpdateIssueModal, DeleteIssueModal } from "@/components/issues"; // constant // helpers -import { cn } from "@/helpers/common.helper"; // hooks import { useEventTracker, useIssues, useUserPermissions } from "@/hooks/store"; // types diff --git a/web/core/components/issues/issue-layouts/quick-action-dropdowns/module-issue.tsx b/web/core/components/issues/issue-layouts/quick-action-dropdowns/module-issue.tsx index c7f949fcf98..cd33345aefd 100644 --- a/web/core/components/issues/issue-layouts/quick-action-dropdowns/module-issue.tsx +++ b/web/core/components/issues/issue-layouts/quick-action-dropdowns/module-issue.tsx @@ -9,12 +9,10 @@ import { Copy, ExternalLink, Link, Pencil, Trash2, XCircle } from "lucide-react" import { ARCHIVABLE_STATE_GROUPS, EIssuesStoreType, EUserPermissions, EUserPermissionsLevel } from "@plane/constants"; import { TIssue } from "@plane/types"; import { ArchiveIcon, ContextMenu, CustomMenu, TContextMenuItem, TOAST_TYPE, setToast } from "@plane/ui"; -import { copyUrlToClipboard } from "@plane/utils"; +import { copyUrlToClipboard, cn, generateWorkItemLink } from "@plane/utils"; // components import { ArchiveIssueModal, CreateUpdateIssueModal, DeleteIssueModal } from "@/components/issues"; // helpers -import { cn } from "@/helpers/common.helper"; -import { generateWorkItemLink } from "@/helpers/issue.helper"; // hooks import { useIssues, useEventTracker, useProjectState, useUserPermissions, useProject } from "@/hooks/store"; // types diff --git a/web/core/components/issues/issue-layouts/quick-action-dropdowns/project-issue.tsx b/web/core/components/issues/issue-layouts/quick-action-dropdowns/project-issue.tsx index 902351f2bbe..8fde42c3332 100644 --- a/web/core/components/issues/issue-layouts/quick-action-dropdowns/project-issue.tsx +++ b/web/core/components/issues/issue-layouts/quick-action-dropdowns/project-issue.tsx @@ -10,12 +10,10 @@ import { ARCHIVABLE_STATE_GROUPS, EIssuesStoreType, EUserPermissions, EUserPermi import { useTranslation } from "@plane/i18n"; import { TIssue } from "@plane/types"; import { ArchiveIcon, ContextMenu, CustomMenu, TContextMenuItem, TOAST_TYPE, setToast } from "@plane/ui"; -import { copyUrlToClipboard } from "@plane/utils"; +import { copyUrlToClipboard, cn, generateWorkItemLink } from "@plane/utils"; // components import { ArchiveIssueModal, CreateUpdateIssueModal, DeleteIssueModal } from "@/components/issues"; // helpers -import { cn } from "@/helpers/common.helper"; -import { generateWorkItemLink } from "@/helpers/issue.helper"; // hooks import { useEventTracker, useIssues, useProject, useProjectState, useUserPermissions } from "@/hooks/store"; // types diff --git a/web/core/components/issues/issue-layouts/quick-add/form/gantt.tsx b/web/core/components/issues/issue-layouts/quick-add/form/gantt.tsx index 19f0476762e..e5f27e0c518 100644 --- a/web/core/components/issues/issue-layouts/quick-add/form/gantt.tsx +++ b/web/core/components/issues/issue-layouts/quick-add/form/gantt.tsx @@ -1,7 +1,7 @@ import { FC } from "react"; import { observer } from "mobx-react"; import { useTranslation } from "@plane/i18n"; -import { cn } from "@/helpers/common.helper"; +import { cn } from "@plane/utils"; import { TQuickAddIssueForm } from "../root"; export const GanttQuickAddIssueForm: FC = observer((props) => { diff --git a/web/core/components/issues/issue-layouts/quick-add/root.tsx b/web/core/components/issues/issue-layouts/quick-add/root.tsx index 6bc6997a4cd..28c4edbe5dd 100644 --- a/web/core/components/issues/issue-layouts/quick-add/root.tsx +++ b/web/core/components/issues/issue-layouts/quick-add/root.tsx @@ -12,12 +12,11 @@ import { useTranslation } from "@plane/i18n"; import { IProject, TIssue } from "@plane/types"; // ui import { setPromiseToast } from "@plane/ui"; +import { cn, createIssuePayload } from "@plane/utils"; // components import { CreateIssueToastActionItems } from "@/components/issues"; // constants // helpers -import { cn } from "@/helpers/common.helper"; -import { createIssuePayload } from "@/helpers/issue.helper"; // hooks import { useEventTracker } from "@/hooks/store"; // plane web components diff --git a/web/core/components/issues/issue-layouts/spreadsheet/columns/created-on-column.tsx b/web/core/components/issues/issue-layouts/spreadsheet/columns/created-on-column.tsx index 79ac6e9244a..d1e2b4b548b 100644 --- a/web/core/components/issues/issue-layouts/spreadsheet/columns/created-on-column.tsx +++ b/web/core/components/issues/issue-layouts/spreadsheet/columns/created-on-column.tsx @@ -4,7 +4,7 @@ import { observer } from "mobx-react"; import { TIssue } from "@plane/types"; // helpers import { Row } from "@plane/ui"; -import { renderFormattedDate } from "@/helpers/date-time.helper"; +import { renderFormattedDate } from "@plane/utils"; type Props = { issue: TIssue; diff --git a/web/core/components/issues/issue-layouts/spreadsheet/columns/due-date-column.tsx b/web/core/components/issues/issue-layouts/spreadsheet/columns/due-date-column.tsx index 57858ff7543..98612b46f1c 100644 --- a/web/core/components/issues/issue-layouts/spreadsheet/columns/due-date-column.tsx +++ b/web/core/components/issues/issue-layouts/spreadsheet/columns/due-date-column.tsx @@ -3,12 +3,10 @@ import { observer } from "mobx-react"; import { CalendarCheck2 } from "lucide-react"; // types import { TIssue } from "@plane/types"; +import { cn, getDate, renderFormattedPayloadDate, shouldHighlightIssueDueDate } from "@plane/utils"; // components import { DateDropdown } from "@/components/dropdowns"; // helpers -import { cn } from "@/helpers/common.helper"; -import { getDate, renderFormattedPayloadDate } from "@/helpers/date-time.helper"; -import { shouldHighlightIssueDueDate } from "@/helpers/issue.helper"; // hooks import { useProjectState } from "@/hooks/store"; diff --git a/web/core/components/issues/issue-layouts/spreadsheet/columns/start-date-column.tsx b/web/core/components/issues/issue-layouts/spreadsheet/columns/start-date-column.tsx index a20c2472204..397e68905fb 100644 --- a/web/core/components/issues/issue-layouts/spreadsheet/columns/start-date-column.tsx +++ b/web/core/components/issues/issue-layouts/spreadsheet/columns/start-date-column.tsx @@ -4,9 +4,9 @@ import { CalendarClock } from "lucide-react"; // types import { TIssue } from "@plane/types"; // components +import { getDate, renderFormattedPayloadDate } from "@plane/utils"; import { DateDropdown } from "@/components/dropdowns"; // helpers -import { getDate, renderFormattedPayloadDate } from "@/helpers/date-time.helper"; type Props = { issue: TIssue; diff --git a/web/core/components/issues/issue-layouts/spreadsheet/columns/sub-issue-column.tsx b/web/core/components/issues/issue-layouts/spreadsheet/columns/sub-issue-column.tsx index 54f3d858650..21e17144518 100644 --- a/web/core/components/issues/issue-layouts/spreadsheet/columns/sub-issue-column.tsx +++ b/web/core/components/issues/issue-layouts/spreadsheet/columns/sub-issue-column.tsx @@ -5,7 +5,7 @@ import { useParams } from "next/navigation"; import { TIssue } from "@plane/types"; // helpers import { Row } from "@plane/ui"; -import { cn } from "@/helpers/common.helper"; +import { cn } from "@plane/utils"; // hooks import { useAppRouter } from "@/hooks/use-app-router"; import { IssueStats } from "@/plane-web/components/issues/issue-layouts/issue-stats"; diff --git a/web/core/components/issues/issue-layouts/spreadsheet/columns/updated-on-column.tsx b/web/core/components/issues/issue-layouts/spreadsheet/columns/updated-on-column.tsx index a93c0170014..9cdf79720f0 100644 --- a/web/core/components/issues/issue-layouts/spreadsheet/columns/updated-on-column.tsx +++ b/web/core/components/issues/issue-layouts/spreadsheet/columns/updated-on-column.tsx @@ -4,7 +4,7 @@ import { observer } from "mobx-react"; import { TIssue } from "@plane/types"; // helpers import { Row } from "@plane/ui"; -import { renderFormattedDate } from "@/helpers/date-time.helper"; +import { renderFormattedDate } from "@plane/utils"; type Props = { issue: TIssue; diff --git a/web/core/components/issues/issue-layouts/spreadsheet/issue-row.tsx b/web/core/components/issues/issue-layouts/spreadsheet/issue-row.tsx index c60519053a3..a645bffe252 100644 --- a/web/core/components/issues/issue-layouts/spreadsheet/issue-row.tsx +++ b/web/core/components/issues/issue-layouts/spreadsheet/issue-row.tsx @@ -11,12 +11,11 @@ import { useOutsideClickDetector } from "@plane/hooks"; import { IIssueDisplayProperties, TIssue } from "@plane/types"; // ui import { ControlLink, Row, Tooltip } from "@plane/ui"; +import { cn, generateWorkItemLink } from "@plane/utils"; // components import { MultipleSelectEntityAction } from "@/components/core"; import RenderIfVisible from "@/components/core/render-if-visible-HOC"; // helper -import { cn } from "@/helpers/common.helper"; -import { generateWorkItemLink } from "@/helpers/issue.helper"; // hooks import { useIssueDetail, useIssues, useProject } from "@/hooks/store"; import useIssuePeekOverviewRedirection from "@/hooks/use-issue-peek-overview-redirection"; diff --git a/web/core/components/issues/issue-layouts/spreadsheet/spreadsheet-header.tsx b/web/core/components/issues/issue-layouts/spreadsheet/spreadsheet-header.tsx index d58fc26544f..1a68aba4df2 100644 --- a/web/core/components/issues/issue-layouts/spreadsheet/spreadsheet-header.tsx +++ b/web/core/components/issues/issue-layouts/spreadsheet/spreadsheet-header.tsx @@ -6,10 +6,10 @@ import { SPREADSHEET_SELECT_GROUP } from "@plane/constants"; import { IIssueDisplayFilterOptions, IIssueDisplayProperties } from "@plane/types"; // components import { Row } from "@plane/ui"; +import { cn } from "@plane/utils"; import { MultipleSelectGroupAction } from "@/components/core"; import { SpreadsheetHeaderColumn } from "@/components/issues/issue-layouts"; // helpers -import { cn } from "@/helpers/common.helper"; // hooks import { TSelectionHelper } from "@/hooks/use-multiple-select"; diff --git a/web/core/components/issues/issue-layouts/utils.tsx b/web/core/components/issues/issue-layouts/utils.tsx index c0e9dc6585a..f16bdcc49db 100644 --- a/web/core/components/issues/issue-layouts/utils.tsx +++ b/web/core/components/issues/issue-layouts/utils.tsx @@ -30,11 +30,10 @@ import { } from "@plane/types"; // plane ui import { Avatar, CycleGroupIcon, DiceIcon, ISvgIcons, PriorityIcon, StateGroupIcon } from "@plane/ui"; +import { renderFormattedDate, getFileURL } from "@plane/utils"; // components import { Logo } from "@/components/common"; // helpers -import { renderFormattedDate } from "@/helpers/date-time.helper"; -import { getFileURL } from "@/helpers/file.helper"; // store import { store } from "@/lib/store-context"; // plane web store diff --git a/web/core/components/issues/issue-modal/components/default-properties.tsx b/web/core/components/issues/issue-modal/components/default-properties.tsx index 5696743c727..20eb13a4c2c 100644 --- a/web/core/components/issues/issue-modal/components/default-properties.tsx +++ b/web/core/components/issues/issue-modal/components/default-properties.tsx @@ -11,6 +11,7 @@ import { useTranslation } from "@plane/i18n"; import { ISearchIssueResponse, TIssue } from "@plane/types"; // ui import { CustomMenu } from "@plane/ui"; +import { getDate, renderFormattedPayloadDate, getTabIndex } from "@plane/utils"; // components import { CycleDropdown, @@ -24,8 +25,6 @@ import { import { ParentIssuesListModal } from "@/components/issues"; import { IssueLabelSelect } from "@/components/issues/select"; // helpers -import { getDate, renderFormattedPayloadDate } from "@/helpers/date-time.helper"; -import { getTabIndex } from "@/helpers/tab-indices.helper"; // hooks import { useProjectEstimates, useProject, useUserPermissions } from "@/hooks/store"; import { usePlatformOS } from "@/hooks/use-platform-os"; diff --git a/web/core/components/issues/issue-modal/components/description-editor.tsx b/web/core/components/issues/issue-modal/components/description-editor.tsx index 9cae8d8407b..b1bbce5b904 100644 --- a/web/core/components/issues/issue-modal/components/description-editor.tsx +++ b/web/core/components/issues/issue-modal/components/description-editor.tsx @@ -15,12 +15,11 @@ import { TIssue } from "@plane/types"; import { EFileAssetType } from "@plane/types/src/enums"; // ui import { Loader, setToast, TOAST_TYPE } from "@plane/ui"; +import { getDescriptionPlaceholderI18n, getTabIndex } from "@plane/utils"; // components import { GptAssistantPopover } from "@/components/core"; import { RichTextEditor } from "@/components/editor"; // helpers -import { getDescriptionPlaceholderI18n } from "@/helpers/issue.helper"; -import { getTabIndex } from "@/helpers/tab-indices.helper"; // hooks import { useEditorAsset, useInstance, useWorkspace } from "@/hooks/store"; import useKeypress from "@/hooks/use-keypress"; diff --git a/web/core/components/issues/issue-modal/components/parent-tag.tsx b/web/core/components/issues/issue-modal/components/parent-tag.tsx index 583bc850b51..10d936001ba 100644 --- a/web/core/components/issues/issue-modal/components/parent-tag.tsx +++ b/web/core/components/issues/issue-modal/components/parent-tag.tsx @@ -9,7 +9,7 @@ import { ETabIndices } from "@plane/constants"; // types import { ISearchIssueResponse, TIssue } from "@plane/types"; // helpers -import { getTabIndex } from "@/helpers/tab-indices.helper"; +import { getTabIndex } from "@plane/utils"; // hooks import { usePlatformOS } from "@/hooks/use-platform-os"; // plane web components diff --git a/web/core/components/issues/issue-modal/components/project-select.tsx b/web/core/components/issues/issue-modal/components/project-select.tsx index 29268b4adcf..b148d4ce38a 100644 --- a/web/core/components/issues/issue-modal/components/project-select.tsx +++ b/web/core/components/issues/issue-modal/components/project-select.tsx @@ -7,11 +7,10 @@ import { Control, Controller } from "react-hook-form"; import { ETabIndices } from "@plane/constants"; // types import { TIssue } from "@plane/types"; +import { shouldRenderProject, getTabIndex } from "@plane/utils"; // components import { ProjectDropdown } from "@/components/dropdowns"; // helpers -import { shouldRenderProject } from "@/helpers/project.helper"; -import { getTabIndex } from "@/helpers/tab-indices.helper"; // store hooks import { useUser } from "@/hooks/store"; import { usePlatformOS } from "@/hooks/use-platform-os"; diff --git a/web/core/components/issues/issue-modal/components/title-input.tsx b/web/core/components/issues/issue-modal/components/title-input.tsx index aec93914955..11c07eaaea6 100644 --- a/web/core/components/issues/issue-modal/components/title-input.tsx +++ b/web/core/components/issues/issue-modal/components/title-input.tsx @@ -11,7 +11,7 @@ import { TIssue } from "@plane/types"; // ui import { Input } from "@plane/ui"; // helpers -import { getTabIndex } from "@/helpers/tab-indices.helper"; +import { getTabIndex } from "@plane/utils"; // hooks import { usePlatformOS } from "@/hooks/use-platform-os"; diff --git a/web/core/components/issues/issue-modal/context/issue-modal-context.tsx b/web/core/components/issues/issue-modal/context/issue-modal-context.tsx index 59d6558a6f2..8b4f7061f0a 100644 --- a/web/core/components/issues/issue-modal/context/issue-modal-context.tsx +++ b/web/core/components/issues/issue-modal/context/issue-modal-context.tsx @@ -1,12 +1,12 @@ import { createContext } from "react"; // ce imports -import { TIssueFields } from "ce/components/issues"; // react-hook-form import { UseFormReset, UseFormWatch } from "react-hook-form"; // plane imports import { EditorRefApi } from "@plane/editor"; import { ISearchIssueResponse, TIssue } from "@plane/types"; import { TIssuePropertyValues, TIssuePropertyValueErrors } from "@/plane-web/types/issue-types"; +import { TIssueFields } from "ce/components/issues"; export type TPropertyValuesValidationProps = { projectId: string | null; diff --git a/web/core/components/issues/issue-modal/draft-issue-layout.tsx b/web/core/components/issues/issue-modal/draft-issue-layout.tsx index e10ca34b786..96cc4a3220e 100644 --- a/web/core/components/issues/issue-modal/draft-issue-layout.tsx +++ b/web/core/components/issues/issue-modal/draft-issue-layout.tsx @@ -10,9 +10,9 @@ import type { TIssue } from "@plane/types"; // ui import { TOAST_TYPE, setToast } from "@plane/ui"; // components +import { isEmptyHtmlString } from "@plane/utils"; import { ConfirmIssueDiscard } from "@/components/issues"; // helpers -import { isEmptyHtmlString } from "@/helpers/string.helper"; // hooks import { useIssueModal } from "@/hooks/context/use-issue-modal"; import { useEventTracker, useWorkspaceDraftIssues } from "@/hooks/store"; diff --git a/web/core/components/issues/issue-modal/form.tsx b/web/core/components/issues/issue-modal/form.tsx index ca37cbf24a8..addf1917a62 100644 --- a/web/core/components/issues/issue-modal/form.tsx +++ b/web/core/components/issues/issue-modal/form.tsx @@ -13,8 +13,8 @@ import { useTranslation } from "@plane/i18n"; import type { TIssue, TWorkspaceDraftIssue } from "@plane/types"; // hooks import { Button, ToggleSwitch, TOAST_TYPE, setToast } from "@plane/ui"; +import { convertWorkItemDataToSearchResponse, getUpdateFormDataForReset, cn, getTextContent, getChangedIssuefields, getTabIndex } from "@plane/utils"; // components -import { convertWorkItemDataToSearchResponse, getUpdateFormDataForReset } from "@plane/utils"; import { IssueDefaultProperties, IssueDescriptionEditor, @@ -24,10 +24,6 @@ import { } from "@/components/issues/issue-modal/components"; import { CreateLabelModal } from "@/components/labels"; // helpers -import { cn } from "@/helpers/common.helper"; -import { getTextContent } from "@/helpers/editor.helper"; -import { getChangedIssuefields } from "@/helpers/issue-modal.helper"; -import { getTabIndex } from "@/helpers/tab-indices.helper"; // hooks import { useIssueModal } from "@/hooks/context/use-issue-modal"; import { useIssueDetail, useProject, useProjectState, useWorkspaceDraftIssues } from "@/hooks/store"; diff --git a/web/core/components/issues/parent-issues-list-modal.tsx b/web/core/components/issues/parent-issues-list-modal.tsx index e289caf2a53..835663a941b 100644 --- a/web/core/components/issues/parent-issues-list-modal.tsx +++ b/web/core/components/issues/parent-issues-list-modal.tsx @@ -12,11 +12,10 @@ import { useTranslation } from "@plane/i18n"; import { ISearchIssueResponse } from "@plane/types"; // ui import { Loader } from "@plane/ui"; +import { generateWorkItemLink, getTabIndex } from "@plane/utils"; // components import { IssueSearchModalEmptyState } from "@/components/core"; // helpers -import { generateWorkItemLink } from "@/helpers/issue.helper"; -import { getTabIndex } from "@/helpers/tab-indices.helper"; // hooks import useDebounce from "@/hooks/use-debounce"; import { usePlatformOS } from "@/hooks/use-platform-os"; diff --git a/web/core/components/issues/peek-overview/header.tsx b/web/core/components/issues/peek-overview/header.tsx index c5d66e87def..2078d4c8a0e 100644 --- a/web/core/components/issues/peek-overview/header.tsx +++ b/web/core/components/issues/peek-overview/header.tsx @@ -18,12 +18,10 @@ import { Tooltip, setToast, } from "@plane/ui"; -import { copyUrlToClipboard } from "@plane/utils"; +import { copyUrlToClipboard, cn, generateWorkItemLink } from "@plane/utils"; // components import { IssueSubscription, NameDescriptionUpdateStatus } from "@/components/issues"; // helpers -import { cn } from "@/helpers/common.helper"; -import { generateWorkItemLink } from "@/helpers/issue.helper"; // store hooks import { useIssueDetail, useProject, useProjectState, useUser } from "@/hooks/store"; // hooks diff --git a/web/core/components/issues/peek-overview/issue-detail.tsx b/web/core/components/issues/peek-overview/issue-detail.tsx index 7960f80e197..6873da488cd 100644 --- a/web/core/components/issues/peek-overview/issue-detail.tsx +++ b/web/core/components/issues/peek-overview/issue-detail.tsx @@ -5,10 +5,10 @@ import { observer } from "mobx-react"; import { EditorRefApi } from "@plane/editor"; import { TNameDescriptionLoader } from "@plane/types"; // components +import { getTextContent } from "@plane/utils"; import { DescriptionVersionsRoot } from "@/components/core/description-versions"; import { IssueParentDetail, TIssueOperations } from "@/components/issues"; // helpers -import { getTextContent } from "@/helpers/editor.helper"; // hooks import { useIssueDetail, useMember, useProject, useUser } from "@/hooks/store"; import useReloadConfirmations from "@/hooks/use-reload-confirmation"; diff --git a/web/core/components/issues/peek-overview/properties.tsx b/web/core/components/issues/peek-overview/properties.tsx index 93516297f9a..41921cf561c 100644 --- a/web/core/components/issues/peek-overview/properties.tsx +++ b/web/core/components/issues/peek-overview/properties.tsx @@ -7,6 +7,7 @@ import { Signal, Tag, Triangle, LayoutPanelTop, CalendarClock, CalendarCheck2, U import { useTranslation } from "@plane/i18n"; // ui icons import { DiceIcon, DoubleCircleIcon, ContrastIcon } from "@plane/ui"; +import { cn, getDate, renderFormattedPayloadDate, shouldHighlightIssueDueDate } from "@plane/utils"; // components import { DateDropdown, @@ -18,9 +19,6 @@ import { import { ButtonAvatars } from "@/components/dropdowns/member/avatar"; import { IssueCycleSelect, IssueModuleSelect, IssueLabel, TIssueOperations } from "@/components/issues"; // helpers -import { cn } from "@/helpers/common.helper"; -import { getDate, renderFormattedPayloadDate } from "@/helpers/date-time.helper"; -import { shouldHighlightIssueDueDate } from "@/helpers/issue.helper"; import { useIssueDetail, useMember, useProject, useProjectState } from "@/hooks/store"; // plane web components import { IssueParentSelectRoot, IssueWorklogProperty } from "@/plane-web/components/issues"; diff --git a/web/core/components/issues/peek-overview/view.tsx b/web/core/components/issues/peek-overview/view.tsx index 72bca2408f0..e75b91268b6 100644 --- a/web/core/components/issues/peek-overview/view.tsx +++ b/web/core/components/issues/peek-overview/view.tsx @@ -5,6 +5,7 @@ import { EIssueServiceType } from "@plane/constants"; // types import { TNameDescriptionLoader } from "@plane/types"; // components +import { cn } from "@plane/utils"; import { DeleteIssueModal, IssuePeekOverviewHeader, @@ -18,7 +19,6 @@ import { IssueDetailWidgets, } from "@/components/issues"; // helpers -import { cn } from "@/helpers/common.helper"; // hooks import { useIssueDetail } from "@/hooks/store"; import useKeypress from "@/hooks/use-keypress"; diff --git a/web/core/components/issues/relations/issue-list-item.tsx b/web/core/components/issues/relations/issue-list-item.tsx index ee22253276f..eeedabdf947 100644 --- a/web/core/components/issues/relations/issue-list-item.tsx +++ b/web/core/components/issues/relations/issue-list-item.tsx @@ -9,9 +9,9 @@ import { useTranslation } from "@plane/i18n"; import { TIssue, TIssueServiceType } from "@plane/types"; import { ControlLink, CustomMenu, Tooltip } from "@plane/ui"; // components +import { generateWorkItemLink } from "@plane/utils"; import { RelationIssueProperty } from "@/components/issues/relations"; // helpers -import { generateWorkItemLink } from "@/helpers/issue.helper"; // hooks import { useIssueDetail, useProject, useProjectState } from "@/hooks/store"; import useIssuePeekOverviewRedirection from "@/hooks/use-issue-peek-overview-redirection"; diff --git a/web/core/components/issues/select/label.tsx b/web/core/components/issues/select/label.tsx index 149ca0f7717..6c9b72a9111 100644 --- a/web/core/components/issues/select/label.tsx +++ b/web/core/components/issues/select/label.tsx @@ -8,9 +8,9 @@ import { Combobox } from "@headlessui/react"; import { useOutsideClickDetector } from "@plane/hooks"; import { useTranslation } from "@plane/i18n"; // components +import { cn } from "@plane/utils"; import { IssueLabelsList } from "@/components/ui"; // helpers -import { cn } from "@/helpers/common.helper"; // hooks import { useLabel } from "@/hooks/store"; import { useDropdownKeyDown } from "@/hooks/use-dropdown-key-down"; diff --git a/web/core/components/issues/title-input.tsx b/web/core/components/issues/title-input.tsx index 463b81a7910..bc04dbbb4d6 100644 --- a/web/core/components/issues/title-input.tsx +++ b/web/core/components/issues/title-input.tsx @@ -7,7 +7,7 @@ import { TNameDescriptionLoader } from "@plane/types"; // components import { TextArea } from "@plane/ui"; // types -import { cn } from "@/helpers/common.helper"; +import { cn } from "@plane/utils"; import useDebounce from "@/hooks/use-debounce"; import { TIssueOperations } from "./issue-detail"; // hooks diff --git a/web/core/components/issues/workspace-draft/draft-issue-block.tsx b/web/core/components/issues/workspace-draft/draft-issue-block.tsx index ab2639858fa..423231c6c33 100644 --- a/web/core/components/issues/workspace-draft/draft-issue-block.tsx +++ b/web/core/components/issues/workspace-draft/draft-issue-block.tsx @@ -10,7 +10,7 @@ import { TWorkspaceDraftIssue } from "@plane/types"; import { Row, TContextMenuItem, Tooltip } from "@plane/ui"; // constants // helper -import { cn } from "@/helpers/common.helper"; +import { cn } from "@plane/utils"; // hooks import { useAppTheme, useProject, useWorkspaceDraftIssues } from "@/hooks/store"; // plane-web components diff --git a/web/core/components/issues/workspace-draft/draft-issue-properties.tsx b/web/core/components/issues/workspace-draft/draft-issue-properties.tsx index 92f61f8e0f4..4318bc2eafa 100644 --- a/web/core/components/issues/workspace-draft/draft-issue-properties.tsx +++ b/web/core/components/issues/workspace-draft/draft-issue-properties.tsx @@ -7,6 +7,7 @@ import { useParams } from "next/navigation"; import { CalendarCheck2, CalendarClock } from "lucide-react"; // types import { TIssuePriorities, TWorkspaceDraftIssue } from "@plane/types"; +import { getDate, renderFormattedPayloadDate, shouldHighlightIssueDueDate } from "@plane/utils"; // components import { DateDropdown, @@ -18,8 +19,6 @@ import { StateDropdown, } from "@/components/dropdowns"; // helpers -import { getDate, renderFormattedPayloadDate } from "@/helpers/date-time.helper"; -import { shouldHighlightIssueDueDate } from "@/helpers/issue.helper"; // hooks import { useLabel, useProjectState, useProject, useProjectEstimates, useWorkspaceDraftIssues } from "@/hooks/store"; import { usePlatformOS } from "@/hooks/use-platform-os"; diff --git a/web/core/components/issues/workspace-draft/quick-action.tsx b/web/core/components/issues/workspace-draft/quick-action.tsx index 676c79ba680..2a52d83d6db 100644 --- a/web/core/components/issues/workspace-draft/quick-action.tsx +++ b/web/core/components/issues/workspace-draft/quick-action.tsx @@ -5,7 +5,7 @@ import { useTranslation } from "@plane/i18n"; // ui import { ContextMenu, CustomMenu, TContextMenuItem } from "@plane/ui"; // helpers -import { cn } from "@/helpers/common.helper"; +import { cn } from "@plane/utils"; export interface Props { parentRef: React.RefObject; diff --git a/web/core/components/issues/workspace-draft/root.tsx b/web/core/components/issues/workspace-draft/root.tsx index 540839cd203..8f4577e8062 100644 --- a/web/core/components/issues/workspace-draft/root.tsx +++ b/web/core/components/issues/workspace-draft/root.tsx @@ -8,11 +8,11 @@ import { EDraftIssuePaginationType } from "@plane/constants"; import { EUserPermissionsLevel, EUserWorkspaceRoles } from "@plane/constants/src/user"; import { useTranslation } from "@plane/i18n"; // components +import { cn } from "@plane/utils"; import { ComicBoxButton, DetailedEmptyState } from "@/components/empty-state"; // constants // helpers -import { cn } from "@/helpers/common.helper"; // hooks import { useCommandPalette, useProject, useUserPermissions, useWorkspaceDraftIssues } from "@/hooks/store"; import { useResolvedAssetPath } from "@/hooks/use-resolved-asset-path"; diff --git a/web/core/components/labels/create-label-modal.tsx b/web/core/components/labels/create-label-modal.tsx index 6fcbfb6a208..a186783b461 100644 --- a/web/core/components/labels/create-label-modal.tsx +++ b/web/core/components/labels/create-label-modal.tsx @@ -14,7 +14,7 @@ import type { IIssueLabel, IState } from "@plane/types"; // ui import { Button, Input, TOAST_TYPE, setToast } from "@plane/ui"; // helpers -import { getTabIndex } from "@/helpers/tab-indices.helper"; +import { getTabIndex } from "@plane/utils"; // hooks import { useLabel } from "@/hooks/store"; import { usePlatformOS } from "@/hooks/use-platform-os"; diff --git a/web/core/components/labels/label-block/label-item-block.tsx b/web/core/components/labels/label-block/label-item-block.tsx index 6e1d2d82e4d..d74fabc76cb 100644 --- a/web/core/components/labels/label-block/label-item-block.tsx +++ b/web/core/components/labels/label-block/label-item-block.tsx @@ -9,7 +9,7 @@ import { IIssueLabel } from "@plane/types"; // ui import { CustomMenu, DragHandle } from "@plane/ui"; // helpers -import { cn } from "@/helpers/common.helper"; +import { cn } from "@plane/utils"; // components import { LabelName } from "./label-name"; diff --git a/web/core/components/license/modal/card/free-plan.tsx b/web/core/components/license/modal/card/free-plan.tsx index 946742671a6..250ac416406 100644 --- a/web/core/components/license/modal/card/free-plan.tsx +++ b/web/core/components/license/modal/card/free-plan.tsx @@ -5,7 +5,7 @@ import { CircleX } from "lucide-react"; // plane constants import { FREE_PLAN_UPGRADE_FEATURES } from "@plane/constants"; // helpers -import { cn } from "@/helpers/common.helper"; +import { cn } from "@plane/utils"; type FreePlanCardProps = { isOnFreePlan: boolean; diff --git a/web/core/components/modules/analytics-sidebar/issue-progress.tsx b/web/core/components/modules/analytics-sidebar/issue-progress.tsx index a29334ff83f..3562374225b 100644 --- a/web/core/components/modules/analytics-sidebar/issue-progress.tsx +++ b/web/core/components/modules/analytics-sidebar/issue-progress.tsx @@ -6,21 +6,19 @@ import { observer } from "mobx-react"; import { useSearchParams } from "next/navigation"; import { AlertCircle, ChevronUp, ChevronDown } from "lucide-react"; import { Disclosure, Transition } from "@headlessui/react"; -import { EIssueFilterType, EIssuesStoreType } from "@plane/constants"; +import { EIssueFilterType, EIssuesStoreType, EEstimateSystem } from "@plane/constants"; import { useTranslation } from "@plane/i18n"; import { IIssueFilterOptions, TModulePlotType } from "@plane/types"; import { CustomSelect, Spinner } from "@plane/ui"; // components -import ProgressChart from "@/components/core/sidebar/progress-chart"; -import { ModuleProgressStats } from "@/components/modules"; // constants // helpers -import { getDate } from "@/helpers/date-time.helper"; +import { getDate } from "@plane/utils"; +import ProgressChart from "@/components/core/sidebar/progress-chart"; +import { ModuleProgressStats } from "@/components/modules"; // hooks import { useIssues, useModule, useProjectEstimates } from "@/hooks/store"; // plane web constants -import { EEstimateSystem } from "@/plane-web/constants/estimates"; - type TModuleAnalyticsProgress = { workspaceSlug: string; projectId: string; diff --git a/web/core/components/modules/analytics-sidebar/progress-stats.tsx b/web/core/components/modules/analytics-sidebar/progress-stats.tsx index 5c92786d77f..b30811219c8 100644 --- a/web/core/components/modules/analytics-sidebar/progress-stats.tsx +++ b/web/core/components/modules/analytics-sidebar/progress-stats.tsx @@ -14,11 +14,10 @@ import { TStateGroups, } from "@plane/types"; import { Avatar, StateGroupIcon } from "@plane/ui"; +import { cn, getFileURL } from "@plane/utils"; // components import { SingleProgressStats } from "@/components/core"; // helpers -import { cn } from "@/helpers/common.helper"; -import { getFileURL } from "@/helpers/file.helper"; // hooks import { useProjectState } from "@/hooks/store"; import useLocalStorage from "@/hooks/use-local-storage"; diff --git a/web/core/components/modules/analytics-sidebar/root.tsx b/web/core/components/modules/analytics-sidebar/root.tsx index ce6068566d3..bbe1e0d142a 100644 --- a/web/core/components/modules/analytics-sidebar/root.tsx +++ b/web/core/components/modules/analytics-sidebar/root.tsx @@ -6,21 +6,15 @@ import { useParams } from "next/navigation"; import { Controller, useForm } from "react-hook-form"; import { CalendarClock, ChevronDown, ChevronRight, Info, Plus, SquareUser, Users } from "lucide-react"; import { Disclosure, Transition } from "@headlessui/react"; +import { MODULE_STATUS, MODULE_LINK_CREATED, MODULE_LINK_DELETED, MODULE_LINK_UPDATED, MODULE_UPDATED, EUserPermissions, EUserPermissionsLevel, EEstimateSystem } from "@plane/constants"; // plane types -import { - MODULE_STATUS, - MODULE_LINK_CREATED, - MODULE_LINK_DELETED, - MODULE_LINK_UPDATED, - MODULE_UPDATED, - EUserPermissions, - EUserPermissionsLevel, -} from "@plane/constants"; import { useTranslation } from "@plane/i18n"; import { ILinkDetails, IModule, ModuleLink } from "@plane/types"; // plane ui import { Loader, LayersIcon, CustomSelect, ModuleStatusIcon, TOAST_TYPE, setToast, TextArea } from "@plane/ui"; // components +// helpers +import { getDate, renderFormattedPayloadDate } from "@plane/utils"; import { DateRangeDropdown, MemberDropdown } from "@/components/dropdowns"; import { ArchiveModuleModal, @@ -29,13 +23,9 @@ import { ModuleAnalyticsProgress, ModuleLinksList, } from "@/components/modules"; -// helpers -import { getDate, renderFormattedPayloadDate } from "@/helpers/date-time.helper"; // hooks import { useModule, useEventTracker, useProjectEstimates, useUserPermissions } from "@/hooks/store"; // plane web constants -import { EEstimateSystem } from "@/plane-web/constants/estimates"; - const defaultValues: Partial = { lead_id: "", member_ids: [], diff --git a/web/core/components/modules/applied-filters/date.tsx b/web/core/components/modules/applied-filters/date.tsx index 53c24a3a9c7..f3babd7658f 100644 --- a/web/core/components/modules/applied-filters/date.tsx +++ b/web/core/components/modules/applied-filters/date.tsx @@ -2,9 +2,8 @@ import { observer } from "mobx-react"; // icons import { X } from "lucide-react"; import { DATE_AFTER_FILTER_OPTIONS } from "@plane/constants"; +import { renderFormattedDate, capitalizeFirstLetter } from "@plane/utils"; // helpers -import { renderFormattedDate } from "@/helpers/date-time.helper"; -import { capitalizeFirstLetter } from "@/helpers/string.helper"; // constants type Props = { diff --git a/web/core/components/modules/applied-filters/members.tsx b/web/core/components/modules/applied-filters/members.tsx index ccb8c90c921..e1c8b68343d 100644 --- a/web/core/components/modules/applied-filters/members.tsx +++ b/web/core/components/modules/applied-filters/members.tsx @@ -5,7 +5,7 @@ import { X } from "lucide-react"; // plane ui import { Avatar } from "@plane/ui"; // helpers -import { getFileURL } from "@/helpers/file.helper"; +import { getFileURL } from "@plane/utils"; // hooks import { useMember } from "@/hooks/store"; diff --git a/web/core/components/modules/applied-filters/root.tsx b/web/core/components/modules/applied-filters/root.tsx index f8b4fac08bb..2ba2765e22d 100644 --- a/web/core/components/modules/applied-filters/root.tsx +++ b/web/core/components/modules/applied-filters/root.tsx @@ -3,9 +3,9 @@ import { useTranslation } from "@plane/i18n"; import { TModuleDisplayFilters, TModuleFilters } from "@plane/types"; // components import { Header, EHeaderVariant, Tag } from "@plane/ui"; +import { replaceUnderscoreIfSnakeCase } from "@plane/utils"; import { AppliedDateFilters, AppliedMembersFilters, AppliedStatusFilters } from "@/components/modules"; // helpers -import { replaceUnderscoreIfSnakeCase } from "@/helpers/string.helper"; // types type Props = { diff --git a/web/core/components/modules/archived-modules/header.tsx b/web/core/components/modules/archived-modules/header.tsx index 47687e2b4f1..c0bd2d930ac 100644 --- a/web/core/components/modules/archived-modules/header.tsx +++ b/web/core/components/modules/archived-modules/header.tsx @@ -7,13 +7,12 @@ import { ListFilter, Search, X } from "lucide-react"; import { useOutsideClickDetector } from "@plane/hooks"; // types import type { TModuleFilters } from "@plane/types"; +import { cn, calculateTotalFilters } from "@plane/utils"; // components import { ArchiveTabsList } from "@/components/archives"; import { FiltersDropdown } from "@/components/issues"; import { ModuleFiltersSelection, ModuleOrderByDropdown } from "@/components/modules"; // helpers -import { cn } from "@/helpers/common.helper"; -import { calculateTotalFilters } from "@/helpers/filter.helper"; // hooks import { useMember, useModuleFilter } from "@/hooks/store"; diff --git a/web/core/components/modules/archived-modules/root.tsx b/web/core/components/modules/archived-modules/root.tsx index 30ae74a5ce8..9bcb50c6ed1 100644 --- a/web/core/components/modules/archived-modules/root.tsx +++ b/web/core/components/modules/archived-modules/root.tsx @@ -6,11 +6,11 @@ import useSWR from "swr"; import { useTranslation } from "@plane/i18n"; import { TModuleFilters } from "@plane/types"; // components +import { calculateTotalFilters } from "@plane/utils"; import { DetailedEmptyState } from "@/components/empty-state"; import { ArchivedModulesView, ModuleAppliedFiltersList } from "@/components/modules"; import { CycleModuleListLayout } from "@/components/ui"; // helpers -import { calculateTotalFilters } from "@/helpers/filter.helper"; // hooks import { useModule, useModuleFilter } from "@/hooks/store"; import { useResolvedAssetPath } from "@/hooks/use-resolved-asset-path"; diff --git a/web/core/components/modules/dropdowns/filters/lead.tsx b/web/core/components/modules/dropdowns/filters/lead.tsx index 7b225dee9e9..a6de50b4e86 100644 --- a/web/core/components/modules/dropdowns/filters/lead.tsx +++ b/web/core/components/modules/dropdowns/filters/lead.tsx @@ -6,9 +6,9 @@ import { observer } from "mobx-react"; // plane ui import { Avatar, Loader } from "@plane/ui"; // components +import { getFileURL } from "@plane/utils"; import { FilterHeader, FilterOption } from "@/components/issues"; // helpers -import { getFileURL } from "@/helpers/file.helper"; // hooks import { useMember, useUser } from "@/hooks/store"; diff --git a/web/core/components/modules/dropdowns/filters/members.tsx b/web/core/components/modules/dropdowns/filters/members.tsx index 752858547c5..1f593203a70 100644 --- a/web/core/components/modules/dropdowns/filters/members.tsx +++ b/web/core/components/modules/dropdowns/filters/members.tsx @@ -6,9 +6,9 @@ import { observer } from "mobx-react"; // plane ui import { Avatar, Loader } from "@plane/ui"; // components +import { getFileURL } from "@plane/utils"; import { FilterHeader, FilterOption } from "@/components/issues"; // helpers -import { getFileURL } from "@/helpers/file.helper"; // hooks import { useMember, useUser } from "@/hooks/store"; diff --git a/web/core/components/modules/dropdowns/filters/start-date.tsx b/web/core/components/modules/dropdowns/filters/start-date.tsx index e43a7e50c81..2d7b9c17f27 100644 --- a/web/core/components/modules/dropdowns/filters/start-date.tsx +++ b/web/core/components/modules/dropdowns/filters/start-date.tsx @@ -3,11 +3,11 @@ import { observer } from "mobx-react"; // constants import { DATE_AFTER_FILTER_OPTIONS } from "@plane/constants"; // components +import { isInDateFormat } from "@plane/utils"; import { DateFilterModal } from "@/components/core"; import { FilterHeader, FilterOption } from "@/components/issues"; // helpers -import { isInDateFormat } from "@/helpers/date-time.helper"; type Props = { appliedFilters: string[] | null; diff --git a/web/core/components/modules/dropdowns/filters/target-date.tsx b/web/core/components/modules/dropdowns/filters/target-date.tsx index c7ed9c84074..2bb0f84c270 100644 --- a/web/core/components/modules/dropdowns/filters/target-date.tsx +++ b/web/core/components/modules/dropdowns/filters/target-date.tsx @@ -3,10 +3,10 @@ import { observer } from "mobx-react"; // plane constants import { DATE_AFTER_FILTER_OPTIONS } from "@plane/constants"; // components +import { isInDateFormat } from "@plane/utils"; import { DateFilterModal } from "@/components/core"; import { FilterHeader, FilterOption } from "@/components/issues"; // helpers -import { isInDateFormat } from "@/helpers/date-time.helper"; type Props = { appliedFilters: string[] | null; diff --git a/web/core/components/modules/dropdowns/order-by.tsx b/web/core/components/modules/dropdowns/order-by.tsx index 6a373527c8b..4fe3b3c7050 100644 --- a/web/core/components/modules/dropdowns/order-by.tsx +++ b/web/core/components/modules/dropdowns/order-by.tsx @@ -7,7 +7,7 @@ import { TModuleOrderByOptions } from "@plane/types"; // ui import { CustomMenu, getButtonStyling } from "@plane/ui"; // helpers -import { cn } from "@/helpers/common.helper"; +import { cn } from "@plane/utils"; // types // constants diff --git a/web/core/components/modules/form.tsx b/web/core/components/modules/form.tsx index 4123c0bb109..d1bdae0d2ac 100644 --- a/web/core/components/modules/form.tsx +++ b/web/core/components/modules/form.tsx @@ -8,13 +8,11 @@ import { useTranslation } from "@plane/i18n"; import { IModule } from "@plane/types"; // ui import { Button, Input, TextArea } from "@plane/ui"; +import { getDate, renderFormattedPayloadDate, shouldRenderProject, getTabIndex } from "@plane/utils"; // components import { DateRangeDropdown, ProjectDropdown, MemberDropdown } from "@/components/dropdowns"; import { ModuleStatusSelect } from "@/components/modules"; // helpers -import { getDate, renderFormattedPayloadDate } from "@/helpers/date-time.helper"; -import { shouldRenderProject } from "@/helpers/project.helper"; -import { getTabIndex } from "@/helpers/tab-indices.helper"; // types type Props = { diff --git a/web/core/components/modules/links/list-item.tsx b/web/core/components/modules/links/list-item.tsx index e816525c931..283062cc78e 100644 --- a/web/core/components/modules/links/list-item.tsx +++ b/web/core/components/modules/links/list-item.tsx @@ -4,10 +4,9 @@ import { Copy, Pencil, Trash2 } from "lucide-react"; import { ILinkDetails } from "@plane/types"; // plane ui import { setToast, TOAST_TYPE, Tooltip } from "@plane/ui"; -import { getIconForLink } from "@plane/utils"; +import { getIconForLink, copyTextToClipboard, calculateTimeAgo } from "@plane/utils"; // helpers -import { calculateTimeAgo } from "@/helpers/date-time.helper"; -import { copyTextToClipboard } from "@/helpers/string.helper"; +// // hooks import { useMember } from "@/hooks/store"; import { usePlatformOS } from "@/hooks/use-platform-os"; diff --git a/web/core/components/modules/module-card-item.tsx b/web/core/components/modules/module-card-item.tsx index 2204738cf3b..59b269c4a48 100644 --- a/web/core/components/modules/module-card-item.tsx +++ b/web/core/components/modules/module-card-item.tsx @@ -27,14 +27,13 @@ import { setPromiseToast, setToast, } from "@plane/ui"; +import { getDate, renderFormattedPayloadDate, generateQueryParams } from "@plane/utils"; // components import { DateRangeDropdown } from "@/components/dropdowns"; import { ButtonAvatars } from "@/components/dropdowns/member/avatar"; import { ModuleQuickActions } from "@/components/modules"; import { ModuleStatusDropdown } from "@/components/modules/module-status-dropdown"; // helpers -import { getDate, renderFormattedPayloadDate } from "@/helpers/date-time.helper"; -import { generateQueryParams } from "@/helpers/router.helper"; // hooks import { useEventTracker, useMember, useModule, useUserPermissions } from "@/hooks/store"; import { useAppRouter } from "@/hooks/use-app-router"; diff --git a/web/core/components/modules/module-list-item-action.tsx b/web/core/components/modules/module-list-item-action.tsx index 7a1b37a65ce..5106e058d97 100644 --- a/web/core/components/modules/module-list-item-action.tsx +++ b/web/core/components/modules/module-list-item-action.tsx @@ -20,12 +20,12 @@ import { IModule } from "@plane/types"; // ui import { FavoriteStar, TOAST_TYPE, Tooltip, setPromiseToast, setToast } from "@plane/ui"; // components +import { renderFormattedPayloadDate, getDate } from "@plane/utils"; import { DateRangeDropdown } from "@/components/dropdowns"; import { ModuleQuickActions } from "@/components/modules"; import { ModuleStatusDropdown } from "@/components/modules/module-status-dropdown"; // constants // hooks -import { renderFormattedPayloadDate, getDate } from "@/helpers/date-time.helper"; import { useEventTracker, useMember, useModule, useUserPermissions } from "@/hooks/store"; import { ButtonAvatars } from "../dropdowns/member/avatar"; diff --git a/web/core/components/modules/module-list-item.tsx b/web/core/components/modules/module-list-item.tsx index 64dfe745271..0d20bd224fd 100644 --- a/web/core/components/modules/module-list-item.tsx +++ b/web/core/components/modules/module-list-item.tsx @@ -8,10 +8,10 @@ import { Check, Info } from "lucide-react"; // ui import { CircularProgressIndicator } from "@plane/ui"; // components +import { generateQueryParams } from "@plane/utils"; import { ListItem } from "@/components/core/list"; import { ModuleListItemAction, ModuleQuickActions } from "@/components/modules"; // helpers -import { generateQueryParams } from "@/helpers/router.helper"; // hooks import { useModule } from "@/hooks/store"; import { useAppRouter } from "@/hooks/use-app-router"; diff --git a/web/core/components/modules/module-peek-overview.tsx b/web/core/components/modules/module-peek-overview.tsx index 02fb857478a..590ef67e8a5 100644 --- a/web/core/components/modules/module-peek-overview.tsx +++ b/web/core/components/modules/module-peek-overview.tsx @@ -2,7 +2,7 @@ import React, { useEffect } from "react"; import { observer } from "mobx-react"; import { usePathname, useSearchParams } from "next/navigation"; // hooks -import { generateQueryParams } from "@/helpers/router.helper"; +import { generateQueryParams } from "@plane/utils"; import { useModule } from "@/hooks/store"; import { useAppRouter } from "@/hooks/use-app-router"; // components diff --git a/web/core/components/modules/module-view-header.tsx b/web/core/components/modules/module-view-header.tsx index 149545113db..efa96c6c648 100644 --- a/web/core/components/modules/module-view-header.tsx +++ b/web/core/components/modules/module-view-header.tsx @@ -12,14 +12,13 @@ import { useTranslation } from "@plane/i18n"; import { TModuleFilters } from "@plane/types"; // ui import { Tooltip } from "@plane/ui"; +import { cn, calculateTotalFilters } from "@plane/utils"; // plane utils -import { cn } from "@plane/utils"; // components import { FiltersDropdown } from "@/components/issues"; import { ModuleFiltersSelection, ModuleOrderByDropdown } from "@/components/modules/dropdowns"; // constants // helpers -import { calculateTotalFilters } from "@/helpers/filter.helper"; // hooks import { useMember, useModuleFilter } from "@/hooks/store"; import { usePlatformOS } from "@/hooks/use-platform-os"; diff --git a/web/core/components/modules/quick-actions.tsx b/web/core/components/modules/quick-actions.tsx index 9945380af14..8e61b0593c5 100644 --- a/web/core/components/modules/quick-actions.tsx +++ b/web/core/components/modules/quick-actions.tsx @@ -10,11 +10,10 @@ import { EUserPermissions, EUserPermissionsLevel } from "@plane/constants"; import { useTranslation } from "@plane/i18n"; // ui import { ArchiveIcon, ContextMenu, CustomMenu, TContextMenuItem, TOAST_TYPE, setToast } from "@plane/ui"; -import { copyUrlToClipboard } from "@plane/utils"; +import { copyUrlToClipboard, cn } from "@plane/utils"; // components import { ArchiveModuleModal, CreateUpdateModuleModal, DeleteModuleModal } from "@/components/modules"; // helpers -import { cn } from "@/helpers/common.helper"; // hooks import { useModule, useEventTracker, useUserPermissions } from "@/hooks/store"; import { useAppRouter } from "@/hooks/use-app-router"; diff --git a/web/core/components/onboarding/invitations.tsx b/web/core/components/onboarding/invitations.tsx index 1bfdd063cc2..0be9ae8db6c 100644 --- a/web/core/components/onboarding/invitations.tsx +++ b/web/core/components/onboarding/invitations.tsx @@ -7,11 +7,10 @@ import { ROLE, MEMBER_ACCEPTED } from "@plane/constants"; import { IWorkspaceMemberInvitation } from "@plane/types"; // ui import { Button, Checkbox, Spinner } from "@plane/ui"; +import { truncateText, getUserRole } from "@plane/utils"; // constants // helpers import { WorkspaceLogo } from "@/components/workspace/logo"; -import { truncateText } from "@/helpers/string.helper"; -import { getUserRole } from "@/helpers/user.helper"; // hooks import { useEventTracker, useUserSettings, useWorkspace } from "@/hooks/store"; // services diff --git a/web/core/components/onboarding/invite-members.tsx b/web/core/components/onboarding/invite-members.tsx index 34887be715b..55408c42bcc 100644 --- a/web/core/components/onboarding/invite-members.tsx +++ b/web/core/components/onboarding/invite-members.tsx @@ -28,7 +28,7 @@ import { IUser, IWorkspace } from "@plane/types"; import { Button, Input, Spinner, TOAST_TYPE, setToast } from "@plane/ui"; // constants // helpers -import { getUserRole } from "@/helpers/user.helper"; +import { getUserRole } from "@plane/utils"; // hooks import { useEventTracker } from "@/hooks/store"; // services diff --git a/web/core/components/onboarding/profile-setup.tsx b/web/core/components/onboarding/profile-setup.tsx index 76cf98e9139..b5cf202bb11 100644 --- a/web/core/components/onboarding/profile-setup.tsx +++ b/web/core/components/onboarding/profile-setup.tsx @@ -6,20 +6,19 @@ import Image from "next/image"; import { useTheme } from "next-themes"; import { Controller, useForm } from "react-hook-form"; import { Eye, EyeOff } from "lucide-react"; +import { USER_DETAILS, E_ONBOARDING_STEP_1, E_ONBOARDING_STEP_2, E_PASSWORD_STRENGTH, getPasswordStrength } from "@plane/constants"; // types -import { USER_DETAILS, E_ONBOARDING_STEP_1, E_ONBOARDING_STEP_2 } from "@plane/constants"; import { useTranslation } from "@plane/i18n"; import { IUser, TUserProfile, TOnboardingSteps } from "@plane/types"; // ui import { Button, Input, Spinner, TOAST_TYPE, setToast } from "@plane/ui"; // components +import { getFileURL } from "@plane/utils"; import { PasswordStrengthMeter } from "@/components/account"; import { UserImageUploadModal } from "@/components/core"; import { OnboardingHeader, SwitchAccountDropdown } from "@/components/onboarding"; // constants // helpers -import { getFileURL } from "@/helpers/file.helper"; -import { E_PASSWORD_STRENGTH, getPasswordStrength } from "@/helpers/password.helper"; // hooks import { useEventTracker, useUser, useUserProfile } from "@/hooks/store"; // assets diff --git a/web/core/components/onboarding/step-indicator.tsx b/web/core/components/onboarding/step-indicator.tsx index c85485760fd..f10c3bc84d4 100644 --- a/web/core/components/onboarding/step-indicator.tsx +++ b/web/core/components/onboarding/step-indicator.tsx @@ -1,6 +1,6 @@ import React from "react"; // helpers -import { cn } from "@/helpers/common.helper"; +import { cn } from "@plane/utils"; interface OnboardingStepIndicatorProps { currentStep: number; diff --git a/web/core/components/onboarding/switch-account-dropdown.tsx b/web/core/components/onboarding/switch-account-dropdown.tsx index 7ccdb117f38..4769966ffca 100644 --- a/web/core/components/onboarding/switch-account-dropdown.tsx +++ b/web/core/components/onboarding/switch-account-dropdown.tsx @@ -6,9 +6,8 @@ import { ChevronDown } from "lucide-react"; import { Menu, Transition } from "@headlessui/react"; // ui import { Avatar } from "@plane/ui"; +import { cn, getFileURL } from "@plane/utils"; // helpers -import { cn } from "@/helpers/common.helper"; -import { getFileURL } from "@/helpers/file.helper"; // hooks import { useUser } from "@/hooks/store"; // components diff --git a/web/core/components/page-views/workspace-dashboard.tsx b/web/core/components/page-views/workspace-dashboard.tsx index 19d3590b07f..6a4984d43fc 100644 --- a/web/core/components/page-views/workspace-dashboard.tsx +++ b/web/core/components/page-views/workspace-dashboard.tsx @@ -6,6 +6,7 @@ import { EUserPermissionsLevel, PRODUCT_TOUR_COMPLETED, EUserPermissions } from import { useTranslation } from "@plane/i18n"; import { ContentWrapper } from "@plane/ui"; // components +import { cn } from "@plane/utils"; import { DashboardWidgets } from "@/components/dashboard"; import { ComicBoxButton, DetailedEmptyState } from "@/components/empty-state"; import { IssuePeekOverview } from "@/components/issues"; @@ -13,7 +14,6 @@ import { TourRoot } from "@/components/onboarding"; import { UserGreetingsView } from "@/components/user"; // constants // helpers -import { cn } from "@/helpers/common.helper"; // hooks import { useCommandPalette, diff --git a/web/core/components/pages/dropdowns/actions.tsx b/web/core/components/pages/dropdowns/actions.tsx index b0371345512..fbff3201fa8 100644 --- a/web/core/components/pages/dropdowns/actions.tsx +++ b/web/core/components/pages/dropdowns/actions.tsx @@ -22,9 +22,9 @@ import { EditorRefApi } from "@plane/editor"; // plane ui import { ArchiveIcon, ContextMenu, CustomMenu, TContextMenuItem } from "@plane/ui"; // components +import { cn } from "@plane/utils"; import { DeletePageModal } from "@/components/pages"; // helpers -import { cn } from "@/helpers/common.helper"; // hooks import { usePageOperations } from "@/hooks/use-page-operations"; // plane web components diff --git a/web/core/components/pages/editor/editor-body.tsx b/web/core/components/pages/editor/editor-body.tsx index 5f194818361..d7369892403 100644 --- a/web/core/components/pages/editor/editor-body.tsx +++ b/web/core/components/pages/editor/editor-body.tsx @@ -1,6 +1,6 @@ import { Dispatch, SetStateAction, useCallback, useMemo } from "react"; import { observer } from "mobx-react"; -// plane imports +import { LIVE_BASE_PATH, LIVE_BASE_URL } from "@plane/constants"; import { CollaborativeDocumentEditorWithRef, EditorRefApi, @@ -10,15 +10,14 @@ import { TRealtimeConfig, TServerHandler, } from "@plane/editor"; +// plane imports import { TSearchEntityRequestPayload, TSearchResponse, TWebhookConnectionQueryParams } from "@plane/types"; import { ERowVariant, Row } from "@plane/ui"; -import { cn } from "@plane/utils"; +import { cn, generateRandomColor } from "@plane/utils"; // components import { EditorMentionsRoot } from "@/components/editor"; import { PageContentBrowser, PageContentLoader, PageEditorTitle } from "@/components/pages"; // helpers -import { LIVE_BASE_PATH, LIVE_BASE_URL } from "@/helpers/common.helper"; -import { generateRandomColor } from "@/helpers/string.helper"; // hooks import { useEditorMention } from "@/hooks/editor"; import { useUser, useWorkspace, useMember } from "@/hooks/store"; diff --git a/web/core/components/pages/editor/title.tsx b/web/core/components/pages/editor/title.tsx index 5864ac5d9b7..416c43e0719 100644 --- a/web/core/components/pages/editor/title.tsx +++ b/web/core/components/pages/editor/title.tsx @@ -6,9 +6,8 @@ import { observer } from "mobx-react"; import { EditorRefApi } from "@plane/editor"; // ui import { TextArea } from "@plane/ui"; +import { cn, getPageName } from "@plane/utils"; // helpers -import { cn } from "@/helpers/common.helper"; -import { getPageName } from "@/helpers/page.helper"; // hooks import { usePageFilters } from "@/hooks/use-page-filters"; diff --git a/web/core/components/pages/editor/toolbar/color-dropdown.tsx b/web/core/components/pages/editor/toolbar/color-dropdown.tsx index 2809336c17d..b0a3c658f5b 100644 --- a/web/core/components/pages/editor/toolbar/color-dropdown.tsx +++ b/web/core/components/pages/editor/toolbar/color-dropdown.tsx @@ -6,7 +6,7 @@ import { Popover } from "@headlessui/react"; // plane editor import { COLORS_LIST, TEditorCommands } from "@plane/editor"; // helpers -import { cn } from "@/helpers/common.helper"; +import { cn } from "@plane/utils"; type Props = { handleColorSelect: ( diff --git a/web/core/components/pages/editor/toolbar/info-popover.tsx b/web/core/components/pages/editor/toolbar/info-popover.tsx index d5a28145949..49ad06b9b0b 100644 --- a/web/core/components/pages/editor/toolbar/info-popover.tsx +++ b/web/core/components/pages/editor/toolbar/info-popover.tsx @@ -6,12 +6,10 @@ import { usePopper } from "react-popper"; import { Info } from "lucide-react"; // plane imports import { Avatar } from "@plane/ui"; -import { getFileURL, renderFormattedDate } from "@plane/utils"; -// helpers -import { calculateTimeAgoShort, getReadTimeFromWordsCount } from "@/helpers/date-time.helper"; +import { calculateTimeAgoShort, getFileURL, getReadTimeFromWordsCount, renderFormattedDate } from "@plane/utils"; // hooks import { useMember } from "@/hooks/store"; -// store types +// store import { TPageInstance } from "@/store/pages/base-page"; type Props = { diff --git a/web/core/components/pages/editor/toolbar/options-dropdown.tsx b/web/core/components/pages/editor/toolbar/options-dropdown.tsx index 4dbdbf50acc..407ee03c451 100644 --- a/web/core/components/pages/editor/toolbar/options-dropdown.tsx +++ b/web/core/components/pages/editor/toolbar/options-dropdown.tsx @@ -7,9 +7,9 @@ import { ArrowUpToLine, Clipboard, History } from "lucide-react"; // plane imports import { TContextMenuItem, TOAST_TYPE, ToggleSwitch, setToast } from "@plane/ui"; // components +import { copyTextToClipboard } from "@plane/utils"; import { ExportPageModal, PageActions, TPageActions } from "@/components/pages"; // helpers -import { copyTextToClipboard } from "@/helpers/string.helper"; // hooks import { usePageFilters } from "@/hooks/use-page-filters"; import { useQueryParams } from "@/hooks/use-query-params"; diff --git a/web/core/components/pages/editor/toolbar/root.tsx b/web/core/components/pages/editor/toolbar/root.tsx index 8ce0bd005d9..72c9da3d488 100644 --- a/web/core/components/pages/editor/toolbar/root.tsx +++ b/web/core/components/pages/editor/toolbar/root.tsx @@ -1,8 +1,8 @@ import { observer } from "mobx-react"; // components +import { cn } from "@plane/utils"; import { PageToolbar } from "@/components/pages"; // helpers -import { cn } from "@/helpers/common.helper"; // hooks import { usePageFilters } from "@/hooks/use-page-filters"; // plane web components diff --git a/web/core/components/pages/editor/toolbar/toolbar.tsx b/web/core/components/pages/editor/toolbar/toolbar.tsx index f6dd3069166..ca85e60661d 100644 --- a/web/core/components/pages/editor/toolbar/toolbar.tsx +++ b/web/core/components/pages/editor/toolbar/toolbar.tsx @@ -7,11 +7,11 @@ import { EditorRefApi } from "@plane/editor"; // ui import { CustomMenu, Tooltip } from "@plane/ui"; // components +import { cn } from "@plane/utils"; import { ColorDropdown } from "@/components/pages"; // constants import { TOOLBAR_ITEMS, TYPOGRAPHY_ITEMS, ToolbarMenuItem } from "@/constants/editor"; // helpers -import { cn } from "@/helpers/common.helper"; type Props = { editorRef: EditorRefApi; diff --git a/web/core/components/pages/header/root.tsx b/web/core/components/pages/header/root.tsx index a50fa95297b..f546c804bf5 100644 --- a/web/core/components/pages/header/root.tsx +++ b/web/core/components/pages/header/root.tsx @@ -5,6 +5,7 @@ import { useTranslation } from "@plane/i18n"; import { TPageFilterProps, TPageNavigationTabs } from "@plane/types"; // components import { Header, EHeaderVariant } from "@plane/ui"; +import { calculateTotalFilters } from "@plane/utils"; import { FiltersDropdown } from "@/components/issues"; import { PageAppliedFiltersList, @@ -14,7 +15,6 @@ import { PageTabNavigation, } from "@/components/pages"; // helpers -import { calculateTotalFilters } from "@/helpers/filter.helper"; // hooks import { useMember } from "@/hooks/store"; // plane web hooks diff --git a/web/core/components/pages/list/applied-filters/root.tsx b/web/core/components/pages/list/applied-filters/root.tsx index df8063b281b..99558163cb2 100644 --- a/web/core/components/pages/list/applied-filters/root.tsx +++ b/web/core/components/pages/list/applied-filters/root.tsx @@ -3,9 +3,9 @@ import { useTranslation } from "@plane/i18n"; import { TPageFilterProps } from "@plane/types"; // components import { Tag } from "@plane/ui"; +import { replaceUnderscoreIfSnakeCase } from "@plane/utils"; import { AppliedDateFilters, AppliedMembersFilters } from "@/components/common/applied-filters"; // helpers -import { replaceUnderscoreIfSnakeCase } from "@/helpers/string.helper"; // types type Props = { diff --git a/web/core/components/pages/list/block-item-action.tsx b/web/core/components/pages/list/block-item-action.tsx index 58e3a8e2a0f..4b382b4889c 100644 --- a/web/core/components/pages/list/block-item-action.tsx +++ b/web/core/components/pages/list/block-item-action.tsx @@ -5,11 +5,10 @@ import { observer } from "mobx-react"; import { Earth, Info, Lock, Minus } from "lucide-react"; // ui import { Avatar, FavoriteStar, Tooltip } from "@plane/ui"; +import { renderFormattedDate, getFileURL } from "@plane/utils"; // components import { PageActions } from "@/components/pages"; // helpers -import { renderFormattedDate } from "@/helpers/date-time.helper"; -import { getFileURL } from "@/helpers/file.helper"; // hooks import { useMember } from "@/hooks/store"; import { usePageOperations } from "@/hooks/use-page-operations"; diff --git a/web/core/components/pages/list/block.tsx b/web/core/components/pages/list/block.tsx index cd3ddbdae41..6cf7471babf 100644 --- a/web/core/components/pages/list/block.tsx +++ b/web/core/components/pages/list/block.tsx @@ -4,11 +4,11 @@ import { FC, useRef } from "react"; import { observer } from "mobx-react"; import { FileText } from "lucide-react"; // components +import { getPageName } from "@plane/utils"; import { Logo } from "@/components/common"; import { ListItem } from "@/components/core/list"; import { BlockItemAction } from "@/components/pages/list"; // helpers -import { getPageName } from "@/helpers/page.helper"; // hooks import { usePlatformOS } from "@/hooks/use-platform-os"; // plane web hooks diff --git a/web/core/components/pages/list/order-by.tsx b/web/core/components/pages/list/order-by.tsx index 5385ee5ae96..37f5827daf5 100644 --- a/web/core/components/pages/list/order-by.tsx +++ b/web/core/components/pages/list/order-by.tsx @@ -6,7 +6,7 @@ import { TPageFiltersSortBy, TPageFiltersSortKey } from "@plane/types"; // ui import { CustomMenu, getButtonStyling } from "@plane/ui"; // helpers -import { cn } from "@/helpers/common.helper"; +import { cn } from "@plane/utils"; type Props = { onChange: (value: { key?: TPageFiltersSortKey; order?: TPageFiltersSortBy }) => void; diff --git a/web/core/components/pages/list/search-input.tsx b/web/core/components/pages/list/search-input.tsx index 6b116a552ac..f7be11f7652 100644 --- a/web/core/components/pages/list/search-input.tsx +++ b/web/core/components/pages/list/search-input.tsx @@ -3,7 +3,7 @@ import { Search, X } from "lucide-react"; // plane helpers import { useOutsideClickDetector } from "@plane/hooks"; // helpers -import { cn } from "@/helpers/common.helper"; +import { cn } from "@plane/utils"; type Props = { searchQuery: string; diff --git a/web/core/components/pages/list/tab-navigation.tsx b/web/core/components/pages/list/tab-navigation.tsx index fc28d50a23f..35d6d1b9498 100644 --- a/web/core/components/pages/list/tab-navigation.tsx +++ b/web/core/components/pages/list/tab-navigation.tsx @@ -3,7 +3,7 @@ import Link from "next/link"; // types import { TPageNavigationTabs } from "@plane/types"; // helpers -import { cn } from "@/helpers/common.helper"; +import { cn } from "@plane/utils"; type TPageTabNavigation = { workspaceSlug: string; diff --git a/web/core/components/pages/modals/page-form.tsx b/web/core/components/pages/modals/page-form.tsx index 4bc2a842853..32a2a8ad2af 100644 --- a/web/core/components/pages/modals/page-form.tsx +++ b/web/core/components/pages/modals/page-form.tsx @@ -10,12 +10,11 @@ import { useTranslation } from "@plane/i18n"; import { TPage } from "@plane/types"; // ui import { Button, EmojiIconPicker, EmojiIconPickerTypes, Input } from "@plane/ui"; +import { convertHexEmojiToDecimal, getTabIndex } from "@plane/utils"; import { Logo } from "@/components/common"; // constants import { AccessField } from "@/components/common/access-field"; // helpers -import { convertHexEmojiToDecimal } from "@/helpers/emoji.helper"; -import { getTabIndex } from "@/helpers/tab-indices.helper"; // hooks import { usePlatformOS } from "@/hooks/use-platform-os"; diff --git a/web/core/components/pages/version/main-content.tsx b/web/core/components/pages/version/main-content.tsx index b36820fbbf6..e94bfefa780 100644 --- a/web/core/components/pages/version/main-content.tsx +++ b/web/core/components/pages/version/main-content.tsx @@ -7,9 +7,9 @@ import { TPageVersion } from "@plane/types"; // plane ui import { Button, setToast, TOAST_TYPE } from "@plane/ui"; // components +import { renderFormattedDate, renderFormattedTime } from "@plane/utils"; import { TVersionEditorProps } from "@/components/pages"; // helpers -import { renderFormattedDate, renderFormattedTime } from "@/helpers/date-time.helper"; type Props = { activeVersion: string | null; diff --git a/web/core/components/pages/version/root.tsx b/web/core/components/pages/version/root.tsx index 0717be012e9..f1dd0248b42 100644 --- a/web/core/components/pages/version/root.tsx +++ b/web/core/components/pages/version/root.tsx @@ -2,9 +2,9 @@ import { observer } from "mobx-react"; // plane types import { TPageVersion } from "@plane/types"; // components +import { cn } from "@plane/utils"; import { PageVersionsMainContent, PageVersionsSidebarRoot, TVersionEditorProps } from "@/components/pages"; // helpers -import { cn } from "@/helpers/common.helper"; type Props = { activeVersion: string | null; diff --git a/web/core/components/pages/version/sidebar-list-item.tsx b/web/core/components/pages/version/sidebar-list-item.tsx index be11f57250c..b975b435805 100644 --- a/web/core/components/pages/version/sidebar-list-item.tsx +++ b/web/core/components/pages/version/sidebar-list-item.tsx @@ -4,10 +4,8 @@ import Link from "next/link"; import { TPageVersion } from "@plane/types"; // plane ui import { Avatar } from "@plane/ui"; +import { cn, renderFormattedDate, renderFormattedTime, getFileURL } from "@plane/utils"; // helpers -import { cn } from "@/helpers/common.helper"; -import { renderFormattedDate, renderFormattedTime } from "@/helpers/date-time.helper"; -import { getFileURL } from "@/helpers/file.helper"; // hooks import { useMember } from "@/hooks/store"; diff --git a/web/core/components/pages/version/sidebar-list.tsx b/web/core/components/pages/version/sidebar-list.tsx index cf276742b02..bff9c36988b 100644 --- a/web/core/components/pages/version/sidebar-list.tsx +++ b/web/core/components/pages/version/sidebar-list.tsx @@ -7,9 +7,9 @@ import { TPageVersion } from "@plane/types"; // plane ui import { Button, Loader } from "@plane/ui"; // components +import { cn } from "@plane/utils"; import { PlaneVersionsSidebarListItem } from "@/components/pages"; // helpers -import { cn } from "@/helpers/common.helper"; // hooks import { useQueryParams } from "@/hooks/use-query-params"; diff --git a/web/core/components/profile/activity/activity-list.tsx b/web/core/components/profile/activity/activity-list.tsx index 671fd9dc27f..5eb8e8b7dc6 100644 --- a/web/core/components/profile/activity/activity-list.tsx +++ b/web/core/components/profile/activity/activity-list.tsx @@ -4,6 +4,7 @@ import { useParams } from "next/navigation"; // icons import { History, MessageSquare } from "lucide-react"; import { IUserActivityResponse } from "@plane/types"; +import { calculateTimeAgo, getFileURL } from "@plane/utils"; // hooks // components import { ActivityIcon, ActivityMessage, IssueLink } from "@/components/core"; @@ -12,8 +13,6 @@ import { RichTextReadOnlyEditor } from "@/components/editor/rich-text-editor/ric // ui import { ActivitySettingsLoader } from "@/components/ui"; // helpers -import { calculateTimeAgo } from "@/helpers/date-time.helper"; -import { getFileURL } from "@/helpers/file.helper"; // hooks import { useUser, useWorkspace } from "@/hooks/store"; diff --git a/web/core/components/profile/activity/download-button.tsx b/web/core/components/profile/activity/download-button.tsx index 0092299ff3c..f8595cae87a 100644 --- a/web/core/components/profile/activity/download-button.tsx +++ b/web/core/components/profile/activity/download-button.tsx @@ -7,7 +7,7 @@ import { useParams } from "next/navigation"; import { useTranslation } from "@plane/i18n"; import { Button } from "@plane/ui"; // helpers -import { renderFormattedPayloadDate } from "@/helpers/date-time.helper"; +import { renderFormattedPayloadDate } from "@plane/utils"; import { UserService } from "@/services/user.service"; const userService = new UserService(); diff --git a/web/core/components/profile/activity/profile-activity-list.tsx b/web/core/components/profile/activity/profile-activity-list.tsx index 36eca920fec..a647d9571fe 100644 --- a/web/core/components/profile/activity/profile-activity-list.tsx +++ b/web/core/components/profile/activity/profile-activity-list.tsx @@ -4,6 +4,7 @@ import Link from "next/link"; import useSWR from "swr"; // icons import { History, MessageSquare } from "lucide-react"; +import { calculateTimeAgo, getFileURL } from "@plane/utils"; // hooks import { ActivityIcon, ActivityMessage, IssueLink } from "@/components/core"; import { RichTextReadOnlyEditor } from "@/components/editor/rich-text-editor/rich-text-read-only-editor"; @@ -11,8 +12,6 @@ import { ActivitySettingsLoader } from "@/components/ui"; // constants import { USER_ACTIVITY } from "@/constants/fetch-keys"; // helpers -import { calculateTimeAgo } from "@/helpers/date-time.helper"; -import { getFileURL } from "@/helpers/file.helper"; // hooks import { useUser } from "@/hooks/store"; // services diff --git a/web/core/components/profile/form.tsx b/web/core/components/profile/form.tsx index a7c47566a2f..1386dc72bf4 100644 --- a/web/core/components/profile/form.tsx +++ b/web/core/components/profile/form.tsx @@ -12,11 +12,10 @@ import type { IUser, TUserProfile } from "@plane/types"; import { Button, CustomSelect, Input, TOAST_TYPE, setPromiseToast, setToast } from "@plane/ui"; // components import { getButtonStyling } from "@plane/ui/src/button"; -import { cn } from "@plane/utils"; +import { cn, getFileURL } from "@plane/utils"; import { DeactivateAccountModal } from "@/components/account"; import { ImagePickerPopover, UserImageUploadModal } from "@/components/core"; // helpers -import { getFileURL } from "@/helpers/file.helper"; // hooks import { useUser, useUserProfile } from "@/hooks/store"; diff --git a/web/core/components/profile/overview/activity.tsx b/web/core/components/profile/overview/activity.tsx index 9ac14b2aafd..10313ef923b 100644 --- a/web/core/components/profile/overview/activity.tsx +++ b/web/core/components/profile/overview/activity.tsx @@ -6,14 +6,13 @@ import useSWR from "swr"; // ui import { useTranslation } from "@plane/i18n"; import { Loader, Card } from "@plane/ui"; +import { calculateTimeAgo, getFileURL } from "@plane/utils"; // components import { ActivityMessage, IssueLink } from "@/components/core"; import { ProfileEmptyState } from "@/components/ui"; // constants import { USER_PROFILE_ACTIVITY } from "@/constants/fetch-keys"; // helpers -import { calculateTimeAgo } from "@/helpers/date-time.helper"; -import { getFileURL } from "@/helpers/file.helper"; // hooks import { useUser } from "@/hooks/store"; // assets diff --git a/web/core/components/profile/overview/priority-distribution.tsx b/web/core/components/profile/overview/priority-distribution.tsx index 575e1561b7a..a352deb0cda 100644 --- a/web/core/components/profile/overview/priority-distribution.tsx +++ b/web/core/components/profile/overview/priority-distribution.tsx @@ -5,9 +5,9 @@ import { useTranslation } from "@plane/i18n"; import { BarChart } from "@plane/propel/charts/bar-chart"; import { IUserProfileData } from "@plane/types"; import { Loader, Card } from "@plane/ui"; +import { capitalizeFirstLetter } from "@plane/utils"; import { ProfileEmptyState } from "@/components/ui"; // image -import { capitalizeFirstLetter } from "@/helpers/string.helper"; import emptyBarGraph from "@/public/empty-state/empty_bar_graph.svg"; // helpers // types diff --git a/web/core/components/profile/overview/state-distribution.tsx b/web/core/components/profile/overview/state-distribution.tsx index 2d95f146340..ee07a718935 100644 --- a/web/core/components/profile/overview/state-distribution.tsx +++ b/web/core/components/profile/overview/state-distribution.tsx @@ -5,9 +5,9 @@ import { PieChart } from "@plane/propel/charts/pie-chart"; import { IUserProfileData, IUserStateDistribution } from "@plane/types"; // ui import { Card } from "@plane/ui"; +import { capitalizeFirstLetter } from "@plane/utils"; import { ProfileEmptyState } from "@/components/ui"; // helpers -import { capitalizeFirstLetter } from "@/helpers/string.helper"; // image import stateGraph from "@/public/empty-state/state_graph.svg"; diff --git a/web/core/components/profile/profile-issues-filter.tsx b/web/core/components/profile/profile-issues-filter.tsx index baf85c2108e..70a76de95b3 100644 --- a/web/core/components/profile/profile-issues-filter.tsx +++ b/web/core/components/profile/profile-issues-filter.tsx @@ -8,9 +8,9 @@ import { useTranslation } from "@plane/i18n"; // types import { IIssueDisplayFilterOptions, IIssueDisplayProperties, IIssueFilterOptions } from "@plane/types"; // components +import { isIssueFilterActive } from "@plane/utils"; import { DisplayFiltersSelection, FilterSelection, FiltersDropdown, LayoutSelection } from "@/components/issues"; // helpers -import { isIssueFilterActive } from "@/helpers/filter.helper"; // hooks import { useIssues, useLabel } from "@/hooks/store"; diff --git a/web/core/components/profile/profile-setting-content-wrapper.tsx b/web/core/components/profile/profile-setting-content-wrapper.tsx index c9741ca5d3d..85c58039930 100644 --- a/web/core/components/profile/profile-setting-content-wrapper.tsx +++ b/web/core/components/profile/profile-setting-content-wrapper.tsx @@ -1,7 +1,7 @@ "use client"; import React, { FC } from "react"; // helpers -import { cn } from "@/helpers/common.helper"; +import { cn } from "@plane/utils"; import { SidebarHamburgerToggle } from "../core"; type Props = { diff --git a/web/core/components/profile/sidebar.tsx b/web/core/components/profile/sidebar.tsx index 0fd78782b24..1508fd2e982 100644 --- a/web/core/components/profile/sidebar.tsx +++ b/web/core/components/profile/sidebar.tsx @@ -15,12 +15,10 @@ import { useTranslation } from "@plane/i18n"; import { IUserProfileProjectSegregation } from "@plane/types"; // plane ui import { Loader, Tooltip } from "@plane/ui"; +import { cn, renderFormattedDate, getFileURL } from "@plane/utils"; // components import { Logo } from "@/components/common"; // helpers -import { cn } from "@/helpers/common.helper"; -import { renderFormattedDate } from "@/helpers/date-time.helper"; -import { getFileURL } from "@/helpers/file.helper"; // hooks import { useAppTheme, useProject, useUser } from "@/hooks/store"; import { usePlatformOS } from "@/hooks/use-platform-os"; diff --git a/web/core/components/project-states/state-item.tsx b/web/core/components/project-states/state-item.tsx index 192211da305..b8359c2085f 100644 --- a/web/core/components/project-states/state-item.tsx +++ b/web/core/components/project-states/state-item.tsx @@ -9,12 +9,10 @@ import { observer } from "mobx-react"; import { TDraggableData } from "@plane/constants"; import { IState, TStateGroups, TStateOperationsCallbacks } from "@plane/types"; import { DropIndicator } from "@plane/ui"; +import { cn, getCurrentStateSequence } from "@plane/utils"; // components import { StateItemTitle, StateUpdate } from "@/components/project-states"; // helpers -import { cn } from "@/helpers/common.helper"; -import { getCurrentStateSequence } from "@/helpers/state.helper"; - type TStateItem = { groupKey: TStateGroups; groupedStates: Record; diff --git a/web/core/components/project/applied-filters/date.tsx b/web/core/components/project/applied-filters/date.tsx index d5879989fa7..27ac20613d9 100644 --- a/web/core/components/project/applied-filters/date.tsx +++ b/web/core/components/project/applied-filters/date.tsx @@ -2,8 +2,7 @@ import { observer } from "mobx-react"; import { X } from "lucide-react"; // helpers import { PROJECT_CREATED_AT_FILTER_OPTIONS } from "@plane/constants"; -import { renderFormattedDate } from "@/helpers/date-time.helper"; -import { capitalizeFirstLetter } from "@/helpers/string.helper"; +import { renderFormattedDate, capitalizeFirstLetter } from "@plane/utils"; // constants type Props = { diff --git a/web/core/components/project/applied-filters/members.tsx b/web/core/components/project/applied-filters/members.tsx index a8d2e480da3..f0e4519ca96 100644 --- a/web/core/components/project/applied-filters/members.tsx +++ b/web/core/components/project/applied-filters/members.tsx @@ -5,7 +5,7 @@ import { X } from "lucide-react"; // ui import { Avatar } from "@plane/ui"; // helpers -import { getFileURL } from "@/helpers/file.helper"; +import { getFileURL } from "@plane/utils"; // types import { useMember } from "@/hooks/store"; diff --git a/web/core/components/project/applied-filters/root.tsx b/web/core/components/project/applied-filters/root.tsx index 2069aa28bf0..c2489054d5b 100644 --- a/web/core/components/project/applied-filters/root.tsx +++ b/web/core/components/project/applied-filters/root.tsx @@ -8,6 +8,7 @@ import { TProjectAppliedDisplayFilterKeys, TProjectFilters } from "@plane/types" // ui import { EHeaderVariant, Header, Tag, Tooltip } from "@plane/ui"; // components +import { replaceUnderscoreIfSnakeCase } from "@plane/utils"; import { AppliedAccessFilters, AppliedDateFilters, @@ -15,7 +16,6 @@ import { AppliedProjectDisplayFilters, } from "@/components/project"; // helpers -import { replaceUnderscoreIfSnakeCase } from "@/helpers/string.helper"; type Props = { appliedFilters: TProjectFilters; diff --git a/web/core/components/project/card.tsx b/web/core/components/project/card.tsx index 48ff34d242f..a90838720ae 100644 --- a/web/core/components/project/card.tsx +++ b/web/core/components/project/card.tsx @@ -5,11 +5,10 @@ import { observer } from "mobx-react"; import Link from "next/link"; import { useParams } from "next/navigation"; import { ArchiveRestoreIcon, Check, ExternalLink, LinkIcon, Lock, Settings, Trash2, UserPlus } from "lucide-react"; -// types +// plane imports import { EUserPermissions, EUserPermissionsLevel, IS_FAVORITE_MENU_OPEN } from "@plane/constants"; import { useLocalStorage } from "@plane/hooks"; import type { IProject } from "@plane/types"; -// ui import { Avatar, AvatarGroup, @@ -22,19 +21,14 @@ import { TContextMenuItem, FavoriteStar, } from "@plane/ui"; -import { copyUrlToClipboard } from "@plane/utils"; +import { copyUrlToClipboard, cn, getFileURL, renderFormattedDate } from "@plane/utils"; // components -import { Logo } from "@/components/common"; +import { Logo } from "@/components/common/logo"; import { ArchiveRestoreProjectModal, DeleteProjectModal, JoinProjectModal } from "@/components/project"; -// helpers -import { cn } from "@/helpers/common.helper"; -import { renderFormattedDate } from "@/helpers/date-time.helper"; -import { getFileURL } from "@/helpers/file.helper"; // hooks import { useMember, useProject, useUserPermissions } from "@/hooks/store"; import { useAppRouter } from "@/hooks/use-app-router"; import { usePlatformOS } from "@/hooks/use-platform-os"; -// plane-web constants type Props = { project: IProject; diff --git a/web/core/components/project/create-project-modal.tsx b/web/core/components/project/create-project-modal.tsx index 2360f458ed7..716f3ef4e80 100644 --- a/web/core/components/project/create-project-modal.tsx +++ b/web/core/components/project/create-project-modal.tsx @@ -1,9 +1,8 @@ import { useEffect, FC, useState } from "react"; -// plane ui import { EModalPosition, EModalWidth, ModalCore } from "@plane/ui"; +import { getAssetIdFromUrl, checkURLValidity } from "@plane/utils"; +// plane ui // helpers -import { getAssetIdFromUrl } from "@/helpers/file.helper"; -import { checkURLValidity } from "@/helpers/string.helper"; // hooks import useKeypress from "@/hooks/use-keypress"; // plane web components diff --git a/web/core/components/project/create/common-attributes.tsx b/web/core/components/project/create/common-attributes.tsx index 97807e09c57..2586f8be60c 100644 --- a/web/core/components/project/create/common-attributes.tsx +++ b/web/core/components/project/create/common-attributes.tsx @@ -6,11 +6,9 @@ import { ETabIndices } from "@plane/constants"; import { useTranslation } from "@plane/i18n"; // ui import { Input, TextArea, Tooltip } from "@plane/ui"; +import { cn, projectIdentifierSanitizer, getTabIndex } from "@plane/utils"; // plane utils -import { cn } from "@plane/utils"; // helpers -import { projectIdentifierSanitizer } from "@/helpers/project.helper"; -import { getTabIndex } from "@/helpers/tab-indices.helper"; // plane-web types import { TProject } from "@/plane-web/types/projects"; diff --git a/web/core/components/project/create/header.tsx b/web/core/components/project/create/header.tsx index 6bc1e8e1ac5..2c393aff10b 100644 --- a/web/core/components/project/create/header.tsx +++ b/web/core/components/project/create/header.tsx @@ -8,12 +8,10 @@ import { useTranslation } from "@plane/i18n"; import { IProject } from "@plane/types"; // plane ui import { CustomEmojiIconPicker, EmojiIconPickerTypes, Logo } from "@plane/ui"; +import { convertHexEmojiToDecimal, getFileURL, getTabIndex } from "@plane/utils"; // components import { ImagePickerPopover } from "@/components/core"; // helpers -import { convertHexEmojiToDecimal } from "@/helpers/emoji.helper"; -import { getFileURL } from "@/helpers/file.helper"; -import { getTabIndex } from "@/helpers/tab-indices.helper"; // plane web imports import { ProjectTemplateSelect } from "@/plane-web/components/projects/create/template-select"; diff --git a/web/core/components/project/create/project-create-buttons.tsx b/web/core/components/project/create/project-create-buttons.tsx index 98a6e80f9bf..e3037075782 100644 --- a/web/core/components/project/create/project-create-buttons.tsx +++ b/web/core/components/project/create/project-create-buttons.tsx @@ -6,7 +6,7 @@ import { IProject } from "@plane/types"; // ui import { Button } from "@plane/ui"; // helpers -import { getTabIndex } from "@/helpers/tab-indices.helper"; +import { getTabIndex } from "@plane/utils"; type Props = { handleClose: () => void; diff --git a/web/core/components/project/dropdowns/filters/created-at.tsx b/web/core/components/project/dropdowns/filters/created-at.tsx index 87d45a2a5e7..6b223f259f5 100644 --- a/web/core/components/project/dropdowns/filters/created-at.tsx +++ b/web/core/components/project/dropdowns/filters/created-at.tsx @@ -3,11 +3,11 @@ import { observer } from "mobx-react"; // plane constants import { PROJECT_CREATED_AT_FILTER_OPTIONS } from "@plane/constants"; // components +import { isInDateFormat } from "@plane/utils"; import { DateFilterModal } from "@/components/core"; import { FilterHeader, FilterOption } from "@/components/issues"; // helpers -import { isInDateFormat } from "@/helpers/date-time.helper"; type Props = { appliedFilters: string[] | null; diff --git a/web/core/components/project/dropdowns/filters/lead.tsx b/web/core/components/project/dropdowns/filters/lead.tsx index 7b225dee9e9..a6de50b4e86 100644 --- a/web/core/components/project/dropdowns/filters/lead.tsx +++ b/web/core/components/project/dropdowns/filters/lead.tsx @@ -6,9 +6,9 @@ import { observer } from "mobx-react"; // plane ui import { Avatar, Loader } from "@plane/ui"; // components +import { getFileURL } from "@plane/utils"; import { FilterHeader, FilterOption } from "@/components/issues"; // helpers -import { getFileURL } from "@/helpers/file.helper"; // hooks import { useMember, useUser } from "@/hooks/store"; diff --git a/web/core/components/project/dropdowns/filters/members.tsx b/web/core/components/project/dropdowns/filters/members.tsx index 752858547c5..1f593203a70 100644 --- a/web/core/components/project/dropdowns/filters/members.tsx +++ b/web/core/components/project/dropdowns/filters/members.tsx @@ -6,9 +6,9 @@ import { observer } from "mobx-react"; // plane ui import { Avatar, Loader } from "@plane/ui"; // components +import { getFileURL } from "@plane/utils"; import { FilterHeader, FilterOption } from "@/components/issues"; // helpers -import { getFileURL } from "@/helpers/file.helper"; // hooks import { useMember, useUser } from "@/hooks/store"; diff --git a/web/core/components/project/dropdowns/order-by.tsx b/web/core/components/project/dropdowns/order-by.tsx index b9665b61ae2..e75e256f0ac 100644 --- a/web/core/components/project/dropdowns/order-by.tsx +++ b/web/core/components/project/dropdowns/order-by.tsx @@ -7,7 +7,7 @@ import { TProjectOrderByOptions } from "@plane/types"; // ui import { CustomMenu, getButtonStyling } from "@plane/ui"; // helpers -import { cn } from "@/helpers/common.helper"; +import { cn } from "@plane/utils"; // types // constants diff --git a/web/core/components/project/filters.tsx b/web/core/components/project/filters.tsx index 54ae3a75266..5a97acde097 100644 --- a/web/core/components/project/filters.tsx +++ b/web/core/components/project/filters.tsx @@ -6,13 +6,12 @@ import { ListFilter } from "lucide-react"; import { useTranslation } from "@plane/i18n"; // plane types import { TProjectFilters } from "@plane/types"; +import { cn, calculateTotalFilters } from "@plane/utils"; // plane utils -import { cn } from "@plane/utils"; // components import { FiltersDropdown } from "@/components/issues"; import { ProjectFiltersSelection, ProjectOrderByDropdown } from "@/components/project"; // helpers -import { calculateTotalFilters } from "@/helpers/filter.helper"; // hooks import { useMember, useProjectFilter } from "@/hooks/store"; diff --git a/web/core/components/project/form.tsx b/web/core/components/project/form.tsx index f87f8ba8436..f5b6320c741 100644 --- a/web/core/components/project/form.tsx +++ b/web/core/components/project/form.tsx @@ -19,15 +19,13 @@ import { EmojiIconPickerTypes, Tooltip, } from "@plane/ui"; +import { renderFormattedDate, convertHexEmojiToDecimal, getFileURL } from "@plane/utils"; // components import { Logo } from "@/components/common"; import { ImagePickerPopover } from "@/components/core"; import { TimezoneSelect } from "@/components/global"; import { ProjectNetworkIcon } from "@/components/project"; // helpers -import { renderFormattedDate } from "@/helpers/date-time.helper"; -import { convertHexEmojiToDecimal } from "@/helpers/emoji.helper"; -import { getFileURL } from "@/helpers/file.helper"; // hooks import { useEventTracker, useProject } from "@/hooks/store"; import { usePlatformOS } from "@/hooks/use-platform-os"; diff --git a/web/core/components/project/member-select.tsx b/web/core/components/project/member-select.tsx index 44cc6382e68..15aaee22443 100644 --- a/web/core/components/project/member-select.tsx +++ b/web/core/components/project/member-select.tsx @@ -8,7 +8,7 @@ import { Ban } from "lucide-react"; import { EUserProjectRoles } from "@plane/constants"; import { Avatar, CustomSearchSelect } from "@plane/ui"; // helpers -import { getFileURL } from "@/helpers/file.helper"; +import { getFileURL } from "@plane/utils"; // hooks import { useMember } from "@/hooks/store"; diff --git a/web/core/components/project/multi-select-modal.tsx b/web/core/components/project/multi-select-modal.tsx index ade55675d95..0ab59bccefd 100644 --- a/web/core/components/project/multi-select-modal.tsx +++ b/web/core/components/project/multi-select-modal.tsx @@ -7,10 +7,10 @@ import { Combobox } from "@headlessui/react"; import { useTranslation } from "@plane/i18n"; import { Button, Checkbox, EModalPosition, EModalWidth, ModalCore } from "@plane/ui"; // components +import { cn } from "@plane/utils"; import { Logo } from "@/components/common"; import { SimpleEmptyState } from "@/components/empty-state"; // helpers -import { cn } from "@/helpers/common.helper"; // hooks import { useProject } from "@/hooks/store"; import { useResolvedAssetPath } from "@/hooks/use-resolved-asset-path"; diff --git a/web/core/components/project/publish-project/modal.tsx b/web/core/components/project/publish-project/modal.tsx index 5496e699398..a980b2eacf6 100644 --- a/web/core/components/project/publish-project/modal.tsx +++ b/web/core/components/project/publish-project/modal.tsx @@ -6,12 +6,12 @@ import { useParams } from "next/navigation"; import { Controller, useForm } from "react-hook-form"; import { Check, ExternalLink, Globe2 } from "lucide-react"; // types +import { SPACE_BASE_PATH, SPACE_BASE_URL } from "@plane/constants"; import { IProject, TProjectPublishLayouts, TProjectPublishSettings } from "@plane/types"; // ui import { Button, Loader, ToggleSwitch, TOAST_TYPE, setToast, CustomSelect, ModalCore, EModalWidth } from "@plane/ui"; // helpers -import { SPACE_BASE_PATH, SPACE_BASE_URL } from "@/helpers/common.helper"; -import { copyTextToClipboard } from "@/helpers/string.helper"; +import { copyTextToClipboard } from "@plane/utils"; // hooks import { useProjectPublish } from "@/hooks/store"; diff --git a/web/core/components/project/root.tsx b/web/core/components/project/root.tsx index 9475563fd2a..e0be0292a40 100644 --- a/web/core/components/project/root.tsx +++ b/web/core/components/project/root.tsx @@ -7,10 +7,10 @@ import { useParams, usePathname } from "next/navigation"; import { useTranslation } from "@plane/i18n"; import { TProjectAppliedDisplayFilterKeys, TProjectFilters } from "@plane/types"; // components -import { PageHead } from "@/components/core"; +import { calculateTotalFilters } from "@plane/utils"; +import { PageHead } from "@/components/core/page-title"; import { ProjectAppliedFiltersList, ProjectCardList } from "@/components/project"; // helpers -import { calculateTotalFilters } from "@/helpers/filter.helper"; // hooks import { useProject, useProjectFilter, useWorkspace } from "@/hooks/store"; diff --git a/web/core/components/project/search-projects.tsx b/web/core/components/project/search-projects.tsx index 412e979e9a0..c7d41280fc3 100644 --- a/web/core/components/project/search-projects.tsx +++ b/web/core/components/project/search-projects.tsx @@ -8,7 +8,7 @@ import { useOutsideClickDetector } from "@plane/hooks"; // i18n import { useTranslation } from "@plane/i18n"; // helpers -import { cn } from "@/helpers/common.helper"; +import { cn } from "@plane/utils"; // hooks import { useProjectFilter } from "@/hooks/store"; diff --git a/web/core/components/project/send-project-invitation-modal.tsx b/web/core/components/project/send-project-invitation-modal.tsx index 9b0a0882f51..9906a40a5ca 100644 --- a/web/core/components/project/send-project-invitation-modal.tsx +++ b/web/core/components/project/send-project-invitation-modal.tsx @@ -10,7 +10,7 @@ import { ROLE, PROJECT_MEMBER_ADDED, EUserPermissions } from "@plane/constants"; import { useTranslation } from "@plane/i18n"; import { Avatar, Button, CustomSelect, CustomSearchSelect, TOAST_TYPE, setToast } from "@plane/ui"; // helpers -import { getFileURL } from "@/helpers/file.helper"; +import { getFileURL } from "@plane/utils"; // hooks import { useEventTracker, useMember, useUserPermissions } from "@/hooks/store"; diff --git a/web/core/components/sidebar/sidebar-navigation.tsx b/web/core/components/sidebar/sidebar-navigation.tsx index f31a93c9c39..0e52c6ef9ee 100644 --- a/web/core/components/sidebar/sidebar-navigation.tsx +++ b/web/core/components/sidebar/sidebar-navigation.tsx @@ -1,7 +1,7 @@ "use client"; import React, { FC } from "react"; // helpers -import { cn } from "@/helpers/common.helper"; +import { cn } from "@plane/utils"; type TSidebarNavItem = { className?: string; diff --git a/web/core/components/stickies/modal/search.tsx b/web/core/components/stickies/modal/search.tsx index 22499c03a8b..8cdee6cc468 100644 --- a/web/core/components/stickies/modal/search.tsx +++ b/web/core/components/stickies/modal/search.tsx @@ -9,7 +9,7 @@ import { Search, X } from "lucide-react"; import { useOutsideClickDetector } from "@plane/hooks"; // helpers import { useTranslation } from "@plane/i18n"; -import { cn } from "@/helpers/common.helper"; +import { cn } from "@plane/utils"; import { useSticky } from "@/hooks/use-stickies"; export const StickySearch: FC = observer(() => { diff --git a/web/core/components/stickies/sticky/sticky-item-drag-handle.tsx b/web/core/components/stickies/sticky/sticky-item-drag-handle.tsx index e46c981f665..2269a9db4ce 100644 --- a/web/core/components/stickies/sticky/sticky-item-drag-handle.tsx +++ b/web/core/components/stickies/sticky/sticky-item-drag-handle.tsx @@ -4,7 +4,7 @@ import { observer } from "mobx-react"; // ui import { DragHandle } from "@plane/ui"; // helper -import { cn } from "@/helpers/common.helper"; +import { cn } from "@plane/utils"; type Props = { isDragging: boolean; diff --git a/web/core/components/views/applied-filters/root.tsx b/web/core/components/views/applied-filters/root.tsx index 8a881d2d0e1..bb654338e65 100644 --- a/web/core/components/views/applied-filters/root.tsx +++ b/web/core/components/views/applied-filters/root.tsx @@ -4,10 +4,10 @@ import { useTranslation } from "@plane/i18n"; import { TViewFilterProps } from "@plane/types"; // components import { Tag } from "@plane/ui"; +import { replaceUnderscoreIfSnakeCase } from "@plane/utils"; import { AppliedDateFilters, AppliedMembersFilters } from "@/components/common/applied-filters"; // constants // helpers -import { replaceUnderscoreIfSnakeCase } from "@/helpers/string.helper"; import { AppliedAccessFilters } from "./access"; // types diff --git a/web/core/components/views/form.tsx b/web/core/components/views/form.tsx index 3e1d0fba3fb..2b5e6ab9f5c 100644 --- a/web/core/components/views/form.tsx +++ b/web/core/components/views/form.tsx @@ -12,13 +12,11 @@ import { useTranslation } from "@plane/i18n"; import { IProjectView, IIssueFilterOptions, IIssueDisplayProperties, IIssueDisplayFilterOptions } from "@plane/types"; // ui import { Button, EmojiIconPicker, EmojiIconPickerTypes, Input, TextArea } from "@plane/ui"; +import { convertHexEmojiToDecimal, getComputedDisplayFilters, getComputedDisplayProperties, getTabIndex } from "@plane/utils"; // components import { Logo } from "@/components/common"; import { AppliedFiltersList, DisplayFiltersSelection, FilterSelection, FiltersDropdown } from "@/components/issues"; // helpers -import { convertHexEmojiToDecimal } from "@/helpers/emoji.helper"; -import { getComputedDisplayFilters, getComputedDisplayProperties } from "@/helpers/issue.helper"; -import { getTabIndex } from "@/helpers/tab-indices.helper"; // hooks import { useLabel, useMember, useProject, useProjectState } from "@/hooks/store"; import { usePlatformOS } from "@/hooks/use-platform-os"; diff --git a/web/core/components/views/quick-actions.tsx b/web/core/components/views/quick-actions.tsx index d8062499810..27b2e73eaee 100644 --- a/web/core/components/views/quick-actions.tsx +++ b/web/core/components/views/quick-actions.tsx @@ -8,11 +8,10 @@ import { EUserPermissions, EUserPermissionsLevel } from "@plane/constants"; import { IProjectView } from "@plane/types"; // ui import { ContextMenu, CustomMenu, TContextMenuItem, TOAST_TYPE, setToast } from "@plane/ui"; -import { copyUrlToClipboard } from "@plane/utils"; +import { copyUrlToClipboard, cn } from "@plane/utils"; // components import { CreateUpdateProjectViewModal, DeleteProjectViewModal } from "@/components/views"; // helpers -import { cn } from "@/helpers/common.helper"; // hooks import { useUser, useUserPermissions } from "@/hooks/store"; import { PublishViewModal, useViewPublish } from "@/plane-web/components/views/publish"; diff --git a/web/core/components/views/view-list-header.tsx b/web/core/components/views/view-list-header.tsx index 8c66e1a6807..e28aa37d8a6 100644 --- a/web/core/components/views/view-list-header.tsx +++ b/web/core/components/views/view-list-header.tsx @@ -5,7 +5,7 @@ import { ListFilter, Search, X } from "lucide-react"; // plane helpers import { useOutsideClickDetector } from "@plane/hooks"; // helpers -import { cn } from "@/helpers/common.helper"; +import { cn } from "@plane/utils"; // hooks import { useMember, useProjectView } from "@/hooks/store"; import { FiltersDropdown } from "../issues"; diff --git a/web/core/components/views/view-list-item-action.tsx b/web/core/components/views/view-list-item-action.tsx index eaeb412efc0..1dbed08ac27 100644 --- a/web/core/components/views/view-list-item-action.tsx +++ b/web/core/components/views/view-list-item-action.tsx @@ -8,11 +8,10 @@ import { useLocalStorage } from "@plane/hooks"; import { IProjectView } from "@plane/types"; // ui import { Tooltip, FavoriteStar } from "@plane/ui"; +import { calculateTotalFilters, getPublishViewLink } from "@plane/utils"; // components import { DeleteProjectViewModal, CreateUpdateProjectViewModal, ViewQuickActions } from "@/components/views"; // helpers -import { calculateTotalFilters } from "@/helpers/filter.helper"; -import { getPublishViewLink } from "@/helpers/project-views.helpers"; // hooks import { useMember, useProjectView, useUserPermissions } from "@/hooks/store"; import { PublishViewModal } from "@/plane-web/components/views/publish"; diff --git a/web/core/components/web-hooks/create-webhook-modal.tsx b/web/core/components/web-hooks/create-webhook-modal.tsx index 7dadef9a3a1..838916a6935 100644 --- a/web/core/components/web-hooks/create-webhook-modal.tsx +++ b/web/core/components/web-hooks/create-webhook-modal.tsx @@ -8,7 +8,7 @@ import { IWebhook, IWorkspace, TWebhookEventTypes } from "@plane/types"; // ui import { EModalPosition, EModalWidth, ModalCore, TOAST_TYPE, setToast } from "@plane/ui"; // helpers -import { csvDownload } from "@/helpers/download.helper"; +import { csvDownload } from "@plane/utils"; // hooks import useKeypress from "@/hooks/use-keypress"; // components diff --git a/web/core/components/web-hooks/form/secret-key.tsx b/web/core/components/web-hooks/form/secret-key.tsx index f2d16c14e85..0853595c4b1 100644 --- a/web/core/components/web-hooks/form/secret-key.tsx +++ b/web/core/components/web-hooks/form/secret-key.tsx @@ -10,9 +10,8 @@ import { useTranslation } from "@plane/i18n"; import { IWebhook } from "@plane/types"; // ui import { Button, Tooltip, TOAST_TYPE, setToast } from "@plane/ui"; +import { csvDownload, copyTextToClipboard } from "@plane/utils"; // helpers -import { csvDownload } from "@/helpers/download.helper"; -import { copyTextToClipboard } from "@/helpers/string.helper"; // hooks import { useWebhook, useWorkspace } from "@/hooks/store"; // types diff --git a/web/core/components/web-hooks/utils.ts b/web/core/components/web-hooks/utils.ts index caebe6fc144..8ae44123455 100644 --- a/web/core/components/web-hooks/utils.ts +++ b/web/core/components/web-hooks/utils.ts @@ -1,6 +1,6 @@ // helpers import { IWebhook, IWorkspace } from "@plane/types"; -import { renderFormattedPayloadDate } from "@/helpers/date-time.helper"; +import { renderFormattedPayloadDate } from "@plane/utils"; // types export const getCurrentHookAsCSV = ( diff --git a/web/core/components/workspace-notifications/notification-app-sidebar-option.tsx b/web/core/components/workspace-notifications/notification-app-sidebar-option.tsx index 443169910fc..358026806de 100644 --- a/web/core/components/workspace-notifications/notification-app-sidebar-option.tsx +++ b/web/core/components/workspace-notifications/notification-app-sidebar-option.tsx @@ -3,10 +3,10 @@ import { FC } from "react"; import { observer } from "mobx-react"; import useSWR from "swr"; +// plane imports +import { getNumberCount } from "@plane/utils"; // components -import { CountChip } from "@/components/common"; -// helpers -import { getNumberCount } from "@/helpers/string.helper"; +import { CountChip } from "@/components/common/count-chip"; // hooks import { useWorkspaceNotifications } from "@/hooks/store"; diff --git a/web/core/components/workspace-notifications/root.tsx b/web/core/components/workspace-notifications/root.tsx index 37623a6137a..e78b8a21589 100644 --- a/web/core/components/workspace-notifications/root.tsx +++ b/web/core/components/workspace-notifications/root.tsx @@ -8,7 +8,8 @@ import { NOTIFICATION_TABS, TNotificationTab } from "@plane/constants"; import { useTranslation } from "@plane/i18n"; // components import { Header, Row, ERowVariant, EHeaderVariant, ContentWrapper } from "@plane/ui"; -import { CountChip } from "@/components/common"; +import { cn, getNumberCount } from "@plane/utils"; +import { CountChip } from "@/components/common/count-chip"; import { NotificationsLoader, NotificationEmptyState, @@ -16,8 +17,6 @@ import { AppliedFilters, } from "@/components/workspace-notifications"; // helpers -import { cn } from "@/helpers/common.helper"; -import { getNumberCount } from "@/helpers/string.helper"; // hooks import { useWorkspace, useWorkspaceNotifications } from "@/hooks/store"; import { NotificationCardListRoot } from "@/plane-web/components/workspace-notifications"; diff --git a/web/core/components/workspace-notifications/sidebar/filters/menu/menu-option-item.tsx b/web/core/components/workspace-notifications/sidebar/filters/menu/menu-option-item.tsx index 6fdca559547..206f4b04671 100644 --- a/web/core/components/workspace-notifications/sidebar/filters/menu/menu-option-item.tsx +++ b/web/core/components/workspace-notifications/sidebar/filters/menu/menu-option-item.tsx @@ -6,7 +6,7 @@ import { Check } from "lucide-react"; // plane imports import { ENotificationFilterType } from "@plane/constants"; // helpers -import { cn } from "@/helpers/common.helper"; +import { cn } from "@plane/utils"; // hooks import { useWorkspaceNotifications } from "@/hooks/store"; diff --git a/web/core/components/workspace-notifications/sidebar/header/options/menu-option/menu-item.tsx b/web/core/components/workspace-notifications/sidebar/header/options/menu-option/menu-item.tsx index 9189663102f..2c1a59ce04f 100644 --- a/web/core/components/workspace-notifications/sidebar/header/options/menu-option/menu-item.tsx +++ b/web/core/components/workspace-notifications/sidebar/header/options/menu-option/menu-item.tsx @@ -3,9 +3,9 @@ import { FC } from "react"; import { observer } from "mobx-react"; // components +import { cn } from "@plane/utils"; import type { TPopoverMenuOptions } from "@/components/workspace-notifications"; // helpers -import { cn } from "@/helpers/common.helper"; export const NotificationMenuOptionItem: FC = observer((props) => { const { type, label = "", isActive, prependIcon, appendIcon, onClick } = props; diff --git a/web/core/components/workspace-notifications/sidebar/notification-card/content.tsx b/web/core/components/workspace-notifications/sidebar/notification-card/content.tsx index 7d58b3a8f83..46a623f6da7 100644 --- a/web/core/components/workspace-notifications/sidebar/notification-card/content.tsx +++ b/web/core/components/workspace-notifications/sidebar/notification-card/content.tsx @@ -1,11 +1,9 @@ import { FC } from "react"; import { TNotification } from "@plane/types"; +import { convertMinutesToHoursMinutesString, renderFormattedDate, sanitizeCommentForNotification, replaceUnderscoreIfSnakeCase, stripAndTruncateHTML } from "@plane/utils"; // components -import { LiteTextReadOnlyEditor } from "@/components/editor"; // helpers -import { convertMinutesToHoursMinutesString, renderFormattedDate } from "@/helpers/date-time.helper"; -import { sanitizeCommentForNotification } from "@/helpers/notification.helper"; -import { replaceUnderscoreIfSnakeCase, stripAndTruncateHTML } from "@/helpers/string.helper"; +import { LiteTextReadOnlyEditor } from "@/components/editor"; export const NotificationContent: FC<{ notification: TNotification; diff --git a/web/core/components/workspace-notifications/sidebar/notification-card/item.tsx b/web/core/components/workspace-notifications/sidebar/notification-card/item.tsx index c7fa3c4878d..ab1c43a4330 100644 --- a/web/core/components/workspace-notifications/sidebar/notification-card/item.tsx +++ b/web/core/components/workspace-notifications/sidebar/notification-card/item.tsx @@ -4,12 +4,10 @@ import { FC, useState } from "react"; import { observer } from "mobx-react"; import { Clock } from "lucide-react"; import { Avatar, Row } from "@plane/ui"; +import { cn, calculateTimeAgo, renderFormattedDate, renderFormattedTime, getFileURL } from "@plane/utils"; // components import { NotificationOption } from "@/components/workspace-notifications"; // helpers -import { cn } from "@/helpers/common.helper"; -import { calculateTimeAgo, renderFormattedDate, renderFormattedTime } from "@/helpers/date-time.helper"; -import { getFileURL } from "@/helpers/file.helper"; // hooks import { useIssueDetail, useNotification, useWorkspace, useWorkspaceNotifications } from "@/hooks/store"; import { NotificationContent } from "./content"; diff --git a/web/core/components/workspace-notifications/sidebar/notification-card/options/button.tsx b/web/core/components/workspace-notifications/sidebar/notification-card/options/button.tsx index cfaf26cf5bd..e1b5d791790 100644 --- a/web/core/components/workspace-notifications/sidebar/notification-card/options/button.tsx +++ b/web/core/components/workspace-notifications/sidebar/notification-card/options/button.tsx @@ -3,7 +3,7 @@ import { FC, ReactNode } from "react"; import { Tooltip } from "@plane/ui"; // helpers -import { cn } from "@/helpers/common.helper"; +import { cn } from "@plane/utils"; // hooks import { usePlatformOS } from "@/hooks/use-platform-os"; diff --git a/web/core/components/workspace-notifications/sidebar/notification-card/options/root.tsx b/web/core/components/workspace-notifications/sidebar/notification-card/options/root.tsx index 2017c0db8d6..7d0284ae572 100644 --- a/web/core/components/workspace-notifications/sidebar/notification-card/options/root.tsx +++ b/web/core/components/workspace-notifications/sidebar/notification-card/options/root.tsx @@ -3,13 +3,13 @@ import { FC, Dispatch, SetStateAction } from "react"; import { observer } from "mobx-react"; // components +import { cn } from "@plane/utils"; import { NotificationItemReadOption, NotificationItemArchiveOption, NotificationItemSnoozeOption, } from "@/components/workspace-notifications"; // helpers -import { cn } from "@/helpers/common.helper"; // hooks import { useNotification } from "@/hooks/store"; diff --git a/web/core/components/workspace-notifications/sidebar/notification-card/options/snooze/modal.tsx b/web/core/components/workspace-notifications/sidebar/notification-card/options/snooze/modal.tsx index 8b34af47709..cc3b274f0e3 100644 --- a/web/core/components/workspace-notifications/sidebar/notification-card/options/snooze/modal.tsx +++ b/web/core/components/workspace-notifications/sidebar/notification-card/options/snooze/modal.tsx @@ -9,9 +9,9 @@ import { Transition, Dialog } from "@headlessui/react"; import { allTimeIn30MinutesInterval12HoursFormat } from "@plane/constants"; import { Button, CustomSelect } from "@plane/ui"; // components +import { getDate } from "@plane/utils"; import { DateDropdown } from "@/components/dropdowns"; // helpers -import { getDate } from "@/helpers/date-time.helper"; type TNotificationSnoozeModal = { isOpen: boolean; diff --git a/web/core/components/workspace-notifications/sidebar/notification-card/options/snooze/root.tsx b/web/core/components/workspace-notifications/sidebar/notification-card/options/snooze/root.tsx index 1695cd8c81f..b96783b0951 100644 --- a/web/core/components/workspace-notifications/sidebar/notification-card/options/snooze/root.tsx +++ b/web/core/components/workspace-notifications/sidebar/notification-card/options/snooze/root.tsx @@ -9,9 +9,9 @@ import { NOTIFICATION_SNOOZE_OPTIONS } from "@plane/constants"; import { useTranslation } from "@plane/i18n"; import { Tooltip, setToast, TOAST_TYPE } from "@plane/ui"; // components +import { cn } from "@plane/utils"; import { NotificationSnoozeModal } from "@/components/workspace-notifications"; // helpers -import { cn } from "@/helpers/common.helper"; // hooks import { useWorkspaceNotifications } from "@/hooks/store"; import { usePlatformOS } from "@/hooks/use-platform-os"; diff --git a/web/core/components/workspace/logo.tsx b/web/core/components/workspace/logo.tsx index f25615dfc22..c956fe5ab31 100644 --- a/web/core/components/workspace/logo.tsx +++ b/web/core/components/workspace/logo.tsx @@ -1,9 +1,8 @@ import { observer } from "mobx-react"; // plane imports import { useTranslation } from "@plane/i18n"; -import { cn } from "@plane/utils"; -// helpers -import { getFileURL } from "@/helpers/file.helper"; +import { cn, getFileURL } from "@plane/utils"; + type Props = { logo: string | null | undefined; diff --git a/web/core/components/workspace/settings/member-columns.tsx b/web/core/components/workspace/settings/member-columns.tsx index 160af368ff6..1e5036fefc2 100644 --- a/web/core/components/workspace/settings/member-columns.tsx +++ b/web/core/components/workspace/settings/member-columns.tsx @@ -10,7 +10,7 @@ import { IUser, IWorkspaceMember } from "@plane/types"; import { CustomSelect, PopoverMenu, TOAST_TYPE, setToast } from "@plane/ui"; // constants // helpers -import { getFileURL } from "@/helpers/file.helper"; +import { getFileURL } from "@plane/utils"; // hooks import { useMember, useUser, useUserPermissions } from "@/hooks/store"; // plane web constants diff --git a/web/core/components/workspace/settings/workspace-details.tsx b/web/core/components/workspace/settings/workspace-details.tsx index 39cd7f124d3..8c996b2744c 100644 --- a/web/core/components/workspace/settings/workspace-details.tsx +++ b/web/core/components/workspace/settings/workspace-details.tsx @@ -9,12 +9,11 @@ import { ORGANIZATION_SIZE, WORKSPACE_UPDATED, EUserPermissions, EUserPermission import { useTranslation } from "@plane/i18n"; import { IWorkspace } from "@plane/types"; import { Button, CustomSelect, Input, TOAST_TYPE, setToast } from "@plane/ui"; -import { copyUrlToClipboard } from "@plane/utils"; +import { copyUrlToClipboard, getFileURL } from "@plane/utils"; // components import { LogoSpinner } from "@/components/common"; import { WorkspaceImageUploadModal } from "@/components/core"; // helpers -import { getFileURL } from "@/helpers/file.helper"; // hooks import { useEventTracker, useUserPermissions, useWorkspace } from "@/hooks/store"; // plane web components diff --git a/web/core/components/workspace/sidebar/dropdown-item.tsx b/web/core/components/workspace/sidebar/dropdown-item.tsx index 9eef151d15f..68b2d5b2e98 100644 --- a/web/core/components/workspace/sidebar/dropdown-item.tsx +++ b/web/core/components/workspace/sidebar/dropdown-item.tsx @@ -8,9 +8,8 @@ import { Menu } from "@headlessui/react"; import { EUserPermissions } from "@plane/constants"; import { useTranslation } from "@plane/i18n"; import { IWorkspace } from "@plane/types"; -import { cn, getFileURL } from "@plane/utils"; +import { cn, getFileURL, getUserRole } from "@plane/utils"; // helpers -import { getUserRole } from "@/helpers/user.helper"; // plane web imports import { SubscriptionPill } from "@/plane-web/components/common/subscription"; diff --git a/web/core/components/workspace/sidebar/dropdown.tsx b/web/core/components/workspace/sidebar/dropdown.tsx index d24fb369a29..03483a192b3 100644 --- a/web/core/components/workspace/sidebar/dropdown.tsx +++ b/web/core/components/workspace/sidebar/dropdown.tsx @@ -13,10 +13,8 @@ import { Menu, Transition } from "@headlessui/react"; import { useTranslation } from "@plane/i18n"; import { IWorkspace } from "@plane/types"; import { Avatar, Loader, TOAST_TYPE, setToast } from "@plane/ui"; -import { orderWorkspacesList } from "@plane/utils"; +import { orderWorkspacesList, GOD_MODE_URL, cn, getFileURL } from "@plane/utils"; // helpers -import { GOD_MODE_URL, cn } from "@/helpers/common.helper"; -import { getFileURL } from "@/helpers/file.helper"; // hooks import { useAppTheme, useUser, useUserProfile, useWorkspace } from "@/hooks/store"; // plane web helpers diff --git a/web/core/components/workspace/sidebar/favorites/favorite-folder.tsx b/web/core/components/workspace/sidebar/favorites/favorite-folder.tsx index 9f81deeaf68..91f8addd865 100644 --- a/web/core/components/workspace/sidebar/favorites/favorite-folder.tsx +++ b/web/core/components/workspace/sidebar/favorites/favorite-folder.tsx @@ -23,7 +23,7 @@ import { useTranslation } from "@plane/i18n"; import { IFavorite, InstructionType } from "@plane/types"; import { CustomMenu, Tooltip, DropIndicator, FavoriteFolderIcon, DragHandle } from "@plane/ui"; // helpers -import { cn } from "@/helpers/common.helper"; +import { cn } from "@plane/utils"; // hooks import { useAppTheme } from "@/hooks/store"; import { useFavorite } from "@/hooks/store/use-favorite"; diff --git a/web/core/components/workspace/sidebar/favorites/favorite-items/common/favorite-item-drag-handle.tsx b/web/core/components/workspace/sidebar/favorites/favorite-items/common/favorite-item-drag-handle.tsx index 6c8e8666ea8..91f9107c7f3 100644 --- a/web/core/components/workspace/sidebar/favorites/favorite-items/common/favorite-item-drag-handle.tsx +++ b/web/core/components/workspace/sidebar/favorites/favorite-items/common/favorite-item-drag-handle.tsx @@ -4,7 +4,7 @@ import { observer } from "mobx-react"; // ui import { DragHandle, Tooltip } from "@plane/ui"; // helper -import { cn } from "@/helpers/common.helper"; +import { cn } from "@plane/utils"; // hooks import { usePlatformOS } from "@/hooks/use-platform-os"; diff --git a/web/core/components/workspace/sidebar/favorites/favorite-items/common/favorite-item-quick-action.tsx b/web/core/components/workspace/sidebar/favorites/favorite-items/common/favorite-item-quick-action.tsx index cf6436733f4..92bd9292e65 100644 --- a/web/core/components/workspace/sidebar/favorites/favorite-items/common/favorite-item-quick-action.tsx +++ b/web/core/components/workspace/sidebar/favorites/favorite-items/common/favorite-item-quick-action.tsx @@ -7,7 +7,7 @@ import { useTranslation } from "@plane/i18n"; import { IFavorite } from "@plane/types"; import { CustomMenu } from "@plane/ui"; // helpers -import { cn } from "@/helpers/common.helper"; +import { cn } from "@plane/utils"; type Props = { ref: React.MutableRefObject; diff --git a/web/core/components/workspace/sidebar/favorites/favorite-items/common/favorite-item-wrapper.tsx b/web/core/components/workspace/sidebar/favorites/favorite-items/common/favorite-item-wrapper.tsx index f1ffde408ca..9c3c64b8d06 100644 --- a/web/core/components/workspace/sidebar/favorites/favorite-items/common/favorite-item-wrapper.tsx +++ b/web/core/components/workspace/sidebar/favorites/favorite-items/common/favorite-item-wrapper.tsx @@ -1,7 +1,7 @@ "use client"; import React, { FC } from "react"; // helpers -import { cn } from "@/helpers/common.helper"; +import { cn } from "@plane/utils"; type Props = { children: React.ReactNode; diff --git a/web/core/components/workspace/sidebar/favorites/favorites-menu.tsx b/web/core/components/workspace/sidebar/favorites/favorites-menu.tsx index f83f0ed061b..d2d30a37df9 100644 --- a/web/core/components/workspace/sidebar/favorites/favorites-menu.tsx +++ b/web/core/components/workspace/sidebar/favorites/favorites-menu.tsx @@ -21,7 +21,7 @@ import { setToast, TOAST_TYPE, Tooltip } from "@plane/ui"; // constants // helpers -import { cn } from "@/helpers/common.helper"; +import { cn } from "@plane/utils"; // hooks import { useAppTheme } from "@/hooks/store"; import { useFavorite } from "@/hooks/store/use-favorite"; diff --git a/web/core/components/workspace/sidebar/help-section.tsx b/web/core/components/workspace/sidebar/help-section.tsx index 9c1b98fe8be..73f036cd412 100644 --- a/web/core/components/workspace/sidebar/help-section.tsx +++ b/web/core/components/workspace/sidebar/help-section.tsx @@ -8,9 +8,9 @@ import { useTranslation } from "@plane/i18n"; // ui import { CustomMenu, Tooltip, ToggleSwitch } from "@plane/ui"; // components +import { cn } from "@plane/utils"; import { ProductUpdatesModal } from "@/components/global"; // helpers -import { cn } from "@/helpers/common.helper"; // hooks import { useAppTheme, useCommandPalette, useInstance, useTransient, useUserSettings } from "@/hooks/store"; import { usePlatformOS } from "@/hooks/use-platform-os"; diff --git a/web/core/components/workspace/sidebar/projects-list-item.tsx b/web/core/components/workspace/sidebar/projects-list-item.tsx index 33f96e3b514..ac7ece6472d 100644 --- a/web/core/components/workspace/sidebar/projects-list-item.tsx +++ b/web/core/components/workspace/sidebar/projects-list-item.tsx @@ -19,10 +19,10 @@ import { useTranslation } from "@plane/i18n"; // ui import { CustomMenu, Tooltip, ArchiveIcon, DropIndicator, DragHandle, ControlLink } from "@plane/ui"; // components -import { Logo } from "@/components/common"; +import { cn } from "@plane/utils"; +import { Logo } from "@/components/common/logo"; import { LeaveProjectModal, PublishProjectModal } from "@/components/project"; // helpers -import { cn } from "@/helpers/common.helper"; // hooks import { useAppTheme, useCommandPalette, useEventTracker, useProject, useUserPermissions } from "@/hooks/store"; import { usePlatformOS } from "@/hooks/use-platform-os"; diff --git a/web/core/components/workspace/sidebar/projects-list.tsx b/web/core/components/workspace/sidebar/projects-list.tsx index bea70b0d61b..2ef487468cd 100644 --- a/web/core/components/workspace/sidebar/projects-list.tsx +++ b/web/core/components/workspace/sidebar/projects-list.tsx @@ -11,13 +11,11 @@ import { EUserPermissions, EUserPermissionsLevel } from "@plane/constants"; import { useTranslation } from "@plane/i18n"; // ui import { Loader, TOAST_TYPE, Tooltip, setToast } from "@plane/ui"; -import { copyUrlToClipboard } from "@plane/utils"; +import { copyUrlToClipboard, cn, orderJoinedProjects } from "@plane/utils"; // components import { CreateProjectModal } from "@/components/project"; import { SidebarProjectsListItem } from "@/components/workspace"; // helpers -import { cn } from "@/helpers/common.helper"; -import { orderJoinedProjects } from "@/helpers/project.helper"; // hooks import { useAppTheme, useCommandPalette, useEventTracker, useProject, useUserPermissions } from "@/hooks/store"; // plane web types diff --git a/web/core/components/workspace/sidebar/quick-actions.tsx b/web/core/components/workspace/sidebar/quick-actions.tsx index 86ab8960300..8ba2506c31a 100644 --- a/web/core/components/workspace/sidebar/quick-actions.tsx +++ b/web/core/components/workspace/sidebar/quick-actions.tsx @@ -7,10 +7,10 @@ import { useTranslation } from "@plane/i18n"; // types import { TIssue } from "@plane/types"; // components +import { cn } from "@plane/utils"; import { CreateUpdateIssueModal } from "@/components/issues"; // constants // helpers -import { cn } from "@/helpers/common.helper"; // hooks import { useAppTheme, useCommandPalette, useEventTracker, useProject, useUserPermissions } from "@/hooks/store"; import useLocalStorage from "@/hooks/use-local-storage"; diff --git a/web/core/components/workspace/sidebar/user-menu.tsx b/web/core/components/workspace/sidebar/user-menu.tsx index 2d625ae6b69..5e3ee4b0a5d 100644 --- a/web/core/components/workspace/sidebar/user-menu.tsx +++ b/web/core/components/workspace/sidebar/user-menu.tsx @@ -8,9 +8,9 @@ import { Home, Inbox, PenSquare } from "lucide-react"; import { EUserWorkspaceRoles } from "@plane/constants"; import { UserActivityIcon } from "@plane/ui"; // components +import { cn } from "@plane/utils"; import { SidebarUserMenuItem } from "@/components/workspace/sidebar"; // helpers -import { cn } from "@/helpers/common.helper"; // hooks import { useAppTheme, useUserPermissions, useUser } from "@/hooks/store"; diff --git a/web/core/components/workspace/sidebar/workspace-menu.tsx b/web/core/components/workspace/sidebar/workspace-menu.tsx index 2b2fa90b317..57582c6c83e 100644 --- a/web/core/components/workspace/sidebar/workspace-menu.tsx +++ b/web/core/components/workspace/sidebar/workspace-menu.tsx @@ -9,9 +9,9 @@ import { Disclosure, Transition } from "@headlessui/react"; import { EUserWorkspaceRoles } from "@plane/constants"; import { ContrastIcon } from "@plane/ui"; // components +import { cn } from "@plane/utils"; import { SidebarWorkspaceMenuHeader, SidebarWorkspaceMenuItem } from "@/components/workspace/sidebar"; // helpers -import { cn } from "@/helpers/common.helper"; // hooks import { useAppTheme } from "@/hooks/store"; import useLocalStorage from "@/hooks/use-local-storage"; diff --git a/web/core/components/workspace/views/default-view-list-item.tsx b/web/core/components/workspace/views/default-view-list-item.tsx index de64052cfe6..536d7ff8ac9 100644 --- a/web/core/components/workspace/views/default-view-list-item.tsx +++ b/web/core/components/workspace/views/default-view-list-item.tsx @@ -3,7 +3,7 @@ import Link from "next/link"; import { useParams } from "next/navigation"; import { useTranslation } from "@plane/i18n"; // helpers -import { truncateText } from "@/helpers/string.helper"; +import { truncateText } from "@plane/utils"; type Props = { view: { key: string; i18n_label: string } }; diff --git a/web/core/components/workspace/views/default-view-quick-action.tsx b/web/core/components/workspace/views/default-view-quick-action.tsx index 9ade52acb1d..e7f0e276a3d 100644 --- a/web/core/components/workspace/views/default-view-quick-action.tsx +++ b/web/core/components/workspace/views/default-view-quick-action.tsx @@ -8,10 +8,8 @@ import { useTranslation } from "@plane/i18n"; // ui import { TStaticViewTypes } from "@plane/types"; import { ContextMenu, CustomMenu, TContextMenuItem, TOAST_TYPE, setToast } from "@plane/ui"; -import { copyUrlToClipboard } from "@plane/utils"; +import { copyUrlToClipboard, cn } from "@plane/utils"; // helpers -import { cn } from "@/helpers/common.helper"; - type Props = { parentRef: React.RefObject; workspaceSlug: string; diff --git a/web/core/components/workspace/views/form.tsx b/web/core/components/workspace/views/form.tsx index 5abe7f2dd9c..6761822165c 100644 --- a/web/core/components/workspace/views/form.tsx +++ b/web/core/components/workspace/views/form.tsx @@ -12,9 +12,9 @@ import { IIssueDisplayFilterOptions, IIssueDisplayProperties, IIssueFilterOption // ui import { Button, Input, TextArea } from "@plane/ui"; // components +import { getComputedDisplayFilters, getComputedDisplayProperties } from "@plane/utils"; import { AppliedFiltersList, DisplayFiltersSelection, FilterSelection, FiltersDropdown } from "@/components/issues"; // helpers -import { getComputedDisplayFilters, getComputedDisplayProperties } from "@/helpers/issue.helper"; // hooks import { useLabel, useMember } from "@/hooks/store"; import { AccessController } from "@/plane-web/components/views/access-controller"; diff --git a/web/core/components/workspace/views/quick-action.tsx b/web/core/components/workspace/views/quick-action.tsx index 5fbdffc4f6f..e0950a78ac0 100644 --- a/web/core/components/workspace/views/quick-action.tsx +++ b/web/core/components/workspace/views/quick-action.tsx @@ -9,13 +9,11 @@ import { EViewAccess, EUserPermissions, EUserPermissionsLevel } from "@plane/con import { useTranslation } from "@plane/i18n"; import { IWorkspaceView } from "@plane/types"; import { ContextMenu, TContextMenuItem, TOAST_TYPE, setToast } from "@plane/ui"; -import { copyUrlToClipboard } from "@plane/utils"; +import { copyUrlToClipboard, cn } from "@plane/utils"; // components import { CreateUpdateWorkspaceViewModal, DeleteGlobalViewModal } from "@/components/workspace"; // constants // helpers -import { cn } from "@/helpers/common.helper"; -import {} from "@/helpers/string.helper"; // hooks import { useUser, useUserPermissions } from "@/hooks/store"; diff --git a/web/core/components/workspace/views/view-list-item.tsx b/web/core/components/workspace/views/view-list-item.tsx index 23bab4f5ec6..38fd9b57825 100644 --- a/web/core/components/workspace/views/view-list-item.tsx +++ b/web/core/components/workspace/views/view-list-item.tsx @@ -8,11 +8,10 @@ import { useParams } from "next/navigation"; import { Pencil, Trash2 } from "lucide-react"; // ui import { CustomMenu } from "@plane/ui"; +import { calculateTotalFilters, truncateText } from "@plane/utils"; // components import { CreateUpdateWorkspaceViewModal, DeleteGlobalViewModal } from "@/components/workspace"; // helpers -import { calculateTotalFilters } from "@/helpers/filter.helper"; -import { truncateText } from "@/helpers/string.helper"; // store hooks import { useEventTracker, useGlobalView } from "@/hooks/store"; diff --git a/web/core/constants/editor.ts b/web/core/constants/editor.ts index 5e8c723d71d..ef9c914022c 100644 --- a/web/core/constants/editor.ts +++ b/web/core/constants/editor.ts @@ -23,12 +23,10 @@ import { TextQuote, Underline, } from "lucide-react"; -// editor +// plane imports import { TCommandExtraProps, TEditorCommands, TEditorFontStyle } from "@plane/editor"; -// ui import { MonospaceIcon, SansSerifIcon, SerifIcon } from "@plane/ui"; -// helpers -import { convertRemToPixel } from "@/helpers/common.helper"; +import { convertRemToPixel } from "@plane/utils"; type TEditorTypes = "lite" | "document" | "sticky"; diff --git a/web/core/hooks/editor/use-editor-config.ts b/web/core/hooks/editor/use-editor-config.ts index 166df1d5b32..c812b031177 100644 --- a/web/core/hooks/editor/use-editor-config.ts +++ b/web/core/hooks/editor/use-editor-config.ts @@ -2,7 +2,7 @@ import { useCallback } from "react"; // plane editor import { TFileHandler, TReadOnlyFileHandler } from "@plane/editor"; // helpers -import { getEditorAssetSrc } from "@/helpers/editor.helper"; +import { getEditorAssetSrc } from "@plane/utils"; // hooks import { useEditorAsset } from "@/hooks/store"; // plane web hooks diff --git a/web/core/hooks/editor/use-editor-mention.tsx b/web/core/hooks/editor/use-editor-mention.tsx index 183cc1ec9dd..04e3686ddda 100644 --- a/web/core/hooks/editor/use-editor-mention.tsx +++ b/web/core/hooks/editor/use-editor-mention.tsx @@ -6,7 +6,7 @@ import { TSearchEntities, TSearchEntityRequestPayload, TSearchResponse, TUserSea // plane ui import { Avatar } from "@plane/ui"; // helpers -import { getFileURL } from "@/helpers/file.helper"; +import { getFileURL } from "@plane/utils"; // plane web constants import { EDITOR_MENTION_TYPES } from "@/plane-web/constants/editor"; // plane web hooks diff --git a/web/core/hooks/use-comment-reaction.tsx b/web/core/hooks/use-comment-reaction.tsx index 848c9b42654..3f9126fae22 100644 --- a/web/core/hooks/use-comment-reaction.tsx +++ b/web/core/hooks/use-comment-reaction.tsx @@ -1,8 +1,8 @@ import useSWR from "swr"; // fetch keys +import { groupReactions } from "@plane/utils"; import { COMMENT_REACTION_LIST } from "@/constants/fetch-keys"; // services -import { groupReactions } from "@/helpers/emoji.helper"; import { useUser } from "@/hooks/store"; import { IssueReactionService } from "@/services/issue"; // helpers diff --git a/web/core/hooks/use-favorite-item-details.tsx b/web/core/hooks/use-favorite-item-details.tsx index eadc64f7c3e..b9cd11304fc 100644 --- a/web/core/hooks/use-favorite-item-details.tsx +++ b/web/core/hooks/use-favorite-item-details.tsx @@ -1,12 +1,12 @@ // plane imports import { IFavorite } from "@plane/types"; // components +import { getPageName } from "@plane/utils"; import { generateFavoriteItemLink, getFavoriteItemIcon, } from "@/components/workspace/sidebar/favorites/favorite-items/common"; // helpers -import { getPageName } from "@/helpers/page.helper"; // hooks import { useProject, useProjectView, useCycle, useModule } from "@/hooks/store"; // plane web hooks diff --git a/web/core/hooks/use-issue-peek-overview-redirection.tsx b/web/core/hooks/use-issue-peek-overview-redirection.tsx index beb27b70b39..9b980fe329e 100644 --- a/web/core/hooks/use-issue-peek-overview-redirection.tsx +++ b/web/core/hooks/use-issue-peek-overview-redirection.tsx @@ -4,7 +4,7 @@ import { EIssueServiceType } from "@plane/constants"; // types import { TIssue } from "@plane/types"; // helpers -import { generateWorkItemLink } from "@/helpers/issue.helper"; +import { generateWorkItemLink } from "@plane/utils"; // hooks import { useIssueDetail, useProject } from "./store"; diff --git a/web/core/hooks/use-parse-editor-content.ts b/web/core/hooks/use-parse-editor-content.ts index 86e13a73f96..8e4f3ba9700 100644 --- a/web/core/hooks/use-parse-editor-content.ts +++ b/web/core/hooks/use-parse-editor-content.ts @@ -3,7 +3,7 @@ import { useParams } from "next/navigation"; // plane types import { TSearchEntities } from "@plane/types"; // helpers -import { getBase64Image } from "@/helpers/file.helper"; +import { getBase64Image } from "@plane/utils"; // hooks import { useMember } from "@/hooks/store"; // plane web hooks diff --git a/web/core/lib/posthog-provider.tsx b/web/core/lib/posthog-provider.tsx index 8799e827ac9..f0aa054589e 100644 --- a/web/core/lib/posthog-provider.tsx +++ b/web/core/lib/posthog-provider.tsx @@ -9,7 +9,7 @@ import { PostHogProvider as PHProvider } from "posthog-js/react"; // constants import { GROUP_WORKSPACE } from "@plane/constants"; // helpers -import { getUserRole } from "@/helpers/user.helper"; +import { getUserRole } from "@plane/utils"; // hooks import { useWorkspace, useUser, useInstance, useUserPermissions } from "@/hooks/store"; // dynamic imports diff --git a/web/core/lib/wrappers/store-wrapper.tsx b/web/core/lib/wrappers/store-wrapper.tsx index 0243c34f48b..a665199bb19 100644 --- a/web/core/lib/wrappers/store-wrapper.tsx +++ b/web/core/lib/wrappers/store-wrapper.tsx @@ -4,7 +4,7 @@ import { useParams } from "next/navigation"; import { useTheme } from "next-themes"; import { useTranslation, TLanguage } from "@plane/i18n"; // helpers -import { applyTheme, unsetCustomCssVariables } from "@/helpers/theme.helper"; +import { applyTheme, unsetCustomCssVariables } from "@plane/utils"; // hooks import { useRouterParams, useAppTheme, useUserProfile } from "@/hooks/store"; diff --git a/web/core/local-db/utils/load-workspace.ts b/web/core/local-db/utils/load-workspace.ts index 0cd4931187b..509e093a91b 100644 --- a/web/core/local-db/utils/load-workspace.ts +++ b/web/core/local-db/utils/load-workspace.ts @@ -1,6 +1,6 @@ import { difference } from "lodash"; +import { API_BASE_URL } from "@plane/constants"; import { IEstimate, IEstimatePoint, IWorkspaceMember, TIssue } from "@plane/types"; -import { API_BASE_URL } from "@/helpers/common.helper"; import { EstimateService } from "@/plane-web/services/project/estimate.service"; import { CycleService } from "@/services/cycle.service"; import { IssueLabelService } from "@/services/issue/issue_label.service"; diff --git a/web/core/services/ai.service.ts b/web/core/services/ai.service.ts index bb0241e06d5..7588e309b93 100644 --- a/web/core/services/ai.service.ts +++ b/web/core/services/ai.service.ts @@ -1,5 +1,5 @@ // helpers -import { API_BASE_URL } from "@/helpers/common.helper"; +import { API_BASE_URL } from "@plane/constants"; // plane web constants import { AI_EDITOR_TASKS } from "@/plane-web/constants/ai"; // services diff --git a/web/core/services/analytics.service.ts b/web/core/services/analytics.service.ts index 991407d1656..2cf818babca 100644 --- a/web/core/services/analytics.service.ts +++ b/web/core/services/analytics.service.ts @@ -1,4 +1,5 @@ // services +import { API_BASE_URL } from "@plane/constants"; import { IAnalyticsParams, IAnalyticsResponse, @@ -6,7 +7,6 @@ import { IExportAnalyticsFormData, ISaveAnalyticsFormData, } from "@plane/types"; -import { API_BASE_URL } from "@/helpers/common.helper"; import { APIService } from "@/services/api.service"; // types // helpers diff --git a/web/core/services/api_token.service.ts b/web/core/services/api_token.service.ts index 51078396cd8..ba0acfb3913 100644 --- a/web/core/services/api_token.service.ts +++ b/web/core/services/api_token.service.ts @@ -1,5 +1,5 @@ +import { API_BASE_URL } from "@plane/constants"; import { IApiToken } from "@plane/types"; -import { API_BASE_URL } from "@/helpers/common.helper"; import { APIService } from "./api.service"; export class APITokenService extends APIService { diff --git a/web/core/services/app_config.service.ts b/web/core/services/app_config.service.ts index 52794a46d3b..e930ac232ad 100644 --- a/web/core/services/app_config.service.ts +++ b/web/core/services/app_config.service.ts @@ -1,5 +1,5 @@ // services -import { API_BASE_URL } from "@/helpers/common.helper"; +import { API_BASE_URL } from "@plane/constants"; import { APIService } from "@/services/api.service"; // helper // types diff --git a/web/core/services/app_installation.service.ts b/web/core/services/app_installation.service.ts index 6c584feb660..6c5f0e4def2 100644 --- a/web/core/services/app_installation.service.ts +++ b/web/core/services/app_installation.service.ts @@ -1,5 +1,5 @@ // services -import { API_BASE_URL } from "@/helpers/common.helper"; +import { API_BASE_URL } from "@plane/constants"; import { APIService } from "@/services/api.service"; // helpers diff --git a/web/core/services/auth.service.ts b/web/core/services/auth.service.ts index 7663afde86d..9e167f98186 100644 --- a/web/core/services/auth.service.ts +++ b/web/core/services/auth.service.ts @@ -1,7 +1,7 @@ // types +import { API_BASE_URL } from "@plane/constants"; import { ICsrfTokenData, IEmailCheckData, IEmailCheckResponse } from "@plane/types"; // helpers -import { API_BASE_URL } from "@/helpers/common.helper"; // services import { APIService } from "@/services/api.service"; diff --git a/web/core/services/cycle.service.ts b/web/core/services/cycle.service.ts index 1b580d18fc1..222f04bf2ac 100644 --- a/web/core/services/cycle.service.ts +++ b/web/core/services/cycle.service.ts @@ -1,4 +1,5 @@ // services +import { API_BASE_URL } from "@plane/constants"; import type { CycleDateCheckData, ICycle, @@ -8,7 +9,6 @@ import type { TProgressSnapshot, TCycleEstimateDistribution, } from "@plane/types"; -import { API_BASE_URL } from "@/helpers/common.helper"; import { APIService } from "@/services/api.service"; export class CycleService extends APIService { diff --git a/web/core/services/cycle_archive.service.ts b/web/core/services/cycle_archive.service.ts index 06f3f426a1a..3042b104977 100644 --- a/web/core/services/cycle_archive.service.ts +++ b/web/core/services/cycle_archive.service.ts @@ -1,7 +1,7 @@ // type +import { API_BASE_URL } from "@plane/constants"; import { ICycle } from "@plane/types"; // helpers -import { API_BASE_URL } from "@/helpers/common.helper"; // services import { APIService } from "@/services/api.service"; diff --git a/web/core/services/dashboard.service.ts b/web/core/services/dashboard.service.ts index ad86932f944..a7416b173da 100644 --- a/web/core/services/dashboard.service.ts +++ b/web/core/services/dashboard.service.ts @@ -1,5 +1,5 @@ +import { API_BASE_URL } from "@plane/constants"; import { THomeDashboardResponse, TWidget, TWidgetStatsResponse, TWidgetStatsRequestParams } from "@plane/types"; -import { API_BASE_URL } from "@/helpers/common.helper"; import { APIService } from "@/services/api.service"; // helpers // types diff --git a/web/core/services/favorite/favorite.service.ts b/web/core/services/favorite/favorite.service.ts index 8a4963cdf3f..13168932fb3 100644 --- a/web/core/services/favorite/favorite.service.ts +++ b/web/core/services/favorite/favorite.service.ts @@ -1,6 +1,6 @@ +import { API_BASE_URL } from "@plane/constants"; import type { IFavorite } from "@plane/types"; // helpers -import { API_BASE_URL } from "@/helpers/common.helper"; // services import { APIService } from "@/services/api.service"; // types diff --git a/web/core/services/file.service.ts b/web/core/services/file.service.ts index 2c9c82a6daa..d5f4c28e540 100644 --- a/web/core/services/file.service.ts +++ b/web/core/services/file.service.ts @@ -1,9 +1,9 @@ import { AxiosRequestConfig } from "axios"; // plane types +import { API_BASE_URL } from "@plane/constants"; import { TFileEntityInfo, TFileSignedURLResponse } from "@plane/types"; // helpers -import { API_BASE_URL } from "@/helpers/common.helper"; -import { generateFileUploadPayload, getAssetIdFromUrl, getFileMetaDataForUpload } from "@/helpers/file.helper"; +import { generateFileUploadPayload, getAssetIdFromUrl, getFileMetaDataForUpload } from "@plane/utils"; // services import { APIService } from "@/services/api.service"; import { FileUploadService } from "@/services/file-upload.service"; diff --git a/web/core/services/inbox/inbox-issue.service.ts b/web/core/services/inbox/inbox-issue.service.ts index 007c364c500..bccb6b22424 100644 --- a/web/core/services/inbox/inbox-issue.service.ts +++ b/web/core/services/inbox/inbox-issue.service.ts @@ -1,8 +1,7 @@ // plane imports -import { EInboxIssueSource, TInboxIssue } from "@plane/constants"; +import { EInboxIssueSource, TInboxIssue, API_BASE_URL } from "@plane/constants"; import type { TIssue, TInboxIssueWithPagination } from "@plane/types"; // helpers -import { API_BASE_URL } from "@/helpers/common.helper"; // services import { APIService } from "@/services/api.service"; diff --git a/web/core/services/inbox/intake-work_item_version.service.ts b/web/core/services/inbox/intake-work_item_version.service.ts index c8ebaa28476..34c47bcd0a1 100644 --- a/web/core/services/inbox/intake-work_item_version.service.ts +++ b/web/core/services/inbox/intake-work_item_version.service.ts @@ -1,7 +1,7 @@ // plane imports +import { API_BASE_URL } from "@plane/constants"; import { type TDescriptionVersionsListResponse, type TDescriptionVersionDetails } from "@plane/types"; // helpers -import { API_BASE_URL } from "@/helpers/common.helper"; // services import { APIService } from "@/services/api.service"; diff --git a/web/core/services/instance.service.ts b/web/core/services/instance.service.ts index 29b93bb5506..b85fad7db27 100644 --- a/web/core/services/instance.service.ts +++ b/web/core/services/instance.service.ts @@ -1,7 +1,7 @@ // types +import { API_BASE_URL } from "@plane/constants"; import type { IInstanceInfo, TPage } from "@plane/types"; // helpers -import { API_BASE_URL } from "@/helpers/common.helper"; // services import { APIService } from "@/services/api.service"; diff --git a/web/core/services/integrations/github.service.ts b/web/core/services/integrations/github.service.ts index 634eb643628..4e8129d4027 100644 --- a/web/core/services/integrations/github.service.ts +++ b/web/core/services/integrations/github.service.ts @@ -1,5 +1,5 @@ +import { API_BASE_URL } from "@plane/constants"; import { IGithubRepoInfo, IGithubServiceImportFormData } from "@plane/types"; -import { API_BASE_URL } from "@/helpers/common.helper"; import { APIService } from "@/services/api.service"; // helpers // types diff --git a/web/core/services/integrations/integration.service.ts b/web/core/services/integrations/integration.service.ts index bf62f8fbe0b..f284473fcc9 100644 --- a/web/core/services/integrations/integration.service.ts +++ b/web/core/services/integrations/integration.service.ts @@ -1,5 +1,5 @@ +import { API_BASE_URL } from "@plane/constants"; import { IAppIntegration, IImporterService, IWorkspaceIntegration, IExportServiceResponse } from "@plane/types"; -import { API_BASE_URL } from "@/helpers/common.helper"; import { APIService } from "@/services/api.service"; // types // helper diff --git a/web/core/services/integrations/jira.service.ts b/web/core/services/integrations/jira.service.ts index 14130ed1697..6be50b2ec81 100644 --- a/web/core/services/integrations/jira.service.ts +++ b/web/core/services/integrations/jira.service.ts @@ -1,5 +1,5 @@ +import { API_BASE_URL } from "@plane/constants"; import { IJiraMetadata, IJiraResponse, IJiraImporterForm } from "@plane/types"; -import { API_BASE_URL } from "@/helpers/common.helper"; import { APIService } from "@/services/api.service"; // types diff --git a/web/core/services/issue/issue.service.ts b/web/core/services/issue/issue.service.ts index e53492b813f..88df42b893f 100644 --- a/web/core/services/issue/issue.service.ts +++ b/web/core/services/issue/issue.service.ts @@ -1,5 +1,5 @@ -import { EIssueServiceType } from "@plane/constants"; // types +import { EIssueServiceType, API_BASE_URL } from "@plane/constants"; import { TIssueParams, type IIssueDisplayProperties, @@ -12,8 +12,7 @@ import { type TIssueSubIssues, } from "@plane/types"; // helpers -import { API_BASE_URL } from "@/helpers/common.helper"; -import { getIssuesShouldFallbackToServer } from "@/helpers/issue.helper"; +import { getIssuesShouldFallbackToServer } from "@plane/utils"; import { persistence } from "@/local-db/storage.sqlite"; // services diff --git a/web/core/services/issue/issue_activity.service.ts b/web/core/services/issue/issue_activity.service.ts index 103cf6e2171..4eb5e90b0f4 100644 --- a/web/core/services/issue/issue_activity.service.ts +++ b/web/core/services/issue/issue_activity.service.ts @@ -1,6 +1,5 @@ -import { EIssueServiceType } from "@plane/constants"; +import { EIssueServiceType, API_BASE_URL } from "@plane/constants"; import { TIssueActivity, TIssueServiceType } from "@plane/types"; -import { API_BASE_URL } from "@/helpers/common.helper"; import { APIService } from "@/services/api.service"; // types // helper diff --git a/web/core/services/issue/issue_archive.service.ts b/web/core/services/issue/issue_archive.service.ts index b86886ca935..ae4eefd6300 100644 --- a/web/core/services/issue/issue_archive.service.ts +++ b/web/core/services/issue/issue_archive.service.ts @@ -1,6 +1,5 @@ -import { EIssueServiceType } from "@plane/constants"; +import { EIssueServiceType, API_BASE_URL } from "@plane/constants"; import { TIssue, TIssueServiceType } from "@plane/types"; -import { API_BASE_URL } from "@/helpers/common.helper"; import { APIService } from "@/services/api.service"; // types // constants diff --git a/web/core/services/issue/issue_attachment.service.ts b/web/core/services/issue/issue_attachment.service.ts index 322e8c2c68a..46ef780c21b 100644 --- a/web/core/services/issue/issue_attachment.service.ts +++ b/web/core/services/issue/issue_attachment.service.ts @@ -1,10 +1,9 @@ import { AxiosRequestConfig } from "axios"; -import { EIssueServiceType } from "@plane/constants"; +import { EIssueServiceType, API_BASE_URL } from "@plane/constants"; // plane types import { TIssueAttachment, TIssueAttachmentUploadResponse, TIssueServiceType } from "@plane/types"; // helpers -import { API_BASE_URL } from "@/helpers/common.helper"; -import { generateFileUploadPayload, getFileMetaDataForUpload } from "@/helpers/file.helper"; +import { generateFileUploadPayload, getFileMetaDataForUpload } from "@plane/utils"; // services import { APIService } from "@/services/api.service"; import { FileUploadService } from "@/services/file-upload.service"; diff --git a/web/core/services/issue/issue_comment.service.ts b/web/core/services/issue/issue_comment.service.ts index 8a55f49a1d5..dc559c69a30 100644 --- a/web/core/services/issue/issue_comment.service.ts +++ b/web/core/services/issue/issue_comment.service.ts @@ -1,9 +1,8 @@ -import { EIssueServiceType } from "@plane/constants"; // plane types +import { EIssueServiceType, API_BASE_URL } from "@plane/constants"; import { TFileSignedURLResponse, TIssueComment, TIssueServiceType } from "@plane/types"; // helpers -import { API_BASE_URL } from "@/helpers/common.helper"; -import { generateFileUploadPayload, getFileMetaDataForUpload } from "@/helpers/file.helper"; +import { generateFileUploadPayload, getFileMetaDataForUpload } from "@plane/utils"; // services import { APIService } from "@/services/api.service"; import { FileUploadService } from "@/services/file-upload.service"; diff --git a/web/core/services/issue/issue_draft.service.ts b/web/core/services/issue/issue_draft.service.ts index 919031285bb..ebac8620511 100644 --- a/web/core/services/issue/issue_draft.service.ts +++ b/web/core/services/issue/issue_draft.service.ts @@ -1,5 +1,5 @@ +import { API_BASE_URL } from "@plane/constants"; import { TIssue, TIssuesResponse } from "@plane/types"; -import { API_BASE_URL } from "@/helpers/common.helper"; import { APIService } from "@/services/api.service"; // helpers diff --git a/web/core/services/issue/issue_label.service.ts b/web/core/services/issue/issue_label.service.ts index 7a685218c67..21a5531fc9d 100644 --- a/web/core/services/issue/issue_label.service.ts +++ b/web/core/services/issue/issue_label.service.ts @@ -1,5 +1,5 @@ +import { API_BASE_URL } from "@plane/constants"; import { IIssueLabel } from "@plane/types"; -import { API_BASE_URL } from "@/helpers/common.helper"; // services import { APIService } from "@/services/api.service"; // types diff --git a/web/core/services/issue/issue_reaction.service.ts b/web/core/services/issue/issue_reaction.service.ts index 39fc8406ac6..2cd6e9f7f2a 100644 --- a/web/core/services/issue/issue_reaction.service.ts +++ b/web/core/services/issue/issue_reaction.service.ts @@ -1,6 +1,5 @@ -import { EIssueServiceType } from "@plane/constants"; +import { EIssueServiceType, API_BASE_URL } from "@plane/constants"; import { type TIssueCommentReaction, type TIssueReaction, type TIssueServiceType } from "@plane/types"; -import { API_BASE_URL } from "@/helpers/common.helper"; // services import { APIService } from "@/services/api.service"; // types diff --git a/web/core/services/issue/issue_relation.service.ts b/web/core/services/issue/issue_relation.service.ts index 2168cdb44bf..86aa8800b36 100644 --- a/web/core/services/issue/issue_relation.service.ts +++ b/web/core/services/issue/issue_relation.service.ts @@ -1,6 +1,6 @@ +import { API_BASE_URL } from "@plane/constants"; import type { TIssueRelation, TIssue } from "@plane/types"; // helpers -import { API_BASE_URL } from "@/helpers/common.helper"; // Plane-web import { TIssueRelationTypes } from "@/plane-web/types"; // services diff --git a/web/core/services/issue/work_item_version.service.ts b/web/core/services/issue/work_item_version.service.ts index cf36842fae4..84a03412460 100644 --- a/web/core/services/issue/work_item_version.service.ts +++ b/web/core/services/issue/work_item_version.service.ts @@ -1,12 +1,11 @@ // plane imports -import { EIssueServiceType } from "@plane/constants"; +import { EIssueServiceType, API_BASE_URL } from "@plane/constants"; import { type TDescriptionVersionsListResponse, type TDescriptionVersionDetails, type TIssueServiceType, } from "@plane/types"; // helpers -import { API_BASE_URL } from "@/helpers/common.helper"; // services import { APIService } from "@/services/api.service"; diff --git a/web/core/services/issue/workspace_draft.service.ts b/web/core/services/issue/workspace_draft.service.ts index d1d1ff17697..bccfb213ed7 100644 --- a/web/core/services/issue/workspace_draft.service.ts +++ b/web/core/services/issue/workspace_draft.service.ts @@ -1,6 +1,6 @@ +import { API_BASE_URL } from "@plane/constants"; import { TIssue, TWorkspaceDraftIssue, TWorkspaceDraftPaginationInfo } from "@plane/types"; // helpers -import { API_BASE_URL } from "@/helpers/common.helper"; // services import { APIService } from "@/services/api.service"; diff --git a/web/core/services/issue_filter.service.ts b/web/core/services/issue_filter.service.ts index 3e288bb1a8d..d6f67b108ce 100644 --- a/web/core/services/issue_filter.service.ts +++ b/web/core/services/issue_filter.service.ts @@ -1,6 +1,6 @@ // services +import { API_BASE_URL } from "@plane/constants"; import type { IIssueFiltersResponse } from "@plane/types"; -import { API_BASE_URL } from "@/helpers/common.helper"; import { APIService } from "@/services/api.service"; // types diff --git a/web/core/services/module.service.ts b/web/core/services/module.service.ts index 89ecc1726a8..cf67fcf9476 100644 --- a/web/core/services/module.service.ts +++ b/web/core/services/module.service.ts @@ -1,7 +1,7 @@ // types +import { API_BASE_URL } from "@plane/constants"; import type { IModule, ILinkDetails, ModuleLink, TIssuesResponse } from "@plane/types"; // services -import { API_BASE_URL } from "@/helpers/common.helper"; import { APIService } from "@/services/api.service"; export class ModuleService extends APIService { diff --git a/web/core/services/module_archive.service.ts b/web/core/services/module_archive.service.ts index c74f4c64094..a53e85aeadb 100644 --- a/web/core/services/module_archive.service.ts +++ b/web/core/services/module_archive.service.ts @@ -1,7 +1,7 @@ // type +import { API_BASE_URL } from "@plane/constants"; import { IModule } from "@plane/types"; // helpers -import { API_BASE_URL } from "@/helpers/common.helper"; // services import { APIService } from "@/services/api.service"; diff --git a/web/core/services/page/project-page-version.service.ts b/web/core/services/page/project-page-version.service.ts index 05732e3d225..2f973f0fa10 100644 --- a/web/core/services/page/project-page-version.service.ts +++ b/web/core/services/page/project-page-version.service.ts @@ -1,7 +1,7 @@ // plane types +import { API_BASE_URL } from "@plane/constants"; import { TPageVersion } from "@plane/types"; // helpers -import { API_BASE_URL } from "@/helpers/common.helper"; // services import { APIService } from "@/services/api.service"; diff --git a/web/core/services/page/project-page.service.ts b/web/core/services/page/project-page.service.ts index cafee7621f2..5d532651228 100644 --- a/web/core/services/page/project-page.service.ts +++ b/web/core/services/page/project-page.service.ts @@ -1,7 +1,7 @@ // types +import { API_BASE_URL } from "@plane/constants"; import { TDocumentPayload, TPage } from "@plane/types"; // helpers -import { API_BASE_URL } from "@/helpers/common.helper"; // services import { APIService } from "@/services/api.service"; import { FileUploadService } from "@/services/file-upload.service"; diff --git a/web/core/services/project/project-archive.service.ts b/web/core/services/project/project-archive.service.ts index 5fdca54b627..8e0d87773da 100644 --- a/web/core/services/project/project-archive.service.ts +++ b/web/core/services/project/project-archive.service.ts @@ -1,5 +1,5 @@ // helpers -import { API_BASE_URL } from "@/helpers/common.helper"; +import { API_BASE_URL } from "@plane/constants"; // services import { APIService } from "@/services/api.service"; diff --git a/web/core/services/project/project-export.service.ts b/web/core/services/project/project-export.service.ts index c94383d157e..a1232c9532e 100644 --- a/web/core/services/project/project-export.service.ts +++ b/web/core/services/project/project-export.service.ts @@ -1,4 +1,4 @@ -import { API_BASE_URL } from "@/helpers/common.helper"; +import { API_BASE_URL } from "@plane/constants"; import { APIService } from "@/services/api.service"; // helpers diff --git a/web/core/services/project/project-member.service.ts b/web/core/services/project/project-member.service.ts index 6f07c57781d..ce5a19a579c 100644 --- a/web/core/services/project/project-member.service.ts +++ b/web/core/services/project/project-member.service.ts @@ -1,6 +1,6 @@ // types +import { API_BASE_URL } from "@plane/constants"; import type { IProjectBulkAddFormData, TProjectMembership } from "@plane/types"; -import { API_BASE_URL } from "@/helpers/common.helper"; // services import { APIService } from "@/services/api.service"; diff --git a/web/core/services/project/project-publish.service.ts b/web/core/services/project/project-publish.service.ts index 134cc4b5f15..edbe3fbb862 100644 --- a/web/core/services/project/project-publish.service.ts +++ b/web/core/services/project/project-publish.service.ts @@ -1,7 +1,7 @@ // types +import { API_BASE_URL } from "@plane/constants"; import { TProjectPublishSettings } from "@plane/types"; // helpers -import { API_BASE_URL } from "@/helpers/common.helper"; // services import { APIService } from "@/services/api.service"; diff --git a/web/core/services/project/project-state.service.ts b/web/core/services/project/project-state.service.ts index 17d3468d8ca..d74fc1391ae 100644 --- a/web/core/services/project/project-state.service.ts +++ b/web/core/services/project/project-state.service.ts @@ -1,6 +1,6 @@ // services +import { API_BASE_URL } from "@plane/constants"; import type { IState } from "@plane/types"; -import { API_BASE_URL } from "@/helpers/common.helper"; import { APIService } from "@/services/api.service"; // helpers // types diff --git a/web/core/services/project/project.service.ts b/web/core/services/project/project.service.ts index fc8ed944276..bf5a2ce2e53 100644 --- a/web/core/services/project/project.service.ts +++ b/web/core/services/project/project.service.ts @@ -1,3 +1,4 @@ +import { API_BASE_URL } from "@plane/constants"; import type { GithubRepositoriesResponse, ISearchIssueResponse, @@ -6,7 +7,6 @@ import type { TProjectIssuesSearchParams, } from "@plane/types"; // helpers -import { API_BASE_URL } from "@/helpers/common.helper"; // plane web types import { TProject, TPartialProject } from "@/plane-web/types"; // services diff --git a/web/core/services/sticky.service.ts b/web/core/services/sticky.service.ts index 7e31b311be9..1dfbc2c92ac 100644 --- a/web/core/services/sticky.service.ts +++ b/web/core/services/sticky.service.ts @@ -1,7 +1,6 @@ // helpers -import { STICKIES_PER_PAGE } from "@plane/constants"; +import { STICKIES_PER_PAGE, API_BASE_URL } from "@plane/constants"; import { TSticky } from "@plane/types"; -import { API_BASE_URL } from "@/helpers/common.helper"; // services import { APIService } from "@/services/api.service"; diff --git a/web/core/services/timezone.service.ts b/web/core/services/timezone.service.ts index d19e7e96495..4bcee3f7b9e 100644 --- a/web/core/services/timezone.service.ts +++ b/web/core/services/timezone.service.ts @@ -1,6 +1,6 @@ +import { API_BASE_URL } from "@plane/constants"; import { TTimezones } from "@plane/types"; // helpers -import { API_BASE_URL } from "@/helpers/common.helper"; // api services import { APIService } from "@/services/api.service"; diff --git a/web/core/services/user.service.ts b/web/core/services/user.service.ts index c888dfa6746..585c88b6cc0 100644 --- a/web/core/services/user.service.ts +++ b/web/core/services/user.service.ts @@ -1,4 +1,5 @@ // services +import { API_BASE_URL } from "@plane/constants"; import type { TIssue, IUser, @@ -11,7 +12,6 @@ import type { TIssuesResponse, TUserProfile, } from "@plane/types"; -import { API_BASE_URL } from "@/helpers/common.helper"; import { APIService } from "@/services/api.service"; // types // helpers diff --git a/web/core/services/webhook.service.ts b/web/core/services/webhook.service.ts index f85d4966a4a..408baac8082 100644 --- a/web/core/services/webhook.service.ts +++ b/web/core/services/webhook.service.ts @@ -1,6 +1,6 @@ // api services +import { API_BASE_URL } from "@plane/constants"; import { IWebhook } from "@plane/types"; -import { API_BASE_URL } from "@/helpers/common.helper"; import { APIService } from "@/services/api.service"; // helpers // types diff --git a/web/core/services/workspace-notification.service.ts b/web/core/services/workspace-notification.service.ts index 933b8206332..640fa99a04a 100644 --- a/web/core/services/workspace-notification.service.ts +++ b/web/core/services/workspace-notification.service.ts @@ -1,5 +1,6 @@ /* eslint-disable no-useless-catch */ +import { API_BASE_URL } from "@plane/constants"; import type { TNotificationPaginatedInfo, TNotificationPaginatedInfoQueryParams, @@ -7,7 +8,6 @@ import type { TUnreadNotificationsCount, } from "@plane/types"; // helpers -import { API_BASE_URL } from "@/helpers/common.helper"; // services import { APIService } from "@/services/api.service"; diff --git a/web/core/store/cycle.store.ts b/web/core/store/cycle.store.ts index d08d8e935d7..c23af6850f3 100644 --- a/web/core/store/cycle.store.ts +++ b/web/core/store/cycle.store.ts @@ -13,10 +13,8 @@ import { TCycleDistribution, TCycleEstimateType, } from "@plane/types"; +import { orderCycles, shouldFilterCycle, getDate, DistributionUpdates, updateDistribution } from "@plane/utils"; // helpers -import { orderCycles, shouldFilterCycle } from "@/helpers/cycle.helper"; -import { getDate } from "@/helpers/date-time.helper"; -import { DistributionUpdates, updateDistribution } from "@/helpers/distribution-update.helper"; // services import { syncIssuesWithDeletedCycles } from "@/local-db/utils/load-workspace"; import { CycleService } from "@/services/cycle.service"; diff --git a/web/core/store/inbox/inbox-issue.store.ts b/web/core/store/inbox/inbox-issue.store.ts index 8e193435e26..40421c30c47 100644 --- a/web/core/store/inbox/inbox-issue.store.ts +++ b/web/core/store/inbox/inbox-issue.store.ts @@ -1,10 +1,9 @@ import clone from "lodash/clone"; import set from "lodash/set"; import { makeObservable, observable, runInAction, action } from "mobx"; -import { TInboxIssue, TInboxIssueStatus, EInboxIssueSource } from "@plane/constants"; +import { TInboxIssue, TInboxIssueStatus, EInboxIssueSource, EInboxIssueStatus } from "@plane/constants"; import { TIssue, TInboxDuplicateIssueDetails } from "@plane/types"; // helpers -import { EInboxIssueStatus } from "@/helpers/inbox.helper"; // local db import { addIssueToPersistanceLayer } from "@/local-db/utils/utils"; // services diff --git a/web/core/store/inbox/project-inbox.store.ts b/web/core/store/inbox/project-inbox.store.ts index 996f85d0d2b..33e974e4e1f 100644 --- a/web/core/store/inbox/project-inbox.store.ts +++ b/web/core/store/inbox/project-inbox.store.ts @@ -4,16 +4,16 @@ import omit from "lodash/omit"; import set from "lodash/set"; import { action, computed, makeObservable, observable, runInAction } from "mobx"; import { computedFn } from "mobx-utils"; +import { TInboxIssue, TInboxIssueCurrentTab, EInboxIssueCurrentTab, EInboxIssueStatus, EPastDurationFilters } from "@plane/constants"; // types -import { TInboxIssue, TInboxIssueCurrentTab } from "@plane/constants"; import { TInboxIssueFilter, TInboxIssueSorting, TInboxIssuePaginationInfo, TInboxIssueSortingOrderByQueryParam, } from "@plane/types"; +import { getCustomDates} from "@plane/utils"; // helpers -import { EInboxIssueCurrentTab, EInboxIssueStatus, EPastDurationFilters, getCustomDates } from "@/helpers/inbox.helper"; // services import { InboxIssueService } from "@/services/inbox"; // root store diff --git a/web/core/store/issue/archived/filter.store.ts b/web/core/store/issue/archived/filter.store.ts index d9cbb9ab172..3c171add164 100644 --- a/web/core/store/issue/archived/filter.store.ts +++ b/web/core/store/issue/archived/filter.store.ts @@ -15,7 +15,7 @@ import { TIssueParams, IssuePaginationOptions, } from "@plane/types"; -import { handleIssueQueryParamsByLayout } from "@/helpers/issue.helper"; +import { handleIssueQueryParamsByLayout } from "@plane/utils"; import { IssueFiltersService } from "@/services/issue_filter.service"; import { IBaseIssueFilterStore, IssueFilterHelperStore } from "../helpers/issue-filter-helper.store"; // helpers diff --git a/web/core/store/issue/cycle/filter.store.ts b/web/core/store/issue/cycle/filter.store.ts index c8a0bc0fb4a..c335c5a53f9 100644 --- a/web/core/store/issue/cycle/filter.store.ts +++ b/web/core/store/issue/cycle/filter.store.ts @@ -13,7 +13,7 @@ import { TIssueParams, IssuePaginationOptions, } from "@plane/types"; -import { handleIssueQueryParamsByLayout } from "@/helpers/issue.helper"; +import { handleIssueQueryParamsByLayout } from "@plane/utils"; import { IssueFiltersService } from "@/services/issue_filter.service"; import { IBaseIssueFilterStore, IssueFilterHelperStore } from "../helpers/issue-filter-helper.store"; // helpers diff --git a/web/core/store/issue/cycle/issue.store.ts b/web/core/store/issue/cycle/issue.store.ts index 9bf2c7e16df..34917d7d114 100644 --- a/web/core/store/issue/cycle/issue.store.ts +++ b/web/core/store/issue/cycle/issue.store.ts @@ -19,7 +19,7 @@ import { TBulkOperationsPayload, } from "@plane/types"; // helpers -import { getDistributionPathsPostUpdate } from "@/helpers/distribution-update.helper"; +import { getDistributionPathsPostUpdate } from "@plane/utils"; //local import { storage } from "@/lib/local-storage"; import { persistence } from "@/local-db/storage.sqlite"; diff --git a/web/core/store/issue/draft/filter.store.ts b/web/core/store/issue/draft/filter.store.ts index 7b06262c92f..45e0855c8b3 100644 --- a/web/core/store/issue/draft/filter.store.ts +++ b/web/core/store/issue/draft/filter.store.ts @@ -15,7 +15,7 @@ import { TIssueParams, IssuePaginationOptions, } from "@plane/types"; -import { handleIssueQueryParamsByLayout } from "@/helpers/issue.helper"; +import { handleIssueQueryParamsByLayout } from "@plane/utils"; import { IssueFiltersService } from "@/services/issue_filter.service"; import { IBaseIssueFilterStore, IssueFilterHelperStore } from "../helpers/issue-filter-helper.store"; // helpers diff --git a/web/core/store/issue/helpers/base-issues-utils.ts b/web/core/store/issue/helpers/base-issues-utils.ts index dcb4e86adb4..f2f71428d20 100644 --- a/web/core/store/issue/helpers/base-issues-utils.ts +++ b/web/core/store/issue/helpers/base-issues-utils.ts @@ -5,7 +5,6 @@ import isEmpty from "lodash/isEmpty"; import orderBy from "lodash/orderBy"; import set from "lodash/set"; import uniq from "lodash/uniq"; -import { runInAction } from "mobx"; import { ALL_ISSUES, EIssueFilterType, FILTER_TO_ISSUE_MAP, ISSUE_PRIORITIES } from "@plane/constants"; import { IIssueDisplayFilterOptions, @@ -16,7 +15,7 @@ import { TIssueGroupByOptions, TIssueOrderByOptions, } from "@plane/types"; -import { checkDateCriteria, convertToISODateString, parseDateFilter } from "@/helpers/date-time.helper"; +import { checkDateCriteria, convertToISODateString, parseDateFilter } from "@plane/utils"; import { store } from "@/lib/store-context"; import { EIssueGroupedAction, ISSUE_GROUP_BY_KEY } from "./base-issues.store"; diff --git a/web/core/store/issue/helpers/base-issues.store.ts b/web/core/store/issue/helpers/base-issues.store.ts index b28ff13faad..02e22a19d50 100644 --- a/web/core/store/issue/helpers/base-issues.store.ts +++ b/web/core/store/issue/helpers/base-issues.store.ts @@ -29,11 +29,10 @@ import { TGroupedIssueCount, TPaginationData, TBulkOperationsPayload, + IBlockUpdateDependencyData, } from "@plane/types"; -// components -import { IBlockUpdateDependencyData } from "@/components/gantt-chart"; // helpers -import { convertToISODateString } from "@/helpers/date-time.helper"; +import { convertToISODateString } from "@plane/utils"; // local-db import { SPECIAL_ORDER_BY } from "@/local-db/utils/query-constructor"; import { updatePersistentLayer } from "@/local-db/utils/utils"; diff --git a/web/core/store/issue/helpers/issue-filter-helper.store.ts b/web/core/store/issue/helpers/issue-filter-helper.store.ts index c0c31d160fd..6284cfe10c3 100644 --- a/web/core/store/issue/helpers/issue-filter-helper.store.ts +++ b/web/core/store/issue/helpers/issue-filter-helper.store.ts @@ -20,7 +20,7 @@ import { TStaticViewTypes, } from "@plane/types"; // helpers -import { getComputedDisplayFilters, getComputedDisplayProperties } from "@/helpers/issue.helper"; +import { getComputedDisplayFilters, getComputedDisplayProperties } from "@plane/utils"; // lib import { storage } from "@/lib/local-storage"; diff --git a/web/core/store/issue/issue-details/comment_reaction.store.ts b/web/core/store/issue/issue-details/comment_reaction.store.ts index a8865f79856..ae679990e31 100644 --- a/web/core/store/issue/issue-details/comment_reaction.store.ts +++ b/web/core/store/issue/issue-details/comment_reaction.store.ts @@ -8,7 +8,7 @@ import { action, makeObservable, observable, runInAction } from "mobx"; // types // helpers import { TIssueCommentReaction, TIssueCommentReactionIdMap, TIssueCommentReactionMap } from "@plane/types"; -import { groupReactions } from "@/helpers/emoji.helper"; +import { groupReactions } from "@plane/utils"; import { IssueReactionService } from "@/services/issue"; import { IIssueDetail } from "./root.store"; diff --git a/web/core/store/issue/issue-details/reaction.store.ts b/web/core/store/issue/issue-details/reaction.store.ts index 5fd0e224528..f7eda21cca4 100644 --- a/web/core/store/issue/issue-details/reaction.store.ts +++ b/web/core/store/issue/issue-details/reaction.store.ts @@ -8,7 +8,7 @@ import { action, makeObservable, observable, runInAction } from "mobx"; // types // helpers import { TIssueReaction, TIssueReactionMap, TIssueReactionIdMap, TIssue, TIssueServiceType } from "@plane/types"; -import { groupReactions } from "@/helpers/emoji.helper"; +import { groupReactions } from "@plane/utils"; import { IssueReactionService } from "@/services/issue"; import { IIssueDetail } from "./root.store"; diff --git a/web/core/store/issue/issue.store.ts b/web/core/store/issue/issue.store.ts index 56e8ed22a63..871abd5d11a 100644 --- a/web/core/store/issue/issue.store.ts +++ b/web/core/store/issue/issue.store.ts @@ -6,7 +6,7 @@ import { computedFn } from "mobx-utils"; // types import { TIssue } from "@plane/types"; // helpers -import { getCurrentDateTimeInISO } from "@/helpers/date-time.helper"; +import { getCurrentDateTimeInISO } from "@plane/utils"; import { rootStore } from "@/lib/store-context"; // services import { deleteIssueFromLocal } from "@/local-db/utils/load-issues"; diff --git a/web/core/store/issue/issue_calendar_view.store.ts b/web/core/store/issue/issue_calendar_view.store.ts index 4757fb5b3b6..ad1489fba4b 100644 --- a/web/core/store/issue/issue_calendar_view.store.ts +++ b/web/core/store/issue/issue_calendar_view.store.ts @@ -2,11 +2,9 @@ import { observable, action, makeObservable, runInAction, computed } from "mobx" // helpers import { computedFn } from "mobx-utils"; -import { ICalendarPayload, ICalendarWeek } from "@/components/issues"; -import { generateCalendarData } from "@/helpers/calendar.helper"; +import { ICalendarPayload, ICalendarWeek } from "@plane/types"; +import { generateCalendarData, getWeekNumberOfDate } from "@plane/utils"; // types -import { getWeekNumberOfDate } from "@/helpers/date-time.helper"; - export interface ICalendarStore { calendarFilters: { activeMonthDate: Date; diff --git a/web/core/store/issue/issue_gantt_view.store.ts b/web/core/store/issue/issue_gantt_view.store.ts index 974c78b7297..d39b0a27361 100644 --- a/web/core/store/issue/issue_gantt_view.store.ts +++ b/web/core/store/issue/issue_gantt_view.store.ts @@ -1,7 +1,7 @@ import { action, makeObservable, observable, runInAction } from "mobx"; import { computedFn } from "mobx-utils"; // helpers -import { ChartDataType, TGanttViews } from "@/components/gantt-chart"; +import type { ChartDataType, TGanttViews } from "@plane/types"; import { currentViewDataWithView } from "@/components/gantt-chart/data"; // types diff --git a/web/core/store/issue/module/filter.store.ts b/web/core/store/issue/module/filter.store.ts index e1bd1b07005..8516af7f3dc 100644 --- a/web/core/store/issue/module/filter.store.ts +++ b/web/core/store/issue/module/filter.store.ts @@ -13,7 +13,7 @@ import { TIssueParams, IssuePaginationOptions, } from "@plane/types"; -import { handleIssueQueryParamsByLayout } from "@/helpers/issue.helper"; +import { handleIssueQueryParamsByLayout } from "@plane/utils"; import { IssueFiltersService } from "@/services/issue_filter.service"; import { IBaseIssueFilterStore, IssueFilterHelperStore } from "../helpers/issue-filter-helper.store"; // helpers diff --git a/web/core/store/issue/module/issue.store.ts b/web/core/store/issue/module/issue.store.ts index 8d9dc6be902..345fdf61f9f 100644 --- a/web/core/store/issue/module/issue.store.ts +++ b/web/core/store/issue/module/issue.store.ts @@ -9,7 +9,7 @@ import { TBulkOperationsPayload, } from "@plane/types"; // helpers -import { getDistributionPathsPostUpdate } from "@/helpers/distribution-update.helper"; +import { getDistributionPathsPostUpdate } from "@plane/utils"; import { BaseIssuesStore, IBaseIssuesStore } from "../helpers/base-issues.store"; // import { IIssueRootStore } from "../root.store"; diff --git a/web/core/store/issue/profile/filter.store.ts b/web/core/store/issue/profile/filter.store.ts index 5ba8083289f..4938c9c695b 100644 --- a/web/core/store/issue/profile/filter.store.ts +++ b/web/core/store/issue/profile/filter.store.ts @@ -13,7 +13,7 @@ import { TIssueParams, IssuePaginationOptions, } from "@plane/types"; -import { handleIssueQueryParamsByLayout } from "@/helpers/issue.helper"; +import { handleIssueQueryParamsByLayout } from "@plane/utils"; import { IssueFiltersService } from "@/services/issue_filter.service"; import { IBaseIssueFilterStore, IssueFilterHelperStore } from "../helpers/issue-filter-helper.store"; // helpers diff --git a/web/core/store/issue/project-views/filter.store.ts b/web/core/store/issue/project-views/filter.store.ts index a25a53cff30..a8ccbfa3e00 100644 --- a/web/core/store/issue/project-views/filter.store.ts +++ b/web/core/store/issue/project-views/filter.store.ts @@ -13,7 +13,7 @@ import { TIssueParams, IssuePaginationOptions, } from "@plane/types"; -import { handleIssueQueryParamsByLayout } from "@/helpers/issue.helper"; +import { handleIssueQueryParamsByLayout } from "@plane/utils"; // services import { ViewService } from "@/plane-web/services"; import { IBaseIssueFilterStore, IssueFilterHelperStore } from "../helpers/issue-filter-helper.store"; diff --git a/web/core/store/issue/project/filter.store.ts b/web/core/store/issue/project/filter.store.ts index 4d194e2f12e..31dd56612f3 100644 --- a/web/core/store/issue/project/filter.store.ts +++ b/web/core/store/issue/project/filter.store.ts @@ -13,7 +13,7 @@ import { TIssueParams, IssuePaginationOptions, } from "@plane/types"; -import { handleIssueQueryParamsByLayout } from "@/helpers/issue.helper"; +import { handleIssueQueryParamsByLayout } from "@plane/utils"; import { IssueFiltersService } from "@/services/issue_filter.service"; import { IBaseIssueFilterStore, IssueFilterHelperStore } from "../helpers/issue-filter-helper.store"; // helpers diff --git a/web/core/store/issue/workspace-draft/filter.store.ts b/web/core/store/issue/workspace-draft/filter.store.ts index 7d504596f2f..05e5ea51171 100644 --- a/web/core/store/issue/workspace-draft/filter.store.ts +++ b/web/core/store/issue/workspace-draft/filter.store.ts @@ -14,7 +14,7 @@ import { TIssueParams, IssuePaginationOptions, } from "@plane/types"; -import { handleIssueQueryParamsByLayout } from "@/helpers/issue.helper"; +import { handleIssueQueryParamsByLayout } from "@plane/utils"; import { IssueFiltersService } from "@/services/issue_filter.service"; import { IBaseIssueFilterStore, IssueFilterHelperStore } from "../helpers/issue-filter-helper.store"; // helpers diff --git a/web/core/store/issue/workspace-draft/issue.store.ts b/web/core/store/issue/workspace-draft/issue.store.ts index 6783b89b135..3aebd98b68f 100644 --- a/web/core/store/issue/workspace-draft/issue.store.ts +++ b/web/core/store/issue/workspace-draft/issue.store.ts @@ -22,7 +22,7 @@ import { } from "@plane/types"; // constants // helpers -import { getCurrentDateTimeInISO, convertToISODateString } from "@/helpers/date-time.helper"; +import { getCurrentDateTimeInISO, convertToISODateString } from "@plane/utils"; // local-db import { addIssueToPersistanceLayer } from "@/local-db/utils/utils"; // services diff --git a/web/core/store/issue/workspace/filter.store.ts b/web/core/store/issue/workspace/filter.store.ts index ffc36e65087..2a98ba03cb6 100644 --- a/web/core/store/issue/workspace/filter.store.ts +++ b/web/core/store/issue/workspace/filter.store.ts @@ -18,7 +18,7 @@ import { IssuePaginationOptions, } from "@plane/types"; // services -import { handleIssueQueryParamsByLayout } from "@/helpers/issue.helper"; +import { handleIssueQueryParamsByLayout } from "@plane/utils"; import { WorkspaceService } from "@/plane-web/services"; import { IBaseIssueFilterStore, IssueFilterHelperStore } from "../helpers/issue-filter-helper.store"; // helpers diff --git a/web/core/store/label.store.ts b/web/core/store/label.store.ts index c220593618e..688f0b974a3 100644 --- a/web/core/store/label.store.ts +++ b/web/core/store/label.store.ts @@ -5,7 +5,7 @@ import { computedFn } from "mobx-utils"; // types import { IIssueLabel, IIssueLabelTree } from "@plane/types"; // helpers -import { buildTree } from "@/helpers/array.helper"; +import { buildTree } from "@plane/utils"; // services import { syncIssuesWithDeletedLabels } from "@/local-db/utils/load-workspace"; import { IssueLabelService } from "@/services/issue"; diff --git a/web/core/store/module.store.ts b/web/core/store/module.store.ts index 5e4c0b294c5..5592835cce7 100644 --- a/web/core/store/module.store.ts +++ b/web/core/store/module.store.ts @@ -6,9 +6,8 @@ import { action, computed, observable, makeObservable, runInAction } from "mobx" import { computedFn } from "mobx-utils"; // types import { IModule, ILinkDetails, TModulePlotType } from "@plane/types"; +import { DistributionUpdates, updateDistribution, orderModules, shouldFilterModule } from "@plane/utils"; // helpers -import { DistributionUpdates, updateDistribution } from "@/helpers/distribution-update.helper"; -import { orderModules, shouldFilterModule } from "@/helpers/module.helper"; // services import { syncIssuesWithDeletedModules } from "@/local-db/utils/load-workspace"; import { ModuleService } from "@/services/module.service"; diff --git a/web/core/store/notifications/workspace-notifications.store.ts b/web/core/store/notifications/workspace-notifications.store.ts index 5e0edd81601..ef8d20bf59a 100644 --- a/web/core/store/notifications/workspace-notifications.store.ts +++ b/web/core/store/notifications/workspace-notifications.store.ts @@ -15,7 +15,7 @@ import { TUnreadNotificationsCount, } from "@plane/types"; // helpers -import { convertToEpoch } from "@/helpers/date-time.helper"; +import { convertToEpoch } from "@plane/utils"; // services import workspaceNotificationService from "@/services/workspace-notification.service"; // store diff --git a/web/core/store/pages/project-page.store.ts b/web/core/store/pages/project-page.store.ts index 070021bdcb0..4f519a583cc 100644 --- a/web/core/store/pages/project-page.store.ts +++ b/web/core/store/pages/project-page.store.ts @@ -6,7 +6,7 @@ import { computedFn } from "mobx-utils"; import { EUserPermissions, EUserProjectRoles } from "@plane/constants"; import { TPage, TPageFilters, TPageNavigationTabs } from "@plane/types"; // helpers -import { filterPagesByPageType, getPageName, orderPages, shouldFilterPage } from "@/helpers/page.helper"; +import { filterPagesByPageType, getPageName, orderPages, shouldFilterPage } from "@plane/utils"; // plane web constants // plane web store import { RootStore } from "@/plane-web/store/root.store"; diff --git a/web/core/store/project-view.store.ts b/web/core/store/project-view.store.ts index d2e911aa664..9e30308d7b8 100644 --- a/web/core/store/project-view.store.ts +++ b/web/core/store/project-view.store.ts @@ -6,7 +6,7 @@ import { EViewAccess } from "@plane/constants"; import { IProjectView, TPublishViewDetails, TPublishViewSettings, TViewFilters } from "@plane/types"; // constants // helpers -import { getValidatedViewFilters, getViewName, orderViews, shouldFilterView } from "@/helpers/project-views.helpers"; +import { getValidatedViewFilters, getViewName, orderViews, shouldFilterView } from "@plane/utils"; // services import { ViewService } from "@/plane-web/services"; // store diff --git a/web/core/store/project/project.store.ts b/web/core/store/project/project.store.ts index e460b1087eb..47b88863606 100644 --- a/web/core/store/project/project.store.ts +++ b/web/core/store/project/project.store.ts @@ -7,7 +7,7 @@ import { computedFn } from "mobx-utils"; // plane imports import { TFetchStatus, TLoader, TProjectAnalyticsCount, TProjectAnalyticsCountParams } from "@plane/types"; // helpers -import { orderProjects, shouldFilterProject } from "@/helpers/project.helper"; +import { orderProjects, shouldFilterProject } from "@plane/utils"; // services import { TProject, TPartialProject } from "@/plane-web/types/projects"; import { IssueLabelService, IssueService } from "@/services/issue"; diff --git a/web/core/store/state.store.ts b/web/core/store/state.store.ts index 2097bdc471c..8f1d324b68f 100644 --- a/web/core/store/state.store.ts +++ b/web/core/store/state.store.ts @@ -6,7 +6,7 @@ import { computedFn } from "mobx-utils"; import { STATE_GROUPS } from "@plane/constants"; import { IState } from "@plane/types"; // helpers -import { sortStates } from "@/helpers/state.helper"; +import { sortStates } from "@plane/utils"; // plane web import { syncIssuesWithDeletedStates } from "@/local-db/utils/load-workspace"; import { ProjectStateService } from "@/plane-web/services/project/project-state.service"; diff --git a/web/core/store/user/index.ts b/web/core/store/user/index.ts index 2d4b71e6457..27a8a7362fe 100644 --- a/web/core/store/user/index.ts +++ b/web/core/store/user/index.ts @@ -1,13 +1,12 @@ import cloneDeep from "lodash/cloneDeep"; import set from "lodash/set"; import { action, makeObservable, observable, runInAction, computed } from "mobx"; -// plane imports -import { EUserPermissions } from "@plane/constants"; +import { EUserPermissions, API_BASE_URL } from "@plane/constants"; +// types import { IUser } from "@plane/types"; import { TUserPermissions } from "@plane/types/src/enums"; // helpers -import { API_BASE_URL } from "@/helpers/common.helper"; -// local db +// local import { persistence } from "@/local-db/storage.sqlite"; // plane web imports import { RootStore } from "@/plane-web/store/root.store"; diff --git a/web/helpers/analytics.helper.ts b/web/helpers/analytics.helper.ts index cee4b40f352..2639a0631e1 100644 --- a/web/helpers/analytics.helper.ts +++ b/web/helpers/analytics.helper.ts @@ -4,9 +4,11 @@ import { BarDatum } from "@nivo/bar"; import { ANALYTICS_DATE_KEYS, STATE_GROUPS } from "@plane/constants"; import { IAnalyticsData, IAnalyticsParams, IAnalyticsResponse, TStateGroups } from "@plane/types"; // constants +import { addSpaceIfCamelCase, capitalizeFirstLetter, generateRandomColor } from "@plane/utils"; import { MONTHS_LIST } from "@/constants/calendar"; // helpers -import { addSpaceIfCamelCase, capitalizeFirstLetter, generateRandomColor } from "@/helpers/string.helper"; + +// ------------ DEPRECATED (REMOVE ONCE ANALYTICS V2 IS STABLE) ------------ export const convertResponseToBarGraphData = ( response: IAnalyticsData | undefined, diff --git a/web/helpers/array.helper.ts b/web/helpers/array.helper.ts deleted file mode 100644 index 028d6c0ea74..00000000000 --- a/web/helpers/array.helper.ts +++ /dev/null @@ -1,119 +0,0 @@ -import isEmpty from "lodash/isEmpty"; -import { IIssueLabel, IIssueLabelTree } from "@plane/types"; - -export const groupBy = (array: any[], key: string) => { - const innerKey = key.split("."); // split the key by dot - return array.reduce((result, currentValue) => { - const key = innerKey.reduce((obj, i) => obj?.[i], currentValue) ?? "None"; // get the value of the inner key - (result[key] = result[key] || []).push(currentValue); - return result; - }, {}); -}; - -export const orderArrayBy = (orgArray: any[], key: string, ordering: "ascending" | "descending" = "ascending") => { - if (!orgArray || !Array.isArray(orgArray) || orgArray.length === 0) return []; - - const array = [...orgArray]; - - if (key[0] === "-") { - ordering = "descending"; - key = key.slice(1); - } - - const innerKey = key.split("."); // split the key by dot - - return array.sort((a, b) => { - const keyA = innerKey.reduce((obj, i) => obj[i], a); // get the value of the inner key - const keyB = innerKey.reduce((obj, i) => obj[i], b); // get the value of the inner key - if (keyA < keyB) { - return ordering === "ascending" ? -1 : 1; - } - if (keyA > keyB) { - return ordering === "ascending" ? 1 : -1; - } - return 0; - }); -}; - -export const checkDuplicates = (array: any[]) => new Set(array).size !== array.length; - -export const findStringWithMostCharacters = (strings: string[]): string => { - if (!strings || strings.length === 0) return ""; - - return strings.reduce((longestString, currentString) => - currentString.length > longestString.length ? currentString : longestString - ); -}; - -export const checkIfArraysHaveSameElements = (arr1: any[] | null, arr2: any[] | null): boolean => { - if (!arr1 || !arr2) return false; - if (!Array.isArray(arr1) || !Array.isArray(arr2)) return false; - if (arr1.length === 0 && arr2.length === 0) return true; - - return arr1.length === arr2.length && arr1.every((e) => arr2.includes(e)); -}; - -type GroupedItems = { [key: string]: T[] }; - -export const groupByField = (array: T[], field: keyof T): GroupedItems => - array.reduce((grouped: GroupedItems, item: T) => { - const key = String(item[field]); - grouped[key] = (grouped[key] || []).concat(item); - return grouped; - }, {}); - -export const sortByField = (array: any[], field: string): any[] => - array.sort((a, b) => (a[field] < b[field] ? -1 : a[field] > b[field] ? 1 : 0)); - -export const orderGroupedDataByField = (groupedData: GroupedItems, orderBy: keyof T): GroupedItems => { - for (const key in groupedData) { - if (groupedData.hasOwnProperty(key)) { - groupedData[key] = groupedData[key].sort((a, b) => { - if (a[orderBy] < b[orderBy]) return -1; - if (a[orderBy] > b[orderBy]) return 1; - return 0; - }); - } - } - return groupedData; -}; - -export const buildTree = (array: IIssueLabel[], parent = null) => { - const tree: IIssueLabelTree[] = []; - - array.forEach((item: any) => { - if (item.parent === parent) { - const children = buildTree(array, item.id); - item.children = children; - tree.push(item); - } - }); - - return tree; -}; - -/** - * Returns Valid keys from object whose value is not falsy - * @param obj - * @returns - */ -export const getValidKeysFromObject = (obj: any) => { - if (!obj || isEmpty(obj) || typeof obj !== "object" || Array.isArray(obj)) return []; - - return Object.keys(obj).filter((key) => !!obj[key]); -}; - -/** - * Convert an array into an object of keys and boolean strue - * @param arrayStrings - * @returns - */ -export const convertStringArrayToBooleanObject = (arrayStrings: string[]) => { - const obj: { [key: string]: boolean } = {}; - - for (const arrayString of arrayStrings) { - obj[arrayString] = true; - } - - return obj; -}; diff --git a/web/helpers/attachment.helper.ts b/web/helpers/attachment.helper.ts deleted file mode 100644 index 1f9f4f5a3c3..00000000000 --- a/web/helpers/attachment.helper.ts +++ /dev/null @@ -1,32 +0,0 @@ -export const generateFileName = (fileName: string) => { - const date = new Date(); - const timestamp = date.getTime(); - - const _fileName = getFileName(fileName); - const nameWithoutExtension = _fileName.length > 80 ? _fileName.substring(0, 80) : _fileName; - const extension = getFileExtension(fileName); - - return `${nameWithoutExtension}-${timestamp}.${extension}`; -}; - -export const getFileExtension = (filename: string) => filename.slice(((filename.lastIndexOf(".") - 1) >>> 0) + 2); - -export const getFileName = (fileName: string) => { - const dotIndex = fileName.lastIndexOf("."); - - const nameWithoutExtension = fileName.substring(0, dotIndex); - - return nameWithoutExtension; -}; - -export const convertBytesToSize = (bytes: number) => { - let size; - - if (bytes < 1024 * 1024) { - size = Math.round(bytes / 1024) + " KB"; - } else { - size = Math.round(bytes / (1024 * 1024)) + " MB"; - } - - return size; -}; diff --git a/web/helpers/authentication.helper.tsx b/web/helpers/authentication.helper.tsx index 0cb2c80a76b..e8ecd592cfe 100644 --- a/web/helpers/authentication.helper.tsx +++ b/web/helpers/authentication.helper.tsx @@ -1,7 +1,7 @@ import { ReactNode } from "react"; import Link from "next/link"; -// helpers -import { SUPPORT_EMAIL } from "./common.helper"; +// plane imports +import { SUPPORT_EMAIL } from "@plane/constants"; export enum EPageTypes { PUBLIC = "PUBLIC", diff --git a/web/helpers/color.helper.ts b/web/helpers/color.helper.ts deleted file mode 100644 index 14b157a7a2d..00000000000 --- a/web/helpers/color.helper.ts +++ /dev/null @@ -1,144 +0,0 @@ -export type TRgb = { r: number; g: number; b: number }; - -export const hexToRgb = (hex: string): TRgb => { - const r = parseInt(hex.slice(1, 3), 16); - const g = parseInt(hex.slice(3, 5), 16); - const b = parseInt(hex.slice(5, 7), 16); - - return { r, g, b }; -}; - -export const rgbToHex = (rgb: TRgb): string => { - const { r, g, b } = rgb; - - const hexR = r.toString(16).padStart(2, "0"); - const hexG = g.toString(16).padStart(2, "0"); - const hexB = b.toString(16).padStart(2, "0"); - - return `#${hexR}${hexG}${hexB}`; -}; - -/** - * Calculate relative luminance of a color according to WCAG - * @param {Object} rgb - RGB color object with r, g, b properties - * @returns {number} Relative luminance value - */ -export function getLuminance({ r, g, b }: { r: number; g: number; b: number }) { - // Convert RGB to sRGB - const sR = r / 255; - const sG = g / 255; - const sB = b / 255; - - // Convert sRGB to linear RGB with gamma correction - const R = sR <= 0.03928 ? sR / 12.92 : Math.pow((sR + 0.055) / 1.055, 2.4); - const G = sG <= 0.03928 ? sG / 12.92 : Math.pow((sG + 0.055) / 1.055, 2.4); - const B = sB <= 0.03928 ? sB / 12.92 : Math.pow((sB + 0.055) / 1.055, 2.4); - - // Calculate luminance - return 0.2126 * R + 0.7152 * G + 0.0722 * B; -} - -/** - * Calculate contrast ratio between two colors - * @param {Object} rgb1 - First RGB color object - * @param {Object} rgb2 - Second RGB color object - * @returns {number} Contrast ratio between the colors - */ -export function getContrastRatio(rgb1: { r: number; g: number; b: number }, rgb2: { r: number; g: number; b: number }) { - const luminance1 = getLuminance(rgb1); - const luminance2 = getLuminance(rgb2); - - const lighter = Math.max(luminance1, luminance2); - const darker = Math.min(luminance1, luminance2); - - return (lighter + 0.05) / (darker + 0.05); -} - -/** - * Lighten a color by a specified amount - * @param {Object} rgb - RGB color object - * @param {number} amount - Amount to lighten (0-1) - * @returns {Object} Lightened RGB color - */ -export function lightenColor(rgb: { r: number; g: number; b: number }, amount: number) { - return { - r: rgb.r + (255 - rgb.r) * amount, - g: rgb.g + (255 - rgb.g) * amount, - b: rgb.b + (255 - rgb.b) * amount, - }; -} - -/** - * Darken a color by a specified amount - * @param {Object} rgb - RGB color object - * @param {number} amount - Amount to darken (0-1) - * @returns {Object} Darkened RGB color - */ -export function darkenColor(rgb: { r: number; g: number; b: number }, amount: number) { - return { - r: rgb.r * (1 - amount), - g: rgb.g * (1 - amount), - b: rgb.b * (1 - amount), - }; -} - -/** - * Generate appropriate foreground and background colors based on input color - * @param {string} color - Input color in hex format - * @returns {Object} Object containing foreground and background colors in hex format - */ -export function generateIconColors(color: string) { - // Parse input color - const rgbColor = hexToRgb(color); - const luminance = getLuminance(rgbColor); - - // Initialize output colors - let foregroundColor = rgbColor; - - // Constants for color adjustment - const MIN_CONTRAST_RATIO = 3.0; // Minimum acceptable contrast ratio - - // For light colors, use as foreground and darken for background - if (luminance > 0.5) { - // Make sure the foreground color is dark enough for visibility - let adjustedForeground = foregroundColor; - const whiteContrast = getContrastRatio(foregroundColor, { r: 255, g: 255, b: 255 }); - - if (whiteContrast < MIN_CONTRAST_RATIO) { - // Darken the foreground color until it has enough contrast - let darkenAmount = 0.1; - while (darkenAmount <= 0.9) { - adjustedForeground = darkenColor(foregroundColor, darkenAmount); - if (getContrastRatio(adjustedForeground, { r: 255, g: 255, b: 255 }) >= MIN_CONTRAST_RATIO) { - break; - } - darkenAmount += 0.1; - } - foregroundColor = adjustedForeground; - } - } - // For dark colors, use as foreground and lighten for background - else { - // Make sure the foreground color is light enough for visibility - let adjustedForeground = foregroundColor; - const blackContrast = getContrastRatio(foregroundColor, { r: 0, g: 0, b: 0 }); - - if (blackContrast < MIN_CONTRAST_RATIO) { - // Lighten the foreground color until it has enough contrast - let lightenAmount = 0.1; - while (lightenAmount <= 0.9) { - adjustedForeground = lightenColor(foregroundColor, lightenAmount); - if (getContrastRatio(adjustedForeground, { r: 0, g: 0, b: 0 }) >= MIN_CONTRAST_RATIO) { - break; - } - lightenAmount += 0.1; - } - foregroundColor = adjustedForeground; - } - } - - return { - foreground: rgbToHex({ r: foregroundColor.r, g: foregroundColor.g, b: foregroundColor.b }), - background: `rgba(${foregroundColor.r}, ${foregroundColor.g}, ${foregroundColor.b}, 0.25)`, - }; -} diff --git a/web/helpers/command-palette.ts b/web/helpers/command-palette.ts deleted file mode 100644 index 7a451832159..00000000000 --- a/web/helpers/command-palette.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "ce/helpers/command-palette"; diff --git a/web/helpers/common.helper.ts b/web/helpers/common.helper.ts deleted file mode 100644 index a17d2856307..00000000000 --- a/web/helpers/common.helper.ts +++ /dev/null @@ -1,44 +0,0 @@ -import { clsx, type ClassValue } from "clsx"; -import { twMerge } from "tailwind-merge"; - -export const API_BASE_URL = process.env.NEXT_PUBLIC_API_BASE_URL || ""; - -export const ADMIN_BASE_URL = process.env.NEXT_PUBLIC_ADMIN_BASE_URL || ""; -export const ADMIN_BASE_PATH = process.env.NEXT_PUBLIC_ADMIN_BASE_PATH || ""; - -export const SPACE_BASE_URL = process.env.NEXT_PUBLIC_SPACE_BASE_URL || ""; -export const SPACE_BASE_PATH = process.env.NEXT_PUBLIC_SPACE_BASE_PATH || ""; - -export const LIVE_BASE_URL = process.env.NEXT_PUBLIC_LIVE_BASE_URL || ""; -export const LIVE_BASE_PATH = process.env.NEXT_PUBLIC_LIVE_BASE_PATH || ""; -export const LIVE_URL = `${LIVE_BASE_URL}${LIVE_BASE_PATH}`; - -export const SUPPORT_EMAIL = process.env.NEXT_PUBLIC_SUPPORT_EMAIL || ""; - -export const GOD_MODE_URL = encodeURI(`${ADMIN_BASE_URL}${ADMIN_BASE_PATH}/`); - -export const debounce = (func: any, wait: number, immediate: boolean = false) => { - let timeout: any; - - return function executedFunction(...args: any) { - const later = () => { - timeout = null; - if (!immediate) func(...args); - }; - - const callNow = immediate && !timeout; - - clearTimeout(timeout); - - timeout = setTimeout(later, wait); - - if (callNow) func(...args); - }; -}; - -export const cn = (...inputs: ClassValue[]) => twMerge(clsx(inputs)); - -export const convertRemToPixel = (rem: number): number => rem * 0.9 * 16; - -export const getProgress = (completed: number | undefined, total: number | undefined) => - total && total > 0 ? Math.round(((completed ?? 0) / total) * 100) : 0; diff --git a/web/helpers/dashboard.helper.ts b/web/helpers/dashboard.helper.ts index 239c259e7a1..f429c415bc3 100644 --- a/web/helpers/dashboard.helper.ts +++ b/web/helpers/dashboard.helper.ts @@ -4,7 +4,9 @@ import { endOfMonth, endOfWeek, endOfYear, startOfMonth, startOfWeek, startOfYea import { DURATION_FILTER_OPTIONS, EDurationFilters } from "@plane/constants"; import { TIssuesListTypes } from "@plane/types"; // constants -import { renderFormattedDate, renderFormattedPayloadDate } from "./date-time.helper"; +import { renderFormattedDate, renderFormattedPayloadDate } from "@plane/utils"; + +// -------------------- DEPRECATED -------------------- /** * @description returns date range based on the duration filter diff --git a/web/helpers/date-time.helper.ts b/web/helpers/date-time.helper.ts deleted file mode 100644 index cff0da2c2df..00000000000 --- a/web/helpers/date-time.helper.ts +++ /dev/null @@ -1,477 +0,0 @@ -import { differenceInDays, format, formatDistanceToNow, isAfter, isEqual, isValid, parseISO } from "date-fns"; -import isNumber from "lodash/isNumber"; - -// Format Date Helpers -/** - * @returns {string | null} formatted date in the desired format or platform default format (MMM dd, yyyy) - * @description Returns date in the formatted format - * @param {Date | string} date - * @param {string} formatToken (optional) // default MMM dd, yyyy - * @example renderFormattedDate("2024-01-01", "MM-DD-YYYY") // Jan 01, 2024 - * @example renderFormattedDate("2024-01-01") // Jan 01, 2024 - */ -export const renderFormattedDate = ( - date: string | Date | undefined | null, - formatToken: string = "MMM dd, yyyy" -): string | undefined => { - // Parse the date to check if it is valid - const parsedDate = getDate(date); - // return if undefined - if (!parsedDate) return; - // Check if the parsed date is valid before formatting - if (!isValid(parsedDate)) return; // Return null for invalid dates - let formattedDate; - try { - // Format the date in the format provided or default format (MMM dd, yyyy) - formattedDate = format(parsedDate, formatToken); - } catch (e) { - // Format the date in format (MMM dd, yyyy) in case of any error - formattedDate = format(parsedDate, "MMM dd, yyyy"); - } - return formattedDate; -}; - -/** - * @returns {string} formatted date in the format of MMM dd - * @description Returns date in the formatted format - * @param {string | Date} date - * @example renderShortDateFormat("2024-01-01") // Jan 01 - */ -export const renderFormattedDateWithoutYear = (date: string | Date): string => { - // Parse the date to check if it is valid - const parsedDate = getDate(date); - // return if undefined - if (!parsedDate) return ""; - // Check if the parsed date is valid before formatting - if (!isValid(parsedDate)) return ""; // Return empty string for invalid dates - // Format the date in short format (MMM dd) - const formattedDate = format(parsedDate, "MMM dd"); - return formattedDate; -}; - -/** - * @returns {string | null} formatted date in the format of yyyy-mm-dd to be used in payload - * @description Returns date in the formatted format to be used in payload - * @param {Date | string} date - * @example renderFormattedPayloadDate("Jan 01, 20224") // "2024-01-01" - */ -export const renderFormattedPayloadDate = (date: Date | string | undefined | null): string | undefined => { - // Parse the date to check if it is valid - const parsedDate = getDate(date); - // return if undefined - if (!parsedDate) return; - // Check if the parsed date is valid before formatting - if (!isValid(parsedDate)) return; // Return null for invalid dates - // Format the date in payload format (yyyy-mm-dd) - const formattedDate = format(parsedDate, "yyyy-MM-dd"); - return formattedDate; -}; - -// Format Time Helpers -/** - * @returns {string} formatted date in the format of hh:mm a or HH:mm - * @description Returns date in 12 hour format if in12HourFormat is true else 24 hour format - * @param {string | Date} date - * @param {boolean} timeFormat (optional) // default 24 hour - * @example renderFormattedTime("2024-01-01 13:00:00") // 13:00 - * @example renderFormattedTime("2024-01-01 13:00:00", "12-hour") // 01:00 PM - */ -export const renderFormattedTime = (date: string | Date, timeFormat: "12-hour" | "24-hour" = "24-hour"): string => { - // Parse the date to check if it is valid - const parsedDate = new Date(date); - // return if undefined - if (!parsedDate) return ""; - // Check if the parsed date is valid - if (!isValid(parsedDate)) return ""; // Return empty string for invalid dates - // Format the date in 12 hour format if in12HourFormat is true - if (timeFormat === "12-hour") { - const formattedTime = format(parsedDate, "hh:mm a"); - return formattedTime; - } - // Format the date in 24 hour format - const formattedTime = format(parsedDate, "HH:mm"); - return formattedTime; -}; - -// Date Difference Helpers -/** - * @returns {number} total number of days in range - * @description Returns total number of days in range - * @param {string} startDate - * @param {string} endDate - * @param {boolean} inclusive - * @example checkIfStringIsDate("2021-01-01", "2021-01-08") // 8 - */ -export const findTotalDaysInRange = ( - startDate: Date | string | undefined | null, - endDate: Date | string | undefined | null, - inclusive: boolean = true -): number | undefined => { - // Parse the dates to check if they are valid - const parsedStartDate = getDate(startDate); - const parsedEndDate = getDate(endDate); - // return if undefined - if (!parsedStartDate || !parsedEndDate) return; - // Check if the parsed dates are valid before calculating the difference - if (!isValid(parsedStartDate) || !isValid(parsedEndDate)) return 0; // Return 0 for invalid dates - // Calculate the difference in days - const diffInDays = differenceInDays(parsedEndDate, parsedStartDate); - // Return the difference in days based on inclusive flag - return inclusive ? diffInDays + 1 : diffInDays; -}; - -/** - * Add number of days to the provided date and return a resulting new date - * @param startDate - * @param numberOfDays - * @returns - */ -export const addDaysToDate = (startDate: Date | string | undefined | null, numberOfDays: number) => { - // Parse the dates to check if they are valid - const parsedStartDate = getDate(startDate); - - // return if undefined - if (!parsedStartDate) return; - - const newDate = new Date(parsedStartDate); - newDate.setDate(newDate.getDate() + numberOfDays); - - return newDate; -}; - -/** - * @returns {number} number of days left from today - * @description Returns number of days left from today - * @param {string | Date} date - * @param {boolean} inclusive (optional) // default true - * @example findHowManyDaysLeft("2024-01-01") // 3 - */ -export const findHowManyDaysLeft = ( - date: Date | string | undefined | null, - inclusive: boolean = true -): number | undefined => { - if (!date) return undefined; - // Pass the date to findTotalDaysInRange function to find the total number of days in range from today - return findTotalDaysInRange(new Date(), date, inclusive); -}; - -// Time Difference Helpers -/** - * @returns {string} formatted date in the form of amount of time passed since the event happened - * @description Returns time passed since the event happened - * @param {string | Date} time - * @example calculateTimeAgo("2023-01-01") // 1 year ago - */ -export const calculateTimeAgo = (time: string | number | Date | null): string => { - if (!time) return ""; - // Parse the time to check if it is valid - const parsedTime = typeof time === "string" || typeof time === "number" ? parseISO(String(time)) : time; - // return if undefined - if (!parsedTime) return ""; // Return empty string for invalid dates - // Format the time in the form of amount of time passed since the event happened - const distance = formatDistanceToNow(parsedTime, { addSuffix: true }); - return distance; -}; - -export function calculateTimeAgoShort(date: string | number | Date | null): string { - if (!date) { - return ""; - } - - const parsedDate = typeof date === "string" ? parseISO(date) : new Date(date); - const now = new Date(); - const diffInSeconds = (now.getTime() - parsedDate.getTime()) / 1000; - - if (diffInSeconds < 60) { - return `${Math.floor(diffInSeconds)}s`; - } - - const diffInMinutes = diffInSeconds / 60; - if (diffInMinutes < 60) { - return `${Math.floor(diffInMinutes)}m`; - } - - const diffInHours = diffInMinutes / 60; - if (diffInHours < 24) { - return `${Math.floor(diffInHours)}h`; - } - - const diffInDays = diffInHours / 24; - if (diffInDays < 30) { - return `${Math.floor(diffInDays)}d`; - } - - const diffInMonths = diffInDays / 30; - if (diffInMonths < 12) { - return `${Math.floor(diffInMonths)}mo`; - } - - const diffInYears = diffInMonths / 12; - return `${Math.floor(diffInYears)}y`; -} - -// Date Validation Helpers -/** - * @returns {string} boolean value depending on whether the date is greater than today - * @description Returns boolean value depending on whether the date is greater than today - * @param {string} dateStr - * @example isDateGreaterThanToday("2024-01-01") // true - */ -export const isDateGreaterThanToday = (dateStr: string): boolean => { - // Return false if dateStr is not present - if (!dateStr) return false; - // Parse the date to check if it is valid - const date = parseISO(dateStr); - const today = new Date(); - // Check if the parsed date is valid - if (!isValid(date)) return false; // Return false for invalid dates - // Return true if the date is greater than today - return isAfter(date, today); -}; - -// Week Related Helpers -/** - * @returns {number} week number of date - * @description Returns week number of date - * @param {Date} date - * @example getWeekNumber(new Date("2023-09-01")) // 35 - */ -export const getWeekNumberOfDate = (date: Date): number => { - const currentDate = date; - // Adjust the starting day to Sunday (0) instead of Monday (1) - const startDate = new Date(currentDate.getFullYear(), 0, 1); - // Calculate the number of days between currentDate and startDate - const days = Math.floor((currentDate.getTime() - startDate.getTime()) / (24 * 60 * 60 * 1000)); - // Adjust the calculation for weekNumber - const weekNumber = Math.ceil((days + 1) / 7); - return weekNumber; -}; - -/** - * @returns {boolean} boolean value depending on whether the dates are equal - * @description Returns boolean value depending on whether the dates are equal - * @param date1 - * @param date2 - * @example checkIfDatesAreEqual("2024-01-01", "2024-01-01") // true - * @example checkIfDatesAreEqual("2024-01-01", "2024-01-02") // false - */ -export const checkIfDatesAreEqual = ( - date1: Date | string | null | undefined, - date2: Date | string | null | undefined -): boolean => { - const parsedDate1 = getDate(date1); - const parsedDate2 = getDate(date2); - // return if undefined - if (!parsedDate1 && !parsedDate2) return true; - if (!parsedDate1 || !parsedDate2) return false; - - return isEqual(parsedDate1, parsedDate2); -}; - -/** - * This method returns a date from string of type yyyy-mm-dd - * This method is recommended to use instead of new Date() as this does not introduce any timezone offsets - * @param date - * @returns date or undefined - */ -export const getDate = (date: string | Date | undefined | null): Date | undefined => { - try { - if (!date || date === "") return; - - if (typeof date !== "string" && !(date instanceof String)) return date; - - const [yearString, monthString, dayString] = date.substring(0, 10).split("-"); - const year = parseInt(yearString); - const month = parseInt(monthString); - const day = parseInt(dayString); - if (!isNumber(year) || !isNumber(month) || !isNumber(day)) return; - - return new Date(year, month - 1, day); - } catch (e) { - return undefined; - } -}; - -export const isInDateFormat = (date: string) => { - const datePattern = /^\d{4}-\d{2}-\d{2}$/; - return datePattern.test(date); -}; - -/** - * returns the date string in ISO format regardless of the timezone in input date string - * @param dateString - * @returns - */ -export const convertToISODateString = (dateString: string | undefined) => { - if (!dateString) return dateString; - - const date = new Date(dateString); - return date.toISOString(); -}; - -/** - * returns the date string in Epoch regardless of the timezone in input date string - * @param dateString - * @returns - */ -export const convertToEpoch = (dateString: string | undefined) => { - if (!dateString) return dateString; - - const date = new Date(dateString); - return date.getTime(); -}; - -/** - * get current Date time in UTC ISO format - * @returns - */ -export const getCurrentDateTimeInISO = () => { - const date = new Date(); - return date.toISOString(); -}; - -/** - * @description converts hours and minutes to minutes - * @param { number } hours - * @param { number } minutes - * @returns { number } minutes - * @example convertHoursMinutesToMinutes(2, 30) // Output: 150 - */ -export const convertHoursMinutesToMinutes = (hours: number, minutes: number): number => hours * 60 + minutes; - -/** - * @description converts minutes to hours and minutes - * @param { number } mins - * @returns { number, number } hours and minutes - * @example convertMinutesToHoursAndMinutes(150) // Output: { hours: 2, minutes: 30 } - */ -export const convertMinutesToHoursAndMinutes = (mins: number): { hours: number; minutes: number } => { - const hours = Math.floor(mins / 60); - const minutes = Math.floor(mins % 60); - - return { hours: hours, minutes: minutes }; -}; - -/** - * @description converts minutes to hours and minutes string - * @param { number } totalMinutes - * @returns { string } 0h 0m - * @example convertMinutesToHoursAndMinutes(150) // Output: 2h 10m - */ -export const convertMinutesToHoursMinutesString = (totalMinutes: number): string => { - const { hours, minutes } = convertMinutesToHoursAndMinutes(totalMinutes); - - return `${hours ? `${hours}h ` : ``}${minutes ? `${minutes}m ` : ``}`; -}; - -/** - * @description calculates the read time for a document using the words count - * @param {number} wordsCount - * @returns {number} total number of seconds - * @example getReadTimeFromWordsCount(400) // Output: 120 - * @example getReadTimeFromWordsCount(100) // Output: 30s - */ -export const getReadTimeFromWordsCount = (wordsCount: number): number => { - const wordsPerMinute = 200; - const minutes = wordsCount / wordsPerMinute; - return minutes * 60; -}; - -/** - * @description generates an array of dates between the start and end dates - * @param startDate - * @param endDate - * @returns - */ -export const generateDateArray = (startDate: string | Date, endDate: string | Date) => { - // Convert the start and end dates to Date objects if they aren't already - const start = new Date(startDate); - // start.setDate(start.getDate() + 1); - const end = new Date(endDate); - end.setDate(end.getDate() + 1); - - // Create an empty array to store the dates - const dateArray = []; - - // Use a while loop to generate dates between the range - while (start <= end) { - // Increment the date by 1 day (86400000 milliseconds) - start.setDate(start.getDate() + 1); - // Push the current date (converted to ISO string for consistency) - dateArray.push({ - date: new Date(start).toISOString().split("T")[0], - }); - } - - return dateArray; -}; - -/** - * Processes relative date strings like "1_weeks", "2_months" etc and returns a Date - * @param value The relative date string (e.g., "1_weeks", "2_months") - * @returns Date object representing the calculated date - */ -export const processRelativeDate = (value: string): Date => { - const [amountStr, unit] = value.split("_"); - const amount = parseInt(amountStr, 10); - if (isNaN(amount)) { - throw new Error(`Invalid relative amount: ${amountStr}`); - } - const date = new Date(); - - switch (unit) { - case "days": - date.setDate(date.getDate() + amount); - break; - case "weeks": - date.setDate(date.getDate() + amount * 7); - break; - case "months": - date.setMonth(date.getMonth() + amount); - break; - default: - throw new Error(`Unsupported time unit: ${unit}`); - } - - return date; -}; - -/** - * Parses a date filter string and returns the comparison type and date - * @param filterValue The date filter string (e.g., "1_weeks;after;fromnow" or "2024-12-01;after") - * @returns Object containing the comparison type and target date - */ -export const parseDateFilter = (filterValue: string): { type: "after" | "before"; date: Date } => { - const parts = filterValue.split(";"); - const dateStr = parts[0]; - const type = parts[1] as "after" | "before"; - - let date: Date; - if (dateStr.includes("_")) { - // Handle relative dates (e.g., "1_weeks;after;fromnow") - date = processRelativeDate(dateStr); - } else { - // Handle absolute dates (e.g., "2024-12-01;after") - date = new Date(dateStr); - } - - return { type, date }; -}; - -/** - * Checks if a date meets the filter criteria - * @param dateToCheck The date to check - * @param filterDate The filter date to compare against - * @param type The type of comparison ('after' or 'before') - * @returns boolean indicating if the date meets the criteria - */ -export const checkDateCriteria = (dateToCheck: Date | null, filterDate: Date, type: "after" | "before"): boolean => { - if (!dateToCheck) return false; - - const checkDate = new Date(dateToCheck); - const normalizedCheck = new Date(checkDate.setHours(0, 0, 0, 0)); - const normalizedFilter = new Date(filterDate.getTime()); - normalizedFilter.setHours(0, 0, 0, 0); - - return type === "after" ? normalizedCheck >= normalizedFilter : normalizedCheck <= normalizedFilter; -}; diff --git a/web/helpers/download.helper.ts b/web/helpers/download.helper.ts deleted file mode 100644 index 2709edd0169..00000000000 --- a/web/helpers/download.helper.ts +++ /dev/null @@ -1,14 +0,0 @@ -export const csvDownload = (data: Array> | { [key: string]: string }, name: string) => { - const rows = Array.isArray(data) ? [...data] : [Object.keys(data), Object.values(data)]; - - const csvContent = "data:text/csv;charset=utf-8," + rows.map((e) => e.join(",")).join("\n"); - const encodedUri = encodeURI(csvContent); - - const link = document.createElement("a"); - link.href = encodedUri; - link.download = `${name}.csv`; - - document.body.appendChild(link); - link.click(); - document.body.removeChild(link); // Cleanup after the download link is clicked -}; diff --git a/web/helpers/emoji.helper.tsx b/web/helpers/emoji.helper.tsx index 626bd5c3e09..6932f63afc3 100644 --- a/web/helpers/emoji.helper.tsx +++ b/web/helpers/emoji.helper.tsx @@ -1,11 +1,8 @@ -// plane imports -import { RANDOM_EMOJI_CODES } from "@plane/constants"; -import { LUCIDE_ICONS_LIST } from "@plane/ui"; - -export const getRandomEmoji = () => RANDOM_EMOJI_CODES[Math.floor(Math.random() * RANDOM_EMOJI_CODES.length)]; - -export const getRandomIconName = () => LUCIDE_ICONS_LIST[Math.floor(Math.random() * LUCIDE_ICONS_LIST.length)].name; - +/** + * Renders an emoji or icon + * @param {string | { name: string; color: string }} emoji - The emoji or icon to render + * @returns {React.ReactNode} The rendered emoji or icon + */ export const renderEmoji = ( emoji: | string @@ -13,7 +10,7 @@ export const renderEmoji = ( name: string; color: string; } -) => { +): React.ReactNode => { if (!emoji) return; if (typeof emoji === "object") @@ -24,54 +21,3 @@ export const renderEmoji = ( ); else return isNaN(parseInt(emoji)) ? emoji : String.fromCodePoint(parseInt(emoji)); }; - -export const groupReactions: (reactions: any[], key: string) => { [key: string]: any[] } = ( - reactions: any, - key: string -) => { - if (!Array.isArray(reactions)) { - console.error("Expected an array of reactions, but got:", reactions); - return {}; - } - - const groupedReactions = reactions.reduce( - (acc: any, reaction: any) => { - if (!reaction || typeof reaction !== "object" || !Object.prototype.hasOwnProperty.call(reaction, key)) { - console.warn("Skipping undefined reaction or missing key:", reaction); - return acc; // Skip undefined reactions or those without the specified key - } - - if (!acc[reaction[key]]) { - acc[reaction[key]] = []; - } - acc[reaction[key]].push(reaction); - return acc; - }, - {} as { [key: string]: any[] } - ); - - return groupedReactions; -}; - -export const convertHexEmojiToDecimal = (emojiUnified: string): string => { - if (!emojiUnified) return ""; - - return emojiUnified - .toString() - .split("-") - .map((e) => parseInt(e, 16)) - .join("-"); -}; - -export const emojiCodeToUnicode = (emoji: string) => { - if (!emoji) return ""; - - // convert emoji code to unicode - const uniCodeEmoji = emoji - .toString() - .split("-") - .map((emoji) => parseInt(emoji, 10).toString(16)) - .join("-"); - - return uniCodeEmoji; -}; diff --git a/web/helpers/file.helper.ts b/web/helpers/file.helper.ts deleted file mode 100644 index a64177a7ab9..00000000000 --- a/web/helpers/file.helper.ts +++ /dev/null @@ -1,96 +0,0 @@ -// types -import { TFileMetaDataLite, TFileSignedURLResponse } from "@plane/types"; -// helpers -import { API_BASE_URL } from "@/helpers/common.helper"; - -/** - * @description from the provided signed URL response, generate a payload to be used to upload the file - * @param {TFileSignedURLResponse} signedURLResponse - * @param {File} file - * @returns {FormData} file upload request payload - */ -export const generateFileUploadPayload = (signedURLResponse: TFileSignedURLResponse, file: File): FormData => { - const formData = new FormData(); - Object.entries(signedURLResponse.upload_data.fields).forEach(([key, value]) => formData.append(key, value)); - formData.append("file", file); - return formData; -}; - -/** - * @description combine the file path with the base URL - * @param {string} path - * @returns {string} final URL with the base URL - */ -export const getFileURL = (path: string): string | undefined => { - if (!path) return undefined; - const isValidURL = path.startsWith("http"); - if (isValidURL) return path; - return `${API_BASE_URL}${path}`; -}; - -/** - * @description returns the necessary file meta data to upload a file - * @param {File} file - * @returns {TFileMetaDataLite} payload with file info - */ -export const getFileMetaDataForUpload = (file: File): TFileMetaDataLite => ({ - name: file.name, - size: file.size, - type: file.type, -}); - -/** - * @description this function returns the assetId from the asset source - * @param {string} src - * @returns {string} assetId - */ -export const getAssetIdFromUrl = (src: string): string => { - // remove the last char if it is a slash - if (src.charAt(src.length - 1) === "/") src = src.slice(0, -1); - const sourcePaths = src.split("/"); - const assetUrl = sourcePaths[sourcePaths.length - 1]; - return assetUrl; -}; - -/** - * @description encode image via URL to base64 - * @param {string} url - * @returns - */ -export const getBase64Image = async (url: string): Promise => { - if (!url || typeof url !== "string") { - throw new Error("Invalid URL provided"); - } - - // Try to create a URL object to validate the URL - try { - new URL(url); - } catch (error) { - throw new Error("Invalid URL format"); - } - - const response = await fetch(url); - // check if the response is OK - if (!response.ok) { - throw new Error(`Failed to fetch image: ${response.statusText}`); - } - - const blob = await response.blob(); - return new Promise((resolve, reject) => { - const reader = new FileReader(); - - reader.onloadend = () => { - if (reader.result) { - resolve(reader.result as string); - } else { - reject(new Error("Failed to convert image to base64.")); - } - }; - - reader.onerror = () => { - reject(new Error("Failed to read the image file.")); - }; - - reader.readAsDataURL(blob); - }); -}; diff --git a/web/helpers/graph.helper.ts b/web/helpers/graph.helper.ts index 3cc79518ba4..0ca5d3ffa7a 100644 --- a/web/helpers/graph.helper.ts +++ b/web/helpers/graph.helper.ts @@ -1,3 +1,5 @@ +// ------------ DEPRECATED (Use re-charts and its helpers instead) ------------ + export const generateYAxisTickValues = (data: number[]) => { if (!data || !Array.isArray(data) || data.length === 0) return []; diff --git a/web/helpers/issue-modal.helper.ts b/web/helpers/issue-modal.helper.ts deleted file mode 100644 index 11322652e41..00000000000 --- a/web/helpers/issue-modal.helper.ts +++ /dev/null @@ -1,16 +0,0 @@ -import set from "lodash/set"; -// types -import type { TIssue } from "@plane/types"; - -export function getChangedIssuefields(formData: Partial, dirtyFields: { [key: string]: boolean | undefined }) { - const changedFields = {}; - - const dirtyFieldKeys = Object.keys(dirtyFields) as (keyof TIssue)[]; - for (const dirtyField of dirtyFieldKeys) { - if (!!dirtyFields[dirtyField]) { - set(changedFields, [dirtyField], formData[dirtyField]); - } - } - - return changedFields as Partial; -} diff --git a/web/helpers/password.helper.ts b/web/helpers/password.helper.ts deleted file mode 100644 index dfe9a5c65fb..00000000000 --- a/web/helpers/password.helper.ts +++ /dev/null @@ -1,67 +0,0 @@ -import zxcvbn from "zxcvbn"; - -export enum E_PASSWORD_STRENGTH { - EMPTY = "empty", - LENGTH_NOT_VALID = "length_not_valid", - STRENGTH_NOT_VALID = "strength_not_valid", - STRENGTH_VALID = "strength_valid", -} - -const PASSWORD_MIN_LENGTH = 8; -// const PASSWORD_NUMBER_REGEX = /\d/; -// const PASSWORD_CHAR_CAPS_REGEX = /[A-Z]/; -// const PASSWORD_SPECIAL_CHAR_REGEX = /[`!@#$%^&*()_\-+=\[\]{};':"\\|,.<>\/?~ ]/; - -export const PASSWORD_CRITERIA = [ - { - key: "min_8_char", - label: "Min 8 characters", - isCriteriaValid: (password: string) => password.length >= PASSWORD_MIN_LENGTH, - }, - // { - // key: "min_1_upper_case", - // label: "Min 1 upper-case letter", - // isCriteriaValid: (password: string) => PASSWORD_NUMBER_REGEX.test(password), - // }, - // { - // key: "min_1_number", - // label: "Min 1 number", - // isCriteriaValid: (password: string) => PASSWORD_CHAR_CAPS_REGEX.test(password), - // }, - // { - // key: "min_1_special_char", - // label: "Min 1 special character", - // isCriteriaValid: (password: string) => PASSWORD_SPECIAL_CHAR_REGEX.test(password), - // }, -]; - -export const getPasswordStrength = (password: string): E_PASSWORD_STRENGTH => { - let passwordStrength: E_PASSWORD_STRENGTH = E_PASSWORD_STRENGTH.EMPTY; - - if (!password || password === "" || password.length <= 0) { - return passwordStrength; - } - - if (password.length >= PASSWORD_MIN_LENGTH) { - passwordStrength = E_PASSWORD_STRENGTH.STRENGTH_NOT_VALID; - } else { - passwordStrength = E_PASSWORD_STRENGTH.LENGTH_NOT_VALID; - return passwordStrength; - } - - const passwordCriteriaValidation = PASSWORD_CRITERIA.map((criteria) => criteria.isCriteriaValid(password)).every( - (criterion) => criterion - ); - const passwordStrengthScore = zxcvbn(password).score; - - if (passwordCriteriaValidation === false || passwordStrengthScore <= 2) { - passwordStrength = E_PASSWORD_STRENGTH.STRENGTH_NOT_VALID; - return passwordStrength; - } - - if (passwordCriteriaValidation === true && passwordStrengthScore >= 3) { - passwordStrength = E_PASSWORD_STRENGTH.STRENGTH_VALID; - } - - return passwordStrength; -}; diff --git a/web/helpers/string.helper.ts b/web/helpers/string.helper.ts deleted file mode 100644 index d0973109171..00000000000 --- a/web/helpers/string.helper.ts +++ /dev/null @@ -1,265 +0,0 @@ -import DOMPurify from "isomorphic-dompurify"; -import { - CYCLE_ISSUES_WITH_PARAMS, - MODULE_ISSUES_WITH_PARAMS, - PROJECT_ISSUES_LIST_WITH_PARAMS, - VIEW_ISSUES, -} from "@/constants/fetch-keys"; - -export const addSpaceIfCamelCase = (str: string) => { - if (str === undefined || str === null) return ""; - - if (typeof str !== "string") str = `${str}`; - - return str.replace(/([a-z])([A-Z])/g, "$1 $2"); -}; - -export const replaceUnderscoreIfSnakeCase = (str: string) => str.replace(/_/g, " "); - -export const capitalizeFirstLetter = (str: string) => str.charAt(0).toUpperCase() + str.slice(1); - -export const truncateText = (str: string, length: number) => { - if (!str || str === "") return ""; - - return str.length > length ? `${str.substring(0, length)}...` : str; -}; - -export const createSimilarString = (str: string) => { - const shuffled = str - .split("") - .sort(() => Math.random() - 0.5) - .join(""); - - return shuffled; -}; - -const fallbackCopyTextToClipboard = (text: string) => { - const textArea = document.createElement("textarea"); - textArea.value = text; - - // Avoid scrolling to bottom - textArea.style.top = "0"; - textArea.style.left = "0"; - textArea.style.position = "fixed"; - - document.body.appendChild(textArea); - textArea.focus(); - textArea.select(); - - try { - // FIXME: Even though we are using this as a fallback, execCommand is deprecated 👎. We should find a better way to do this. - // https://developer.mozilla.org/en-US/docs/Web/API/Document/execCommand - document.execCommand("copy"); - } catch (err) { - // catch fallback error - } - - document.body.removeChild(textArea); -}; - -export const copyTextToClipboard = async (text: string) => { - if (!navigator.clipboard) { - fallbackCopyTextToClipboard(text); - return; - } - await navigator.clipboard.writeText(text); -}; - -export const generateRandomColor = (string: string): string => { - if (!string) return "rgb(var(--color-primary-100))"; - - string = `${string}`; - - const uniqueId = string.length.toString() + string; // Unique identifier based on string length - const combinedString = uniqueId + string; - - const hash = Array.from(combinedString).reduce((acc, char) => { - const charCode = char.charCodeAt(0); - return (acc << 5) - acc + charCode; - }, 0); - - const hue = hash % 360; - const saturation = 70; // Higher saturation for pastel colors - const lightness = 60; // Mid-range lightness for pastel colors - - const randomColor = `hsl(${hue}, ${saturation}%, ${lightness}%)`; - - return randomColor; -}; - -export const getFirstCharacters = (str: string) => { - const words = str.trim().split(" "); - if (words.length === 1) { - return words[0].charAt(0); - } else { - return words[0].charAt(0) + words[1].charAt(0); - } -}; - -/** - * @description: This function will remove all the HTML tags from the string - * @param {string} html - * @return {string} - * @example: - * const html = "

Some text

"; - * const text = stripHTML(html); - * console.log(text); // Some text - */ - -export const sanitizeHTML = (htmlString: string) => { - const sanitizedText = DOMPurify.sanitize(htmlString, { ALLOWED_TAGS: [] }); // sanitize the string to remove all HTML tags - return sanitizedText.trim(); // trim the string to remove leading and trailing whitespaces -}; - -/** - * - * @example: - * const html = "

Some text

"; - * const text = stripAndTruncateHTML(html); - * console.log(text); // Some text - */ - -export const stripAndTruncateHTML = (html: string, length: number = 55) => truncateText(sanitizeHTML(html), length); - -/** - * @description: This function return number count in string if number is more than 100 then it will return 99+ - * @param {number} number - * @return {string} - * @example: - * const number = 100; - * const text = getNumberCount(number); - * console.log(text); // 99+ - */ - -export const getNumberCount = (number: number): string => { - if (number > 99) { - return "99+"; - } - return number.toString(); -}; - -export const objToQueryParams = (obj: any) => { - const params = new URLSearchParams(); - - if (!obj) return params.toString(); - - for (const [key, value] of Object.entries(obj)) { - if (value !== undefined && value !== null) params.append(key, value as string); - } - - return params.toString(); -}; - -export const getFetchKeysForIssueMutation = (options: { - cycleId?: string | string[]; - moduleId?: string | string[]; - viewId?: string | string[]; - projectId: string; - viewGanttParams: any; - ganttParams: any; -}) => { - const { cycleId, moduleId, viewId, projectId, viewGanttParams, ganttParams } = options; - - const ganttFetchKey = cycleId - ? { ganttFetchKey: CYCLE_ISSUES_WITH_PARAMS(cycleId.toString(), ganttParams) } - : moduleId - ? { ganttFetchKey: MODULE_ISSUES_WITH_PARAMS(moduleId.toString(), ganttParams) } - : viewId - ? { ganttFetchKey: VIEW_ISSUES(viewId.toString(), viewGanttParams) } - : { ganttFetchKey: PROJECT_ISSUES_LIST_WITH_PARAMS(projectId?.toString() ?? "", ganttParams) }; - - return { - ...ganttFetchKey, - }; -}; - -/** - * @returns {boolean} true if searchQuery is substring of text in the same order, false otherwise - * @description Returns true if searchQuery is substring of text in the same order, false otherwise - * @param {string} text string to compare from - * @param {string} searchQuery - * @example substringMatch("hello world", "hlo") => true - * @example substringMatch("hello world", "hoe") => false - */ -export const substringMatch = (text: string, searchQuery: string): boolean => { - try { - let searchIndex = 0; - - for (let i = 0; i < text.length; i++) { - if (text[i].toLowerCase() === searchQuery[searchIndex]?.toLowerCase()) searchIndex++; - - // All characters of searchQuery found in order - if (searchIndex === searchQuery.length) return true; - } - - // Not all characters of searchQuery found in order - return false; - } catch (error) { - return false; - } -}; - -/** - * @returns {boolean} true if email is valid, false otherwise - * @description Returns true if email is valid, false otherwise - * @param {string} email string to check if it is a valid email - * @example checkEmailIsValid("hello world") => false - * @example checkEmailIsValid("example@plane.so") => true - */ -export const checkEmailValidity = (email: string): boolean => { - if (!email) return false; - - const isEmailValid = - /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test( - email - ); - - return isEmailValid; -}; - -export const isEmptyHtmlString = (htmlString: string, allowedHTMLTags: string[] = []) => { - // Remove HTML tags using regex - const cleanText = DOMPurify.sanitize(htmlString, { ALLOWED_TAGS: allowedHTMLTags }); - // Trim the string and check if it's empty - return cleanText.trim() === ""; -}; - -/** - * @description this function returns whether a comment is empty or not by checking for the following conditions- - * 1. If comment is undefined - * 2. If comment is an empty string - * 3. If comment is "

" - * @param {string | undefined} comment - * @returns {boolean} - */ -export const isCommentEmpty = (comment: string | undefined): boolean => { - // return true if comment is undefined - if (!comment) return true; - return ( - comment?.trim() === "" || - comment === "

" || - isEmptyHtmlString(comment ?? "", ["img", "mention-component", "image-component"]) - ); -}; - -/** - * @description - * This function test whether a URL is valid or not. - * - * It accepts URLs with or without the protocol. - * @param {string} url - * @returns {boolean} - * @example - * checkURLValidity("https://example.com") => true - * checkURLValidity("example.com") => true - * checkURLValidity("example") => false - */ -export const checkURLValidity = (url: string): boolean => { - if (!url) return false; - - // regex to support complex query parameters and fragments - const urlPattern = - /^(https?:\/\/)?((([a-z\d-]+\.)*[a-z\d-]+\.[a-z]{2,6})|(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}))(:\d+)?(\/[\w.-]*)*(\?[^#\s]*)?(#[\w-]*)?$/i; - - return urlPattern.test(url); -}; diff --git a/web/helpers/theme.helper.ts b/web/helpers/theme.helper.ts deleted file mode 100644 index 9b0638c1f66..00000000000 --- a/web/helpers/theme.helper.ts +++ /dev/null @@ -1,123 +0,0 @@ -import { TRgb, hexToRgb } from "@/helpers/color.helper"; - -type TShades = { - 10: TRgb; - 20: TRgb; - 30: TRgb; - 40: TRgb; - 50: TRgb; - 60: TRgb; - 70: TRgb; - 80: TRgb; - 90: TRgb; - 100: TRgb; - 200: TRgb; - 300: TRgb; - 400: TRgb; - 500: TRgb; - 600: TRgb; - 700: TRgb; - 800: TRgb; - 900: TRgb; -}; - -const calculateShades = (hexValue: string): TShades => { - const shades: Partial = {}; - const { r, g, b } = hexToRgb(hexValue); - - const convertHexToSpecificShade = (shade: number): TRgb => { - if (shade <= 100) { - const decimalValue = (100 - shade) / 100; - - const newR = Math.floor(r + (255 - r) * decimalValue); - const newG = Math.floor(g + (255 - g) * decimalValue); - const newB = Math.floor(b + (255 - b) * decimalValue); - - return { - r: newR, - g: newG, - b: newB, - }; - } else { - const decimalValue = 1 - Math.ceil((shade - 100) / 100) / 10; - - const newR = Math.ceil(r * decimalValue); - const newG = Math.ceil(g * decimalValue); - const newB = Math.ceil(b * decimalValue); - - return { - r: newR, - g: newG, - b: newB, - }; - } - }; - - for (let i = 10; i <= 900; i >= 100 ? (i += 100) : (i += 10)) - shades[i as keyof TShades] = convertHexToSpecificShade(i); - - return shades as TShades; -}; - -export const applyTheme = (palette: string, isDarkPalette: boolean) => { - if (!palette) return; - const themeElement = document?.querySelector("html"); - // palette: [bg, text, primary, sidebarBg, sidebarText] - const values: string[] = palette.split(","); - values.push(isDarkPalette ? "dark" : "light"); - - const bgShades = calculateShades(values[0]); - const textShades = calculateShades(values[1]); - const primaryShades = calculateShades(values[2]); - const sidebarBackgroundShades = calculateShades(values[3]); - const sidebarTextShades = calculateShades(values[4]); - - for (let i = 10; i <= 900; i >= 100 ? (i += 100) : (i += 10)) { - const shade = i as keyof TShades; - - const bgRgbValues = `${bgShades[shade].r}, ${bgShades[shade].g}, ${bgShades[shade].b}`; - const textRgbValues = `${textShades[shade].r}, ${textShades[shade].g}, ${textShades[shade].b}`; - const primaryRgbValues = `${primaryShades[shade].r}, ${primaryShades[shade].g}, ${primaryShades[shade].b}`; - const sidebarBackgroundRgbValues = `${sidebarBackgroundShades[shade].r}, ${sidebarBackgroundShades[shade].g}, ${sidebarBackgroundShades[shade].b}`; - const sidebarTextRgbValues = `${sidebarTextShades[shade].r}, ${sidebarTextShades[shade].g}, ${sidebarTextShades[shade].b}`; - - themeElement?.style.setProperty(`--color-background-${shade}`, bgRgbValues); - themeElement?.style.setProperty(`--color-text-${shade}`, textRgbValues); - themeElement?.style.setProperty(`--color-primary-${shade}`, primaryRgbValues); - themeElement?.style.setProperty(`--color-sidebar-background-${shade}`, sidebarBackgroundRgbValues); - themeElement?.style.setProperty(`--color-sidebar-text-${shade}`, sidebarTextRgbValues); - - if (i >= 100 && i <= 400) { - const borderShade = i === 100 ? 70 : i === 200 ? 80 : i === 300 ? 90 : 100; - - themeElement?.style.setProperty( - `--color-border-${shade}`, - `${bgShades[borderShade].r}, ${bgShades[borderShade].g}, ${bgShades[borderShade].b}` - ); - themeElement?.style.setProperty( - `--color-sidebar-border-${shade}`, - `${sidebarBackgroundShades[borderShade].r}, ${sidebarBackgroundShades[borderShade].g}, ${sidebarBackgroundShades[borderShade].b}` - ); - } - } - - themeElement?.style.setProperty("--color-scheme", values[5]); -}; - -export const unsetCustomCssVariables = () => { - for (let i = 10; i <= 900; i >= 100 ? (i += 100) : (i += 10)) { - const dom = document.querySelector("[data-theme='custom']"); - - dom?.style.removeProperty(`--color-background-${i}`); - dom?.style.removeProperty(`--color-text-${i}`); - dom?.style.removeProperty(`--color-border-${i}`); - dom?.style.removeProperty(`--color-primary-${i}`); - dom?.style.removeProperty(`--color-sidebar-background-${i}`); - dom?.style.removeProperty(`--color-sidebar-text-${i}`); - dom?.style.removeProperty(`--color-sidebar-border-${i}`); - dom?.style.removeProperty("--color-scheme"); - } -}; - -export const resolveGeneralTheme = (resolvedTheme: string | undefined) => - resolvedTheme?.includes("light") ? "light" : resolvedTheme?.includes("dark") ? "dark" : "system"; From 280338ec22666a679eda24b0e2dd2c7d523b10de Mon Sep 17 00:00:00 2001 From: Prateek Shourya Date: Fri, 6 Jun 2025 17:51:45 +0530 Subject: [PATCH 02/10] fix: build and lint errors --- .../components/authentication/auth-banner.tsx | 6 ++--- admin/core/components/login/sign-in-form.tsx | 4 +-- admin/core/lib/auth-helpers.tsx | 4 +-- packages/constants/src/auth.ts | 8 ++++++ .../{ui/src/emoji => constants/src}/icons.ts | 0 packages/constants/src/index.ts | 1 + packages/constants/src/state.ts | 1 + packages/ui/src/emoji/icons-list.tsx | 10 +++---- packages/ui/src/emoji/index.ts | 1 - packages/ui/src/emoji/logo.tsx | 8 +++--- packages/ui/src/emoji/lucide-icons-list.tsx | 14 +++++----- packages/utils/src/auth.ts | 2 ++ packages/utils/src/color.ts | 27 +++++++++++++++++++ packages/utils/src/distribution-update.ts | 4 ++- packages/utils/src/emoji.ts | 5 ++-- packages/utils/src/index.ts | 5 ++++ packages/utils/src/permission.ts | 13 --------- packages/utils/src/permission/role.ts | 12 +++++++++ .../components/account/auth-forms/email.tsx | 2 +- .../helpers/password-strength-meter.tsx | 2 +- space/core/components/common/project-logo.tsx | 2 +- .../editor/embeds/mentions/user.tsx | 2 +- .../components/editor/lite-text-editor.tsx | 2 +- .../editor/lite-text-read-only-editor.tsx | 2 +- .../editor/rich-text-read-only-editor.tsx | 2 +- space/core/components/editor/toolbar.tsx | 6 ++--- .../issue-layouts/kanban/kanban-group.tsx | 3 +-- .../issue-layouts/properties/due-date.tsx | 2 +- .../components/issues/navbar/user-avatar.tsx | 2 +- .../comment/comment-detail-card.tsx | 2 +- .../comment/comment-reactions.tsx | 3 ++- .../issues/peek-overview/issue-properties.tsx | 5 ++-- .../issues/reactions/issue-vote-reactions.tsx | 3 ++- space/helpers/editor.helper.ts | 5 ++-- .../settings/account/preferences/page.tsx | 4 ++- .../settings/account/security/page.tsx | 5 ++-- .../(settings)/settings/account/sidebar.tsx | 5 +++- web/app/layout.tsx | 2 +- .../components/preferences/theme-switcher.tsx | 4 +-- web/ce/constants/index.ts | 1 - .../account/auth-forms/password.tsx | 3 ++- .../account/password-strength-meter.tsx | 13 +++------ web/core/components/common/logo.tsx | 6 ++--- .../rich-text-read-only-editor.tsx | 2 ++ .../gantt-chart/chart/main-content.tsx | 6 +---- web/core/components/gantt-chart/index.ts | 1 - web/core/components/gantt-chart/root.tsx | 3 ++- .../issues/issue-layouts/calendar/index.ts | 1 - .../gantt-chart/modules-list-layout.tsx | 6 ++--- .../components/onboarding/profile-setup.tsx | 4 +-- .../project/sidebar/nav-item-children.tsx | 2 +- .../settings/project/sidebar/root.tsx | 7 +++-- .../components/settings/sidebar/header.tsx | 6 ++++- .../components/settings/sidebar/nav-item.tsx | 4 ++- .../components/workspace/sidebar/dropdown.tsx | 3 ++- web/ee/constants/estimates.ts | 1 - 56 files changed, 151 insertions(+), 108 deletions(-) rename packages/{ui/src/emoji => constants/src}/icons.ts (100%) delete mode 100644 packages/utils/src/permission.ts delete mode 100644 web/ee/constants/estimates.ts diff --git a/admin/core/components/authentication/auth-banner.tsx b/admin/core/components/authentication/auth-banner.tsx index 7c1e5ea292b..5d63808f138 100644 --- a/admin/core/components/authentication/auth-banner.tsx +++ b/admin/core/components/authentication/auth-banner.tsx @@ -1,11 +1,11 @@ import { FC } from "react"; import { Info, X } from "lucide-react"; // plane constants -import { TAuthErrorInfo } from "@plane/constants"; +import { TAdminAuthErrorInfo } from "@plane/constants"; type TAuthBanner = { - bannerData: TAuthErrorInfo | undefined; - handleBannerData?: (bannerData: TAuthErrorInfo | undefined) => void; + bannerData: TAdminAuthErrorInfo | undefined; + handleBannerData?: (bannerData: TAdminAuthErrorInfo | undefined) => void; }; export const AuthBanner: FC = (props) => { diff --git a/admin/core/components/login/sign-in-form.tsx b/admin/core/components/login/sign-in-form.tsx index 986e5cebea5..553ffe6c56f 100644 --- a/admin/core/components/login/sign-in-form.tsx +++ b/admin/core/components/login/sign-in-form.tsx @@ -4,7 +4,7 @@ import { FC, useEffect, useMemo, useState } from "react"; import { useSearchParams } from "next/navigation"; import { Eye, EyeOff } from "lucide-react"; // plane internal packages -import { API_BASE_URL, EAdminAuthErrorCodes, TAuthErrorInfo } from "@plane/constants"; +import { API_BASE_URL, EAdminAuthErrorCodes, TAdminAuthErrorInfo } from "@plane/constants"; import { AuthService } from "@plane/services"; import { Button, Input, Spinner } from "@plane/ui"; // components @@ -54,7 +54,7 @@ export const InstanceSignInForm: FC = (props) => { const [csrfToken, setCsrfToken] = useState(undefined); const [formData, setFormData] = useState(defaultFromData); const [isSubmitting, setIsSubmitting] = useState(false); - const [errorInfo, setErrorInfo] = useState(undefined); + const [errorInfo, setErrorInfo] = useState(undefined); const handleFormChange = (key: keyof TFormData, value: string | boolean) => setFormData((prev) => ({ ...prev, [key]: value })); diff --git a/admin/core/lib/auth-helpers.tsx b/admin/core/lib/auth-helpers.tsx index 582b56e298c..f9882b5e512 100644 --- a/admin/core/lib/auth-helpers.tsx +++ b/admin/core/lib/auth-helpers.tsx @@ -3,7 +3,7 @@ import Image from "next/image"; import Link from "next/link"; import { KeyRound, Mails } from "lucide-react"; // plane packages -import { SUPPORT_EMAIL, EAdminAuthErrorCodes, TAuthErrorInfo } from "@plane/constants"; +import { SUPPORT_EMAIL, EAdminAuthErrorCodes, TAdminAuthErrorInfo } from "@plane/constants"; import { TGetBaseAuthenticationModeProps, TInstanceAuthenticationModes } from "@plane/types"; import { resolveGeneralTheme } from "@plane/utils"; // components @@ -89,7 +89,7 @@ const errorCodeMessages: { export const authErrorHandler = ( errorCode: EAdminAuthErrorCodes, email?: string | undefined -): TAuthErrorInfo | undefined => { +): TAdminAuthErrorInfo | undefined => { const bannerAlertErrorCodes = [ EAdminAuthErrorCodes.ADMIN_ALREADY_EXIST, EAdminAuthErrorCodes.REQUIRED_ADMIN_EMAIL_PASSWORD_FIRST_NAME, diff --git a/packages/constants/src/auth.ts b/packages/constants/src/auth.ts index 390313bf710..01ed762ff6a 100644 --- a/packages/constants/src/auth.ts +++ b/packages/constants/src/auth.ts @@ -74,6 +74,7 @@ export type TAuthErrorInfo = { message: React.ReactNode; }; + export enum EAdminAuthErrorCodes { // Admin ADMIN_ALREADY_EXIST = "5150", @@ -87,6 +88,13 @@ export enum EAdminAuthErrorCodes { ADMIN_USER_DEACTIVATED = "5190", } +export type TAdminAuthErrorInfo = { + type: EErrorAlertType; + code: EAdminAuthErrorCodes; + title: string; + message: React.ReactNode; +}; + export enum EAuthErrorCodes { // Global INSTANCE_NOT_CONFIGURED = "5000", diff --git a/packages/ui/src/emoji/icons.ts b/packages/constants/src/icons.ts similarity index 100% rename from packages/ui/src/emoji/icons.ts rename to packages/constants/src/icons.ts diff --git a/packages/constants/src/index.ts b/packages/constants/src/index.ts index a9da528c327..85450ec2075 100644 --- a/packages/constants/src/index.ts +++ b/packages/constants/src/index.ts @@ -6,6 +6,7 @@ export * from "./endpoints"; export * from "./file"; export * from "./filter"; export * from "./graph"; +export * from "./icons"; export * from "./instance"; export * from "./issue"; export * from "./metadata"; diff --git a/packages/constants/src/state.ts b/packages/constants/src/state.ts index 3b6de4c8f5e..af79710232e 100644 --- a/packages/constants/src/state.ts +++ b/packages/constants/src/state.ts @@ -1,4 +1,5 @@ "use client" + export type TStateGroups = "backlog" | "unstarted" | "started" | "completed" | "cancelled"; export type TDraggableData = { diff --git a/packages/ui/src/emoji/icons-list.tsx b/packages/ui/src/emoji/icons-list.tsx index bb76074890b..bae22ffb827 100644 --- a/packages/ui/src/emoji/icons-list.tsx +++ b/packages/ui/src/emoji/icons-list.tsx @@ -1,14 +1,14 @@ +import { Search } from "lucide-react"; import React, { useEffect, useState } from "react"; // icons -import { Search } from "lucide-react"; -import { MATERIAL_ICONS_LIST } from "./icons"; +import useFontFaceObserver from "use-font-face-observer"; +import { MATERIAL_ICONS_LIST } from "@plane/constants"; +import { cn } from "../../helpers"; +import { Input } from "../form-fields"; import { InfoIcon } from "../icons"; // components -import { Input } from "../form-fields"; // hooks -import useFontFaceObserver from "use-font-face-observer"; // helpers -import { cn } from "../../helpers"; import { DEFAULT_COLORS, TIconsListProps, adjustColorForContrast } from "./emoji-icon-helper"; export const IconsList: React.FC = (props) => { diff --git a/packages/ui/src/emoji/index.ts b/packages/ui/src/emoji/index.ts index c881d88972c..c87b6cd238c 100644 --- a/packages/ui/src/emoji/index.ts +++ b/packages/ui/src/emoji/index.ts @@ -1,5 +1,4 @@ export * from "./emoji-icon-picker-new"; export * from "./emoji-icon-picker"; export * from "./emoji-icon-helper"; -export * from "./icons"; export * from "./logo"; diff --git a/packages/ui/src/emoji/logo.tsx b/packages/ui/src/emoji/logo.tsx index 74d226dfa17..0d598bac318 100644 --- a/packages/ui/src/emoji/logo.tsx +++ b/packages/ui/src/emoji/logo.tsx @@ -1,9 +1,9 @@ -import React, { FC } from "react"; import { Emoji } from "emoji-picker-react"; +import React, { FC } from "react"; import useFontFaceObserver from "use-font-face-observer"; -// icons -import { LUCIDE_ICONS_LIST } from "./icons"; -// helpers +// plane imports +import { LUCIDE_ICONS_LIST } from "@plane/constants"; +// local imports import { emojiCodeToUnicode } from "./helpers"; export type TEmojiLogoProps = { diff --git a/packages/ui/src/emoji/lucide-icons-list.tsx b/packages/ui/src/emoji/lucide-icons-list.tsx index d2fe95ecf86..d569feb267a 100644 --- a/packages/ui/src/emoji/lucide-icons-list.tsx +++ b/packages/ui/src/emoji/lucide-icons-list.tsx @@ -1,14 +1,12 @@ +import { Search } from "lucide-react"; import React, { useEffect, useState } from "react"; -// components -import { Input } from "../form-fields"; -// helpers +// plane imports +import { LUCIDE_ICONS_LIST } from "@plane/constants"; +// local imports import { cn } from "../../helpers"; -import { DEFAULT_COLORS, TIconsListProps, adjustColorForContrast } from "./emoji-icon-helper"; -// icons +import { Input } from "../form-fields"; import { InfoIcon } from "../icons"; -// constants -import { LUCIDE_ICONS_LIST } from "./icons"; -import { Search } from "lucide-react"; +import { DEFAULT_COLORS, TIconsListProps, adjustColorForContrast } from "./emoji-icon-helper"; export const LucideIconsList: React.FC = (props) => { const { defaultColor, onChange, searchDisabled = false } = props; diff --git a/packages/utils/src/auth.ts b/packages/utils/src/auth.ts index 9d857e4dff5..ddd1b339698 100644 --- a/packages/utils/src/auth.ts +++ b/packages/utils/src/auth.ts @@ -1,3 +1,5 @@ +"use client"; + import { ReactNode } from "react"; import zxcvbn from "zxcvbn"; // plane imports diff --git a/packages/utils/src/color.ts b/packages/utils/src/color.ts index 4f1194c62eb..04e4e95f242 100644 --- a/packages/utils/src/color.ts +++ b/packages/utils/src/color.ts @@ -267,3 +267,30 @@ export function generateIconColors(color: string) { background: `rgba(${foregroundColor.r}, ${foregroundColor.g}, ${foregroundColor.b}, 0.25)`, }; } + +/** + * Generate a random color based on a string + * @param {string} string - The string to generate a color from + * @returns {string} The random color in HSL format + */ +export const generateRandomColor = (string: string): string => { + if (!string) return "rgb(var(--color-primary-100))"; + + string = `${string}`; + + const uniqueId = string.length.toString() + string; // Unique identifier based on string length + const combinedString = uniqueId + string; + + const hash = Array.from(combinedString).reduce((acc, char) => { + const charCode = char.charCodeAt(0); + return (acc << 5) - acc + charCode; + }, 0); + + const hue = hash % 360; + const saturation = 70; // Higher saturation for pastel colors + const lightness = 60; // Mid-range lightness for pastel colors + + const randomColor = `hsl(${hue}, ${saturation}%, ${lightness}%)`; + + return randomColor; +}; diff --git a/packages/utils/src/distribution-update.ts b/packages/utils/src/distribution-update.ts index fe25cae4fdb..d085aabdb0e 100644 --- a/packages/utils/src/distribution-update.ts +++ b/packages/utils/src/distribution-update.ts @@ -1,3 +1,5 @@ +"use client"; + import { format } from "date-fns"; import get from "lodash/get"; import set from "lodash/set"; @@ -5,7 +7,7 @@ import set from "lodash/set"; import { STATE_GROUPS, COMPLETED_STATE_GROUPS } from "@plane/constants"; import { ICycle, IEstimatePoint, IModule, IState, TIssue } from "@plane/types"; // helper -import { getDate } from "@plane/utils"; +import { getDate } from "./datetime"; export type DistributionObjectUpdate = { id: string; diff --git a/packages/utils/src/emoji.ts b/packages/utils/src/emoji.ts index 1f83e592e72..00272f41a47 100644 --- a/packages/utils/src/emoji.ts +++ b/packages/utils/src/emoji.ts @@ -1,6 +1,7 @@ +"use client"; + // plane imports -import { RANDOM_EMOJI_CODES } from "@plane/constants"; -import { LUCIDE_ICONS_LIST } from "@plane/ui"; +import { LUCIDE_ICONS_LIST, RANDOM_EMOJI_CODES } from "@plane/constants"; /** * Converts a hyphen-separated hexadecimal emoji code to its decimal representation diff --git a/packages/utils/src/index.ts b/packages/utils/src/index.ts index 0bd45321098..1e6eb687e4e 100644 --- a/packages/utils/src/index.ts +++ b/packages/utils/src/index.ts @@ -4,22 +4,27 @@ export * from "./auth"; export * from "./calendar"; export * from "./color"; export * from "./common"; +export * from "./cycle"; export * from "./datetime"; export * from "./distribution-update"; export * from "./editor"; export * from "./emoji"; +export * from "./estimates"; export * from "./file"; export * from "./filter"; export * from "./get-icon-for-link"; export * from "./intake"; export * from "./math"; +export * from "./module"; export * from "./notification"; export * from "./page"; export * from "./permission"; export * from "./project"; export * from "./project-views"; +export * from "./router"; export * from "./string"; export * from "./subscription"; +export * from "./tab-indices"; export * from "./theme"; export * from "./work-item"; export * from "./workspace"; diff --git a/packages/utils/src/permission.ts b/packages/utils/src/permission.ts deleted file mode 100644 index 78105000594..00000000000 --- a/packages/utils/src/permission.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { EUserPermissions, EUserProjectRoles, EUserWorkspaceRoles } from "@plane/constants"; - -type TSupportedRole = EUserPermissions | EUserProjectRoles | EUserWorkspaceRoles; - -/** - * @description Returns the highest role from an array of supported roles - * @param { TSupportedRole[] } roles - * @returns { TSupportedRole | undefined } - */ -export const getHighestRole = (roles: T[]): T | undefined => { - if (!roles || roles.length === 0) return undefined; - return roles.reduce((highest, current) => (current > highest ? current : highest)); -}; diff --git a/packages/utils/src/permission/role.ts b/packages/utils/src/permission/role.ts index f741f91c8cc..5e6bf02e117 100644 --- a/packages/utils/src/permission/role.ts +++ b/packages/utils/src/permission/role.ts @@ -11,3 +11,15 @@ export const getUserRole = (role: EUserPermissions | EUserWorkspaceRoles | EUser return "ADMIN"; } }; + +type TSupportedRole = EUserPermissions | EUserProjectRoles | EUserWorkspaceRoles; + +/** + * @description Returns the highest role from an array of supported roles + * @param { TSupportedRole[] } roles + * @returns { TSupportedRole | undefined } + */ +export const getHighestRole = (roles: T[]): T | undefined => { + if (!roles || roles.length === 0) return undefined; + return roles.reduce((highest, current) => (current > highest ? current : highest)); +}; diff --git a/space/core/components/account/auth-forms/email.tsx b/space/core/components/account/auth-forms/email.tsx index f0b88407a83..23aab36d176 100644 --- a/space/core/components/account/auth-forms/email.tsx +++ b/space/core/components/account/auth-forms/email.tsx @@ -9,7 +9,7 @@ import { IEmailCheckData } from "@plane/types"; // ui import { Button, Input, Spinner } from "@plane/ui"; // helpers -import { cn } from "@/helpers/common.helper"; +import { cn } from "@plane/utils"; import { checkEmailValidity } from "@/helpers/string.helper"; type TAuthEmailForm = { diff --git a/space/core/components/account/helpers/password-strength-meter.tsx b/space/core/components/account/helpers/password-strength-meter.tsx index 342f77efb70..611067355c1 100644 --- a/space/core/components/account/helpers/password-strength-meter.tsx +++ b/space/core/components/account/helpers/password-strength-meter.tsx @@ -3,7 +3,7 @@ import { FC, useMemo } from "react"; // import { CircleCheck } from "lucide-react"; // helpers -import { cn } from "@/helpers/common.helper"; +import { cn } from "@plane/utils"; import { E_PASSWORD_STRENGTH, // PASSWORD_CRITERIA, diff --git a/space/core/components/common/project-logo.tsx b/space/core/components/common/project-logo.tsx index dfb3a4b80e2..2dfc04b3888 100644 --- a/space/core/components/common/project-logo.tsx +++ b/space/core/components/common/project-logo.tsx @@ -1,7 +1,7 @@ // types import { TLogoProps } from "@plane/types"; // helpers -import { cn } from "@/helpers/common.helper"; +import { cn } from "@plane/utils"; type Props = { className?: string; diff --git a/space/core/components/editor/embeds/mentions/user.tsx b/space/core/components/editor/embeds/mentions/user.tsx index 5a178396b83..eb3698a9820 100644 --- a/space/core/components/editor/embeds/mentions/user.tsx +++ b/space/core/components/editor/embeds/mentions/user.tsx @@ -1,6 +1,6 @@ import { observer } from "mobx-react"; // helpers -import { cn } from "@/helpers/common.helper"; +import { cn } from "@plane/utils"; // hooks import { useMember, useUser } from "@/hooks/store"; diff --git a/space/core/components/editor/lite-text-editor.tsx b/space/core/components/editor/lite-text-editor.tsx index 6c6a19641ae..5c62d14f82d 100644 --- a/space/core/components/editor/lite-text-editor.tsx +++ b/space/core/components/editor/lite-text-editor.tsx @@ -2,10 +2,10 @@ import React from "react"; // plane imports import { EditorRefApi, ILiteTextEditor, LiteTextEditorWithRef, TFileHandler } from "@plane/editor"; import { MakeOptional } from "@plane/types"; +import { cn } from "@plane/utils"; // components import { EditorMentionsRoot, IssueCommentToolbar } from "@/components/editor"; // helpers -import { cn } from "@/helpers/common.helper"; import { getEditorFileHandlers } from "@/helpers/editor.helper"; import { isCommentEmpty } from "@/helpers/string.helper"; diff --git a/space/core/components/editor/lite-text-read-only-editor.tsx b/space/core/components/editor/lite-text-read-only-editor.tsx index acb5cf14d18..45c7fb6125a 100644 --- a/space/core/components/editor/lite-text-read-only-editor.tsx +++ b/space/core/components/editor/lite-text-read-only-editor.tsx @@ -2,10 +2,10 @@ import React from "react"; // plane imports import { EditorReadOnlyRefApi, ILiteTextReadOnlyEditor, LiteTextReadOnlyEditorWithRef } from "@plane/editor"; import { MakeOptional } from "@plane/types"; +import { cn } from "@plane/utils"; // components import { EditorMentionsRoot } from "@/components/editor"; // helpers -import { cn } from "@/helpers/common.helper"; import { getReadOnlyEditorFileHandlers } from "@/helpers/editor.helper"; // store hooks import { useMember } from "@/hooks/store"; diff --git a/space/core/components/editor/rich-text-read-only-editor.tsx b/space/core/components/editor/rich-text-read-only-editor.tsx index f2d386629f3..7a39760dfe9 100644 --- a/space/core/components/editor/rich-text-read-only-editor.tsx +++ b/space/core/components/editor/rich-text-read-only-editor.tsx @@ -2,10 +2,10 @@ import React from "react"; // plane imports import { EditorReadOnlyRefApi, IRichTextReadOnlyEditor, RichTextReadOnlyEditorWithRef } from "@plane/editor"; import { MakeOptional } from "@plane/types"; +import { cn } from "@plane/utils"; // components import { EditorMentionsRoot } from "@/components/editor"; // helpers -import { cn } from "@/helpers/common.helper"; import { getReadOnlyEditorFileHandlers } from "@/helpers/editor.helper"; // store hooks import { useMember } from "@/hooks/store"; diff --git a/space/core/components/editor/toolbar.tsx b/space/core/components/editor/toolbar.tsx index 0d6931af553..e1c457c38dd 100644 --- a/space/core/components/editor/toolbar.tsx +++ b/space/core/components/editor/toolbar.tsx @@ -1,12 +1,10 @@ "use client"; import React, { useEffect, useState, useCallback } from "react"; -// editor +// plane imports import { TOOLBAR_ITEMS, ToolbarMenuItem, EditorRefApi } from "@plane/editor"; -// ui import { Button, Tooltip } from "@plane/ui"; -// helpers -import { cn } from "@/helpers/common.helper"; +import { cn } from "@plane/utils"; type Props = { executeCommand: (item: ToolbarMenuItem) => void; diff --git a/space/core/components/issues/issue-layouts/kanban/kanban-group.tsx b/space/core/components/issues/issue-layouts/kanban/kanban-group.tsx index fd00d20bac3..50e6ba7740c 100644 --- a/space/core/components/issues/issue-layouts/kanban/kanban-group.tsx +++ b/space/core/components/issues/issue-layouts/kanban/kanban-group.tsx @@ -11,8 +11,7 @@ import { TPaginationData, TLoader, } from "@plane/types"; -// helpers -import { cn } from "@/helpers/common.helper"; +import { cn } from "@plane/utils"; // hooks import { useIntersectionObserver } from "@/hooks/use-intersection-observer"; // diff --git a/space/core/components/issues/issue-layouts/properties/due-date.tsx b/space/core/components/issues/issue-layouts/properties/due-date.tsx index fd4875154b0..1ab6293a349 100644 --- a/space/core/components/issues/issue-layouts/properties/due-date.tsx +++ b/space/core/components/issues/issue-layouts/properties/due-date.tsx @@ -3,8 +3,8 @@ import { observer } from "mobx-react"; import { CalendarCheck2 } from "lucide-react"; import { Tooltip } from "@plane/ui"; +import { cn } from "@plane/utils"; // helpers -import { cn } from "@/helpers/common.helper"; import { renderFormattedDate } from "@/helpers/date-time.helper"; import { shouldHighlightIssueDueDate } from "@/helpers/issue.helper"; // hooks diff --git a/space/core/components/issues/navbar/user-avatar.tsx b/space/core/components/issues/navbar/user-avatar.tsx index 0d07064782e..d33eb2f77f2 100644 --- a/space/core/components/issues/navbar/user-avatar.tsx +++ b/space/core/components/issues/navbar/user-avatar.tsx @@ -11,8 +11,8 @@ import { Popover, Transition } from "@headlessui/react"; import { API_BASE_URL } from "@plane/constants"; import { AuthService } from "@plane/services"; import { Avatar, Button } from "@plane/ui"; +import { getFileURL } from "@plane/utils"; // helpers -import { getFileURL } from "@/helpers/file.helper"; import { queryParamGenerator } from "@/helpers/query-param-generator"; // hooks import { useUser } from "@/hooks/store"; diff --git a/space/core/components/issues/peek-overview/comment/comment-detail-card.tsx b/space/core/components/issues/peek-overview/comment/comment-detail-card.tsx index 56a71be5a5a..9adebeb2db4 100644 --- a/space/core/components/issues/peek-overview/comment/comment-detail-card.tsx +++ b/space/core/components/issues/peek-overview/comment/comment-detail-card.tsx @@ -6,12 +6,12 @@ import { Menu, Transition } from "@headlessui/react"; // plane imports import { EditorRefApi } from "@plane/editor"; import { TIssuePublicComment } from "@plane/types"; +import { getFileURL } from "@plane/utils"; // components import { LiteTextEditor, LiteTextReadOnlyEditor } from "@/components/editor"; import { CommentReactions } from "@/components/issues/peek-overview"; // helpers import { timeAgo } from "@/helpers/date-time.helper"; -import { getFileURL } from "@/helpers/file.helper"; // hooks import { useIssueDetails, usePublish, useUser } from "@/hooks/store"; import useIsInIframe from "@/hooks/use-is-in-iframe"; diff --git a/space/core/components/issues/peek-overview/comment/comment-reactions.tsx b/space/core/components/issues/peek-overview/comment/comment-reactions.tsx index e285e5a8abd..6ffb589526a 100644 --- a/space/core/components/issues/peek-overview/comment/comment-reactions.tsx +++ b/space/core/components/issues/peek-overview/comment/comment-reactions.tsx @@ -4,10 +4,11 @@ import React from "react"; import { observer } from "mobx-react"; import { usePathname, useRouter, useSearchParams } from "next/navigation"; import { Tooltip } from "@plane/ui"; +// plane imports +import { cn } from "@plane/utils"; // ui import { ReactionSelector } from "@/components/ui"; // helpers -import { cn } from "@/helpers/common.helper"; import { groupReactions, renderEmoji } from "@/helpers/emoji.helper"; import { queryParamGenerator } from "@/helpers/query-param-generator"; // hooks diff --git a/space/core/components/issues/peek-overview/issue-properties.tsx b/space/core/components/issues/peek-overview/issue-properties.tsx index 596993bc21a..f9390a19383 100644 --- a/space/core/components/issues/peek-overview/issue-properties.tsx +++ b/space/core/components/issues/peek-overview/issue-properties.tsx @@ -3,14 +3,13 @@ import { observer } from "mobx-react"; import { useParams } from "next/navigation"; import { CalendarCheck2, Signal } from "lucide-react"; +// plane imports import { useTranslation } from "@plane/i18n"; -// ui import { DoubleCircleIcon, StateGroupIcon, TOAST_TYPE, setToast } from "@plane/ui"; -import { getIssuePriorityFilters } from "@plane/utils"; +import { cn, getIssuePriorityFilters } from "@plane/utils"; // components import { Icon } from "@/components/ui"; // helpers -import { cn } from "@/helpers/common.helper"; import { renderFormattedDate } from "@/helpers/date-time.helper"; import { shouldHighlightIssueDueDate } from "@/helpers/issue.helper"; import { copyTextToClipboard, addSpaceIfCamelCase } from "@/helpers/string.helper"; diff --git a/space/core/components/issues/reactions/issue-vote-reactions.tsx b/space/core/components/issues/reactions/issue-vote-reactions.tsx index 7134c05cf99..83f93e0b743 100644 --- a/space/core/components/issues/reactions/issue-vote-reactions.tsx +++ b/space/core/components/issues/reactions/issue-vote-reactions.tsx @@ -3,9 +3,10 @@ import { useState } from "react"; import { observer } from "mobx-react"; import { usePathname, useRouter, useSearchParams } from "next/navigation"; +// plane imports import { Tooltip } from "@plane/ui"; +import { cn } from "@plane/utils"; // helpers -import { cn } from "@/helpers/common.helper"; import { queryParamGenerator } from "@/helpers/query-param-generator"; // hooks import { useIssueDetails, useUser } from "@/hooks/store"; diff --git a/space/helpers/editor.helper.ts b/space/helpers/editor.helper.ts index cde842c7251..e63ba8834c4 100644 --- a/space/helpers/editor.helper.ts +++ b/space/helpers/editor.helper.ts @@ -1,9 +1,8 @@ -// plane internal +// plane imports import { MAX_FILE_SIZE } from "@plane/constants"; import { TFileHandler, TReadOnlyFileHandler } from "@plane/editor"; import { SitesFileService } from "@plane/services"; -// helpers -import { getFileURL } from "@/helpers/file.helper"; +import { getFileURL } from "@plane/utils"; // services const sitesFileService = new SitesFileService(); diff --git a/web/app/(all)/[workspaceSlug]/(settings)/settings/account/preferences/page.tsx b/web/app/(all)/[workspaceSlug]/(settings)/settings/account/preferences/page.tsx index 81c37ae4c43..87479a2c8b1 100644 --- a/web/app/(all)/[workspaceSlug]/(settings)/settings/account/preferences/page.tsx +++ b/web/app/(all)/[workspaceSlug]/(settings)/settings/account/preferences/page.tsx @@ -6,10 +6,12 @@ import { useTranslation } from "@plane/i18n"; import { LogoSpinner } from "@/components/common"; import { PageHead } from "@/components/core"; import { PreferencesList } from "@/components/preferences/list"; -import { LanguageTimezone, ProfileSettingContentHeader } from "@/components/profile"; +import { ProfileSettingContentHeader } from "@/components/profile"; // hooks +import { LanguageTimezone } from "@/components/profile/preferences/language-timezone"; import { SettingsHeading } from "@/components/settings"; import { useUserProfile } from "@/hooks/store"; + const ProfileAppearancePage = observer(() => { const { t } = useTranslation(); // hooks diff --git a/web/app/(all)/[workspaceSlug]/(settings)/settings/account/security/page.tsx b/web/app/(all)/[workspaceSlug]/(settings)/settings/account/security/page.tsx index b9cdf9d2687..3200959c762 100644 --- a/web/app/(all)/[workspaceSlug]/(settings)/settings/account/security/page.tsx +++ b/web/app/(all)/[workspaceSlug]/(settings)/settings/account/security/page.tsx @@ -4,16 +4,17 @@ import { useState } from "react"; import { observer } from "mobx-react"; import { Controller, useForm } from "react-hook-form"; import { Eye, EyeOff } from "lucide-react"; +// plane imports +import { E_PASSWORD_STRENGTH } from "@plane/constants"; import { useTranslation } from "@plane/i18n"; -// ui import { Button, Input, TOAST_TYPE, setToast } from "@plane/ui"; +import { getPasswordStrength } from "@plane/utils"; // components import { PasswordStrengthMeter } from "@/components/account"; import { PageHead } from "@/components/core"; import { ProfileSettingContentHeader } from "@/components/profile"; // helpers import { authErrorHandler } from "@/helpers/authentication.helper"; -import { E_PASSWORD_STRENGTH, getPasswordStrength } from "@/helpers/password.helper"; // hooks import { useUser } from "@/hooks/store"; // services diff --git a/web/app/(all)/[workspaceSlug]/(settings)/settings/account/sidebar.tsx b/web/app/(all)/[workspaceSlug]/(settings)/settings/account/sidebar.tsx index 6e495daff10..addc5959645 100644 --- a/web/app/(all)/[workspaceSlug]/(settings)/settings/account/sidebar.tsx +++ b/web/app/(all)/[workspaceSlug]/(settings)/settings/account/sidebar.tsx @@ -1,6 +1,7 @@ import { observer } from "mobx-react"; import { useParams, usePathname } from "next/navigation"; import { CircleUser, Activity, Bell, CircleUserRound, KeyRound, Settings2, Blocks, Lock } from "lucide-react"; +// plane imports import { EUserPermissions, EUserPermissionsLevel, @@ -8,8 +9,10 @@ import { PROFILE_SETTINGS_CATEGORIES, PROFILE_SETTINGS_CATEGORY, } from "@plane/constants"; +import { getFileURL } from "@plane/utils"; +// components import { SettingsSidebar } from "@/components/settings"; -import { getFileURL } from "@/helpers/file.helper"; +// hooks import { useUser, useUserPermissions } from "@/hooks/store/user"; const ICONS = { diff --git a/web/app/layout.tsx b/web/app/layout.tsx index d368a70d7bd..9b810b84466 100644 --- a/web/app/layout.tsx +++ b/web/app/layout.tsx @@ -7,7 +7,7 @@ import "@/styles/globals.css"; import { SITE_DESCRIPTION, SITE_NAME } from "@plane/constants"; // helpers -import { cn } from "@/helpers/common.helper"; +import { cn } from "@plane/utils"; // local import { AppProvider } from "./provider"; diff --git a/web/ce/components/preferences/theme-switcher.tsx b/web/ce/components/preferences/theme-switcher.tsx index 6fd39723105..5de3d729b6b 100644 --- a/web/ce/components/preferences/theme-switcher.tsx +++ b/web/ce/components/preferences/theme-switcher.tsx @@ -3,16 +3,16 @@ import { useEffect, useState, useCallback } from "react"; import { observer } from "mobx-react"; import { useTheme } from "next-themes"; +// plane imports import { I_THEME_OPTION, THEME_OPTIONS } from "@plane/constants"; import { useTranslation } from "@plane/i18n"; import { IUserTheme } from "@plane/types"; import { setPromiseToast } from "@plane/ui"; - +import { applyTheme, unsetCustomCssVariables } from "@plane/utils"; // components import { CustomThemeSelector, ThemeSwitch } from "@/components/core"; // helpers import { PreferencesSection } from "@/components/preferences/section"; -import { applyTheme, unsetCustomCssVariables } from "@/helpers/theme.helper"; // hooks import { useUserProfile } from "@/hooks/store"; diff --git a/web/ce/constants/index.ts b/web/ce/constants/index.ts index 1a86ad1e242..5612b3026b7 100644 --- a/web/ce/constants/index.ts +++ b/web/ce/constants/index.ts @@ -1,5 +1,4 @@ export * from "./ai"; -export * from "./estimates"; export * from "./gantt-chart"; export * from "./project"; export * from "./sidebar-favorites"; diff --git a/web/core/components/account/auth-forms/password.tsx b/web/core/components/account/auth-forms/password.tsx index d0ae8940e0d..b3740acea08 100644 --- a/web/core/components/account/auth-forms/password.tsx +++ b/web/core/components/account/auth-forms/password.tsx @@ -5,10 +5,11 @@ import { observer } from "mobx-react"; import Link from "next/link"; // icons import { Eye, EyeOff, Info, X, XCircle } from "lucide-react"; -import { FORGOT_PASSWORD, SIGN_IN_WITH_CODE, SIGN_IN_WITH_PASSWORD, SIGN_UP_WITH_PASSWORD, API_BASE_URL, E_PASSWORD_STRENGTH, getPasswordStrength } from "@plane/constants"; // plane imports +import { FORGOT_PASSWORD, SIGN_IN_WITH_CODE, SIGN_IN_WITH_PASSWORD, SIGN_UP_WITH_PASSWORD, API_BASE_URL, E_PASSWORD_STRENGTH } from "@plane/constants"; import { useTranslation } from "@plane/i18n"; import { Button, Input, Spinner } from "@plane/ui"; +import { getPasswordStrength } from "@plane/utils"; // components import { ForgotPasswordPopover, PasswordStrengthMeter } from "@/components/account"; // constants diff --git a/web/core/components/account/password-strength-meter.tsx b/web/core/components/account/password-strength-meter.tsx index 3dc6309425a..76b03f66a72 100644 --- a/web/core/components/account/password-strength-meter.tsx +++ b/web/core/components/account/password-strength-meter.tsx @@ -1,15 +1,10 @@ "use client"; import { FC, useMemo } from "react"; +// plane imports +import { E_PASSWORD_STRENGTH } from "@plane/constants"; import { useTranslation } from "@plane/i18n"; -// import { CircleCheck } from "lucide-react"; -// helpers -import { cn } from "@plane/utils"; -import { - E_PASSWORD_STRENGTH, - // PASSWORD_CRITERIA, - getPasswordStrength, -} from "@/helpers/password.helper"; +import { cn, getPasswordStrength } from "@plane/utils"; type TPasswordStrengthMeter = { password: string; @@ -59,7 +54,7 @@ export const PasswordStrengthMeter: FC = (props) => { }; } } - }, [strength,t]); + }, [strength, t]); const isPasswordMeterVisible = isFocused ? true : strength === E_PASSWORD_STRENGTH.STRENGTH_VALID ? false : true; diff --git a/web/core/components/common/logo.tsx b/web/core/components/common/logo.tsx index 4f1a992819a..f02fd289635 100644 --- a/web/core/components/common/logo.tsx +++ b/web/core/components/common/logo.tsx @@ -6,11 +6,9 @@ import { Emoji } from "emoji-picker-react"; // should be after the imported here rather than some below helper functions as it is in the original file // eslint-disable-next-line import/order import useFontFaceObserver from "use-font-face-observer"; -// types +// plane imports +import { LUCIDE_ICONS_LIST } from "@plane/constants"; import { TLogoProps } from "@plane/types"; -// ui -import { LUCIDE_ICONS_LIST } from "@plane/ui"; -// helpers import { emojiCodeToUnicode } from "@plane/utils"; type Props = { diff --git a/web/core/components/editor/rich-text-editor/rich-text-read-only-editor.tsx b/web/core/components/editor/rich-text-editor/rich-text-read-only-editor.tsx index 75260b07fd6..7ac8a8a2226 100644 --- a/web/core/components/editor/rich-text-editor/rich-text-read-only-editor.tsx +++ b/web/core/components/editor/rich-text-editor/rich-text-read-only-editor.tsx @@ -1,3 +1,5 @@ +"use client"; + import React from "react"; // plane imports import { EditorReadOnlyRefApi, IRichTextReadOnlyEditor, RichTextReadOnlyEditorWithRef } from "@plane/editor"; diff --git a/web/core/components/gantt-chart/chart/main-content.tsx b/web/core/components/gantt-chart/chart/main-content.tsx index 30b79ec9bb1..8297bfae5c0 100644 --- a/web/core/components/gantt-chart/chart/main-content.tsx +++ b/web/core/components/gantt-chart/chart/main-content.tsx @@ -2,19 +2,15 @@ import { useEffect, useRef } from "react"; import { combine } from "@atlaskit/pragmatic-drag-and-drop/combine"; import { autoScrollForElements } from "@atlaskit/pragmatic-drag-and-drop-auto-scroll/element"; import { observer } from "mobx-react"; +import { ChartDataType, IBlockUpdateData, IBlockUpdateDependencyData, IGanttBlock, TGanttViews } from "@plane/types"; import { cn, getDate } from "@plane/utils"; // components import { MultipleSelectGroup } from "@/components/core"; import { - ChartDataType, GanttChartBlocksList, GanttChartSidebar, - IBlockUpdateData, - IBlockUpdateDependencyData, - IGanttBlock, MonthChartView, QuarterChartView, - TGanttViews, WeekChartView, } from "@/components/gantt-chart"; // helpers diff --git a/web/core/components/gantt-chart/index.ts b/web/core/components/gantt-chart/index.ts index bb2cbc99c70..2d3055c2c2a 100644 --- a/web/core/components/gantt-chart/index.ts +++ b/web/core/components/gantt-chart/index.ts @@ -3,4 +3,3 @@ export * from "./chart"; export * from "./helpers"; export * from "./root"; export * from "./sidebar"; -export * from "./types"; diff --git a/web/core/components/gantt-chart/root.tsx b/web/core/components/gantt-chart/root.tsx index a88bd390563..3e761477cf5 100644 --- a/web/core/components/gantt-chart/root.tsx +++ b/web/core/components/gantt-chart/root.tsx @@ -1,9 +1,10 @@ import { FC, useEffect } from "react"; import { observer } from "mobx-react"; // components -import type { ChartViewRoot, IBlockUpdateData, IBlockUpdateDependencyData } from "@plane/types"; +import type { IBlockUpdateData, IBlockUpdateDependencyData } from "@plane/types"; // hooks import { useTimeLineChartStore } from "@/hooks/use-timeline-chart"; +import { ChartViewRoot } from "./chart/root"; type GanttChartRootProps = { border?: boolean; diff --git a/web/core/components/issues/issue-layouts/calendar/index.ts b/web/core/components/issues/issue-layouts/calendar/index.ts index d6028f4f503..e9a722af0b9 100644 --- a/web/core/components/issues/issue-layouts/calendar/index.ts +++ b/web/core/components/issues/issue-layouts/calendar/index.ts @@ -1,7 +1,6 @@ export * from "./dropdowns"; export * from "./roots"; export * from "./calendar"; -export * from "./types.d"; export * from "./day-tile"; export * from "./header"; export * from "./issue-blocks"; diff --git a/web/core/components/modules/gantt-chart/modules-list-layout.tsx b/web/core/components/modules/gantt-chart/modules-list-layout.tsx index 29d15855799..c87f1c4d5f3 100644 --- a/web/core/components/modules/gantt-chart/modules-list-layout.tsx +++ b/web/core/components/modules/gantt-chart/modules-list-layout.tsx @@ -1,12 +1,10 @@ import { observer } from "mobx-react"; import { useParams } from "next/navigation"; // PLane -import { IModule } from "@plane/types"; +import { IBlockUpdateData, IBlockUpdateDependencyData, IModule } from "@plane/types"; // components import { GanttChartRoot, - IBlockUpdateData, - IBlockUpdateDependencyData, ModuleGanttSidebar, } from "@/components/gantt-chart"; import { ETimeLineTypeType, TimeLineTypeContext } from "@/components/gantt-chart/contexts"; @@ -19,7 +17,7 @@ export const ModulesListGanttChartView: React.FC = observer(() => { const { workspaceSlug, projectId } = useParams(); // store const { currentProjectDetails } = useProject(); - const { getFilteredModuleIds, updateModuleDetails, getModuleById } = useModule(); + const { getFilteredModuleIds, updateModuleDetails } = useModule(); const { currentProjectDisplayFilters: displayFilters } = useModuleFilter(); // derived values diff --git a/web/core/components/onboarding/profile-setup.tsx b/web/core/components/onboarding/profile-setup.tsx index b5cf202bb11..4cbb025552a 100644 --- a/web/core/components/onboarding/profile-setup.tsx +++ b/web/core/components/onboarding/profile-setup.tsx @@ -6,14 +6,14 @@ import Image from "next/image"; import { useTheme } from "next-themes"; import { Controller, useForm } from "react-hook-form"; import { Eye, EyeOff } from "lucide-react"; -import { USER_DETAILS, E_ONBOARDING_STEP_1, E_ONBOARDING_STEP_2, E_PASSWORD_STRENGTH, getPasswordStrength } from "@plane/constants"; +import { USER_DETAILS, E_ONBOARDING_STEP_1, E_ONBOARDING_STEP_2, E_PASSWORD_STRENGTH } from "@plane/constants"; // types import { useTranslation } from "@plane/i18n"; import { IUser, TUserProfile, TOnboardingSteps } from "@plane/types"; // ui import { Button, Input, Spinner, TOAST_TYPE, setToast } from "@plane/ui"; // components -import { getFileURL } from "@plane/utils"; +import { getFileURL, getPasswordStrength } from "@plane/utils"; import { PasswordStrengthMeter } from "@/components/account"; import { UserImageUploadModal } from "@/components/core"; import { OnboardingHeader, SwitchAccountDropdown } from "@/components/onboarding"; diff --git a/web/core/components/settings/project/sidebar/nav-item-children.tsx b/web/core/components/settings/project/sidebar/nav-item-children.tsx index 514394844a2..4cf4c6b9947 100644 --- a/web/core/components/settings/project/sidebar/nav-item-children.tsx +++ b/web/core/components/settings/project/sidebar/nav-item-children.tsx @@ -5,7 +5,7 @@ import { usePathname, useParams } from "next/navigation"; import { EUserPermissionsLevel } from "@plane/constants"; import { useTranslation } from "@plane/i18n"; import { Loader } from "@plane/ui"; -import { cn } from "@/helpers/common.helper"; +import { cn } from "@plane/utils"; import { useProject, useUserPermissions, useUserSettings } from "@/hooks/store"; import { PROJECT_SETTINGS_LINKS } from "@/plane-web/constants/project"; import { getProjectSettingsPageLabelI18nKey } from "@/plane-web/helpers/project-settings"; diff --git a/web/core/components/settings/project/sidebar/root.tsx b/web/core/components/settings/project/sidebar/root.tsx index a7a5b0b8d55..de3d0c4e4f6 100644 --- a/web/core/components/settings/project/sidebar/root.tsx +++ b/web/core/components/settings/project/sidebar/root.tsx @@ -1,10 +1,13 @@ import { observer } from "mobx-react"; import { useParams } from "next/navigation"; +// plane imports import { PROJECT_SETTINGS_CATEGORIES, PROJECT_SETTINGS_CATEGORY } from "@plane/constants"; +import { getUserRole } from "@plane/utils"; +// components import { Logo } from "@/components/common"; - -import { getUserRole } from "@/helpers/user.helper"; +// hooks import { useProject } from "@/hooks/store/use-project"; +// local imports import { SettingsSidebar } from "../.."; import { NavItemChildren } from "./nav-item-children"; diff --git a/web/core/components/settings/sidebar/header.tsx b/web/core/components/settings/sidebar/header.tsx index b5b17fb0df8..56fd49ffacb 100644 --- a/web/core/components/settings/sidebar/header.tsx +++ b/web/core/components/settings/sidebar/header.tsx @@ -1,7 +1,11 @@ import { observer } from "mobx-react"; +// plane imports +import { getUserRole } from "@plane/utils"; +// components import { WorkspaceLogo } from "@/components/workspace"; -import { getUserRole } from "@/helpers/user.helper"; +// hooks import { useWorkspace } from "@/hooks/store/use-workspace"; +// plane web imports import { SubscriptionPill } from "@/plane-web/components/common"; export const SettingsSidebarHeader = observer((props: { customHeader?: React.ReactNode }) => { diff --git a/web/core/components/settings/sidebar/nav-item.tsx b/web/core/components/settings/sidebar/nav-item.tsx index d06930ef57b..53ebcc97a5f 100644 --- a/web/core/components/settings/sidebar/nav-item.tsx +++ b/web/core/components/settings/sidebar/nav-item.tsx @@ -3,9 +3,11 @@ import { observer } from "mobx-react"; import Link from "next/link"; import { useParams } from "next/navigation"; import { Disclosure } from "@headlessui/react"; +// plane imports import { EUserWorkspaceRoles } from "@plane/constants"; import { useTranslation } from "@plane/i18n"; -import { cn } from "@/helpers/common.helper"; +import { cn } from "@plane/utils"; +// hooks import { useUserSettings } from "@/hooks/store"; export type TSettingItem = { diff --git a/web/core/components/workspace/sidebar/dropdown.tsx b/web/core/components/workspace/sidebar/dropdown.tsx index 03483a192b3..d1d5e524974 100644 --- a/web/core/components/workspace/sidebar/dropdown.tsx +++ b/web/core/components/workspace/sidebar/dropdown.tsx @@ -10,10 +10,11 @@ import { ChevronDown, CirclePlus, LogOut, Mails, Settings } from "lucide-react"; // ui import { Menu, Transition } from "@headlessui/react"; // plane imports +import { GOD_MODE_URL } from "@plane/constants"; import { useTranslation } from "@plane/i18n"; import { IWorkspace } from "@plane/types"; import { Avatar, Loader, TOAST_TYPE, setToast } from "@plane/ui"; -import { orderWorkspacesList, GOD_MODE_URL, cn, getFileURL } from "@plane/utils"; +import { orderWorkspacesList, cn, getFileURL } from "@plane/utils"; // helpers // hooks import { useAppTheme, useUser, useUserProfile, useWorkspace } from "@/hooks/store"; diff --git a/web/ee/constants/estimates.ts b/web/ee/constants/estimates.ts deleted file mode 100644 index 06376ef9dd9..00000000000 --- a/web/ee/constants/estimates.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "ce/constants/estimates"; From dd675c7178172fd12ec38595d7d57e2dc12b4253 Mon Sep 17 00:00:00 2001 From: Prateek Shourya Date: Fri, 6 Jun 2025 17:54:31 +0530 Subject: [PATCH 03/10] chore: update drag handle plugin --- packages/editor/src/core/plugins/drag-handle.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/editor/src/core/plugins/drag-handle.ts b/packages/editor/src/core/plugins/drag-handle.ts index aa00fa32d90..4a534bc4cd1 100644 --- a/packages/editor/src/core/plugins/drag-handle.ts +++ b/packages/editor/src/core/plugins/drag-handle.ts @@ -1,7 +1,6 @@ import { Fragment, Slice, Node, Schema } from "@tiptap/pm/model"; import { NodeSelection } from "@tiptap/pm/state"; -// @ts-expect-error __serializeForClipboard's is not exported -import { __serializeForClipboard, EditorView } from "@tiptap/pm/view"; +import { EditorView } from "@tiptap/pm/view"; // constants import { CORE_EXTENSIONS } from "@/constants/extension"; // extensions @@ -417,7 +416,7 @@ const handleNodeSelection = ( } const slice = view.state.selection.content(); - const { dom, text } = __serializeForClipboard(view, slice); + const { dom, text } = view.serializeForClipboard(slice); if (event instanceof DragEvent && event.dataTransfer) { event.dataTransfer.clearData(); From c932134cb5fe7a80efd2c49121e6421fde891354 Mon Sep 17 00:00:00 2001 From: Prateek Shourya Date: Fri, 6 Jun 2025 18:53:17 +0530 Subject: [PATCH 04/10] chore: update table cell type to fix build errors --- packages/propel/src/table/core.tsx | 168 +++++++++++------------------ packages/propel/tsconfig.json | 3 +- 2 files changed, 64 insertions(+), 107 deletions(-) diff --git a/packages/propel/src/table/core.tsx b/packages/propel/src/table/core.tsx index e6e7ad59c43..577b79b2ebd 100644 --- a/packages/propel/src/table/core.tsx +++ b/packages/propel/src/table/core.tsx @@ -1,120 +1,76 @@ -import * as React from "react" +import * as React from "react"; -import { cn } from "@plane/utils" +import { cn } from "@plane/utils"; -const Table = React.forwardRef< - HTMLTableElement, - React.HTMLAttributes ->(({ className, ...props }, ref) => ( +const Table = React.forwardRef>( + ({ className, ...props }, ref) => (
- +
-)) -Table.displayName = "Table" + ) +); +Table.displayName = "Table"; -const TableHeader = React.forwardRef< - HTMLTableSectionElement, - React.HTMLAttributes ->(({ className, ...props }, ref) => ( - -)) -TableHeader.displayName = "TableHeader" - -const TableBody = React.forwardRef< - HTMLTableSectionElement, - React.HTMLAttributes ->(({ className, ...props }, ref) => ( - >( + ({ className, ...props }, ref) => ( + -)) -TableBody.displayName = "TableBody" + ) +); +TableHeader.displayName = "TableHeader"; -const TableFooter = React.forwardRef< - HTMLTableSectionElement, - React.HTMLAttributes ->(({ className, ...props }, ref) => ( - -)) -TableFooter.displayName = "TableFooter" +const TableBody = React.forwardRef>( + ({ className, ...props }, ref) => +); +TableBody.displayName = "TableBody"; + +const TableFooter = React.forwardRef>( + ({ className, ...props }, ref) => ( + + ) +); +TableFooter.displayName = "TableFooter"; -const TableRow = React.forwardRef< - HTMLTableRowElement, - React.HTMLAttributes ->(({ className, ...props }, ref) => ( +const TableRow = React.forwardRef>( + ({ className, ...props }, ref) => ( -)) -TableRow.displayName = "TableRow" + ) +); +TableRow.displayName = "TableRow"; -const TableHead = React.forwardRef< - HTMLTableHeaderCellElement, - React.ThHTMLAttributes ->(({ className, ...props }, ref) => ( -
[role=checkbox]]:translate-y-[2px]", - className - )} - {...props} - /> -)) -TableHead.displayName = "TableHead" +const TableHead = React.forwardRef>(({ className, ...props }, ref) => ( + [role=checkbox]]:translate-y-[2px]", + className + )} + {...props} + /> +)); +TableHead.displayName = "TableHead"; -const TableCell = React.forwardRef< - HTMLTableDataCellElement, - React.TdHTMLAttributes ->(({ className, ...props }, ref) => ( - [role=checkbox]]:translate-y-[2px]", - className - )} - {...props} - /> -)) -TableCell.displayName = "TableCell" +const TableCell = React.forwardRef>(({ className, ...props }, ref) => ( + [role=checkbox]]:translate-y-[2px]", className)} + {...props} + /> +)); +TableCell.displayName = "TableCell"; -const TableCaption = React.forwardRef< - HTMLTableDataCellElement, - React.HTMLAttributes ->(({ className, ...props }, ref) => ( -
-)) -TableCaption.displayName = "TableCaption" +const TableCaption = React.forwardRef>( + ({ className, ...props }, ref) => ( + + ) +); +TableCaption.displayName = "TableCaption"; -export { - Table, - TableHeader, - TableBody, - TableFooter, - TableHead, - TableRow, - TableCell, - TableCaption, -} \ No newline at end of file +export { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption }; diff --git a/packages/propel/tsconfig.json b/packages/propel/tsconfig.json index 1f695a242b3..f811f5e05f9 100644 --- a/packages/propel/tsconfig.json +++ b/packages/propel/tsconfig.json @@ -1,7 +1,8 @@ { "extends": "@plane/typescript-config/react-library.json", "compilerOptions": { - "outDir": "dist" + "jsx": "react", + "lib": ["esnext", "dom"] }, "include": ["src"], "exclude": ["node_modules", "dist"] From 8c8928a7f1b579ce380756822056784d2952dc99 Mon Sep 17 00:00:00 2001 From: Prateek Shourya Date: Fri, 6 Jun 2025 19:21:32 +0530 Subject: [PATCH 05/10] fix: build errors --- packages/constants/src/endpoints.ts | 16 +++++++--------- space/core/lib/toast-provider.tsx | 7 +++---- web/core/components/analytics/total-insights.tsx | 8 ++++---- .../quick-action-dropdowns/helper.tsx | 4 +--- 4 files changed, 15 insertions(+), 20 deletions(-) diff --git a/packages/constants/src/endpoints.ts b/packages/constants/src/endpoints.ts index f7f79a6c1fb..3f7a4eeeebb 100644 --- a/packages/constants/src/endpoints.ts +++ b/packages/constants/src/endpoints.ts @@ -1,28 +1,26 @@ export const API_BASE_URL = process.env.NEXT_PUBLIC_API_BASE_URL || ""; export const API_BASE_PATH = process.env.NEXT_PUBLIC_API_BASE_PATH || ""; -export const API_URL = encodeURI(`${API_BASE_URL}${API_BASE_PATH}/`); +export const API_URL = encodeURI(`${API_BASE_URL}${API_BASE_PATH}`); // God Mode Admin App Base Url export const ADMIN_BASE_URL = process.env.NEXT_PUBLIC_ADMIN_BASE_URL || ""; export const ADMIN_BASE_PATH = process.env.NEXT_PUBLIC_ADMIN_BASE_PATH || ""; -export const GOD_MODE_URL = encodeURI(`${ADMIN_BASE_URL}${ADMIN_BASE_PATH}/`); +export const GOD_MODE_URL = encodeURI(`${ADMIN_BASE_URL}${ADMIN_BASE_PATH}`); // Publish App Base Url export const SPACE_BASE_URL = process.env.NEXT_PUBLIC_SPACE_BASE_URL || ""; export const SPACE_BASE_PATH = process.env.NEXT_PUBLIC_SPACE_BASE_PATH || ""; -export const SITES_URL = encodeURI(`${SPACE_BASE_URL}${SPACE_BASE_PATH}/`); +export const SITES_URL = encodeURI(`${SPACE_BASE_URL}${SPACE_BASE_PATH}`); // Live App Base Url export const LIVE_BASE_URL = process.env.NEXT_PUBLIC_LIVE_BASE_URL || ""; export const LIVE_BASE_PATH = process.env.NEXT_PUBLIC_LIVE_BASE_PATH || ""; -export const LIVE_URL = encodeURI(`${LIVE_BASE_URL}${LIVE_BASE_PATH}/`); +export const LIVE_URL = encodeURI(`${LIVE_BASE_URL}${LIVE_BASE_PATH}`); // Web App Base Url export const WEB_BASE_URL = process.env.NEXT_PUBLIC_WEB_BASE_URL || ""; export const WEB_BASE_PATH = process.env.NEXT_PUBLIC_WEB_BASE_PATH || ""; -export const WEB_URL = encodeURI(`${WEB_BASE_URL}${WEB_BASE_PATH}/`); +export const WEB_URL = encodeURI(`${WEB_BASE_URL}${WEB_BASE_PATH}`); // plane website url -export const WEBSITE_URL = - process.env.NEXT_PUBLIC_WEBSITE_URL || "https://plane.so"; +export const WEBSITE_URL = process.env.NEXT_PUBLIC_WEBSITE_URL || "https://plane.so"; // support email -export const SUPPORT_EMAIL = - process.env.NEXT_PUBLIC_SUPPORT_EMAIL || "support@plane.so"; +export const SUPPORT_EMAIL = process.env.NEXT_PUBLIC_SUPPORT_EMAIL || "support@plane.so"; // marketing links export const MARKETING_PRICING_PAGE_LINK = "https://plane.so/pricing"; export const MARKETING_CONTACT_US_PAGE_LINK = "https://plane.so/contact"; diff --git a/space/core/lib/toast-provider.tsx b/space/core/lib/toast-provider.tsx index 1083cb6af67..20a37c3e921 100644 --- a/space/core/lib/toast-provider.tsx +++ b/space/core/lib/toast-provider.tsx @@ -1,11 +1,10 @@ "use client"; import { ReactNode } from "react"; -import { useTheme } from "next-themes" -// ui +import { useTheme } from "next-themes"; +// plane imports import { Toast } from "@plane/ui"; -// helpers -import { resolveGeneralTheme } from "@/helpers/common.helper"; +import { resolveGeneralTheme } from "@plane/utils"; export const ToastProvider = ({ children }: { children: ReactNode }) => { // themes diff --git a/web/core/components/analytics/total-insights.tsx b/web/core/components/analytics/total-insights.tsx index 61f3e7205b3..7f2a3bc3669 100644 --- a/web/core/components/analytics/total-insights.tsx +++ b/web/core/components/analytics/total-insights.tsx @@ -5,12 +5,12 @@ import useSWR from "swr"; import { IInsightField, insightsFields } from "@plane/constants"; import { useTranslation } from "@plane/i18n"; import { IAnalyticsResponse, TAnalyticsTabsBase } from "@plane/types"; -//hooks -import { cn } from "@/helpers/common.helper"; +import { cn } from "@plane/utils"; +// hooks import { useAnalytics } from "@/hooks/store/use-analytics"; -//services +// services import { AnalyticsService } from "@/services/analytics.service"; -// plane web components +// local imports import InsightCard from "./insight-card"; const analyticsService = new AnalyticsService(); diff --git a/web/core/components/issues/issue-layouts/quick-action-dropdowns/helper.tsx b/web/core/components/issues/issue-layouts/quick-action-dropdowns/helper.tsx index 790beff463f..3ebcc7e70fd 100644 --- a/web/core/components/issues/issue-layouts/quick-action-dropdowns/helper.tsx +++ b/web/core/components/issues/issue-layouts/quick-action-dropdowns/helper.tsx @@ -5,9 +5,7 @@ import { EIssuesStoreType } from "@plane/constants"; import { useTranslation } from "@plane/i18n"; import { TIssue } from "@plane/types"; import { ArchiveIcon, TContextMenuItem, TOAST_TYPE, setToast } from "@plane/ui"; -import { copyUrlToClipboard } from "@plane/utils"; -// helpers -import { generateWorkItemLink } from "@/helpers/issue.helper"; +import { copyUrlToClipboard, generateWorkItemLink } from "@plane/utils"; // types import { createCopyMenuWithDuplication } from "@/plane-web/components/issues/issue-layouts/quick-action-dropdowns"; From 1c5df523eb74298c16452e6db7187396b1825e7b Mon Sep 17 00:00:00 2001 From: Prateek Shourya Date: Fri, 6 Jun 2025 20:23:32 +0530 Subject: [PATCH 06/10] chore: sync few changes --- packages/editor/src/core/helpers/parser.ts | 92 +++++++++++++++++++ packages/editor/src/core/helpers/yjs-utils.ts | 48 ++++++++++ packages/services/src/file/file.service.ts | 24 +++++ packages/types/src/enums.ts | 12 ++- packages/utils/src/color.ts | 33 ++++--- packages/utils/src/datetime.ts | 6 +- .../components/pages/editor/editor-body.tsx | 4 +- 7 files changed, 198 insertions(+), 21 deletions(-) create mode 100644 packages/editor/src/core/helpers/parser.ts diff --git a/packages/editor/src/core/helpers/parser.ts b/packages/editor/src/core/helpers/parser.ts new file mode 100644 index 00000000000..3d17d0653ba --- /dev/null +++ b/packages/editor/src/core/helpers/parser.ts @@ -0,0 +1,92 @@ +// plane imports +import { FileService } from "@plane/services"; +import { TDocumentPayload } from "@plane/types"; +import { TEditorAssetType } from "@plane/types/src/enums"; +// local imports +import { convertHTMLDocumentToAllFormats } from "./yjs-utils"; + +const fileService = new FileService(); + +/** + * @description function to extract all image assets from HTML content + * @param htmlContent + * @returns {string[]} array of image asset sources + */ +export const extractImageAssetsFromHTMLContent = (htmlContent: string): string[] => { + // create a DOM parser + const parser = new DOMParser(); + // parse the HTML string into a DOM document + const doc = parser.parseFromString(htmlContent, "text/html"); + // get all image components + const imageComponents = doc.querySelectorAll("image-component"); + // collect all unique image sources + const imageSources = new Set(); + // extract sources from image components + imageComponents.forEach((component) => { + const src = component.getAttribute("src"); + if (src) imageSources.add(src); + }); + return Array.from(imageSources); +}; + +/** + * @description function to replace image assets in HTML content with new IDs + * @param props + * @returns {string} HTML content with replaced image assets + */ +export const replaceImageAssetsInHTMLContent = (props: { + htmlContent: string; + assetMap: Record; +}): string => { + const { htmlContent, assetMap } = props; + // create a DOM parser + const parser = new DOMParser(); + // parse the HTML string into a DOM document + const doc = parser.parseFromString(htmlContent, "text/html"); + // replace sources in image components + const imageComponents = doc.querySelectorAll("image-component"); + imageComponents.forEach((component) => { + const oldSrc = component.getAttribute("src"); + if (oldSrc && assetMap[oldSrc]) { + component.setAttribute("src", assetMap[oldSrc]); + } + }); + // serialize the document back into a string + return doc.body.innerHTML; +}; + +export const getEditorContentWithReplacedImageAssets = async (props: { + descriptionHTML: string; + entityId: string; + entityType: TEditorAssetType; + projectId: string | undefined; + variant: "rich" | "document"; + workspaceSlug: string; +}): Promise => { + const { descriptionHTML, entityId, entityType, projectId, variant, workspaceSlug } = props; + let replacedDescription = descriptionHTML; + // step 1: extract image assets from the description + const imageAssets = extractImageAssetsFromHTMLContent(descriptionHTML); + if (imageAssets.length !== 0) { + // step 2: duplicate the image assets + const duplicateAssetsResponse = await fileService.duplicateAssets(workspaceSlug, { + entity_id: entityId, + entity_type: entityType, + project_id: projectId, + asset_ids: imageAssets, + }); + if (Object.keys(duplicateAssetsResponse ?? {}).length > 0) { + // step 3: replace the image assets in the description + replacedDescription = replaceImageAssetsInHTMLContent({ + htmlContent: descriptionHTML, + assetMap: duplicateAssetsResponse, + }); + } + } + // step 4: convert the description to the document payload + const documentPayload = convertHTMLDocumentToAllFormats({ + document_html: replacedDescription, + variant, + }); + return documentPayload; +}; diff --git a/packages/editor/src/core/helpers/yjs-utils.ts b/packages/editor/src/core/helpers/yjs-utils.ts index dce75fd1f58..d61711127bc 100644 --- a/packages/editor/src/core/helpers/yjs-utils.ts +++ b/packages/editor/src/core/helpers/yjs-utils.ts @@ -3,6 +3,7 @@ import { generateHTML, generateJSON } from "@tiptap/html"; import { prosemirrorJSONToYDoc, yXmlFragmentToProseMirrorRootNode } from "y-prosemirror"; import * as Y from "yjs"; // extensions +import { TDocumentPayload } from "@plane/types"; import { CoreEditorExtensionsWithoutProps, DocumentEditorExtensionsWithoutProps, @@ -140,3 +141,50 @@ export const getAllDocumentFormatsFromDocumentEditorBinaryData = ( contentHTML, }; }; + +type TConvertHTMLDocumentToAllFormatsArgs = { + document_html: string; + variant: "rich" | "document"; +}; + +/** + * @description Converts HTML content to all supported document formats (JSON, HTML, and binary) + * @param {TConvertHTMLDocumentToAllFormatsArgs} args - Arguments containing HTML content and variant type + * @param {string} args.document_html - The HTML content to convert + * @param {"rich" | "document"} args.variant - The type of editor variant to use for conversion + * @returns {TDocumentPayload} Object containing the document in all supported formats + * @throws {Error} If an invalid variant is provided + */ +export const convertHTMLDocumentToAllFormats = (args: TConvertHTMLDocumentToAllFormatsArgs): TDocumentPayload => { + const { document_html, variant } = args; + + let allFormats: TDocumentPayload; + + if (variant === "rich") { + // Convert HTML to binary format for rich text editor + const contentBinary = getBinaryDataFromRichTextEditorHTMLString(document_html); + // Generate all document formats from the binary data + const { contentBinaryEncoded, contentHTML, contentJSON } = + getAllDocumentFormatsFromRichTextEditorBinaryData(contentBinary); + allFormats = { + description: contentJSON, + description_html: contentHTML, + description_binary: contentBinaryEncoded, + }; + } else if (variant === "document") { + // Convert HTML to binary format for document editor + const contentBinary = getBinaryDataFromDocumentEditorHTMLString(document_html); + // Generate all document formats from the binary data + const { contentBinaryEncoded, contentHTML, contentJSON } = + getAllDocumentFormatsFromDocumentEditorBinaryData(contentBinary); + allFormats = { + description: contentJSON, + description_html: contentHTML, + description_binary: contentBinaryEncoded, + }; + } else { + throw new Error(`Invalid variant provided: ${variant}`); + } + + return allFormats; +}; diff --git a/packages/services/src/file/file.service.ts b/packages/services/src/file/file.service.ts index 59c054faf1f..97b3d9b5077 100644 --- a/packages/services/src/file/file.service.ts +++ b/packages/services/src/file/file.service.ts @@ -1,6 +1,7 @@ // plane imports import { API_BASE_URL } from "@plane/constants"; // api service +import { EFileAssetType } from "@plane/types/src/enums"; import { APIService } from "../api.service"; // helpers import { getAssetIdFromUrl } from "./helper"; @@ -64,4 +65,27 @@ export class FileService extends APIService { throw error?.response?.data; }); } + + /** + * Duplicates assets + * @param {string} workspaceSlug - The workspace slug + * @param {object} data - The data for the duplicate assets + * @returns {Promise>} Promise resolving to a record of asset IDs + * @throws {Error} If the request fails + */ + async duplicateAssets( + workspaceSlug: string, + data: { + entity_id: string; + entity_type: EFileAssetType; + project_id?: string; + asset_ids: string[]; + } + ): Promise> { + return this.post(`/api/assets/v2/workspaces/${workspaceSlug}/duplicate-assets/`, data) + .then((response) => response?.data) + .catch((error) => { + throw error?.response?.data; + }); + } } diff --git a/packages/types/src/enums.ts b/packages/types/src/enums.ts index a49bec7ab22..7776e9f2429 100644 --- a/packages/types/src/enums.ts +++ b/packages/types/src/enums.ts @@ -68,8 +68,18 @@ export enum EFileAssetType { TEAM_SPACE_COMMENT_DESCRIPTION = "TEAM_SPACE_COMMENT_DESCRIPTION", } +export type TEditorAssetType = + | EFileAssetType.COMMENT_DESCRIPTION + | EFileAssetType.ISSUE_DESCRIPTION + | EFileAssetType.DRAFT_ISSUE_DESCRIPTION + | EFileAssetType.PAGE_DESCRIPTION + | EFileAssetType.TEAM_SPACE_DESCRIPTION + | EFileAssetType.INITIATIVE_DESCRIPTION + | EFileAssetType.PROJECT_DESCRIPTION + | EFileAssetType.TEAM_SPACE_COMMENT_DESCRIPTION; + export enum EUpdateStatus { OFF_TRACK = "OFF-TRACK", ON_TRACK = "ON-TRACK", AT_RISK = "AT-RISK", -} \ No newline at end of file +} diff --git a/packages/utils/src/color.ts b/packages/utils/src/color.ts index 04e4e95f242..017c594b7e4 100644 --- a/packages/utils/src/color.ts +++ b/packages/utils/src/color.ts @@ -269,28 +269,31 @@ export function generateIconColors(color: string) { } /** - * Generate a random color based on a string - * @param {string} string - The string to generate a color from - * @returns {string} The random color in HSL format + * @description Generates a deterministic HSL color based on input string + * @param {string} input - Input string to generate color from + * @returns {THsl} An object containing the HSL values + * @example + * generateRandomColor("hello") // returns consistent HSL color for "hello" + * generateRandomColor("") // returns { h: 0, s: 0, l: 0 } */ -export const generateRandomColor = (string: string): string => { - if (!string) return "rgb(var(--color-primary-100))"; - - string = `${string}`; +export const generateRandomColor = (input: string): THsl => { + // If input is falsy, generate a random seed string. + // The random seed is created by converting a random number to base-36 and taking a substring. + const seed = input || Math.random().toString(36).substring(2, 8); - const uniqueId = string.length.toString() + string; // Unique identifier based on string length - const combinedString = uniqueId + string; + const uniqueId = seed.length.toString() + seed; // Unique identifier based on string length + const combinedString = uniqueId + seed; + // Create a hash value from the combined string. const hash = Array.from(combinedString).reduce((acc, char) => { const charCode = char.charCodeAt(0); return (acc << 5) - acc + charCode; }, 0); - const hue = hash % 360; - const saturation = 70; // Higher saturation for pastel colors - const lightness = 60; // Mid-range lightness for pastel colors - - const randomColor = `hsl(${hue}, ${saturation}%, ${lightness}%)`; + // Derive the HSL values from the hash. + const hue = Math.abs(hash % 360); + const saturation = 70; // Maintains a good amount of color + const lightness = 70; // Increased lightness for a pastel look - return randomColor; + return { h: hue, s: saturation, l: lightness }; }; diff --git a/packages/utils/src/datetime.ts b/packages/utils/src/datetime.ts index cff0da2c2df..a4bcd7869e3 100644 --- a/packages/utils/src/datetime.ts +++ b/packages/utils/src/datetime.ts @@ -388,19 +388,19 @@ export const generateDateArray = (startDate: string | Date, endDate: string | Da const start = new Date(startDate); // start.setDate(start.getDate() + 1); const end = new Date(endDate); - end.setDate(end.getDate() + 1); + end.setDate(end.getDate() + 2); // Create an empty array to store the dates const dateArray = []; // Use a while loop to generate dates between the range while (start <= end) { - // Increment the date by 1 day (86400000 milliseconds) - start.setDate(start.getDate() + 1); // Push the current date (converted to ISO string for consistency) dateArray.push({ date: new Date(start).toISOString().split("T")[0], }); + // Increment the date by 1 day (86400000 milliseconds) + start.setDate(start.getDate() + 1); } return dateArray; diff --git a/web/core/components/pages/editor/editor-body.tsx b/web/core/components/pages/editor/editor-body.tsx index d7369892403..98193b5609c 100644 --- a/web/core/components/pages/editor/editor-body.tsx +++ b/web/core/components/pages/editor/editor-body.tsx @@ -13,7 +13,7 @@ import { // plane imports import { TSearchEntityRequestPayload, TSearchResponse, TWebhookConnectionQueryParams } from "@plane/types"; import { ERowVariant, Row } from "@plane/ui"; -import { cn, generateRandomColor } from "@plane/utils"; +import { cn, generateRandomColor, hslToHex } from "@plane/utils"; // components import { EditorMentionsRoot } from "@/components/editor"; import { PageContentBrowser, PageContentLoader, PageEditorTitle } from "@/components/pages"; @@ -146,7 +146,7 @@ export const PageEditorBody: React.FC = observer((props) => { () => ({ id: currentUser?.id ?? "", name: currentUser?.display_name ?? "", - color: generateRandomColor(currentUser?.id ?? ""), + color: hslToHex(generateRandomColor(currentUser?.id ?? "")), }), [currentUser?.display_name, currentUser?.id] ); From a4908dfdfb730895175a6f52ba85ef2c2a14104a Mon Sep 17 00:00:00 2001 From: Prateek Shourya Date: Mon, 9 Jun 2025 14:50:48 +0530 Subject: [PATCH 07/10] fix: build errors --- web/core/components/dropdowns/merged-date.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/web/core/components/dropdowns/merged-date.tsx b/web/core/components/dropdowns/merged-date.tsx index ca2adc46e5a..92a3d1e82a6 100644 --- a/web/core/components/dropdowns/merged-date.tsx +++ b/web/core/components/dropdowns/merged-date.tsx @@ -1,8 +1,7 @@ import React from "react"; import { observer } from "mobx-react"; // helpers -import { formatDateRange } from "@plane/utils"; -import { getDate } from "@/helpers/date-time.helper"; +import { formatDateRange, getDate } from "@plane/utils"; type Props = { startDate: Date | string | null | undefined; From 65bf7201f7ba19d41a26b0eb9f37abeab6085722 Mon Sep 17 00:00:00 2001 From: Prateek Shourya Date: Mon, 9 Jun 2025 16:11:02 +0530 Subject: [PATCH 08/10] chore: minor fixes related to duplicate assets imports --- packages/editor/src/core/helpers/parser.ts | 11 ++++------- packages/services/src/file/file.service.ts | 16 ++++------------ packages/types/src/file.d.ts | 17 +++++++++++++---- 3 files changed, 21 insertions(+), 23 deletions(-) diff --git a/packages/editor/src/core/helpers/parser.ts b/packages/editor/src/core/helpers/parser.ts index 3d17d0653ba..844c7b6afd8 100644 --- a/packages/editor/src/core/helpers/parser.ts +++ b/packages/editor/src/core/helpers/parser.ts @@ -1,12 +1,9 @@ // plane imports -import { FileService } from "@plane/services"; -import { TDocumentPayload } from "@plane/types"; +import { TDocumentPayload, TDuplicateAssetData, TDuplicateAssetResponse } from "@plane/types"; import { TEditorAssetType } from "@plane/types/src/enums"; // local imports import { convertHTMLDocumentToAllFormats } from "./yjs-utils"; -const fileService = new FileService(); - /** * @description function to extract all image assets from HTML content * @param htmlContent @@ -61,15 +58,15 @@ export const getEditorContentWithReplacedImageAssets = async (props: { entityType: TEditorAssetType; projectId: string | undefined; variant: "rich" | "document"; - workspaceSlug: string; + duplicateAssetService: (params: TDuplicateAssetData) => Promise; }): Promise => { - const { descriptionHTML, entityId, entityType, projectId, variant, workspaceSlug } = props; + const { descriptionHTML, entityId, entityType, projectId, variant, duplicateAssetService } = props; let replacedDescription = descriptionHTML; // step 1: extract image assets from the description const imageAssets = extractImageAssetsFromHTMLContent(descriptionHTML); if (imageAssets.length !== 0) { // step 2: duplicate the image assets - const duplicateAssetsResponse = await fileService.duplicateAssets(workspaceSlug, { + const duplicateAssetsResponse = await duplicateAssetService({ entity_id: entityId, entity_type: entityType, project_id: projectId, diff --git a/packages/services/src/file/file.service.ts b/packages/services/src/file/file.service.ts index 97b3d9b5077..32edd4eb40c 100644 --- a/packages/services/src/file/file.service.ts +++ b/packages/services/src/file/file.service.ts @@ -1,7 +1,7 @@ // plane imports import { API_BASE_URL } from "@plane/constants"; // api service -import { EFileAssetType } from "@plane/types/src/enums"; +import { TDuplicateAssetData, TDuplicateAssetResponse } from "@plane/types"; import { APIService } from "../api.service"; // helpers import { getAssetIdFromUrl } from "./helper"; @@ -69,19 +69,11 @@ export class FileService extends APIService { /** * Duplicates assets * @param {string} workspaceSlug - The workspace slug - * @param {object} data - The data for the duplicate assets - * @returns {Promise>} Promise resolving to a record of asset IDs + * @param {TDuplicateAssetData} data - The data for the duplicate assets + * @returns {Promise} Promise resolving to a record of asset IDs * @throws {Error} If the request fails */ - async duplicateAssets( - workspaceSlug: string, - data: { - entity_id: string; - entity_type: EFileAssetType; - project_id?: string; - asset_ids: string[]; - } - ): Promise> { + async duplicateAssets(workspaceSlug: string, data: TDuplicateAssetData): Promise { return this.post(`/api/assets/v2/workspaces/${workspaceSlug}/duplicate-assets/`, data) .then((response) => response?.data) .catch((error) => { diff --git a/packages/types/src/file.d.ts b/packages/types/src/file.d.ts index 8bcaade6c05..d26533221b6 100644 --- a/packages/types/src/file.d.ts +++ b/packages/types/src/file.d.ts @@ -1,16 +1,16 @@ -import { EFileAssetType } from "./enums" +import { EFileAssetType } from "./enums"; export type TFileMetaDataLite = { name: string; // file size in bytes size: number; type: string; -} +}; export type TFileEntityInfo = { entity_identifier: string; entity_type: EFileAssetType; -} +}; export type TFileMetaData = TFileMetaDataLite & TFileEntityInfo; @@ -29,4 +29,13 @@ export type TFileSignedURLResponse = { "x-amz-signature": string; }; }; -}; \ No newline at end of file +}; + +export type TDuplicateAssetData = { + entity_id: string; + entity_type: EFileAssetType; + project_id?: string; + asset_ids: string[]; +}; + +export type TDuplicateAssetResponse = Record; // asset_id -> new_asset_id From 8bc6475d6b81b7a62ec8a686df0a290fef056c69 Mon Sep 17 00:00:00 2001 From: Prateek Shourya Date: Mon, 16 Jun 2025 14:38:42 +0530 Subject: [PATCH 09/10] fix: build errors --- web/core/components/workspace-notifications/sidebar/root.tsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/web/core/components/workspace-notifications/sidebar/root.tsx b/web/core/components/workspace-notifications/sidebar/root.tsx index 48b94bb1a0d..95d70d8fa57 100644 --- a/web/core/components/workspace-notifications/sidebar/root.tsx +++ b/web/core/components/workspace-notifications/sidebar/root.tsx @@ -8,6 +8,7 @@ import { NOTIFICATION_TABS, TNotificationTab } from "@plane/constants"; import { useTranslation } from "@plane/i18n"; // components import { Header, Row, ERowVariant, EHeaderVariant, ContentWrapper } from "@plane/ui"; +import { cn, getNumberCount } from "@plane/utils"; import { CountChip } from "@/components/common"; import { NotificationsLoader, @@ -15,9 +16,6 @@ import { NotificationSidebarHeader, AppliedFilters, } from "@/components/workspace-notifications"; -// helpers -import { cn } from "@/helpers/common.helper"; -import { getNumberCount } from "@/helpers/string.helper"; // hooks import { useWorkspace, useWorkspaceNotifications } from "@/hooks/store"; From cbb649360b1f68c404abf79961a3b1a77c9bf3d1 Mon Sep 17 00:00:00 2001 From: Prateek Shourya Date: Mon, 16 Jun 2025 15:25:06 +0530 Subject: [PATCH 10/10] chore: minor changes --- web/core/components/workspace-notifications/root.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/core/components/workspace-notifications/root.tsx b/web/core/components/workspace-notifications/root.tsx index f55a8f87f27..f11db704aae 100644 --- a/web/core/components/workspace-notifications/root.tsx +++ b/web/core/components/workspace-notifications/root.tsx @@ -7,7 +7,7 @@ import useSWR from "swr"; import { ENotificationLoader, ENotificationQueryParamType } from "@plane/constants"; import { useTranslation } from "@plane/i18n"; import { cn } from "@plane/utils"; -// helpers +// components import { LogoSpinner } from "@/components/common"; import { SimpleEmptyState } from "@/components/empty-state"; import { InboxContentRoot } from "@/components/inbox";