Skip to content

[WEB-4130] fix: cycle charts minor optimizations#7123

Merged
sriramveeraghanta merged 2 commits intopreviewfrom
fix-cycle-chart-optimization
May 27, 2025
Merged

[WEB-4130] fix: cycle charts minor optimizations#7123
sriramveeraghanta merged 2 commits intopreviewfrom
fix-cycle-chart-optimization

Conversation

@gakshita
Copy link
Collaborator

@gakshita gakshita commented May 26, 2025

Description

  • Changed points to Estimates in dropdown to be inclusive of all estimate types
  • Added computed function for project's estimate type
  • Hide the cycle chart estimate type switcher dropdown when estimate type is category

References

[WEB-4130]

Summary by CodeRabbit

  • New Features

    • The estimate type dropdown now reacts to real-time data updates for improved user experience.
    • The dropdown is hidden when the estimate system is set to "Categories", providing a more streamlined interface.
  • Style

    • The "Points" label in cycle estimate options has been renamed to "Estimates" for greater clarity.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented May 26, 2025

Walkthrough

The changes update UI labeling for estimate options, enhance the EstimateTypeDropdown component with MobX reactivity and refined rendering logic, and introduce a computed property for accessing the current project estimate type within the MobX store.

Changes

File(s) Summary
web/core/components/cycles/analytics-sidebar/issue-progress.tsx Changed the "points" option label in cycleEstimateOptions from "Points" to "Estimates".
web/core/components/cycles/dropdowns/estimate-type-dropdown.tsx Wrapped EstimateTypeDropdown with MobX observer, refined dropdown rendering logic, and updated imports.
web/core/store/estimates/project-estimate.store.ts Added currentProjectEstimateType computed property to the MobX store and its interface.

Sequence Diagram(s)

sequenceDiagram
  participant UI as User Interface
  participant Dropdown as EstimateTypeDropdown (observer)
  participant Store as ProjectEstimateStore

  UI->>Dropdown: Render component
  Dropdown->>Store: Access areEstimateEnabledByProjectId, currentProjectEstimateType
  Store-->>Dropdown: Return observable values
  Dropdown-->>UI: Conditionally render dropdown based on store state and estimate type
Loading

Suggested labels

🐛bug, 🌐frontend, 🌟improvement, ready_to_merge

Suggested reviewers

  • prateekshourya29
  • anmolsinghbhatia

Poem

A dropdown now observes with care,
Showing options only when they're fair.
"Points" become "Estimates"—a subtle shift,
MobX brings the UI a reactive lift.
The store knows which estimate's in play,
Hopping forward, the rabbit says: "Yay!" 🐇✨

✨ 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 May 26, 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: 0

🧹 Nitpick comments (1)
web/core/components/cycles/dropdowns/estimate-type-dropdown.tsx (1)

21-21: Simplify the unnecessary ternary operator.

The ternary operator is redundant since the condition already evaluates to a boolean.

Apply this diff to simplify the expression:

-  const isCurrentProjectEstimateEnabled = projectId && areEstimateEnabledByProjectId(projectId) ? true : false;
+  const isCurrentProjectEstimateEnabled = Boolean(projectId && areEstimateEnabledByProjectId(projectId));

Or even simpler, since areEstimateEnabledByProjectId likely returns a boolean:

-  const isCurrentProjectEstimateEnabled = projectId && areEstimateEnabledByProjectId(projectId) ? true : false;
+  const isCurrentProjectEstimateEnabled = projectId && areEstimateEnabledByProjectId(projectId);
🧰 Tools
🪛 Biome (1.9.4)

[error] 21-21: Unnecessary use of boolean literals in conditional expression.

Simplify your code by directly assigning the result without using a ternary operator.
If your goal is negation, you may use the logical NOT (!) or double NOT (!!) operator for clearer and concise code.
Check for more details about NOT operator.
Unsafe fix: Remove the conditional expression with

(lint/complexity/noUselessTernary)

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 04c7c53 and 2870968.

📒 Files selected for processing (3)
  • web/core/components/cycles/analytics-sidebar/issue-progress.tsx (1 hunks)
  • web/core/components/cycles/dropdowns/estimate-type-dropdown.tsx (3 hunks)
  • web/core/store/estimates/project-estimate.store.ts (3 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (2)
web/core/store/estimates/project-estimate.store.ts (1)
packages/types/src/estimate.d.ts (1)
  • TEstimateSystemKeys (17-17)
web/core/components/cycles/dropdowns/estimate-type-dropdown.tsx (2)
web/core/hooks/store/use-cycle.ts (1)
  • useCycle (7-11)
web/core/store/estimates/project-estimate.store.ts (1)
  • currentProjectEstimate (79-81)
🪛 Biome (1.9.4)
web/core/components/cycles/dropdowns/estimate-type-dropdown.tsx

[error] 21-21: Unnecessary use of boolean literals in conditional expression.

Simplify your code by directly assigning the result without using a ternary operator.
If your goal is negation, you may use the logical NOT (!) or double NOT (!!) operator for clearer and concise code.
Check for more details about NOT operator.
Unsafe fix: Remove the conditional expression with

(lint/complexity/noUselessTernary)

⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Analyze (javascript)
  • GitHub Check: Analyze (python)
🔇 Additional comments (9)
web/core/store/estimates/project-estimate.store.ts (3)

30-30: LGTM! Well-defined computed property interface.

The addition of currentProjectEstimate to the interface is properly typed and follows consistent patterns with other computed properties.


67-67: LGTM! Proper MobX configuration.

The computed property is correctly included in the makeObservable configuration, ensuring reactive updates when dependencies change.


79-81: LGTM! Correct implementation with proper null safety.

The computed property correctly:

  • Uses optional chaining to safely access the estimate type
  • Returns undefined when no active estimate exists
  • Leverages the existing currentActiveEstimateId computed property

This implementation supports the UI enhancement in the dropdown component.

web/core/components/cycles/analytics-sidebar/issue-progress.tsx (1)

35-35: LGTM! Improved terminology for estimate types.

Changing the label from "Points" to "Estimates" better reflects the broader estimate type handling and is more inclusive of different estimate systems. This aligns well with the overall PR objective to improve estimate type management.

web/core/components/cycles/dropdowns/estimate-type-dropdown.tsx (5)

2-2: LGTM! Proper MobX integration.

Adding the observer wrapper enables reactive updates when the underlying MobX store state changes, which is essential for the new estimate type logic.


4-4: LGTM! Necessary import for estimate system check.

The EEstimateSystem enum import is required for comparing against EEstimateSystem.CATEGORIES in the rendering condition.


17-17: LGTM! Proper observer pattern implementation.

The component is correctly wrapped with observer to ensure reactive updates when MobX observables change.

Also applies to: 42-42


20-20: LGTM! Accessing the new computed property.

Destructuring currentProjectEstimate from useProjectEstimates() correctly accesses the new computed property added to the MobX store.


22-23: LGTM! Smart conditional rendering for estimate types.

The enhanced rendering condition correctly hides the dropdown when the current project estimate system is set to CATEGORIES, which aligns with the PR objective to improve estimate type handling. The logic properly combines multiple conditions:

  1. Points data availability OR estimates enabled for the project
  2. AND the estimate system is NOT categories

This prevents showing the dropdown when it's not applicable for category-based estimates.

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

🧹 Nitpick comments (1)
web/core/components/cycles/dropdowns/estimate-type-dropdown.tsx (1)

21-21: Simplify the unnecessary ternary operator.

The ternary operator is redundant since the expression already evaluates to a boolean value.

Apply this diff to simplify the code:

-  const isCurrentProjectEstimateEnabled = projectId && areEstimateEnabledByProjectId(projectId) ? true : false;
+  const isCurrentProjectEstimateEnabled = !!(projectId && areEstimateEnabledByProjectId(projectId));

Alternatively, if you're confident that areEstimateEnabledByProjectId always returns a boolean:

-  const isCurrentProjectEstimateEnabled = projectId && areEstimateEnabledByProjectId(projectId) ? true : false;
+  const isCurrentProjectEstimateEnabled = projectId && areEstimateEnabledByProjectId(projectId);
🧰 Tools
🪛 Biome (1.9.4)

[error] 21-21: Unnecessary use of boolean literals in conditional expression.

Simplify your code by directly assigning the result without using a ternary operator.
If your goal is negation, you may use the logical NOT (!) or double NOT (!!) operator for clearer and concise code.
Check for more details about NOT operator.
Unsafe fix: Remove the conditional expression with

(lint/complexity/noUselessTernary)

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 2870968 and aef50f9.

📒 Files selected for processing (2)
  • web/core/components/cycles/dropdowns/estimate-type-dropdown.tsx (3 hunks)
  • web/core/store/estimates/project-estimate.store.ts (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • web/core/store/estimates/project-estimate.store.ts
🧰 Additional context used
🧬 Code Graph Analysis (1)
web/core/components/cycles/dropdowns/estimate-type-dropdown.tsx (2)
web/core/hooks/store/use-cycle.ts (1)
  • useCycle (7-11)
web/core/store/estimates/project-estimate.store.ts (1)
  • currentProjectEstimateType (79-81)
🪛 Biome (1.9.4)
web/core/components/cycles/dropdowns/estimate-type-dropdown.tsx

[error] 21-21: Unnecessary use of boolean literals in conditional expression.

Simplify your code by directly assigning the result without using a ternary operator.
If your goal is negation, you may use the logical NOT (!) or double NOT (!!) operator for clearer and concise code.
Check for more details about NOT operator.
Unsafe fix: Remove the conditional expression with

(lint/complexity/noUselessTernary)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (4)
web/core/components/cycles/dropdowns/estimate-type-dropdown.tsx (4)

2-2: LGTM! Imports are properly used.

The new imports for observer and EEstimateSystem are correctly utilized in the component for MobX reactivity and conditional rendering logic.

Also applies to: 4-4


17-17: LGTM! Proper MobX observer implementation.

Wrapping the component with observer is correct since it now uses currentProjectEstimateType from the MobX store, ensuring reactive updates when the observable state changes.

Also applies to: 42-42


20-20: LGTM! Proper use of the new computed property.

The addition of currentProjectEstimateType to the destructuring is correct and aligns with the computed property defined in the ProjectEstimateStore class.


22-23: LGTM! Conditional logic correctly implements the requirement.

The addition of currentProjectEstimateType !== EEstimateSystem.CATEGORIES properly hides the dropdown when the estimate type is set to "category", which aligns perfectly with the PR objectives.

@sriramveeraghanta sriramveeraghanta merged commit b4bc499 into preview May 27, 2025
5 of 6 checks passed
@sriramveeraghanta sriramveeraghanta deleted the fix-cycle-chart-optimization branch May 27, 2025 19:24
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.

3 participants