fix bar chart#2207
Conversation
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
2 Skipped Deployments
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Pull request overview
Refactors the BarChart component to compute the bar percentage once per item and switches the inline styles to Tailwind utility classes, placing the percentage label beside the bar instead of overlaying it.
Changes:
- Hoist
percentandpercentLabelcalculations outside the JSX. - Replace inline
stylepositioning of the bar/label with Tailwind classes and a flex layout. - Move the percentage label out of the bar overlay into a sibling element with
tabular-nums.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Greptile SummaryThis PR refactors
Confidence Score: 4/5Safe to merge — the change is a self-contained visual refactor of a single chart component with no logic side effects. The refactor correctly eliminates the magic-pixel subtraction and moves the percentage label to its own flex column. The only unaddressed concern is that No files require special attention beyond the one changed file. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[BarChart receives data array] --> B[Compute percent = item.value / maxValue * 100]
B --> C[Build percentLabel string with optional '+' prefix for last item]
C --> D[Render label span above bar row]
D --> E[Flex row: bar container flex-1 + label span shrink-0 w-10]
E --> F[Bar container: gray background, overflow-hidden]
F --> G[Colored fill div: width = percent%, absolute inset-y-0 left-0]
E --> H[Percent label: outside bar, text-right tabular-nums]
Reviews (1): Last reviewed commit: "fix bar chart" | Re-trigger Greptile |
| const percent = (item.value / maxValue) * 100; | ||
| const percentLabel = `${index === data.length - 1 ? "+" : ""}${percent}%`; |
There was a problem hiding this comment.
Floating-point percentage label: when
item.value is not an exact multiple of maxValue (100), percent will be a float like 33.333333333333336, making the label render as "33.333333333333336%". Consider rounding to a fixed number of decimal places.
| const percent = (item.value / maxValue) * 100; | |
| const percentLabel = `${index === data.length - 1 ? "+" : ""}${percent}%`; | |
| const percent = (item.value / maxValue) * 100; | |
| const percentLabel = `${index === data.length - 1 ? "+" : ""}${percent.toFixed(1)}%`; |
Lite PR
Tip: Review docs on the ENSNode PR process
Summary
Why
Testing
Notes for Reviewer (Optional)
Pre-Review Checklist (Blocking)