-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
✨ (dashboards) piecharts - sorting and label spacing #3855
base: master
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for actualbudget ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Bundle Stats — desktop-clientHey there, this message comes from a GitHub action that helps you and reviewers to understand how these changes affect the size of this project's bundle. As this PR is updated, I'll keep you updated on how the bundle size is impacted. Total
Changeset
View detailed bundle breakdownAdded No assets were added Removed No assets were removed Bigger
Smaller No assets were smaller Unchanged
|
Bundle Stats — loot-coreHey there, this message comes from a GitHub action that helps you and reviewers to understand how these changes affect the size of this project's bundle. As this PR is updated, I'll keep you updated on how the bundle size is impacted. Total
Changeset No files were changed View detailed bundle breakdownAdded No assets were added Removed No assets were removed Bigger No assets were bigger Smaller No assets were smaller Unchanged
|
/update-vrt |
WalkthroughThe pull request introduces modifications to the Possibly related PRs
Suggested labels
Suggested reviewers
Warning There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure. 🔧 eslint (1.23.1)
packages/desktop-client/src/components/reports/graphs/DonutGraph.tsxOops! Something went wrong! :( ESLint: 8.57.1 ESLint couldn't find the plugin "eslint-plugin-eslint-plugin". (The package "eslint-plugin-eslint-plugin" was not found when loaded as a Node module from the directory "/packages/eslint-plugin-actual".) It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:
The plugin "eslint-plugin-eslint-plugin" was referenced from the config file in "packages/eslint-plugin-actual/.eslintrc.js". If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team. 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (2)
💤 Files with no reviewable changes (1)
🔇 Additional comments (4)packages/desktop-client/src/components/reports/graphs/DonutGraph.tsx (4)
The adjustments to text element positioning improve label spacing and prevent overlap:
Line range hint The addition of the
The sorting implementation correctly handles descending order and maintains immutability.
Good changes:
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Outside diff range and nitpick comments (1)
packages/desktop-client/src/components/reports/graphs/DonutGraph.tsx (1)
1-2
: Consider enabling TypeScript strict modeThe file has strict TypeScript checking disabled with
// @ts-strict-ignore
. Consider gradually enabling strict mode to improve type safety and catch potential issues at compile time.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
⛔ Files ignored due to path filters (4)
packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Switches-to-Donut-Graph-and-checks-the-visuals-1-chromium-linux.png
is excluded by!**/*.png
packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Switches-to-Donut-Graph-and-checks-the-visuals-2-chromium-linux.png
is excluded by!**/*.png
packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Switches-to-Donut-Graph-and-checks-the-visuals-3-chromium-linux.png
is excluded by!**/*.png
upcoming-release-notes/3855.md
is excluded by!**/*.md
📒 Files selected for processing (1)
packages/desktop-client/src/components/reports/graphs/DonutGraph.tsx
(6 hunks)
🔇 Additional comments (4)
packages/desktop-client/src/components/reports/graphs/DonutGraph.tsx (4)
43-52
: Improved label spacing in mobile view
The adjustments to text element positioning improve the layout by:
- Centering the main label
- Separating the amount and percentage with consistent spacing
- Using proper text anchoring for alignment
This change aligns well with the PR objective to improve label spacing.
Line range hint 214-220
: LGTM: Improved type safety
Adding type annotation to getVal
function improves type safety and code maintainability.
226-228
: Good use of useMemo for performance optimization
The implementation correctly uses useMemo
to cache the sorted data, preventing unnecessary re-sorting on every render. The dependency array properly includes both unsortedData
and balanceTypeOp
.
260-261
: Verify the impact of angle adjustments
The addition of startAngle
and endAngle
properties changes the chart's orientation. While this might help with label positioning, we should ensure it doesn't affect the user experience negatively.
Let's check for any related visual regression tests:
✅ Verification successful
Angle adjustments are safe and intentional
The angle adjustments (startAngle: 90, endAngle: -270) are safe and appropriate for the following reasons:
- These values create a standard donut chart orientation starting from the top (90°) and going clockwise for a full 360° rotation (-270° = 90° - 360°)
- The component is already using these angle properties throughout its implementation for both the main sectors and decorative elements
- The graph is properly integrated into the reporting system with appropriate type definitions and usage controls
- The changes are consistent with common donut chart implementations where the first slice starts at the top position
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Search for visual regression tests related to DonutGraph
rg -l "DonutGraph" -g "*.test.*"
Length of output: 32
Script:
#!/bin/bash
# Let's search for any test files or snapshots related to DonutGraph with a broader search
rg -l "DonutGraph" --type-add 'test:*.{test.*,spec.*,stories.*,snap*}' --type test
# Also search for any existing usage of these angle properties to understand the current implementation
rg "startAngle|endAngle" packages/desktop-client/src/components/reports/graphs/
Length of output: 1498
Script:
#!/bin/bash
# Let's check the git history of this file to see if these angle values were different before
git log -p packages/desktop-client/src/components/reports/graphs/DonutGraph.tsx | grep -A 5 -B 5 "startAngle\|endAngle"
# Also let's check if there are any existing usages of DonutGraph to understand the current implementation
rg "DonutGraph" -A 3 -B 3 packages/desktop-client/src/components/
Length of output: 8399
packages/desktop-client/src/components/reports/graphs/DonutGraph.tsx
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
packages/desktop-client/src/components/reports/graphs/DonutGraph.tsx
(5 hunks)
🔇 Additional comments (4)
packages/desktop-client/src/components/reports/graphs/DonutGraph.tsx (4)
43-52
: LGTM: Label spacing improvements
The adjustments to text element positioning provide better spacing between labels, which aligns with the PR objectives to prevent overlap, especially on mobile devices.
Line range hint 214-220
: LGTM: Enhanced type safety
Adding the DataEntity
type annotation improves type safety while maintaining the correct logic for handling debt values.
251-251
: LGTM: Consistent data source update
The pie chart correctly uses the sorted data array.
258-259
: LGTM: Improved pie chart orientation
Setting the start angle to 90° and end angle to -270° ensures the pie chart starts from the top and rotates clockwise, which is more intuitive for users.
packages/desktop-client/src/components/reports/graphs/DonutGraph.tsx
Outdated
Show resolved
Hide resolved
Ok, did a few extra updates to better scale the widget. It's definitely not perfect. But better than before :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks brilliant, I won't pretend to understand the maths but the code looks good and it's much better in app
@MatissJanis are you wanting this in for 24.12? It would be a big improvement to the piecharts to go alongside the release of the dashboard. |
I wasn't planing on merging this during the code freeze as it's not really a bugfix. |
Two changes: