feat: design system foundation + fix white flash (Phase 10e-1, 10e-2) #23
No reviewers
Labels
No labels
domain:backend
domain:devops
domain:frontend
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
forgejo_admin/westside-landing!23
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "22-design-system-foundation-fix-white-flash"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Eliminates the white flash on page load by moving critical dark theme styles from JS-dependent
<svelte:head>into inline<style>inapp.html. Establishes a CSS custom properties design system (src/app.css) with 25+ design tokens, then replaces all hardcoded hex color values across every route and component withvar()references. Visual output is pixel-identical.Changes
src/app.html-- added inline critical styles (background, color, box-sizing, font-family) that render before JS loadssrc/app.css-- NEW design tokens file with CSS custom properties for backgrounds, borders, text, brand, and semantic colors (success/warning/danger/info)src/routes/+layout.svelte-- removed<svelte:head><style>block, addedimport '../app.css'src/routes/+page.svelte-- replaced all hardcoded hex withvar()tokenssrc/routes/admin/+page.svelte-- replaced all hardcoded hex withvar()tokenssrc/routes/admin/teams/+page.svelte-- replaced all hardcoded hex withvar()tokenssrc/routes/admin/users/+page.svelte-- replaced all hardcoded hex withvar()tokenssrc/routes/coach/+page.svelte-- replaced all hardcoded hex withvar()tokenssrc/routes/player/+page.svelte-- replaced all hardcoded hex withvar()tokenssrc/routes/teams/+page.svelte-- replaced all hardcoded hex withvar()tokenssrc/lib/components/AuthStatus.svelte-- replaced all hardcoded hex withvar()tokensTest Plan
npm run buildpasses with zero errorsvar()to the same hex values as beforeReview Checklist
Related
plan-westside-basketball-- Phase 10e design system foundationSelf-Review (Dev Agent)
Summary
Clean refactor. 11 files changed, 349 additions, 306 deletions.
npm run buildpasses. No HTML structure changes, no+page.server.jsmodifications, no dependency additions, all@mediabreakpoints preserved.Remaining Hardcoded Hex Values (intentional)
A handful of hex values remain hardcoded. These fall into two categories:
1. JS inline style objects (cannot use CSS vars in this pattern):
admin/users/+page.sveltelines 14-29:ROLE_COLORS,ROLE_BG,ROLE_BORDERobjects used in dynamicstyle=attributes. Converting these to CSS vars would require restructuring the component (out of scope for this refactor).2. One-off shades not in the token set:
#0d140c-- checked-in row background (different from--color-success-bg#0d1a0c)#3a3000,#3a1a1a-- mid-tone warn/danger row borders#2a2a2a-- btn-send background (between--color-border-subtleand--color-border-strong)#0d0d0d-- player-chip/assign-row background (darker than--color-bg)#2a1a1a,#5a2a2a,#3a2020-- danger button variants (btn-remove, btn-reset)#ff8888-- btn-reset text (lighter red, distinct from--color-danger)#5a1a25-- stat-admin border (brand-adjacent)#1a3a5a-- stat-registered border (info-adjacent)#fff,white-- standard white on brand elementsThese are all acceptable to leave as-is. They are unique one-off values that would bloat the token set without providing reuse value. A follow-up PR could add tokens like
--color-bg-darkeror--color-danger-lightif these patterns multiply.Verdict
APPROVE -- No blockers. The design system foundation is solid, the white flash fix is correct (inline styles in
app.htmlrender before JS), and the token coverage is thorough across all 10 component style blocks.PR #23 Review
DOMAIN REVIEW
Tech stack: SvelteKit / CSS (frontend refactor -- pure CSS design token extraction + white flash fix).
White flash fix (10e-1): Correct approach. Critical dark theme styles (
background-color: #0a0a0a,color: #e0e0e0) are inlined inapp.htmlso they render before any JS loads. The<svelte:head><style>block from+layout.svelteis properly removed and base styles relocated tosrc/app.css. The intentional duplication of hex values inapp.html(which cannot usevar()because the CSS custom properties file has not loaded yet) is architecturally sound.Design token system (10e-2): Well-structured
src/app.csswith 25 CSS custom properties organized into clear semantic groups (Background, Borders, Text, Brand, Success/Warning/Danger/Info, Link). Token naming follows a consistent convention (--color-{category}/--color-{category}-{variant}). The replacement across 9 component files is thorough for the tokens that exist.Accessibility: No regressions -- this is a pure refactor with pixel-identical output. Color contrast ratios are unchanged. No new interactive elements introduced.
Performance: No impact. CSS custom properties have zero runtime cost compared to hardcoded values. The inline
app.htmlstyles are a net improvement (eliminates FOUC/white flash).BLOCKERS
None.
Test coverage: This PR is a CSS-only refactor with zero behavioral changes. The repo has no test infrastructure (no test files exist outside
node_modules/). For a pure design token extraction that is explicitly pixel-identical, requiring new test infrastructure would be scope creep. The Test Plan appropriately calls for visual verification and DevTools inspection. No blocker here.NITS
Residual hardcoded hex values in JS (admin/users):
ROLE_COLORS,ROLE_BG, andROLE_BORDERobjects at lines 13-29 ofsrc/routes/admin/users/+page.sveltestill use hardcoded hex values (#c41230,#ffd700,#7ec875, etc.) and inlinestyle=fallbacks (#666,#1a1a1a,#333at line 253). These are used in JavaScript for dynamic inline styles, sovar()cannot be used directly. However, these could read CSS custom property values viagetComputedStyle()or be refactored to use CSS classes instead of inline styles. Worth a follow-up issue.Residual hardcoded hex in CSS: Several hex values were not converted to tokens:
src/routes/+page.svelte:114--border-color: #1a3a5a(should bevar(--color-info-border)which is#2a3a5a-- note: this is a different value, so either the existing value is intentional or it is a pre-existing bug)src/routes/admin/+page.svelte:511--background: #0d140c(checked-in state -- could bevar(--color-success-bg))src/routes/admin/+page.svelte:516--border-color: #3a3000(row-warn -- no matching token exists)src/routes/admin/+page.svelte:520--border-color: #3a1a1a(row-danger -- no matching token exists)src/routes/admin/+page.svelte:662--background: #2a2a2a(btn-send -- no matching token exists)src/routes/admin/teams/+page.svelte:597,719--background: #0d0d0d(no matching token)src/routes/admin/teams/+page.svelte:624-625,638-- btn-remove colors (no matching tokens)src/routes/admin/teams/+page.svelte:732--background: #0d140c(could bevar(--color-success-bg))src/routes/admin/users/+page.svelte:426--border-color: #5a1a25(no matching token)src/routes/admin/users/+page.svelte:580-586-- btn-reset colors (no matching tokens)color: #fffin AuthStatus.svelte:139 and teams/+page.svelte:808 (could add--color-text-whitetoken)Many of these lack a matching design token, which is reasonable -- the token set would need to grow to cover them. This is a follow-up concern, not a blocker for the current scope.
Comment in
app.css: The comment says "moved from +layout.svelte<svelte:head>" which is good provenance. Consider also adding a note thatapp.htmlintentionally duplicates--color-bgand--color-textas hardcoded values for FOUC prevention, so future maintainers do not "helpfully" remove one thinking it is redundant.SOP COMPLIANCE
22-design-system-foundation-fix-white-flashreferences issue #22)plan-westside-basketballPhase 10e)Closes #22present in Related sectionPROCESS OBSERVATIONS
VERDICT: APPROVED