From 78da002155a4f3d8bd2213f696d089c6289f505e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20=C3=98rjavik?= Date: Mon, 16 Nov 2026 14:12:18 +0100 Subject: [PATCH 1/2] chore(web): remove dead code and mount review pages in dev only - Remove the unused search/setSearch store fields and the unused data/users.ts mock user. - The UI showcase, RecipeCard showcase, style guide and style stress tests were no longer reachable from App. Mount them at /dev/* behind import.meta.env.DEV, so they are usable in npm run dev and excluded from the production bundle, and document the routes in the UI README. Closes #79 --- apps/web/src/App.tsx | 3 + apps/web/src/components/ui/README.md | 13 +++- apps/web/src/components/ui/SKILL.md | 2 +- apps/web/src/data/users.ts | 7 -- apps/web/src/dev/DevPages.tsx | 67 +++++++++++++++++++ apps/web/src/dev/devPagesRoute.tsx | 14 ++++ apps/web/src/features/auth/AuthPages.test.tsx | 1 - apps/web/src/store.ts | 10 +-- 8 files changed, 101 insertions(+), 16 deletions(-) delete mode 100644 apps/web/src/data/users.ts create mode 100644 apps/web/src/dev/DevPages.tsx create mode 100644 apps/web/src/dev/devPagesRoute.tsx diff --git a/apps/web/src/App.tsx b/apps/web/src/App.tsx index cd06058..f69bb52 100644 --- a/apps/web/src/App.tsx +++ b/apps/web/src/App.tsx @@ -14,6 +14,7 @@ import CookbookPage from './features/cookbook/CookbookPage'; import RecipeCreatePage from './features/recipes/RecipeCreatePage'; import RecipeDetailPage from './features/recipe-detail/RecipeDetailPage'; import NotFoundPage from './features/not-found/NotFoundPage'; +import { devPagesElement } from './dev/devPagesRoute'; export function App() { const restoreSession = useAppStore((state) => state.restoreSession); @@ -39,6 +40,8 @@ export function App() { } /> + {/* Design-system review pages; only exists in `npm run dev`. */} + {devPagesElement && } ); } diff --git a/apps/web/src/components/ui/README.md b/apps/web/src/components/ui/README.md index 2ed7c71..7b3022f 100644 --- a/apps/web/src/components/ui/README.md +++ b/apps/web/src/components/ui/README.md @@ -6,7 +6,7 @@ The component library is intentionally small and project-specific. Add a new gen ## Visual review -The app currently renders `showcase/UiShowcaseCatalog.tsx`, which displays the component showcases as one long scrollable page. Use it as the primary visual and responsive review surface. +`showcase/UiShowcaseCatalog.tsx` displays the component showcases as one long scrollable page. Use it as the primary visual and responsive review surface. It is mounted on development-only routes (`src/dev/`), so it is never part of the production build. Run: @@ -14,7 +14,16 @@ Run: npm run dev ``` -Then scroll through the catalog and resize the browser. The showcase is intentionally kept as one page so it is quick to compare components, inspect states, and notice responsive regressions. +Then open `http://localhost:5173/project2/dev/` and choose a page: + +| Route | Content | +| ------------------ | ---------------------------------------------- | +| `/dev/ui` | All UI component showcases | +| `/dev/recipe-card` | `RecipeCard` variants (`../recipe/showcase/`) | +| `/dev/styles` | Style guide (`src/styles/style_guide/`) | +| `/dev/style-tests` | Style stress tests (`src/styles/style_tests/`) | + +Scroll through the catalog and resize the browser. The showcase is intentionally kept as one page so it is quick to compare components, inspect states, and notice responsive regressions. Storybook is not currently necessary. The showcase already covers the project's main visual-review need with less setup and maintenance. diff --git a/apps/web/src/components/ui/SKILL.md b/apps/web/src/components/ui/SKILL.md index 310e944..4ee1703 100644 --- a/apps/web/src/components/ui/SKILL.md +++ b/apps/web/src/components/ui/SKILL.md @@ -8,7 +8,7 @@ The UI folder is a small project-specific component library for the recipe appli - `src/components/ui/README.md` — human-facing component documentation and usage examples. - `src/styles/style_guide/SKILL.md` — source of truth for tokens, cascade layers, base styles, utilities, motion, sizing, and global CSS conventions. -- `src/components/ui/showcase/UiShowcaseCatalog.tsx` — primary visual and responsive review surface. +- `src/components/ui/showcase/UiShowcaseCatalog.tsx` — primary visual and responsive review surface, at `/project2/dev/ui` in `npm run dev` (see `src/dev/`). - `src/components/ui/__tests__/` — intentionally small, behavior-focused test suite. ## Folder responsibilities diff --git a/apps/web/src/data/users.ts b/apps/web/src/data/users.ts deleted file mode 100644 index c40bb6b..0000000 --- a/apps/web/src/data/users.ts +++ /dev/null @@ -1,7 +0,0 @@ -import type { User } from '../types/user'; - -export const mockUser = { - id: 'mock-current-user', - name: 'Recipe User', - email: 'user@example.com', -} satisfies User; diff --git a/apps/web/src/dev/DevPages.tsx b/apps/web/src/dev/DevPages.tsx new file mode 100644 index 0000000..9d2ed2a --- /dev/null +++ b/apps/web/src/dev/DevPages.tsx @@ -0,0 +1,67 @@ +import { Link, Route, Routes } from 'react-router-dom'; + +import RecipeCardShowcase from '../components/recipe/showcase/RecipeCardShowcase'; +import UiShowcaseCatalog from '../components/ui/showcase/UiShowcaseCatalog'; +import StylesGuide from '../styles/style_guide/StylesGuide'; +import StyleTestSuite from '../styles/style_tests/StyleTestSuite'; + +/** + * Design-system review pages for development. + * + * Mounted at /dev/* only when Vite runs in development mode (see App.tsx), + * so none of this code is part of the production build. Open + * http://localhost:5173/project2/dev/ while `npm run dev` is running. + */ +const pages = [ + { + path: 'ui', + label: 'UI components', + description: 'Every shared component and its states.', + element: , + }, + { + path: 'recipe-card', + label: 'Recipe card', + description: 'RecipeCard variants and edge cases.', + element: , + }, + { + path: 'styles', + label: 'Style guide', + description: 'Tokens, typography, layout utilities.', + element: , + }, + { + path: 'style-tests', + label: 'Style stress tests', + description: 'Long content, states and responsive layouts.', + element: , + }, +]; + +function DevIndex() { + return ( +
+

Design-system review

+

Development-only pages. They are not included in production.

+
    + {pages.map((page) => ( +
  • + {page.label} — {page.description} +
  • + ))} +
+
+ ); +} + +export default function DevPages() { + return ( + + } /> + {pages.map((page) => ( + + ))} + + ); +} diff --git a/apps/web/src/dev/devPagesRoute.tsx b/apps/web/src/dev/devPagesRoute.tsx new file mode 100644 index 0000000..45fcb06 --- /dev/null +++ b/apps/web/src/dev/devPagesRoute.tsx @@ -0,0 +1,14 @@ +import { lazy, Suspense } from 'react'; + +/* + * import.meta.env.DEV is replaced with `false` in production builds, so the + * minifier drops this branch and Vite never emits the DevPages chunk. + */ +const DevPages = import.meta.env.DEV ? lazy(() => import('./DevPages')) : null; + +/** Element for the /dev/* route, or null outside development. */ +export const devPagesElement = DevPages ? ( + + + +) : null; diff --git a/apps/web/src/features/auth/AuthPages.test.tsx b/apps/web/src/features/auth/AuthPages.test.tsx index f8ca789..95e63f8 100644 --- a/apps/web/src/features/auth/AuthPages.test.tsx +++ b/apps/web/src/features/auth/AuthPages.test.tsx @@ -56,7 +56,6 @@ describe('authentication pages', () => { localStorage.clear(); useAppStore.setState({ - search: '', currentUser: null, }); }); diff --git a/apps/web/src/store.ts b/apps/web/src/store.ts index 9386b69..b916d98 100644 --- a/apps/web/src/store.ts +++ b/apps/web/src/store.ts @@ -20,11 +20,14 @@ export type SessionStatus = // Remove credentials left by the old token-based client during migration. const LEGACY_TOKEN_KEY = 'recipe-platform-session-token'; +/* + * Global client state: only the signed-in user and session status. + * Search, filters, sorting and paging live in the URL (see the + * *UrlState.ts modules), and server data in useRecipeQuery's cache. + */ interface AppState { - search: string; currentUser: User | null; sessionStatus: SessionStatus; - setSearch: (search: string) => void; login: (email: string, password: string) => Promise; @@ -35,12 +38,9 @@ interface AppState { } export const useAppStore = create((set) => ({ - search: '', currentUser: null, sessionStatus: 'restoring', - setSearch: (search) => set({ search }), - login: async (email, password) => { const result = await loginUser(email, password); From 62c73b2c89592b06d31670bd123af6ef4e5df489 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20=C3=98rjavik?= Date: Mon, 16 Nov 2026 19:08:53 +0100 Subject: [PATCH 2/2] fix(web): one main landmark per dev page and a dev 404 fallback Review on #92: the showcases and style tests each rendered their own
, so pages had several main landmarks; they now use
, and DevPages wraps each page in a single
. Unknown /dev/* routes show NotFoundPage instead of a blank page. Refs #79 --- .../recipe/showcase/RecipeCardShowcase.tsx | 4 ++-- .../components/ui/showcase/ButtonShowcase.tsx | 4 ++-- .../components/ui/showcase/CheckboxShowcase.tsx | 4 ++-- .../ui/showcase/DropdownMenuShowcase.tsx | 4 ++-- .../components/ui/showcase/FieldShowcase.tsx | 4 ++-- .../ui/showcase/IconBadgeShowcase.tsx | 4 ++-- .../ui/showcase/IconButtonShowcase.tsx | 4 ++-- .../src/components/ui/showcase/IconShowcase.tsx | 4 ++-- .../components/ui/showcase/RadioShowcase.tsx | 4 ++-- .../components/ui/showcase/SelectShowcase.tsx | 4 ++-- apps/web/src/dev/DevPages.tsx | 17 ++++++++++++++++- apps/web/src/styles/style_guide/StylesGuide.tsx | 6 +++--- .../styles/style_tests/ColorAndStateTest.tsx | 4 ++-- .../styles/style_tests/FoundationStressTest.tsx | 4 ++-- .../styles/style_tests/LayoutUtilitiesTest.tsx | 4 ++-- .../src/styles/style_tests/TypographyTest.tsx | 4 ++-- 16 files changed, 47 insertions(+), 32 deletions(-) diff --git a/apps/web/src/components/recipe/showcase/RecipeCardShowcase.tsx b/apps/web/src/components/recipe/showcase/RecipeCardShowcase.tsx index 0686ef1..b88eb53 100644 --- a/apps/web/src/components/recipe/showcase/RecipeCardShowcase.tsx +++ b/apps/web/src/components/recipe/showcase/RecipeCardShowcase.tsx @@ -34,7 +34,7 @@ export default function RecipeCardShowcase() { const [narrowCardSaved, setNarrowCardSaved] = useState(false); return ( -
+

RecipeCard Showcase

@@ -249,6 +249,6 @@ export default function RecipeCardShowcase() {
-
+
); } diff --git a/apps/web/src/components/ui/showcase/ButtonShowcase.tsx b/apps/web/src/components/ui/showcase/ButtonShowcase.tsx index f79e0cb..de5517e 100644 --- a/apps/web/src/components/ui/showcase/ButtonShowcase.tsx +++ b/apps/web/src/components/ui/showcase/ButtonShowcase.tsx @@ -3,7 +3,7 @@ import { surfaceStyle, raisedSurfaceStyle } from './showcaseStyles'; export default function ButtonShowcase() { return ( -
+

Button Showcase

@@ -414,6 +414,6 @@ export default function ButtonShowcase() {
-
+ ); } diff --git a/apps/web/src/components/ui/showcase/CheckboxShowcase.tsx b/apps/web/src/components/ui/showcase/CheckboxShowcase.tsx index d40075f..cafe4c8 100644 --- a/apps/web/src/components/ui/showcase/CheckboxShowcase.tsx +++ b/apps/web/src/components/ui/showcase/CheckboxShowcase.tsx @@ -8,7 +8,7 @@ export default function CheckboxShowcase() { const [quickRecipes, setQuickRecipes] = useState(true); return ( -
+

Checkbox Showcase

@@ -259,6 +259,6 @@ export default function CheckboxShowcase() {
-
+ ); } diff --git a/apps/web/src/components/ui/showcase/DropdownMenuShowcase.tsx b/apps/web/src/components/ui/showcase/DropdownMenuShowcase.tsx index 0881182..2684587 100644 --- a/apps/web/src/components/ui/showcase/DropdownMenuShowcase.tsx +++ b/apps/web/src/components/ui/showcase/DropdownMenuShowcase.tsx @@ -13,7 +13,7 @@ import { surfaceStyle } from './showcaseStyles'; export default function DropdownMenuShowcase() { return ( -
+

DropdownMenu Showcase

@@ -208,6 +208,6 @@ export default function DropdownMenuShowcase() {
-
+ ); } diff --git a/apps/web/src/components/ui/showcase/FieldShowcase.tsx b/apps/web/src/components/ui/showcase/FieldShowcase.tsx index 301327f..bc4bf97 100644 --- a/apps/web/src/components/ui/showcase/FieldShowcase.tsx +++ b/apps/web/src/components/ui/showcase/FieldShowcase.tsx @@ -3,7 +3,7 @@ import { surfaceStyle, raisedSurfaceStyle } from './showcaseStyles'; export default function FieldShowcase() { return ( -
+

Field Showcase

@@ -348,6 +348,6 @@ export default function FieldShowcase() {
-
+ ); } diff --git a/apps/web/src/components/ui/showcase/IconBadgeShowcase.tsx b/apps/web/src/components/ui/showcase/IconBadgeShowcase.tsx index 00e444c..e24f3f8 100644 --- a/apps/web/src/components/ui/showcase/IconBadgeShowcase.tsx +++ b/apps/web/src/components/ui/showcase/IconBadgeShowcase.tsx @@ -13,7 +13,7 @@ import { surfaceStyle, raisedSurfaceStyle } from './showcaseStyles'; export default function IconBadgeShowcase() { return ( -
+

IconBadge Showcase

@@ -257,6 +257,6 @@ export default function IconBadgeShowcase() {
-
+ ); } diff --git a/apps/web/src/components/ui/showcase/IconButtonShowcase.tsx b/apps/web/src/components/ui/showcase/IconButtonShowcase.tsx index c43be8f..b3fdd11 100644 --- a/apps/web/src/components/ui/showcase/IconButtonShowcase.tsx +++ b/apps/web/src/components/ui/showcase/IconButtonShowcase.tsx @@ -29,7 +29,7 @@ export default function IconButtonShowcase() { const [favorite, setFavorite] = useState(false); return ( -
+

IconButton Showcase

@@ -199,6 +199,6 @@ export default function IconButtonShowcase() {
-
+ ); } diff --git a/apps/web/src/components/ui/showcase/IconShowcase.tsx b/apps/web/src/components/ui/showcase/IconShowcase.tsx index 29c3151..cc1da2e 100644 --- a/apps/web/src/components/ui/showcase/IconShowcase.tsx +++ b/apps/web/src/components/ui/showcase/IconShowcase.tsx @@ -319,7 +319,7 @@ const toneExamples: Array<{ export default function IconShowcase() { return ( -
+

Icon Showcase

@@ -807,6 +807,6 @@ export default function IconShowcase() {
-
+ ); } diff --git a/apps/web/src/components/ui/showcase/RadioShowcase.tsx b/apps/web/src/components/ui/showcase/RadioShowcase.tsx index 459855d..0f4714a 100644 --- a/apps/web/src/components/ui/showcase/RadioShowcase.tsx +++ b/apps/web/src/components/ui/showcase/RadioShowcase.tsx @@ -8,7 +8,7 @@ export default function RadioShowcase() { const [difficulty, setDifficulty] = useState('medium'); return ( -
+

Radio Showcase

@@ -398,6 +398,6 @@ export default function RadioShowcase() {
-
+ ); } diff --git a/apps/web/src/components/ui/showcase/SelectShowcase.tsx b/apps/web/src/components/ui/showcase/SelectShowcase.tsx index 2bd3720..c4264f0 100644 --- a/apps/web/src/components/ui/showcase/SelectShowcase.tsx +++ b/apps/web/src/components/ui/showcase/SelectShowcase.tsx @@ -8,7 +8,7 @@ export default function SelectShowcase() { const [sort, setSort] = useState('newest'); return ( -
+

Select Showcase

@@ -588,6 +588,6 @@ export default function SelectShowcase() {
-
+ ); } diff --git a/apps/web/src/dev/DevPages.tsx b/apps/web/src/dev/DevPages.tsx index 9d2ed2a..d519cb7 100644 --- a/apps/web/src/dev/DevPages.tsx +++ b/apps/web/src/dev/DevPages.tsx @@ -1,5 +1,7 @@ import { Link, Route, Routes } from 'react-router-dom'; +import NotFoundPage from '../features/not-found/NotFoundPage'; + import RecipeCardShowcase from '../components/recipe/showcase/RecipeCardShowcase'; import UiShowcaseCatalog from '../components/ui/showcase/UiShowcaseCatalog'; import StylesGuide from '../styles/style_guide/StylesGuide'; @@ -59,9 +61,22 @@ export default function DevPages() { return ( } /> + {/* One main landmark per page; the showcases use sections inside it. */} {pages.map((page) => ( - + {page.element}
} + /> ))} + + + + } + /> ); } diff --git a/apps/web/src/styles/style_guide/StylesGuide.tsx b/apps/web/src/styles/style_guide/StylesGuide.tsx index 561a10c..12b5ae9 100644 --- a/apps/web/src/styles/style_guide/StylesGuide.tsx +++ b/apps/web/src/styles/style_guide/StylesGuide.tsx @@ -38,7 +38,7 @@ const tokenRows = [ function StylesGuide() { return ( -
+

Styles Guide

@@ -182,7 +182,7 @@ function StylesGuide() { > ...
`} + code={`
...
`} /> - + ); } diff --git a/apps/web/src/styles/style_tests/ColorAndStateTest.tsx b/apps/web/src/styles/style_tests/ColorAndStateTest.tsx index 890695b..d546a31 100644 --- a/apps/web/src/styles/style_tests/ColorAndStateTest.tsx +++ b/apps/web/src/styles/style_tests/ColorAndStateTest.tsx @@ -108,7 +108,7 @@ const borders = [ function ColorAndStateTest() { return ( -
+

Color & State Test

@@ -465,7 +465,7 @@ function ColorAndStateTest() {
-
+ ); } diff --git a/apps/web/src/styles/style_tests/FoundationStressTest.tsx b/apps/web/src/styles/style_tests/FoundationStressTest.tsx index 8bf36c0..0e9919e 100644 --- a/apps/web/src/styles/style_tests/FoundationStressTest.tsx +++ b/apps/web/src/styles/style_tests/FoundationStressTest.tsx @@ -11,7 +11,7 @@ function FoundationStressTest() { const [moved, setMoved] = useState(false); return ( -
+

Foundation Stress Test

@@ -528,7 +528,7 @@ function FoundationStressTest() {
-
+ ); } diff --git a/apps/web/src/styles/style_tests/LayoutUtilitiesTest.tsx b/apps/web/src/styles/style_tests/LayoutUtilitiesTest.tsx index c1b7826..9b70f3c 100644 --- a/apps/web/src/styles/style_tests/LayoutUtilitiesTest.tsx +++ b/apps/web/src/styles/style_tests/LayoutUtilitiesTest.tsx @@ -14,7 +14,7 @@ const testAreaStyle = { function LayoutUtilitiesTest() { return ( -
+

Layout Utilities Test

@@ -340,7 +340,7 @@ function LayoutUtilitiesTest() {

-
+ ); } diff --git a/apps/web/src/styles/style_tests/TypographyTest.tsx b/apps/web/src/styles/style_tests/TypographyTest.tsx index c4bcc09..49325dd 100644 --- a/apps/web/src/styles/style_tests/TypographyTest.tsx +++ b/apps/web/src/styles/style_tests/TypographyTest.tsx @@ -1,6 +1,6 @@ function TypographyTest() { return ( -
+

Typography Test

@@ -241,7 +241,7 @@ function TypographyTest() {
-
+ ); }