GeezerVison is showing github.com — Goal: animated segments, custom medal images, and a completion celebration by chrisnowak · Pull Request #694 · CareEvolution/MyDataHelpsUI
Conversation
chrisnowak
commented
Oct 30, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Overview
For an upcoming study, participants earn a medal every 7 diary entries, and the home screen shows progress toward the next one as a ring around the medal. That's basically our existing Goal component, so rather than build something new this adds a few opt-in flags to it:
animateNewSegments - when the value goes up, only the new segment(s) sweep in, with a little spring/swell, instead of the whole ring redrawing from empty every time the app comes back to the foreground. Several new segments fill one after another.
iconUrl - an image in place of the Font Awesome icon (e.g. a medal). Until the goal is complete it's shown faded and greyscale, per the design.
celebration - when the goal is completed while it's on screen, the medal stamps in, a shine sweeps across it (images or FA icons), and then confetti, light rays or fireworks play. 'random' picks one, with a rare "everything at once" version about 1 time in 6.
Try it here: Container/Goal -> Animated Segments - click "Add entry" up to 7/7.
A few details:
- The ring is now plain SVG instead of a recharts pie, which is what made the per-segment animations practical. With none of the new flags set,
Goal should look and behave exactly as before. The ring is checked against recharts in unit tests (static paths and the load sweep, frame by frame), and I compared screenshots of all the existing Goal stories against main with no pixel differences.
- With
animateNewSegments on, Goal keeps showing its current value while it refreshes instead of dropping back to 0 with a spinner. That's what lets it animate just the change. Without the flag, the refresh works as it does today.
- The celebration only plays on a not-complete -> complete change while the goal is on screen. Loading a goal that's already complete, or coming back to the app at 7/7, never celebrates. Going back to 0 isn't animated either, since in practice that happens on a schedule when the app likely isn't open.
- Reduced motion is respected: no segment animation and no particles, just a fade from grey to color.
- The effects draw on a canvas over the goal, so inside a default
Card they're clipped to the card. Set allowOverflow on the card to let them spill out.
I went back and forth on how to rotate the celebration styles. Rotating by medal number would be nicer (never the same one twice in a row), but Goal only knows the current count toward the next medal, not how many medals have been earned. Storing total entries would make the backend more complex, so it's just random for now.
Not in this PR:
- The ViewBuilder side (
animateNewSegments, iconUrl and celebration on the Goal node). That'll come once this is released.
Security
- I have ensured no secure credentials or sensitive information remain in code, metadata, comments, etc.
- Please verify that you double checked that .storybook/preview.js does not contain your participant access key details.
- There are no temporary testing changes committed such as API base URLs, access tokens, print/log statements, etc.
- These changes do not introduce any security risks, or any such risks have been properly mitigated.
iconUrl is rendered with an <img>, not pasted in as inline SVG markup, so an SVG can't run script and two medals with the same internal gradient ids can't clash. It's otherwise just presentation, with no new inputs or outputs.
Testing
- This change can be adequately tested using the MDH Storybook.
- This change requires additional testing in the MDH iOS/Android/Web apps. (Create a pre-release tag/build and test in a ViewBuilder PR.)
In Storybook, Container/Goal -> Animated Segments:
- Click "Add entry". Only the new segment should sweep in; the others shouldn't move.
- Click it a few times quickly. The segments should fill one after another.
- Get to 7/7. The ring should finish filling, then the medal stamps in, a shine crosses it, and a celebration plays.
- Try each celebration style, the default icon vs. the image, and "card allows overflow" on and off.
- Click "Remove entry". It should just repaint, with no animation.
- Turn on reduce motion in your OS settings and get to 7/7 again. The medal should just fade to color.
Regression: the other Goal stories (Default, Advanced Colors, Tiered, Live) should look exactly as they do on main, including the sweep on load.
In the apps, I'd mostly like to see the celebrations on a real phone: fireworks inside a short card, performance on a lower-end Android (particles are capped at 150), and whether the faded medal is too faint in dark mode.
Documentation
- I have added relevant Storybook updates to this PR.
- If this feature requires a developer doc update, I have tagged
@CareEvolution/api-docs.
- This change does not impact documentation or Storybook.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
With animateNewSegments, Goal keeps showing its current value while it
refreshes, so each newly filled segment sweeps in on its own with a short
spring and swell. Several new segments fill one after another. Lower values,
reduced motion and the default mode change the ring without animating.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WkXf5bWnK8HCAQU4vCivH5
iconUrl renders an image inside the ring instead of the Font Awesome icon,
sized to the icon's circle. An img keeps each SVG's internal ids separate,
so two badges that share gradient ids can sit on one page. The waterfall
badge is added for the stories.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WkXf5bWnK8HCAQU4vCivH5
With celebration set, completing the goal while it is on screen waits for
the ring to finish, stamps the icon in, sweeps a shine across an iconUrl
image once, and plays confetti, light rays or fireworks, picked at random
with a rare all-at-once version. Reduced motion only fades the image to
color. Loading a goal that is already complete never celebrates.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WkXf5bWnK8HCAQU4vCivH5
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
GoalRing now reports when its animation has finished, and Goal starts a
waiting celebration then, instead of estimating the ring's duration. The
estimate started too early when a fill grew while running, and too late
when completing changed the number of segments.
A Font Awesome icon keeps its in-progress color until the stamp and fades
under reduced motion, like an image. The celebration now begins during
render, so the completed look never shows before the wait.
GoalRing's animation planning is a pure, tested function, and its two frame
loops share one hook. Celebration timings live in one place, and
GoalCelebrationStyle is exported.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WkXf5bWnK8HCAQU4vCivH5
chrisnowak
changed the title
DRAFT Goal improvements
Goal: animated segments, custom medal images, and a completion celebration
Oct 31, 2026
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|