Skip to content

[WEB-3808] fix: replaced the profile charts with propel components#6892

Merged
sriramveeraghanta merged 1 commit intopreviewfrom
fix-profile-charts
Apr 9, 2025
Merged

[WEB-3808] fix: replaced the profile charts with propel components#6892
sriramveeraghanta merged 1 commit intopreviewfrom
fix-profile-charts

Conversation

@gakshita
Copy link
Collaborator

@gakshita gakshita commented Apr 8, 2025

Description

Replaced the priority and state distribution charts on the profile page with propel components.

References

[WEB-3808]

Summary by CodeRabbit

  • New Features

    • Enabled dynamic color assignment for bar charts, allowing colors to depend on payload data.
    • Introduced customizable legends for pie charts, offering enhanced control over chart presentation.
  • Refactor

    • Updated profile distribution visualizations by replacing legacy components with redesigned bar and pie charts.
    • Streamlined data mapping and chart configurations for improved clarity and visual appeal.

@makeplane
Copy link

makeplane bot commented Apr 8, 2025

Pull Request Linked with Plane Work Items

Comment Automatically Generated by Plane

@gakshita gakshita changed the title [WEB-3775] fix: replaced the profile charts with propel components [WEB-3808] fix: replaced the profile charts with propel components Apr 8, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Apr 8, 2025

Walkthrough

The changes update how chart components compute their color fills and adjust their configuration. In the BarChart component, the fill property is now assigned conditionally based on whether it is a function. The type definitions for chart properties have been expanded to support dynamic fill values and custom legends. Additionally, the profile overview components have been revised to replace legacy graph components with new chart components, update data mappings, and simplify tooltip and color logic.

Changes

File(s) Change Summary
packages/propel/.../bar-chart/root.tsx
packages/types/.../charts.d.ts
Updated BarChart’s fill property: now conditionally invokes a function if provided. In charts.d.ts, the TBarItem type’s fill property is now a union (`string
web/core/.../priority-distribution.tsx Replaced the BarGraph component with BarChart, updated data mapping (using key, name, count), introduced xAxis and yAxis, and added a priorityColors object while removing previous tooltip and color logic.
web/core/.../state-distribution.tsx Replaced PieGraph with PieChart. Modified data transformation to include a formatted name via a helper function, simplified the color fallback, adjusted chart configurations (margin, innerRadius, tooltip, and label settings), and updated layout classes.

Sequence Diagram(s)

sequenceDiagram
    participant BC as BarChart Component
    participant Bar as Bar
    participant Payload as shapeProps.payload
    BC->>Bar: Iterate over bars for rendering
    alt bar.fill is a function
        BC->>Bar: Call bar.fill(Payload)
        Bar-->>BC: Return dynamic fill color
    else
        BC-->>Bar: Use bar.fill value directly
    end
    BC->>Bar: Render bar with computed fill
Loading
sequenceDiagram
    participant PSD as ProfileStateDistribution
    participant Helper as capitalizeFirstLetter
    participant PC as PieChart Component
    PSD->>Helper: Format group.state_group
    Helper-->>PSD: Return formatted name
    PSD->>PC: Pass mapped data (name, id, key, color)
    PC-->>PSD: Render chart with innerRadius, margins, and tooltip/label settings
Loading

Poem

Hopping through the lines of code so bright,
I tweak the charts to dance in light.
Dynamic fills and legends sing,
As graphs take on a vibrant zing.
A bunny’s cheer for change done right!


📜 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 270f282 and 35a193d.

📒 Files selected for processing (4)
  • packages/propel/src/charts/bar-chart/root.tsx (1 hunks)
  • packages/types/src/charts.d.ts (2 hunks)
  • web/core/components/profile/overview/priority-distribution.tsx (3 hunks)
  • web/core/components/profile/overview/state-distribution.tsx (2 hunks)
🧰 Additional context used
🧬 Code Definitions (2)
web/core/components/profile/overview/priority-distribution.tsx (2)
packages/propel/src/charts/bar-chart/root.tsx (1)
  • BarChart (24-162)
packages/i18n/src/store/index.ts (1)
  • t (231-252)
web/core/components/profile/overview/state-distribution.tsx (2)
packages/propel/src/charts/pie-chart/root.tsx (1)
  • PieChart (12-150)
packages/constants/src/state.ts (1)
  • STATE_GROUPS (13-45)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (8)
packages/propel/src/charts/bar-chart/root.tsx (1)

66-66: Enhanced flexibility for dynamic bar coloring

The change to conditionally check if bar.fill is a function and call it with the payload data enables dynamic color assignment based on the content, which is a good improvement for visualization capabilities.

web/core/components/profile/overview/priority-distribution.tsx (3)

5-5: Updated import to use Propel component

The import has been changed to use the BarChart component from the Propel package, which aligns with the PR objective of replacing profile charts with Propel components.


19-25: Well-defined priority color mapping

A clear and organized color mapping has been established for different priority levels, which will ensure consistent visual representation across the application.


35-64: Comprehensive BarChart configuration

The new chart implementation provides improved configuration with explicit margin settings, dynamic fill coloring based on priority, and localized axis labels. This makes the chart more maintainable and customizable.

A nice addition is the use of the capitalizeFirstLetter helper function to ensure consistent display format for priority labels.

packages/types/src/charts.d.ts (2)

46-46: Enhanced type flexibility for dynamic fills

The fill property type has been expanded to support both static strings and dynamic functions that accept payload data, enabling more sophisticated coloring logic in charts.


119-119: Added support for custom legend rendering

The new customLegend property enables more flexible and tailored legend rendering in pie charts, which improves the customization capabilities of the charting system.

web/core/components/profile/overview/state-distribution.tsx (2)

4-10: Updated imports for Propel integration

The imports have been updated to use the PieChart from Propel package and added a helper function for text formatting, which streamlines the implementation.


28-57: Improved PieChart implementation with better configuration

The new PieChart implementation provides:

  1. Better margin control
  2. Consistent data transformation
  3. Appropriate inner radius for donut chart style
  4. Configurable padding and corner radius

This implementation is more maintainable and visually consistent with the design system.

✨ 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.

@sriramveeraghanta sriramveeraghanta merged commit 6701345 into preview Apr 9, 2025
5 of 6 checks passed
@sriramveeraghanta sriramveeraghanta deleted the fix-profile-charts branch April 9, 2025 09:20
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.

3 participants