3.4 KiB
Frontend System Refactor Summary
Scope
This refactor was applied directly in the codebase.
It focused on:
- radius normalization
- primitive normalization
- removing arbitrary visual drift from shared UI
- standardizing shared surface patterns
- fixing the false abstraction in
components/ui/app-card.tsx
Architecture Preserved
components/uiremains the primitive source of truthcn()inlib/utils.tsremains unchanged and is still the shared class composition helper- existing semantic token naming remains unchanged
- no new UI library was introduced
Current primitive layer remains in:
components/ui/button.tsxcomponents/ui/card.tsxcomponents/ui/dialog.tsxcomponents/ui/select.tsxcomponents/ui/sheet.tsxcomponents/ui/tabs.tsxcomponents/ui/app-card.tsx
What Changed
1. Radius normalization
Shared system areas were normalized toward:
rounded-surfacerounded-nestedrounded-pill
This removed inconsistent rounded-md and rounded-lg usage from the shared admin and primitive system areas.
2. Primitive normalization
The following primitives were aligned with the project token system:
components/ui/dialog.tsxcomponents/ui/sheet.tsxcomponents/ui/tabs.tsx
Changes included:
- tokenized surface colors
- tokenized borders
- tokenized radius
- tokenized shadows
- unified close button treatment in
dialogandsheet
3. Shared UI drift removal
Raw visual values were replaced with semantic tokens in:
components/layout/site-header.tsxcomponents/layout/floating-preferences.tsxapp/[locale]/(site)/page.tsx
This removed raw usage patterns such as:
- hardcoded white/black alpha surfaces
- raw
rgba(...)shadows - raw
text-[hsl(...)]color usage for shared controls
4. Shared surface standardization
Repeated nested panels and stat blocks in feature code were moved toward shared local primitives, especially AppCard.
Refactored areas include:
components/root/media-field-picker.tsxcomponents/root/portfolio-projects-overview.tsxcomponents/root/portfolio-project-form.tsxcomponents/root/portfolio-categories-manager.tsxcomponents/root/site-settings-form.tsx
5. False abstraction fixed
components/ui/app-card.tsx previously declared multiple levels where level 1 and level 2 were visually identical.
That was corrected.
Current AppCard levels are now meaningfully distinct:
level 1bg-cardshadow-card
level 2bg-backgroundborder-inputshadow-xs
level 3bg-surface-2shadow-panel
inverse- preserved as contrast surface
Files Updated
app/[locale]/(site)/page.tsxapp/root/media/page.tsxapp/root/page.tsxcomponents/dashboard/dashboard-card.tsxcomponents/dashboard/dashboard-layout.tsxcomponents/layout/floating-preferences.tsxcomponents/layout/site-header.tsxcomponents/root/flash-message.tsxcomponents/root/media-field-picker.tsxcomponents/root/portfolio-categories-manager.tsxcomponents/root/portfolio-project-form.tsxcomponents/root/portfolio-projects-overview.tsxcomponents/root/portfolio-subnav.tsxcomponents/root/site-settings-form.tsxcomponents/ui/app-card.tsxcomponents/ui/dialog.tsxcomponents/ui/sheet.tsxcomponents/ui/tabs.tsxcomponents/ui/ui-kit-showcase.tsx
Validation
Validation run:
npm run lint
Result:
- passed with no ESLint errors or warnings