Skip to content

[GIT-239] refactor: migrate constants from apps/web to @plane/constants#9204

Open
Rahulcheryala wants to merge 6 commits into
git-238/types-consolidation-packages-typesfrom
git-239/constants-consolidation-packages-constants
Open

[GIT-239] refactor: migrate constants from apps/web to @plane/constants#9204
Rahulcheryala wants to merge 6 commits into
git-238/types-consolidation-packages-typesfrom
git-239/constants-consolidation-packages-constants

Conversation

@Rahulcheryala
Copy link
Copy Markdown
Contributor

@Rahulcheryala Rahulcheryala commented Jun 3, 2026

Description

Consolidated constants to @packages/constants

Type of Change

  • Code refactoring

Summary by CodeRabbit

  • Refactor
    • Consolidated type definitions and constants into shared packages for improved code organization.
    • Updated internal module imports to use centralized constants from shared packages.
    • Refactored favorite item icon handling for improved component composition.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 3, 2026

Review Change Stack

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 68021294-3eac-4420-9623-d5d8ca756a03

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

This PR consolidates type and constant definitions across a monorepo by moving them from app-level local modules to shared package exports (@plane/types, @plane/constants, @plane/editor), then updating ~150+ imports in apps/web to reference the new centralized locations. A new FavoriteItemIcon component replaces a removed helper function, and plan-related exports are reorganized into the billing comparison folder.

Changes

Monorepo-wide Type and Constant Centralization

Layer / File(s) Summary
Type Export Index Updates in packages/types
packages/types/src/index.ts, packages/types/src/issues/issue-property-values.ts, packages/types/src/navigation-preferences.ts, packages/types/src/project/activity.ts, packages/types/src/project/index.ts
packages/types barrel adds re-exports for issue-property-values and navigation-preferences; issue-property-values module introduces placeholder type aliases TIssuePropertyValues and TIssuePropertyValueErrors; comment headers removed from navigation-preferences.
Constant Export Index Updates in packages/constants
packages/constants/src/index.ts, packages/constants/src/ai.ts, packages/constants/src/gantt-chart.ts, packages/constants/src/sidebar-favorites.ts
packages/constants barrel re-exports calendar, fetch-keys, gantt-chart, and sidebar-favorites modules; gantt-chart updates TIssueRelationTypes import to use @plane/types; ai.ts adds LOADING_TEXTS export; FAVORITE_ITEM_ICONS removed from sidebar-favorites.
Editor Toolbar Consolidation in packages/editor
packages/editor/src/core/constants/common.ts
Extends TEditorTypes with "sticky" editor variant; exports IMAGE_ITEM constant; adds sticky branch to TOOLBAR_ITEMS; introduces EDITOR_FONT_STYLES export mapping font variants to icon components.
CE Types Module Cleanup
apps/web/ce/types/gantt-chart.ts, apps/web/ce/types/issue-types/index.ts, apps/web/ce/types/pages/pane-extensions.ts, apps/web/ce/types/projects/projects.ts, apps/web/ce/types/index.ts
Removes type exports TIssueRelationTypes, TIssuePropertyValues, TIssuePropertyValueErrors, navigation pane extension types, and project type aliases; barrel re-exports removed.
Core Editor Constants Cleanup
apps/web/core/constants/editor.ts, apps/web/core/constants/ai.ts
Removes entire editor.ts file (ToolbarMenuItem type, TOOLBAR_ITEMS, TYPOGRAPHY_ITEMS, IMAGE_ITEM, EDITOR_FONT_STYLES, EDITOR_PDF_DOCUMENT_STYLESHEET); removes AI_EDITOR_TASKS and LOADING_TEXTS from ai.ts.
Favorite Items Icon Component and Helper Refactoring
apps/web/core/components/workspace/sidebar/favorites/favorite-items/common/favorite-item-icon.tsx, apps/web/core/components/workspace/sidebar/favorites/favorite-items/common/helper.tsx, apps/web/core/components/workspace/sidebar/favorites/favorite-items/common/index.ts, apps/web/core/hooks/use-favorite-item-details.tsx, apps/web/ce/hooks/use-additional-favorite-item-details.tsx
New FavoriteItemIcon component renders icons and optional logos based on type; getFavoriteItemIcon helper removed; useFavoriteItemDetails and useAdditionalFavoriteItemDetails hooks refactored to use the new component.
Plan Module Reorganization
apps/web/ce/components/workspace/billing/comparison/plan-detail.tsx, apps/web/ce/components/workspace/billing/comparison/root.tsx, apps/web/core/components/workspace/billing/comparison/base.tsx, apps/web/core/components/workspace/billing/comparison/feature-detail.tsx, apps/web/core/components/workspace/billing/comparison/index.ts
Plan types and constants (TPlanePlans, PLANE_PLANS, TPlanDetail, TPlanFeatureData) relocated from @/constants/plans to @/components/workspace/billing/comparison/plans; billing comparison index adds re-export of plans module.
Type Imports: Project and Activity Types
apps/web/app/(all)/[workspaceSlug]/(projects)/extended-project-sidebar.tsx, apps/web/ce/components/breadcrumbs/project.tsx, apps/web/ce/components/projects/create/root.tsx, apps/web/core/components/dropdowns/project/base.tsx, apps/web/core/components/issues/filters.tsx, apps/web/core/components/navigation/project-header-button.tsx, apps/web/core/components/power-k/menus/projects.tsx, apps/web/core/components/project/create-project-modal.tsx, apps/web/core/components/project/create/common-attributes.tsx, apps/web/core/components/workspace/sidebar/projects-list.tsx, apps/web/core/services/project/project.service.ts, apps/web/core/store/project/project.store.ts, apps/web/core/components/common/activity/activity-item.tsx, apps/web/core/components/common/activity/helper.tsx
TProject and TPartialProject imports unified to use @plane/types; TProjectActivity imports updated to @plane/types.
Type Imports: Issue Relation and Navigation Types
apps/web/ce/components/relations/index.tsx, apps/web/core/components/issues/issue-detail-widgets/relations/content.tsx, apps/web/core/components/issues/issue-detail-widgets/relations/quick-action-button.tsx, apps/web/core/components/issues/issue-detail/issue-activity/activity/actions/relation.tsx, apps/web/core/components/issues/issue-detail/relation-select.tsx, apps/web/core/components/issues/relations/issue-list-item.tsx, apps/web/core/components/issues/relations/issue-list.tsx, apps/web/core/components/navigation/customize-navigation-dialog.tsx, apps/web/core/components/issues/issue-modal/context/issue-modal-context.tsx
TIssueRelationTypes and TPersonalNavigationItemKey imports consolidated to @plane/types; TIssuePropertyValues and TIssuePropertyValueErrors imported from @plane/types.
Constants Imports: SWR Fetch Keys
apps/web/app/(all)/[workspaceSlug]/(projects)/profile/[userId]/layout.tsx, apps/web/app/(all)/[workspaceSlug]/(projects)/profile/[userId]/page.tsx, apps/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/archives/issues/(detail)/header.tsx, apps/web/app/(all)/[workspaceSlug]/(settings)/settings/(workspace)/integrations/page.tsx, apps/web/app/(all)/invitations/page.tsx, apps/web/app/(all)/onboarding/page.tsx, apps/web/app/(all)/workspace-invitations/page.tsx, apps/web/core/components/api-token/delete-token-modal.tsx, apps/web/core/components/api-token/modal/create-token-modal.tsx, apps/web/core/components/cycles/active-cycle/use-cycles-details.ts, apps/web/core/components/exporter/guide.tsx, apps/web/core/components/exporter/prev-exports.tsx, apps/web/core/components/integration/single-integration-card.tsx, apps/web/core/components/integration/slack/select-channel.tsx, apps/web/core/components/profile/activity/workspace-activity-list.tsx, apps/web/core/components/profile/overview/activity.tsx, apps/web/core/components/project/integration-card.tsx, apps/web/core/components/project/project-settings-member-defaults.tsx, apps/web/core/components/settings/profile/content/pages/api-tokens.tsx, apps/web/core/layouts/auth-layout/project-wrapper.tsx, apps/web/core/layouts/auth-layout/workspace-wrapper.tsx
SWR cache key constants (USER_PROFILE_, ISSUE_DETAILS, APP_INTEGRATIONS, API_TOKENS_LIST, WORKSPACE_, EXPORT_SERVICES_LIST, PROJECT_*, etc.) relocated from @/constants/fetch-keys to @plane/constants.
Constants Imports: Calendar, Editor, and Other Constants
apps/web/core/components/issues/issue-layouts/calendar/calendar.tsx, apps/web/core/components/issues/issue-layouts/calendar/day-tile.tsx, apps/web/core/components/issues/issue-layouts/calendar/dropdowns/months-dropdown.tsx, apps/web/core/components/issues/issue-layouts/calendar/dropdowns/options-dropdown.tsx, apps/web/core/components/issues/issue-layouts/calendar/week-header.tsx, apps/web/ce/components/pages/editor/ai/menu.tsx, apps/web/core/services/ai.service.ts, apps/web/core/store/issue/issue-details/relation.store.ts, apps/web/core/hooks/use-workspace-issue-properties.ts
Calendar constants (MONTHS_LIST, DAYS_LIST, CALENDAR_LAYOUTS) migrated from @/constants/calendar to @plane/constants; AI_EDITOR_TASKS and LOADING_TEXTS imported from @plane/constants; REVERSE_RELATIONS imported from @plane/constants.
Editor Imports: Toolbar and PDF Styling
apps/web/core/components/editor/lite-text/lite-toolbar.tsx, apps/web/core/components/editor/lite-text/toolbar.tsx, apps/web/core/components/editor/sticky-editor/toolbar.tsx, apps/web/core/components/pages/editor/toolbar/toolbar.tsx, apps/web/core/components/editor/pdf/document.tsx
ToolbarMenuItem, TOOLBAR_ITEMS, TYPOGRAPHY_ITEMS, and IMAGE_ITEM imported from @plane/editor; pdf/document.tsx inlines PDF stylesheet definition using react-pdf StyleSheet.create() locally.
Navigation Preferences Constants Migration
apps/web/core/hooks/use-navigation-preferences.ts
DEFAULT_* navigation preference constants imported from @plane/types instead of @/types/navigation-preferences.
Pages Pane Extension Type Import Update
apps/web/ce/hooks/pages/use-pages-pane-extensions.ts
INavigationPaneExtension type import source changed to @/components/pages/navigation-pane component module.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Suggested labels

🌐frontend, 🌟enhancement

Suggested reviewers

  • prateekshourya29

Poem

🐰 A monorepo dance, so grand and wide,
Types and constants sorted with pride,
From scattered folders to packages they fly,
Icon components sing in the sky,
One hundred imports now unified! 🌟

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive The PR description is minimal, providing only the consolidated consolidation message and code refactoring checkbox, but missing details on what was consolidated, why, or test scenarios. Expand the description to explain which constants were consolidated, the rationale for consolidation, any breaking changes, and how the changes were tested.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: migrating constants from apps/web to @plane/constants, which directly reflects the PR's primary objective.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch git-239/constants-consolidation-packages-constants

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@makeplane
Copy link
Copy Markdown

makeplane Bot commented Jun 3, 2026

Linked to Plane Work Item(s)

This comment was auto-generated by Plane

@Rahulcheryala Rahulcheryala changed the base branch from preview to git-238/types-consolidation-packages-types June 3, 2026 14:25
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
packages/editor/src/core/constants/common.ts (1)

190-193: ⚡ Quick win

Filter sticky toolbar items by itemKey, not display name.

The sticky branch keys off item.name ("Bold", "Italic", "To-do list") while every other branch filters on item.editors. Matching on human-readable labels is brittle—any rename, casing change, or future i18n of name silently drops these items. Prefer filtering on the stable itemKey.

♻️ 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 value

Consider adding .ts extension to local type import.

As per coding guidelines, TypeScript 5.2+ supports explicit .ts extensions in import type statements. 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

📥 Commits

Reviewing files that changed from the base of the PR and between b6e47cc and 459c90d.

📒 Files selected for processing (93)
  • apps/web/app/(all)/[workspaceSlug]/(projects)/extended-project-sidebar.tsx
  • apps/web/app/(all)/[workspaceSlug]/(projects)/profile/[userId]/layout.tsx
  • apps/web/app/(all)/[workspaceSlug]/(projects)/profile/[userId]/page.tsx
  • apps/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/archives/issues/(detail)/header.tsx
  • apps/web/app/(all)/[workspaceSlug]/(settings)/settings/(workspace)/integrations/page.tsx
  • apps/web/app/(all)/invitations/page.tsx
  • apps/web/app/(all)/onboarding/page.tsx
  • apps/web/app/(all)/workspace-invitations/page.tsx
  • apps/web/ce/components/breadcrumbs/project.tsx
  • apps/web/ce/components/pages/editor/ai/menu.tsx
  • apps/web/ce/components/projects/create/root.tsx
  • apps/web/ce/components/relations/index.tsx
  • apps/web/ce/components/workspace/billing/comparison/plan-detail.tsx
  • apps/web/ce/components/workspace/billing/comparison/root.tsx
  • apps/web/ce/hooks/pages/use-pages-pane-extensions.ts
  • apps/web/ce/hooks/use-additional-favorite-item-details.tsx
  • apps/web/ce/types/gantt-chart.ts
  • apps/web/ce/types/index.ts
  • apps/web/ce/types/issue-types/index.ts
  • apps/web/ce/types/issue-types/issue-property-values.d.ts
  • apps/web/ce/types/pages/pane-extensions.ts
  • apps/web/ce/types/projects/projects.ts
  • apps/web/core/components/api-token/delete-token-modal.tsx
  • apps/web/core/components/api-token/modal/create-token-modal.tsx
  • apps/web/core/components/common/activity/activity-item.tsx
  • apps/web/core/components/common/activity/helper.tsx
  • apps/web/core/components/cycles/active-cycle/use-cycles-details.ts
  • apps/web/core/components/dropdowns/project/base.tsx
  • apps/web/core/components/editor/lite-text/lite-toolbar.tsx
  • apps/web/core/components/editor/lite-text/toolbar.tsx
  • apps/web/core/components/editor/pdf/document.tsx
  • apps/web/core/components/editor/sticky-editor/toolbar.tsx
  • apps/web/core/components/exporter/guide.tsx
  • apps/web/core/components/exporter/prev-exports.tsx
  • apps/web/core/components/integration/single-integration-card.tsx
  • apps/web/core/components/integration/slack/select-channel.tsx
  • apps/web/core/components/issues/filters.tsx
  • apps/web/core/components/issues/issue-detail-widgets/relations/content.tsx
  • apps/web/core/components/issues/issue-detail-widgets/relations/quick-action-button.tsx
  • apps/web/core/components/issues/issue-detail/issue-activity/activity/actions/relation.tsx
  • apps/web/core/components/issues/issue-detail/relation-select.tsx
  • apps/web/core/components/issues/issue-layouts/calendar/calendar.tsx
  • apps/web/core/components/issues/issue-layouts/calendar/day-tile.tsx
  • apps/web/core/components/issues/issue-layouts/calendar/dropdowns/months-dropdown.tsx
  • apps/web/core/components/issues/issue-layouts/calendar/dropdowns/options-dropdown.tsx
  • apps/web/core/components/issues/issue-layouts/calendar/week-header.tsx
  • apps/web/core/components/issues/issue-modal/context/issue-modal-context.tsx
  • apps/web/core/components/issues/relations/issue-list-item.tsx
  • apps/web/core/components/issues/relations/issue-list.tsx
  • apps/web/core/components/navigation/customize-navigation-dialog.tsx
  • apps/web/core/components/navigation/project-header-button.tsx
  • apps/web/core/components/pages/editor/toolbar/toolbar.tsx
  • apps/web/core/components/power-k/menus/projects.tsx
  • apps/web/core/components/profile/activity/workspace-activity-list.tsx
  • apps/web/core/components/profile/overview/activity.tsx
  • apps/web/core/components/project/create-project-modal.tsx
  • apps/web/core/components/project/create/common-attributes.tsx
  • apps/web/core/components/project/integration-card.tsx
  • apps/web/core/components/project/project-settings-member-defaults.tsx
  • apps/web/core/components/settings/profile/content/pages/api-tokens.tsx
  • apps/web/core/components/workspace/billing/comparison/base.tsx
  • apps/web/core/components/workspace/billing/comparison/feature-detail.tsx
  • apps/web/core/components/workspace/billing/comparison/index.ts
  • apps/web/core/components/workspace/billing/comparison/plans.tsx
  • apps/web/core/components/workspace/sidebar/favorites/favorite-items/common/favorite-item-icon.tsx
  • apps/web/core/components/workspace/sidebar/favorites/favorite-items/common/helper.tsx
  • apps/web/core/components/workspace/sidebar/favorites/favorite-items/common/index.ts
  • apps/web/core/components/workspace/sidebar/projects-list.tsx
  • apps/web/core/constants/ai.ts
  • apps/web/core/constants/editor.ts
  • apps/web/core/hooks/use-favorite-item-details.tsx
  • apps/web/core/hooks/use-navigation-preferences.ts
  • apps/web/core/hooks/use-workspace-issue-properties.ts
  • apps/web/core/layouts/auth-layout/project-wrapper.tsx
  • apps/web/core/layouts/auth-layout/workspace-wrapper.tsx
  • apps/web/core/services/ai.service.ts
  • apps/web/core/services/issue/issue_relation.service.ts
  • apps/web/core/services/project/project.service.ts
  • apps/web/core/store/issue/issue-details/relation.store.ts
  • apps/web/core/store/issue/issue-details/root.store.ts
  • apps/web/core/store/project/project.store.ts
  • packages/constants/src/ai.ts
  • packages/constants/src/calendar.ts
  • packages/constants/src/fetch-keys.ts
  • packages/constants/src/gantt-chart.ts
  • packages/constants/src/index.ts
  • packages/constants/src/sidebar-favorites.ts
  • packages/editor/src/core/constants/common.ts
  • packages/types/src/index.ts
  • packages/types/src/issues/issue-property-values.ts
  • packages/types/src/navigation-preferences.ts
  • packages/types/src/project/activity.ts
  • packages/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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant