Skip to content

[WEB-4451] chore: work item header quick action enhancements#7414

Merged
sriramveeraghanta merged 2 commits intopreviewfrom
chore-work-item-header-quick-action-enhancements
Jul 15, 2025
Merged

[WEB-4451] chore: work item header quick action enhancements#7414
sriramveeraghanta merged 2 commits intopreviewfrom
chore-work-item-header-quick-action-enhancements

Conversation

@anmolsinghbhatia
Copy link
Collaborator

@anmolsinghbhatia anmolsinghbhatia commented Jul 15, 2025

Description

This PR includes enhancements for work item quick menu for peek view header and detail page header.

Type of Change

  • Improvement

Media

Before After
WEB-4451-Before WEB-4451-After

References

Work-item: [WEB-4451]

Summary by CodeRabbit

  • New Features

    • Introduced a unified quick actions dropdown for issues, consolidating actions like edit, archive, restore, delete, and duplicate into a single menu.
    • Added context-aware menu items and permission checks for issue actions.
  • Refactor

    • Centralized quick action controls into a dedicated component, simplifying the UI and code structure.
    • Shifted modal state management for issue actions to local component state for improved reliability.
    • Replaced individual action buttons in issue peek overview header with the unified quick actions component.
    • Removed direct rendering of archive and delete modals from the peek overview view component.
  • Bug Fixes

    • Improved error handling and user feedback for issue actions with toast notifications and event tracking.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 15, 2025

Walkthrough

This update refactors quick action handling for issues by introducing a new WorkItemDetailQuickActions component, centralizing permission checks, modal management, and menu rendering. Local state replaces store-managed modal state in the issue view, and related components are updated to use the new quick actions component and local modal toggles.

Changes

File(s) Change Summary
issue-detail/issue-detail-quick-actions.tsx, peek-overview/header.tsx Refactored to delegate quick action logic and UI to the new WorkItemDetailQuickActions component. Removed direct modal and permission logic, replaced with prop-based handlers and consolidated action rendering. Updated prop signatures for modal toggles and handlers.
issue-layouts/quick-action-dropdowns/issue-detail.tsx Added new WorkItemDetailQuickActions component encapsulating menu rendering, permission checks, modal state, and action handling for issue quick actions. Integrates with MobX, Next.js routing, and analytics.
issue-layouts/quick-action-dropdowns/helper.tsx Introduced useWorkItemDetailMenuItems hook to generate a memoized set of menu items for work item detail quick actions.
issue-layouts/quick-action-dropdowns/index.ts Added export for the new issue-detail module, making WorkItemDetailQuickActions and related helpers available for import elsewhere.
peek-overview/view.tsx Refactored modal state management to use local component state for archive, delete, duplicate, and edit modals. Removed direct rendering of archive and delete modals. Updated outside click/escape handling to consider new local modal states. Adjusted header props for new modal toggle functions.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant IssueView
    participant IssuePeekOverviewHeader
    participant WorkItemDetailQuickActions
    participant Modal

    User->>IssueView: Opens issue peek
    IssueView->>IssuePeekOverviewHeader: Renders header with quick action props
    IssuePeekOverviewHeader->>WorkItemDetailQuickActions: Renders quick actions menu
    User->>WorkItemDetailQuickActions: Clicks quick action (e.g., Delete)
    WorkItemDetailQuickActions->>Modal: Opens corresponding modal
    User->>Modal: Confirms action
    Modal->>WorkItemDetailQuickActions: Calls handler (e.g., handleDeleteIssue)
    WorkItemDetailQuickActions->>IssuePeekOverviewHeader: Triggers post-action logic
    IssuePeekOverviewHeader->>IssueView: Updates view or closes peek
Loading

Possibly related PRs

  • makeplane/plane#7136: Refactors dropdown context menu components to support nested submenus, which underpins the nested submenu rendering used by WorkItemDetailQuickActions and related quick action dropdowns in this PR.

Suggested labels

🌟improvement

Suggested reviewers

  • prateekshourya29
  • sriramveeraghanta

Poem

In a burrow of code, where quick actions dwell,
A rabbit refactored, and did it well.
With menus and modals all neat and new,
The quick actions now hop—swift, streamlined, and true.
🐇✨
No more scattered buttons, confusion is gone—
The warren of issues just hops right along!

✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@makeplane
Copy link

makeplane bot commented Jul 15, 2025

Pull Request Linked with Plane Work Items

Comment Automatically Generated by Plane

Copy link
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.

Actionable comments posted: 3

🧹 Nitpick comments (1)
apps/web/core/components/issues/issue-layouts/quick-action-dropdowns/issue-detail.tsx (1)

151-152: Remove commented code.

-  //   const MENU_ITEMS = useWorkItemDetailMenuItems(menuItemProps);
   const baseMenuItems = useWorkItemDetailMenuItems(menuItemProps);
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2058f06 and 251f482.

📒 Files selected for processing (6)
  • apps/web/core/components/issues/issue-detail/issue-detail-quick-actions.tsx (4 hunks)
  • apps/web/core/components/issues/issue-layouts/quick-action-dropdowns/helper.tsx (1 hunks)
  • apps/web/core/components/issues/issue-layouts/quick-action-dropdowns/index.ts (1 hunks)
  • apps/web/core/components/issues/issue-layouts/quick-action-dropdowns/issue-detail.tsx (1 hunks)
  • apps/web/core/components/issues/peek-overview/header.tsx (6 hunks)
  • apps/web/core/components/issues/peek-overview/view.tsx (5 hunks)
🧰 Additional context used
🧠 Learnings (2)
apps/web/core/components/issues/peek-overview/header.tsx (1)
Learnt from: vamsikrishnamathala
PR: makeplane/plane#7061
File: web/core/components/workspace-notifications/root.tsx:18-18
Timestamp: 2025-05-14T13:16:23.323Z
Learning: In the Plane project codebase, the path alias `@/plane-web` resolves to the `ce` directory, making imports like `@/plane-web/hooks/use-notification-preview` correctly resolve to files in `web/ce/hooks/`.
apps/web/core/components/issues/issue-detail/issue-detail-quick-actions.tsx (1)
Learnt from: vamsikrishnamathala
PR: makeplane/plane#7214
File: web/core/store/issue/helpers/base-issues.store.ts:117-117
Timestamp: 2025-06-16T07:23:39.497Z
Learning: In the updateIssueDates method of BaseIssuesStore (web/core/store/issue/helpers/base-issues.store.ts), the projectId parameter is intentionally made optional to support override implementations in subclasses. The base implementation requires projectId and includes an early return check, but making it optional allows derived classes to override the method with different parameter requirements.
🧬 Code Graph Analysis (2)
apps/web/core/components/issues/issue-layouts/quick-action-dropdowns/helper.tsx (1)
packages/ui/src/dropdowns/context-menu/root.tsx (1)
  • TContextMenuItem (12-25)
apps/web/core/components/issues/issue-detail/issue-detail-quick-actions.tsx (1)
apps/web/core/components/issues/issue-layouts/quick-action-dropdowns/issue-detail.tsx (1)
  • WorkItemDetailQuickActions (36-353)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (6)
apps/web/core/components/issues/issue-layouts/quick-action-dropdowns/helper.tsx (1)

277-291: LGTM! Clean implementation following established patterns.

The new useWorkItemDetailMenuItems hook is well-structured and follows the existing factory pattern used by other menu item hooks in this file. The memoization with correct dependencies ensures optimal performance.

apps/web/core/components/issues/issue-layouts/quick-action-dropdowns/index.ts (1)

9-9: Export addition looks good.

The new export for the issue-detail module is correctly placed and follows the established pattern.

apps/web/core/components/issues/issue-detail/issue-detail-quick-actions.tsx (1)

1-176: Excellent refactoring to delegate quick actions.

The component has been successfully simplified by delegating quick action UI and permission logic to WorkItemDetailQuickActions. This improves modularity and reduces code duplication while maintaining the same external API.

apps/web/core/components/issues/peek-overview/view.tsx (1)

55-84: Good implementation of local modal state management.

The shift from store-managed to locally-managed modal states improves component encapsulation. The isAnyLocalModalOpen flag properly coordinates with existing modal detection logic.

apps/web/core/components/issues/issue-layouts/quick-action-dropdowns/issue-detail.tsx (1)

36-353: Well-architected component that centralizes quick action logic.

This component successfully consolidates quick action dropdown functionality with:

  • Comprehensive permission checks
  • Proper modal state management
  • Clean separation between local and parent state coordination
  • Flexible menu item customization
  • Event tracking integration

Great job on the modular design!

apps/web/core/components/issues/peek-overview/header.tsx (1)

234-248: LGTM! Good refactoring to use the centralized quick actions component.

The integration of WorkItemDetailQuickActions properly centralizes the quick action controls and maintains all the necessary functionality with improved error handling and event tracking.

Copy link
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.

Actionable comments posted: 0

♻️ Duplicate comments (1)
apps/web/core/components/issues/peek-overview/header.tsx (1)

88-88: Verify parentRef assignment to DOM element.

The parentRef is declared but I don't see it being assigned to a DOM element in the current code. This could cause positioning issues for the WorkItemDetailQuickActions component.

#!/bin/bash
# Check if parentRef is properly assigned to DOM elements in the header component
rg -A 5 -B 5 "ref.*parentRef" --type ts --type tsx
🧹 Nitpick comments (2)
apps/web/core/components/issues/issue-layouts/quick-action-dropdowns/issue-detail.tsx (1)

149-149: Remove commented code.

The commented line should be removed to keep the codebase clean.

-  //   const MENU_ITEMS = useWorkItemDetailMenuItems(menuItemProps);
apps/web/core/components/issues/peek-overview/header.tsx (1)

156-172: Good archive handler implementation.

The handleArchiveIssue function properly handles the archive operation with navigation and event tracking, though it could benefit from error toast notification like the delete handler.

Consider adding error toast notification for consistency:

    } catch (error) {
+     setToast({
+       title: t("toast.error"),
+       type: TOAST_TYPE.ERROR,
+       message: t("entity.archive.failed", { entity: t("issue.label", { count: 1 }) }),
+     });
      captureError({
        eventName: WORK_ITEM_TRACKER_EVENTS.archive,
        payload: { id: issueId },
        error: error as Error,
      });
    }
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 251f482 and 32307b7.

📒 Files selected for processing (2)
  • apps/web/core/components/issues/issue-layouts/quick-action-dropdowns/issue-detail.tsx (1 hunks)
  • apps/web/core/components/issues/peek-overview/header.tsx (6 hunks)
🧰 Additional context used
🧠 Learnings (1)
apps/web/core/components/issues/peek-overview/header.tsx (1)
Learnt from: vamsikrishnamathala
PR: makeplane/plane#7061
File: web/core/components/workspace-notifications/root.tsx:18-18
Timestamp: 2025-05-14T13:16:23.323Z
Learning: In the Plane project codebase, the path alias `@/plane-web` resolves to the `ce` directory, making imports like `@/plane-web/hooks/use-notification-preview` correctly resolve to files in `web/ce/hooks/`.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (5)
apps/web/core/components/issues/issue-layouts/quick-action-dropdowns/issue-detail.tsx (3)

73-79: Good permission checking implementation.

The permission checking logic is well-implemented with proper use of the allowPermissions hook and considers both user permissions and read-only state.


186-232: Excellent modal management with dual state handling.

The modal components are well-implemented with proper state management that handles both local state and optional external toggle callbacks, providing flexibility for different use cases.


244-347: Robust menu rendering with submenu support.

The menu rendering logic properly handles both regular menu items and nested submenus, with consistent styling and event handling. The analytics tracking on menu item clicks is a good practice.

apps/web/core/components/issues/peek-overview/header.tsx (2)

131-154: Excellent error handling in delete handler.

The handleDeleteIssue function implements proper error handling with try/catch, appropriate success/error tracking, and user feedback via toast notifications.


234-247: Excellent refactoring to use centralized quick actions.

The integration with WorkItemDetailQuickActions is well-implemented, passing all necessary props and handlers while maintaining the component's flexibility with the isPeekMode flag.

@sriramveeraghanta sriramveeraghanta merged commit ac22df3 into preview Jul 15, 2025
5 of 6 checks passed
@sriramveeraghanta sriramveeraghanta deleted the chore-work-item-header-quick-action-enhancements branch July 15, 2025 19:22
lifeiscontent pushed a commit that referenced this pull request Aug 18, 2025
* chore: work item header quick action enhancements

* chore: code refactor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants