Skip to content

Add bar/pie chart toggle and cap ongoing allocations at 100% - #96

Merged
farrelld09 merged 1 commit into
mainfrom
create-pie-chart-toggle
Jul 27, 2026
Merged

Add bar/pie chart toggle and cap ongoing allocations at 100%#96
farrelld09 merged 1 commit into
mainfrom
create-pie-chart-toggle

Conversation

@farrelld09

Copy link
Copy Markdown
Collaborator

Summary

  • Adds a toggle on the scenario show page to switch the ongoing-giving allocation chart between the existing horizontal bar and a new pie chart (pure CSS conic-gradient, no new JS dependency), using the existing tabs Stimulus controller.
  • Adds validation preventing ongoing allocation percentages (including Greatest Community Need) from summing to more than 100% for a scenario, mirroring the existing one-time/total-giving-amount validation.
  • Percentage sliders now clamp their max to actual remaining headroom instead of a hardcoded 100 (falling back to the allocation's own current value, so any already-over-limit legacy data still renders sanely), with the CSS fill rescaled to match.

Test plan

  • bin/rails test — 263 runs, 0 failures
  • bin/rubocop on changed Ruby files — no offenses
  • bundle exec herb lint on changed views — no new offenses
  • Manually verified in browser: bar/pie toggle both directions, under- and over-100% pie proportions, slider clamping when already at 100%, and that dragging a slider stops exactly at the remaining headroom

🤖 Generated with Claude Code

Scenario show page now lets users switch the ongoing-giving chart
between the existing horizontal bar and a new CSS conic-gradient pie
chart, via a small pill toggle built on the existing tabs Stimulus
controller.

Also adds validation so ongoing allocation percentages (including
Greatest Community Need) can no longer sum to more than 100% for a
scenario, mirroring the existing one-time/total-giving-amount check.
The percentage sliders now clamp their max to the actual remaining
headroom (falling back to the allocation's own current value so
already-over-limit legacy data still renders correctly) instead of a
hardcoded 100, and their CSS fill is rescaled to match.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@farrelld09
farrelld09 merged commit 762f3e6 into main Jul 27, 2026
4 of 5 checks passed
@farrelld09
farrelld09 deleted the create-pie-chart-toggle branch July 27, 2026 19:30
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.

1 participant