feat: wire theme toggle to zustand store with persisted preference (Closes #476) - #579
Open
waterWang wants to merge 1 commit into
Open
feat: wire theme toggle to zustand store with persisted preference (Closes #476)#579waterWang wants to merge 1 commit into
waterWang wants to merge 1 commit into
Conversation
…loses Protocol-Guild#476) - Add themeStore.ts using zustand create + persist middleware for localStorage persistence of theme preference (pre-existing key 'payd-theme') - Rewrite ThemeProvider to apply data-theme attribute from store state - Rewrite useTheme hook to read theme/toggleTheme/setTheme from zustand store - Complete CSS variable sets for both dark and light themes: warning, accent/danger/success/warning alpha variants, hover colors, input-bg, row-hover, scrim, glass-bg, shadows, accent-glow - Replace hardcoded rgb/hex colors with theme-aware CSS variables in CrossAssetPayment, Login, RevenueSplitDashboard, TransactionHistory, CashFlowForecast pages (match semantic tokens)
4 tasks
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
Fixes #476 — the
ThemeToggle.tsxcomponent existed but its state wasn't wired through a persistent store, and CSS variable sets were incomplete, so dark/light mode switching didn't fully work.Changes
1. Zustand store wiring
frontend/src/stores/themeStore.ts— zustand store withpersistmiddleware persisting preference to localStorage (reuses existingpayd-themekey), exposingtheme,setTheme,toggleThemeproviders/ThemeProvider.tsx— subscribes to the store and appliesdata-themeattribute on the document roothooks/useTheme.ts— now reads directly from the zustand store (same API:theme,toggleTheme, plussetTheme)2. Completed CSS variable sets (both themes)
Added missing tokens to
index.cssfor dark and light:--warning+ warning alpha variants--accent-*,--accent2-*,--danger-*,--success-*alpha variants--accent2-hover,--danger-hover--accent-glow,--glass-bg,--input-bg,--input-bg-hover,--row-hover,--scrim--shadow-sm,--shadow-md3. Replaced hardcoded colors with theme-aware variables
Pages that still used raw
#0a0a0c/#16161a/rgba(...)colors (which rendered identically in light mode):CrossAssetPayment.tsx,Login.tsx,RevenueSplitDashboard.tsx,TransactionHistory.tsx,CashFlowForecast.tsxAcceptance Criteria
Verification
tsc --noEmit— 0 errorsvite build— 3456 modules, built successfully