Skip to content

[WEB-3827] refactor: work item widget components#6902

Merged
pushya22 merged 1 commit intopreviewfrom
refactor/issue-widget-components
Apr 9, 2025
Merged

[WEB-3827] refactor: work item widget components#6902
pushya22 merged 1 commit intopreviewfrom
refactor/issue-widget-components

Conversation

@aaryan610
Copy link
Member

@aaryan610 aaryan610 commented Apr 9, 2025

Description

This PR refactors the work item widget components in the following ways-

  1. Added a new prop issueServiceType from the root level to add support for widgets in different places.
  2. Added hideWIdgets props for the ability to show only selected widgets.

Type of Change

  • Code refactoring

Summary by CodeRabbit

  • New Features
    • Enhanced the issue detail view to support configurable widget visibility, allowing certain sections (like attachments, links, sub-items, and relations) to be selectively displayed for a more tailored experience.
    • Improved consistency in service settings across issue interaction components, ensuring a more predictable and reliable user interface behavior.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Apr 9, 2025

Walkthrough

This pull request updates multiple components by enforcing the explicit provision of the issueServiceType prop—changing it from optional to required—and by introducing an optional hideWidgets array in widget-related components. The modifications remove default values for issueServiceType and update the destructuring logic. Additionally, conditional rendering has been added for various action buttons and collapsible sections based on the values provided in hideWidgets. These changes enhance type safety and configurability across the issue detail widgets.

Changes

File(s) Change Summary
web/core/components/issues/issue-detail-widgets/action-buttons.tsx, .../root.tsx, .../issue-detail-widget-collapsibles.tsx, .../issue-detail-widget-modals.tsx Added new props: issueServiceType (required) and optional hideWidgets; updated prop destructuring and conditional rendering logic to control widget visibility and pass issueServiceType to child components.
web/core/components/issues/issue-detail-widgets/attachments/*, web/core/components/issues/issue-detail-widgets/links/*, web/core/components/issues/issue-detail-widgets/relations/*, web/core/components/issues/issue-detail-widgets/sub-issues/* Converted issueServiceType from optional to required across various widget components by removing default fallback values, ensuring explicit prop provision.
web/core/components/issues/issue-detail/links/*, web/core/components/issues/issue-detail/main-content.tsx Updated type definitions and prop handling for issueServiceType; added new import for constants and passed the prop to modals and widgets for consistent usage.
web/core/components/issues/peek-overview/view.tsx Added explicit issueServiceType prop to both rendering paths of IssueDetailWidgets within the peek overview.

Sequence Diagram(s)

sequenceDiagram
  participant U as User
  participant W as IssueDetailWidgets
  participant AB as ActionButtons
  participant C as Collapsibles
  participant M as Modals

  U->>W: Render with { issueServiceType, hideWidgets }
  W->>AB: Pass props for action buttons
  W->>C: Pass props for collapsible sections
  W->>M: Pass props for modals
  AB->>U: Conditionally render buttons based on hideWidgets
  C->>U: Render collapsible sections accordingly
  M->>U: Display modals with issueServiceType
Loading

Possibly related PRs

Suggested labels

🌟improvement, 🌐frontend

Suggested reviewers

  • prateekshourya29
  • sriramveeraghanta

Poem

I’m a bunny in a code burrow so neat,
Hopping through files with a spring in my feet.
Props made explicit, no defaults to hide,
With issueServiceType guiding each stride.
In a flutter of widgets, I celebrate this treat! 🐰
Hop on for a code adventure, ever so sweet!


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 993c789 and 959f0d9.

📒 Files selected for processing (19)
  • web/core/components/issues/issue-detail-widgets/action-buttons.tsx (1 hunks)
  • web/core/components/issues/issue-detail-widgets/attachments/quick-action-button.tsx (2 hunks)
  • web/core/components/issues/issue-detail-widgets/attachments/root.tsx (2 hunks)
  • web/core/components/issues/issue-detail-widgets/issue-detail-widget-collapsibles.tsx (3 hunks)
  • web/core/components/issues/issue-detail-widgets/issue-detail-widget-modals.tsx (3 hunks)
  • web/core/components/issues/issue-detail-widgets/links/content.tsx (1 hunks)
  • web/core/components/issues/issue-detail-widgets/links/quick-action-button.tsx (1 hunks)
  • web/core/components/issues/issue-detail-widgets/links/root.tsx (2 hunks)
  • web/core/components/issues/issue-detail-widgets/links/title.tsx (2 hunks)
  • web/core/components/issues/issue-detail-widgets/relations/quick-action-button.tsx (2 hunks)
  • web/core/components/issues/issue-detail-widgets/relations/root.tsx (2 hunks)
  • web/core/components/issues/issue-detail-widgets/root.tsx (2 hunks)
  • web/core/components/issues/issue-detail-widgets/sub-issues/quick-action-button.tsx (2 hunks)
  • web/core/components/issues/issue-detail-widgets/sub-issues/root.tsx (2 hunks)
  • web/core/components/issues/issue-detail/links/create-update-link-modal.tsx (2 hunks)
  • web/core/components/issues/issue-detail/links/link-list.tsx (2 hunks)
  • web/core/components/issues/issue-detail/links/root.tsx (3 hunks)
  • web/core/components/issues/issue-detail/main-content.tsx (2 hunks)
  • web/core/components/issues/peek-overview/view.tsx (2 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (16)
web/core/components/issues/issue-detail-widgets/links/quick-action-button.tsx (1)
packages/types/src/issues/issue.d.ts (1)
  • TIssueServiceType (123-123)
web/core/components/issues/issue-detail-widgets/links/content.tsx (1)
packages/types/src/issues/issue.d.ts (1)
  • TIssueServiceType (123-123)
web/core/components/issues/issue-detail-widgets/action-buttons.tsx (2)
packages/types/src/issues/issue.d.ts (1)
  • TIssueServiceType (123-123)
web/core/components/issues/issue-detail-widgets/root.tsx (1)
  • TWorkItemWidgets (13-13)
web/core/components/issues/issue-detail-widgets/issue-detail-widget-modals.tsx (1)
packages/types/src/issues/issue.d.ts (1)
  • TIssueServiceType (123-123)
web/core/components/issues/issue-detail-widgets/relations/root.tsx (1)
packages/types/src/issues/issue.d.ts (1)
  • TIssueServiceType (123-123)
web/core/components/issues/issue-detail/links/link-list.tsx (1)
packages/types/src/issues/issue.d.ts (1)
  • TIssueServiceType (123-123)
web/core/components/issues/issue-detail-widgets/links/root.tsx (1)
packages/types/src/issues/issue.d.ts (1)
  • TIssueServiceType (123-123)
web/core/components/issues/issue-detail-widgets/root.tsx (3)
packages/types/src/issues/issue.d.ts (1)
  • TIssueServiceType (123-123)
web/core/components/issues/issue-detail-widgets/issue-detail-widget-collapsibles.tsx (1)
  • IssueDetailWidgetCollapsibles (29-98)
web/core/components/issues/issue-detail-widgets/issue-detail-widget-modals.tsx (1)
  • IssueDetailWidgetModals (23-185)
web/core/components/issues/issue-detail/links/create-update-link-modal.tsx (1)
packages/types/src/issues/issue.d.ts (1)
  • TIssueServiceType (123-123)
web/core/components/issues/issue-detail-widgets/sub-issues/root.tsx (1)
packages/types/src/issues/issue.d.ts (1)
  • TIssueServiceType (123-123)
web/core/components/issues/issue-detail-widgets/attachments/quick-action-button.tsx (1)
packages/types/src/issues/issue.d.ts (1)
  • TIssueServiceType (123-123)
web/core/components/issues/issue-detail-widgets/attachments/root.tsx (1)
packages/types/src/issues/issue.d.ts (1)
  • TIssueServiceType (123-123)
web/core/components/issues/issue-detail-widgets/links/title.tsx (1)
packages/types/src/issues/issue.d.ts (1)
  • TIssueServiceType (123-123)
web/core/components/issues/issue-detail-widgets/issue-detail-widget-collapsibles.tsx (6)
packages/types/src/issues/issue.d.ts (1)
  • TIssueServiceType (123-123)
web/core/components/issues/issue-detail-widgets/root.tsx (1)
  • TWorkItemWidgets (13-13)
web/core/hooks/store/use-issue-detail.ts (1)
  • useIssueDetail (9-14)
web/core/components/issues/issue-detail-widgets/relations/root.tsx (1)
  • RelationsCollapsible (19-48)
web/core/components/issues/issue-detail-widgets/links/root.tsx (1)
  • LinksCollapsible (20-50)
web/core/components/issues/issue-detail-widgets/attachments/root.tsx (1)
  • AttachmentsCollapsible (23-56)
web/core/components/issues/issue-detail-widgets/relations/quick-action-button.tsx (1)
packages/types/src/issues/issue.d.ts (1)
  • TIssueServiceType (123-123)
web/core/components/issues/issue-detail-widgets/sub-issues/quick-action-button.tsx (1)
packages/types/src/issues/issue.d.ts (1)
  • TIssueServiceType (123-123)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Analyze (javascript)
  • GitHub Check: Analyze (python)
🔇 Additional comments (47)
web/core/components/issues/issue-detail/links/root.tsx (3)

5-6: Appropriate import addition.

The import for EIssueServiceType from "@plane/constants" is correctly added to support the new prop requirement.


93-93: Improved error handling.

The error variable has been removed from the catch clause since it wasn't being used in the toast message, making the code cleaner.


115-115: Correctly implemented the issueServiceType prop.

The issueServiceType prop is now explicitly passed to the IssueLinkCreateUpdateModal component, aligning with the PR's goal of making this prop required rather than using default values.

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

202-202: Correctly implemented the issueServiceType prop.

The issueServiceType prop is now explicitly provided to the IssueDetailWidgets component in the side-peek/modal view, ensuring consistent behavior across different views.


242-242: Consistent implementation of the issueServiceType prop.

The issueServiceType prop is also correctly added to the IssueDetailWidgets component in the full-screen view, maintaining consistency with the previous implementation.

web/core/components/issues/issue-detail/main-content.tsx (2)

6-6: Appropriate import addition.

The import for EIssueServiceType from "@plane/constants" is correctly added to support the new prop requirement.


182-182: Correctly implemented the issueServiceType prop.

The issueServiceType prop is now explicitly passed to the IssueDetailWidgets component in the main content view, aligning with the PR's goal of making this prop required across all components.

web/core/components/issues/issue-detail-widgets/links/content.tsx (2)

14-14: Improvement in type safety.

The issueServiceType prop is now correctly marked as required in the Props type definition, which enhances type safety by ensuring this value is always provided when the component is used.


18-18: Consistent prop destructuring.

The default value assignment for issueServiceType has been removed from the props destructuring, which is consistent with making it a required prop. This ensures that the component relies on the explicitly provided value rather than a default.

web/core/components/issues/issue-detail-widgets/issue-detail-widget-modals.tsx (4)

3-3: Import update for TIssueServiceType is appropriate.

The import has been correctly updated to include TIssueServiceType from the @plane/types package, which is necessary for the new required prop.


20-20: Good addition of required issueServiceType prop.

Adding issueServiceType as a required prop enhances type safety by ensuring this value is always provided when using this component.


24-24: Props destructuring correctly updated.

The destructuring has been properly updated to include the new issueServiceType prop.


150-150: Proper prop passing to child component.

The issueServiceType prop is correctly passed down to the IssueLinkCreateUpdateModal component, maintaining the prop drilling pattern used in this codebase.

web/core/components/issues/issue-detail-widgets/relations/root.tsx (2)

16-16: Changed issueServiceType from optional to required.

This change enforces proper typing and ensures the component always receives the necessary information about the issue service type.


20-20: Removed default value for issueServiceType.

The default value for issueServiceType has been removed from the props destructuring since it's now a required prop. This is consistent with the type definition change and ensures explicit prop passing.

web/core/components/issues/issue-detail-widgets/links/root.tsx (2)

17-17: Changed issueServiceType from optional to required.

Making this prop required ensures type safety and follows the pattern of explicitly requiring all necessary props.


21-21: Removed default value for issueServiceType.

Properly removed the default value from props destructuring since issueServiceType is now a required prop. This ensures consistency with the updated type definition.

web/core/components/issues/issue-detail-widgets/links/quick-action-button.tsx (2)

13-13: Changed issueServiceType from optional to required.

This change enforces that all consumers of this component must provide the issueServiceType prop, improving type safety and preventing potential runtime errors.


17-17: Removed default value for issueServiceType.

The default value has been correctly removed from props destructuring, consistent with making issueServiceType a required prop in the type definition.

web/core/components/issues/issue-detail/links/link-list.tsx (2)

17-17: Changing issueServiceType from optional to required improves type safety.

Making this prop required ensures that all consumers of the LinkList component will explicitly provide an issue service type, preventing potential undefined references in the hook call on line 26.


22-22: Correctly removed default value for required prop.

Since issueServiceType is now a required prop in the type definition, removing the default value assignment is appropriate and consistent with TypeScript best practices.

web/core/components/issues/issue-detail-widgets/action-buttons.tsx (2)

23-24: Adding issueServiceType as required and hideWidgets as optional enhances configurability.

These new props improve type safety and allow for more flexible widget rendering, aligning with the PR objective of supporting widgets in various locations.


34-90: Well-implemented conditional rendering based on the hideWidgets array.

The refactoring to conditionally render each widget button based on the hideWidgets array is clean and consistent. Each action button now receives the required issueServiceType prop, and the optional chaining operator (?.) is appropriately used since hideWidgets is optional.

web/core/components/issues/issue-detail-widgets/sub-issues/quick-action-button.tsx (2)

16-16: Changing issueServiceType from optional to required improves type safety.

This change ensures that the SubIssuesActionButton component will always receive the necessary issueServiceType for proper functioning in the useIssueDetail hook.


20-20: Correctly removed default value for required prop.

Since issueServiceType is now a required prop in the type definition, removing the default value assignment is appropriate and consistent with TypeScript best practices.

web/core/components/issues/issue-detail-widgets/attachments/quick-action-button.tsx (2)

23-23: Changing issueServiceType from optional to required improves type safety.

This change ensures that the component will always receive the necessary issueServiceType for proper functioning with the useIssueDetail hook and attachment operations.


27-27: Correctly removed default value for required prop.

Since issueServiceType is now a required prop in the type definition, removing the default value assignment is appropriate and consistent with TypeScript best practices.

web/core/components/issues/issue-detail-widgets/root.tsx (4)

13-13: Well-defined work item widgets type!

Clear and expressive type definition for the widget options that can be hidden. This makes the API more intuitive for consumers of this component.


21-22: Good type safety improvement

Making issueServiceType required and adding the optional hideWidgets array improves type safety and provides better configurability for the component.


26-34: Effective props destructuring

Clean destructuring of the new props, maintaining clear separation and default values where appropriate.


44-45: Consistent prop forwarding

The new props are consistently passed down to all relevant child components, ensuring proper propagation of configuration throughout the widget hierarchy.

Also applies to: 52-53, 61-62

web/core/components/issues/issue-detail-widgets/sub-issues/root.tsx (2)

17-17: Improved type safety by requiring issueServiceType

Making issueServiceType a required prop ensures that consumers must explicitly provide this value, eliminating potential runtime errors from undefined values.


21-21: Removed default value for issueServiceType

The default value for issueServiceType has been removed, enforcing explicit provision of this prop from parent components. This is consistent with the type definition changes.

web/core/components/issues/issue-detail-widgets/links/title.tsx (2)

17-17: Improved type safety by requiring issueServiceType

Making issueServiceType a required prop in this component aligns with the changes in other components and ensures consistent usage patterns.


21-21: Consistent removal of default value

Removing the default value for issueServiceType is consistent with the changes in other components, enforcing explicit provision of this important configuration prop.

web/core/components/issues/issue-detail-widgets/attachments/root.tsx (2)

20-20: Consistent type safety improvement

Making issueServiceType required here maintains consistency with the changes in other components and improves type safety.


24-24: Removed default value for consistency

The default value for issueServiceType has been removed, which aligns with the pattern established in other components and enforces explicit provision of this prop.

web/core/components/issues/issue-detail-widgets/relations/quick-action-button.tsx (2)

19-19: Type safety improvement: Required prop instead of optional

Changing issueServiceType from optional to required is a good improvement as it explicitly communicates that this prop is necessary for the component to function correctly. This enforces proper usage by parent components and reduces potential runtime errors.


23-23: Removed default value to match required prop

Removing the default value for issueServiceType in the destructuring is consistent with making the prop required in the type definition. This ensures the component will properly handle the explicitly provided value.

web/core/components/issues/issue-detail/links/create-update-link-modal.tsx (2)

26-26: Type safety improvement: Required prop instead of optional

Making issueServiceType a required prop is a good practice as it ensures that the component will always have the necessary context to function correctly. This change forces callers to explicitly provide the service type.


35-35: Removed default value to match required prop

Removing the default value for issueServiceType in the destructuring is consistent with making the prop required in the type definition. This ensures the correct issue service context is always used.

web/core/components/issues/issue-detail-widgets/issue-detail-widget-collapsibles.tsx (6)

5-5: Added import for TIssueServiceType

Adding the import for TIssueServiceType is necessary to support the new required prop. This is consistent with the changes in other files.


25-26: Added new props for improved type safety and configurability

Good addition of two key props:

  1. Required issueServiceType for consistent context handling
  2. Optional hideWidgets array to allow selective display of widgets

This implementation directly addresses the PR objectives of enhancing support for widgets in various locations and providing control over widget visibility.


30-30: Updated destructuring to include new props

The props destructuring has been correctly updated to include the new issueServiceType and hideWidgets props, making them available for use within the component.


37-37: Passing issueServiceType to useIssueDetail

Correctly passing the issueServiceType to the useIssueDetail hook ensures that the correct store implementation is used based on the type of issue being displayed (regular issues, epics, or work items).


44-51: Added conditional rendering based on hideWidgets

The rendering conditions for each widget section now include checks against the hideWidgets array, allowing selective display of widgets as specified in the PR objectives. This implementation provides the flexibility to show only the widgets that users choose.


61-61: Passed issueServiceType to child components

Passing the issueServiceType prop to all child components ensures consistent behavior throughout the component hierarchy. This propagation is necessary for the child components to use the correct service type context.

Also applies to: 69-70, 78-79, 87-87

✨ 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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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 resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @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.

@pushya22 pushya22 changed the title refactor: work item widget components [WEB-3827] refactor: work item widget components Apr 9, 2025
@makeplane
Copy link

makeplane bot commented Apr 9, 2025

Pull Request Linked with Plane Work Items

Comment Automatically Generated by Plane

@pushya22 pushya22 merged commit a3fd616 into preview Apr 9, 2025
5 of 6 checks passed
@pushya22 pushya22 deleted the refactor/issue-widget-components branch April 9, 2025 14:28
@coderabbitai coderabbitai bot mentioned this pull request Apr 15, 2025
1 task
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.

4 participants