feat: dark mode + auditor read-only mode + investor demo masking and demo-data toggle#1
feat: dark mode + auditor read-only mode + investor demo masking and demo-data toggle#1st3rs wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8528e340a9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| useEffect(() => { | ||
| if (mode === 'demo' && localStorage.getItem(DEMO_DATA_KEY) === null) { | ||
| setDemoDataEnabled(true); | ||
| } |
There was a problem hiding this comment.
Force demo data in demo mode regardless of prior toggle
In demo mode the app only enables demoDataEnabled when the demo-data key is missing, so a user who previously toggled demo data off (stored '0') will enter ?mode=demo and still hit the live API. Because withFallback only forces mock data when demoDataEnabled is true, this defeats the “safe presentation” guarantee and can expose real data in demo mode. Consider forcing demoDataEnabled to true whenever mode === 'demo' (or at least preventing the stored false value from bypassing mock data) so demo mode is consistently safe.
Useful? React with 👍 / 👎.
Motivation
Description
ThemeProvider(src/context/ThemeContext.tsx), persisted inlocalStoragekeytrst_admin_theme, and enabled Tailwind dark mode viatailwind.config.js(darkMode: 'class') and CSS updates (src/styles/index.css).ModeProvider(src/context/ModeContext.tsx) exposingmode,setMode,demoDataEnabled,setDemoDataEnabled,isAuditorMode(),isDemoMode(), andcanMutate(); modes persist viatrst_admin_mode/trst_admin_demo_dataand honor?mode=auditor|demoquery params.src/lib/masking.tsand applied masking/redaction across tables and pages (Merchants, Transactions, Settlements, Webhooks, Audit logs, Merchant detail, Dashboard) when demo mode is active.src/lib/queries.ts) so toggling demo data forces mock fallback regardless ofVITE_API_BASE_URL.canMutate()is false, and dark-mode friendly styles across components.src/lib/apiClient.ts,src/lib/authStorage.ts), RBAC helpers (src/lib/rbac.ts), many components updated to use semantic Zinc palette classes and dark variants; new masking helpers and types added (src/types/*).Testing
npm installsuccessfully (dependencies installed).npm run build; TypeScript and Vite build completed successfully and produceddist/artifacts (build succeeded).npm run dev) and validated UI athttp://localhost:5173/; exercised theme toggle, demo toggle and mode banners.artifacts/dashboard-demo.png).Codex Task