feat(frontend): theme a11y + optimistic rollback, balance-sync refactor and animations#842
Merged
emdevelopa merged 2 commits intoMay 28, 2026
Conversation
…or and animations - emdevelopa#801: respect prefers-reduced-motion for the theme-toggle icon swaps, drop the redundant ARIA role, and restore the missing </button> so the Dark Mode toggle compiles and renders. - emdevelopa#802: complete the optimistic theme-update rollback so a failed persist also reverts the <meta name="theme-color"> alongside the theme state and class. - emdevelopa#803: refactor useBalanceSync state into a reducer (start/success/error) and surface the previously-swallowed error to consumers. - emdevelopa#804: animate the Real-time Balance Sync status in SupportPanel with framer-motion, transitioning the figure each time polling syncs a new balance. Closes emdevelopa#801 Closes emdevelopa#802 Closes emdevelopa#803 Closes emdevelopa#804
|
@nanlebenthel-web is attempting to deploy a commit to the Emmanuel's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@nanlebenthel-web Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Four small frontend UX enhancements across the Dark Mode Theme Engine and Real-time Balance Sync modules, bundled into one PR.
ThemeToggle.tsx): respectprefers-reduced-motion(via framer-motion'suseReducedMotion) so the icon swap doesn't animate for motion-sensitive users, and removed the redundantrole="button"on the native<button>(both flagged by standard a11y audits). Also restored a missing</button>closing tag that prevented the component from compiling (see note below).theme-context.tsx): the optimistic theme switch already rolled back state + the document class on a failed persist, but left the<meta name="theme-color">on the new value. The rollback now also reverts the meta theme-color, so no part of the optimistic change lingers after an error.useBalanceSync.ts): consolidated the separatebalances/isLoading/lastUpdatedstate into a singleuseReducerwith explicitFETCH_START/FETCH_SUCCESS/FETCH_ERRORtransitions, and surfaced the previously-swallowederrorto consumers. Public return shape is unchanged (plus the newerror).SupportPanel.tsx): wrapped the balance status (loading / unfunded / available) inAnimatePresencewith keyedmotionelements so it cross-fades, and keyed the available figure by value so it animates each time polling syncs a new balance.Test plan
npx tsc --noEmit— no type errors in any of the four edited filesvitest run src/hooks/useBalanceSync.test.ts— passes (2/2) after the reducer refactorThemeToggle.test.tsx/theme-context.test.tsxnot runnable — see pre-existing issues belowPre-existing issues (not introduced by this PR)
While working on these files I found
mainis currently broken in a few ways unrelated to these issues. I fixed only the one inside a file I was already editing:ThemeToggle.tsxwas missing the closing</button>for its main render, so the file did not compile. I added it as part of [Frontend] Improve screen reader support for Dark Mode Theme Engine #801 since the component couldn't render otherwise.tscalso reports pre-existing syntax errors insrc/components/RecentPayments.tsxandsrc/app/pay/[id]/page.tsx.src/components/ThemeToggle.test.tsxis a 2-line truncated stub (no test suite), and the component test environment fails fortheme-context.test.tsxwith a jsdomappendChilderror onmain(verified identical on the unmodified file).Closes #801
Closes #802
Closes #803
Closes #804