plane icon indicating copy to clipboard operation
plane copied to clipboard

[WEB-5256]chore: quick actions refactor

Open vamsikrishnamathala opened this issue 2 months ago • 2 comments

Description

This update refactors quick actions for a better reusability at these layouts:

  1. Cycle Work items
  2. Module Work items
  3. Project work items
  4. View work items

Type of Change

  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [ ] Feature (non-breaking change which adds functionality)
  • [ ] Improvement (change that would cause existing functionality to not work as expected)
  • [x] Code refactoring
  • [ ] Performance improvements
  • [ ] Documentation update

Screenshots and Media (if applicable)

Test Scenarios

References

Summary by CodeRabbit

  • New Features

    • Added centralized quick‑actions factory and new quick‑action hooks for cycles, modules, views, layouts, and intake header.
    • Introduced a layout quick actions component with copy/open actions and optional modals.
  • Refactor

    • Unified context menu generation across cycles, modules, views and layouts; components now consume the shared menu API and support additional modals.
  • Chores

    • Removed several unused/non‑functional hooks and cleaned up obsolete re-exports.

[!NOTE] Centralizes quick actions with a shared factory and helper hooks, refactoring cycles/modules/views and adding layout-level actions while removing old CE menu/end-cycle hooks.

  • Core common:
    • Factory: Add useQuickActionsFactory with standardized creators for edit, open-new-tab, copy-link, archive, restore, delete in core/components/common/quick-actions-factory.tsx.
    • Helper hooks: Add useCycleMenuItems, useModuleMenuItems, useViewMenuItems, useLayoutMenuItems in core/components/common/quick-actions-helper.tsx returning normalized menu items and optional modals.
  • Components updated:
    • Cycles: core/components/cycles/quick-actions.tsx now builds menu via useCycleMenuItems; integrates archive/delete/edit modals via returned hooks.
    • Modules: core/components/modules/quick-actions.tsx refactored to useModuleMenuItems with standardized actions and modals.
    • Project Views: core/components/views/quick-actions.tsx refactored to useViewMenuItems; supports publish item insertion.
    • Workspace Views: core/components/workspace/views/quick-action.tsx uses useViewMenuItems for menu generation.
    • Layouts: Add core/components/issues/layout-quick-actions.tsx for issue/epic list actions (open/copy).
  • CE adjustments:
    • Remove unused ce/components/cycles/end-cycle/use-end-cycle.tsx and related export; trim old view helper menu logic.
    • Re-export useQuickActionsFactory from ce/components/common/quick-actions-factory.tsx.

Written by Cursor Bugbot for commit 6f292103b4cf6bdf29fb8bc90e13af2cebf92952. This will update automatically on new commits. Configure here.

vamsikrishnamathala avatar Oct 27 '25 14:10 vamsikrishnamathala

[!NOTE]

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

Centralizes quick-action menu creation into a factory and shared helper hooks; removes an unused end-cycle hook and old view menu exports; updates multiple components to consume the new hooks and render optional additional modals returned by those hooks.

Changes

Cohort / File(s) Change Summary
Removed end-cycle hook & re-export
apps/web/ce/components/cycles/end-cycle/index.ts, apps/web/ce/components/cycles/end-cycle/use-end-cycle.tsx
Deleted the static no-op useEndCycle hook and removed its public re-export; index.ts now only re-exports ./modal.
Removed old view menu exports
apps/web/ce/components/views/helper.tsx
Removed exports TMenuItemsFactoryProps, useMenuItemsFactory, and useViewMenuItems; left AdditionalHeaderItems exported.
New quick-actions factory (core + CE re-export)
apps/web/core/components/common/quick-actions-factory.tsx, apps/web/ce/components/common/quick-actions-factory.tsx
Added useQuickActionsFactory (factory of TContextMenuItem creators) and re-exported it via CE module.
New unified quick-actions helper hooks
apps/web/core/components/common/quick-actions-helper.tsx
Introduced useCycleMenuItems, useModuleMenuItems, useViewMenuItems, useLayoutMenuItems, useIntakeHeaderMenuItems and exported related prop interfaces and MenuResult. Hooks return { items, modals } (modals often null).
Cycle quick-actions updated to use hook
apps/web/core/components/cycles/quick-actions.tsx
Replaced inline menu construction with useCycleMenuItems; removed local state logic for archival/completion and integrated any additionalModals from hook results.
Module quick-actions updated to use hook
apps/web/core/components/modules/quick-actions.tsx
Replaced explicit menu building with useModuleMenuItems; removed local archive/delete state, and render hook-provided modals when present.
View quick-actions updated & typing adjustments
apps/web/core/components/views/quick-actions.tsx, apps/web/core/components/workspace/views/quick-action.tsx
Switched to useViewMenuItems, changed passed callbacks/names (handleCopyLink, handleEdit, handleDelete), rely on inferred types and support both array and object return shapes (items + modals).
New layout quick-actions component
apps/web/core/components/issues/layout-quick-actions.tsx
Added LayoutQuickActions component that uses useLayoutMenuItems, provides copy/open handlers, normalizes hook result to render menu items and optional modals.

Sequence Diagram(s)

sequenceDiagram
    participant Component as Component (Cycle/Module/View/Layout)
    participant Hook as Menu Hook (use*MenuItems)
    participant Factory as useQuickActionsFactory
    participant Menu as CustomMenu

    Component->>Hook: call with props (entity details, handlers, permissions)
    Hook->>Factory: obtain factory functions
    Factory-->>Hook: quick-action creators
    Hook->>Hook: build items array and optional modals
    Hook-->>Component: return items (or {items, modals})
    Component->>Component: normalize (array or object)
    Component->>Menu: render items
    Menu-->>Component: user interactions (actions invoke provided handlers)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Areas to focus:
    • apps/web/core/components/common/quick-actions-helper.tsx: verify permission/state conditions and item ordering.
    • Components migrated to hooks (cycles, modules, views): ensure handlers and modal wiring remain correct when hook returns object vs array.
    • layout-quick-actions.tsx: confirm link generation and clipboard/open behavior.
    • Re-exports in CE modules: ensure public API surface didn't unintentionally change.

"🐰
I hopped through code with nimble paws,
Menus gathered into tidy laws,
Hooks and factories now sing in pairs,
Quick actions lined up — tidy wares 🥕"

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The title "[WEB-5256]chore: quick actions refactor" is concise and clearly summarizes the primary change in the pull request. The raw_summary shows the PR's main objective is to refactor quick actions for improved reusability across multiple layouts (cycles, modules, views), and the title directly captures this intent. The title is specific enough for teammates scanning history to understand the central purpose without being overly verbose or misleading.
Description check ✅ Passed The PR description covers the main objective of refactoring quick actions, indicates code refactoring type, and provides implementation details via the CURSOR_SUMMARY note.
✨ Finishing touches
  • [ ] 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • [ ] Create PR with unit tests
  • [ ] Post copyable unit tests in a comment
  • [ ] Commit unit tests in branch chore-quick_actions_refactor

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.

coderabbitai[bot] avatar Oct 27 '25 14:10 coderabbitai[bot]

Linked to Plane Work Item(s)

This comment was auto-generated by Plane

makeplane[bot] avatar Oct 27 '25 14:10 makeplane[bot]