[GIT-239] refactor: migrate constants from apps/web to @plane/constants#9204
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughThis PR consolidates type and constant definitions across a monorepo by moving them from app-level local modules to shared package exports ( ChangesMonorepo-wide Type and Constant Centralization
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Linked to Plane Work Item(s) This comment was auto-generated by Plane |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
packages/editor/src/core/constants/common.ts (1)
190-193: ⚡ Quick winFilter sticky toolbar items by
itemKey, not displayname.The
stickybranch keys offitem.name("Bold", "Italic", "To-do list") while every other branch filters onitem.editors. Matching on human-readable labels is brittle—any rename, casing change, or future i18n ofnamesilently drops these items. Prefer filtering on the stableitemKey.♻️ Proposed change
sticky: { - basic: BASIC_MARK_ITEMS.filter((item) => ["Bold", "Italic"].includes(item.name)), - list: LIST_ITEMS.filter((item) => ["To-do list"].includes(item.name)), + basic: BASIC_MARK_ITEMS.filter((item) => ["bold", "italic"].includes(item.itemKey)), + list: LIST_ITEMS.filter((item) => item.itemKey === "to-do-list"), },🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/editor/src/core/constants/common.ts` around lines 190 - 193, The sticky toolbar filters currently use item.name (in the sticky object for BASIC_MARK_ITEMS and LIST_ITEMS), which is brittle; change those filters to check the stable itemKey property instead (e.g., replace checks like ["Bold","Italic"].includes(item.name) with ["bold","italic"].includes(item.itemKey] and ["todo_list"].includes(item.itemKey) or whatever the canonical itemKey values are) so sticky.basic and sticky.list rely on item.itemKey rather than display name; update the filter predicates in the sticky block to use item.itemKey to match the existing key naming used elsewhere.apps/web/ce/hooks/pages/use-pages-pane-extensions.ts (1)
19-19: 💤 Low valueConsider adding
.tsextension to local type import.As per coding guidelines, TypeScript 5.2+ supports explicit
.tsextensions inimport typestatements. Consider updating the import to include the extension:-import type { INavigationPaneExtension } from "`@/components/pages/navigation-pane`"; +import type { INavigationPaneExtension } from "`@/components/pages/navigation-pane.ts`";This improves clarity and aligns with the guidelines, though the current code will work correctly in most configurations.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/web/ce/hooks/pages/use-pages-pane-extensions.ts` at line 19, Update the local type import to include the explicit .ts extension: change the import of INavigationPaneExtension in use-pages-pane-extensions.ts (the line importing INavigationPaneExtension) so it uses the file extension (e.g., import type { INavigationPaneExtension } from "`@/components/pages/navigation-pane.ts`") to follow the TypeScript 5.2+ guideline for explicit .ts extensions in type-only imports.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@apps/web/ce/hooks/pages/use-pages-pane-extensions.ts`:
- Line 19: Update the local type import to include the explicit .ts extension:
change the import of INavigationPaneExtension in use-pages-pane-extensions.ts
(the line importing INavigationPaneExtension) so it uses the file extension
(e.g., import type { INavigationPaneExtension } from
"`@/components/pages/navigation-pane.ts`") to follow the TypeScript 5.2+ guideline
for explicit .ts extensions in type-only imports.
In `@packages/editor/src/core/constants/common.ts`:
- Around line 190-193: The sticky toolbar filters currently use item.name (in
the sticky object for BASIC_MARK_ITEMS and LIST_ITEMS), which is brittle; change
those filters to check the stable itemKey property instead (e.g., replace checks
like ["Bold","Italic"].includes(item.name) with
["bold","italic"].includes(item.itemKey] and
["todo_list"].includes(item.itemKey) or whatever the canonical itemKey values
are) so sticky.basic and sticky.list rely on item.itemKey rather than display
name; update the filter predicates in the sticky block to use item.itemKey to
match the existing key naming used elsewhere.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: b908c4e4-f2f7-45d8-a33c-35f4f59cef59
📒 Files selected for processing (93)
apps/web/app/(all)/[workspaceSlug]/(projects)/extended-project-sidebar.tsxapps/web/app/(all)/[workspaceSlug]/(projects)/profile/[userId]/layout.tsxapps/web/app/(all)/[workspaceSlug]/(projects)/profile/[userId]/page.tsxapps/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/archives/issues/(detail)/header.tsxapps/web/app/(all)/[workspaceSlug]/(settings)/settings/(workspace)/integrations/page.tsxapps/web/app/(all)/invitations/page.tsxapps/web/app/(all)/onboarding/page.tsxapps/web/app/(all)/workspace-invitations/page.tsxapps/web/ce/components/breadcrumbs/project.tsxapps/web/ce/components/pages/editor/ai/menu.tsxapps/web/ce/components/projects/create/root.tsxapps/web/ce/components/relations/index.tsxapps/web/ce/components/workspace/billing/comparison/plan-detail.tsxapps/web/ce/components/workspace/billing/comparison/root.tsxapps/web/ce/hooks/pages/use-pages-pane-extensions.tsapps/web/ce/hooks/use-additional-favorite-item-details.tsxapps/web/ce/types/gantt-chart.tsapps/web/ce/types/index.tsapps/web/ce/types/issue-types/index.tsapps/web/ce/types/issue-types/issue-property-values.d.tsapps/web/ce/types/pages/pane-extensions.tsapps/web/ce/types/projects/projects.tsapps/web/core/components/api-token/delete-token-modal.tsxapps/web/core/components/api-token/modal/create-token-modal.tsxapps/web/core/components/common/activity/activity-item.tsxapps/web/core/components/common/activity/helper.tsxapps/web/core/components/cycles/active-cycle/use-cycles-details.tsapps/web/core/components/dropdowns/project/base.tsxapps/web/core/components/editor/lite-text/lite-toolbar.tsxapps/web/core/components/editor/lite-text/toolbar.tsxapps/web/core/components/editor/pdf/document.tsxapps/web/core/components/editor/sticky-editor/toolbar.tsxapps/web/core/components/exporter/guide.tsxapps/web/core/components/exporter/prev-exports.tsxapps/web/core/components/integration/single-integration-card.tsxapps/web/core/components/integration/slack/select-channel.tsxapps/web/core/components/issues/filters.tsxapps/web/core/components/issues/issue-detail-widgets/relations/content.tsxapps/web/core/components/issues/issue-detail-widgets/relations/quick-action-button.tsxapps/web/core/components/issues/issue-detail/issue-activity/activity/actions/relation.tsxapps/web/core/components/issues/issue-detail/relation-select.tsxapps/web/core/components/issues/issue-layouts/calendar/calendar.tsxapps/web/core/components/issues/issue-layouts/calendar/day-tile.tsxapps/web/core/components/issues/issue-layouts/calendar/dropdowns/months-dropdown.tsxapps/web/core/components/issues/issue-layouts/calendar/dropdowns/options-dropdown.tsxapps/web/core/components/issues/issue-layouts/calendar/week-header.tsxapps/web/core/components/issues/issue-modal/context/issue-modal-context.tsxapps/web/core/components/issues/relations/issue-list-item.tsxapps/web/core/components/issues/relations/issue-list.tsxapps/web/core/components/navigation/customize-navigation-dialog.tsxapps/web/core/components/navigation/project-header-button.tsxapps/web/core/components/pages/editor/toolbar/toolbar.tsxapps/web/core/components/power-k/menus/projects.tsxapps/web/core/components/profile/activity/workspace-activity-list.tsxapps/web/core/components/profile/overview/activity.tsxapps/web/core/components/project/create-project-modal.tsxapps/web/core/components/project/create/common-attributes.tsxapps/web/core/components/project/integration-card.tsxapps/web/core/components/project/project-settings-member-defaults.tsxapps/web/core/components/settings/profile/content/pages/api-tokens.tsxapps/web/core/components/workspace/billing/comparison/base.tsxapps/web/core/components/workspace/billing/comparison/feature-detail.tsxapps/web/core/components/workspace/billing/comparison/index.tsapps/web/core/components/workspace/billing/comparison/plans.tsxapps/web/core/components/workspace/sidebar/favorites/favorite-items/common/favorite-item-icon.tsxapps/web/core/components/workspace/sidebar/favorites/favorite-items/common/helper.tsxapps/web/core/components/workspace/sidebar/favorites/favorite-items/common/index.tsapps/web/core/components/workspace/sidebar/projects-list.tsxapps/web/core/constants/ai.tsapps/web/core/constants/editor.tsapps/web/core/hooks/use-favorite-item-details.tsxapps/web/core/hooks/use-navigation-preferences.tsapps/web/core/hooks/use-workspace-issue-properties.tsapps/web/core/layouts/auth-layout/project-wrapper.tsxapps/web/core/layouts/auth-layout/workspace-wrapper.tsxapps/web/core/services/ai.service.tsapps/web/core/services/issue/issue_relation.service.tsapps/web/core/services/project/project.service.tsapps/web/core/store/issue/issue-details/relation.store.tsapps/web/core/store/issue/issue-details/root.store.tsapps/web/core/store/project/project.store.tspackages/constants/src/ai.tspackages/constants/src/calendar.tspackages/constants/src/fetch-keys.tspackages/constants/src/gantt-chart.tspackages/constants/src/index.tspackages/constants/src/sidebar-favorites.tspackages/editor/src/core/constants/common.tspackages/types/src/index.tspackages/types/src/issues/issue-property-values.tspackages/types/src/navigation-preferences.tspackages/types/src/project/activity.tspackages/types/src/project/index.ts
💤 Files with no reviewable changes (10)
- apps/web/ce/types/issue-types/issue-property-values.d.ts
- apps/web/ce/types/pages/pane-extensions.ts
- apps/web/ce/types/index.ts
- apps/web/ce/types/issue-types/index.ts
- apps/web/core/constants/editor.ts
- apps/web/ce/types/gantt-chart.ts
- apps/web/core/constants/ai.ts
- packages/constants/src/sidebar-favorites.ts
- packages/types/src/navigation-preferences.ts
- apps/web/ce/types/projects/projects.ts
Description
Consolidated constants to @packages/constants
Type of Change
Summary by CodeRabbit