plane icon indicating copy to clipboard operation
plane copied to clipboard

[WEB-3751] chore: work item state icon improvement

Open anmolsinghbhatia opened this issue 7 months ago • 2 comments

Description

This PR introduces the implementation of a new project state icon.

Type of Change

  • [x] Improvement (change that would cause existing functionality to not work as expected)

References

[WEB-3751]

Summary by CodeRabbit

  • New Features

    • Added a visual progress indicator to state icons, showing each state's relative position within its group.
    • Introduced standardized icon sizing using predefined size keywords (e.g., "xs", "sm", "md", "lg", "xl") across the interface.
    • Included an "order" property for state objects to represent their normalized sequence within groups.
  • Enhancements

    • Updated default colors and simplified designs for state group icons to enhance visual clarity and consistency.
    • Refined icon components with new reusable dashed and progress circle elements for improved rendering.
  • Bug Fixes

    • Improved icon sizing and rendering consistency throughout the application.

anmolsinghbhatia avatar Apr 23 '25 09:04 anmolsinghbhatia

Walkthrough

This update introduces a normalized "order" or "percentage" field to project state objects, representing their relative position within their group. The backend now calculates and exposes this value in API responses, and the frontend TypeScript types are updated accordingly. UI components for state group icons are refactored to utilize this percentage, enabling visual progress indicators and standardized sizing using new size keywords. Icon implementations are modernized, with several new reusable components introduced for circular progress and dashed outlines. All usages of state group icons across the application are updated to use the new sizing and percentage props.

Changes

Files/Paths Change Summary
apiserver/plane/api/views/project.py,
apiserver/plane/app/views/project/base.py
Updated default color values for project states ("Backlog", "Todo", "Done", "Cancelled") during project creation.
apiserver/plane/app/serializers/state.py Added optional order field to StateSerializer and included it in serialized output.
apiserver/plane/app/views/state/base.py,
apiserver/plane/app/views/workspace/state.py
Enhanced state listing logic to compute and assign a normalized "order" value to each state within its group.
packages/types/src/state.d.ts Added non-optional numeric order property to IState interface.
packages/ui/src/icons/state/backlog-group-icon.tsx Refactored to use a simplified SVG with a new color and a DashedCircle component.
packages/ui/src/icons/state/cancelled-group-icon.tsx,
packages/ui/src/icons/state/completed-group-icon.tsx
Updated icon color and SVG path to new shapes and colors.
packages/ui/src/icons/state/dashed-circle.tsx Introduced new DashedCircle React component for rendering dashed circular shapes.
packages/ui/src/icons/state/helper.tsx Updated IStateGroupIcon interface, color mappings, and introduced STATE_GROUP_SIZES constant.
packages/ui/src/icons/state/progress-circle.tsx Added new ProgressCircle React component for circular progress visualization.
packages/ui/src/icons/state/started-group-icon.tsx,
packages/ui/src/icons/state/unstarted-group-icon.tsx
Refactored to use DashedCircle and ProgressCircle for progress display, updated colors, and added percentage prop.
packages/ui/src/icons/state/state-group-icon.tsx Refactored props: replaced explicit width/height with size and added percentage prop.
packages/ui/src/icons/type.ts Added optional percentage property to ISvgIcons interface.
space/core/components/issues/filters/applied-filters/state.tsx,
web/core/components/inbox/inbox-filter/applied-filters/state.tsx,
web/core/components/issues/issue-layouts/filters/applied-filters/state-group.tsx
Updated icon usage to use size="sm" instead of explicit width/height.
space/core/components/issues/issue-layouts/utils.tsx,
web/core/components/issues/issue-layouts/utils.tsx
Updated icon usage to use size="md" or size="lg" and added percentage prop where applicable.
web/ce/components/command-palette/actions/work-item-actions/change-state-list.tsx,
web/core/components/dropdowns/state.tsx,
web/core/components/home/widgets/recents/issue.tsx,
web/core/components/issues/issue-layouts/filters/applied-filters/state.tsx,
web/core/components/issues/issue-layouts/filters/header/filters/state.tsx,
web/core/components/project-states/state-item-title.tsx
Updated icon usage to pass new percentage prop derived from state order.
web/core/components/automation/auto-close-automation.tsx,
web/core/components/project-states/group-item.tsx
Updated icon usage to use new size prop.
web/core/store/state.store.ts Added getStatePercentageInGroup method to calculate a state's normalized position within its group.
packages/constants/src/icon.ts Added new enum EIconSize defining standardized icon sizes.
packages/constants/src/index.ts Exported the new icon size enum module.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant API
    participant Serializer
    participant Database

    Client->>API: Request list of states (optionally grouped)
    API->>Database: Fetch states for project/workspace
    Database-->>API: Return states
    API->>Serializer: Serialize states
    Serializer-->>API: States with "order" field computed per group
    API-->>Client: Return states (with "order" field)
    Client->>UI: Render StateGroupIcon with size and percentage props
    UI->>StateGroupIcon: Pass order as percentage
    StateGroupIcon->>DashedCircle/ProgressCircle: Render visual indicator based on percentage

Suggested reviewers

  • prateekshourya29
  • sriramveeraghanta

Poem

In circles dashed and colors new,
The states now march in ordered queue.
With progress arcs and sizes neat,
Each icon’s look is quite the treat!
Backend and frontend, paw in paw,
Show progress clear—oh, what I saw!
🐇✨ Hopping forward, code anew!


📜 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 734c6240ff315e858d915e103d5d5a966e6fe83f and d3636dff71cb0cc87b9779996178f1f858b080ca.

📒 Files selected for processing (1)
  • apiserver/plane/app/serializers/state.py (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • apiserver/plane/app/serializers/state.py
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Analyze (javascript)
  • GitHub Check: Analyze (python)
✨ 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 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.

coderabbitai[bot] avatar Apr 23 '25 09:04 coderabbitai[bot]

Pull Request Linked with Plane Work Items

Comment Automatically Generated by Plane

makeplane[bot] avatar Apr 23 '25 09:04 makeplane[bot]