From d2201f5286d797e2cddbe03a17ca4d735c432be6 Mon Sep 17 00:00:00 2001 From: Alexander Date: Wed, 9 Sep 2026 07:57:51 -0500 Subject: [PATCH] feat(client): bring the Hero's particle background into the workspace Mount the shared BackgroundLayer behind WorkspaceShell so the authenticated /app views get the same ambient effect as the Hero, /login, and /register, per explicit request. Readability of the dense workspace UI is preserved deliberately: - WorkspaceShell's header gets a frosted (bg/70 + backdrop-blur) treatment instead of a flat opaque background, so nav/user controls stay legible over the animated canvas. - ProjectList's project cards already sit on solid surfaces and need no change. - WorkspaceGraphView's title bar and graph canvas get the same frosted-card treatment as the Hero's own GraphStage (bg-background-elevated/60 + backdrop-blur), since React Flow's dot-grid background is otherwise transparent and would let particles bleed straight through the graph. Also fixes a test gap surfaced by this change: jsdom has no matchMedia implementation, so any component using useReducedMotion (BackgroundLayer's dependency) throws in tests unless it's mocked. Added a shared mock to vitest.setup.ts rather than per-test, since it's a jsdom environment gap, not something specific to this component. --- .../workspace/components/WorkspaceShell.tsx | 11 ++++++++--- .../workspace/graph/WorkspaceGraphView.tsx | 9 +++++++-- client/vitest.setup.ts | 15 +++++++++++++++ 3 files changed, 30 insertions(+), 5 deletions(-) diff --git a/client/src/features/workspace/components/WorkspaceShell.tsx b/client/src/features/workspace/components/WorkspaceShell.tsx index 4f1e689..9ab2a08 100644 --- a/client/src/features/workspace/components/WorkspaceShell.tsx +++ b/client/src/features/workspace/components/WorkspaceShell.tsx @@ -8,6 +8,7 @@ import { useAuthUser } from "@/features/auth/auth.store"; import { useLogout } from "@/features/auth/auth.api"; import { useBootstrapSession } from "@/features/auth/use-bootstrap-session"; import { Button } from "@/components/ui/button"; +import { BackgroundLayer } from "@/components/effects/BackgroundLayer"; import { ProjectSwitcher } from "./ProjectSwitcher"; type Props = { @@ -43,8 +44,12 @@ export function WorkspaceShell({ children }: Props) { } return ( -
-
+
+ {/* Same shared effect as the Hero/login/register (FE-012 lineage). Kept subtle here: the + * header gets a frosted backdrop and page content keeps its own solid surfaces (project + * cards, the graph canvas card) so the animation reads as ambient texture, not clutter. */} + +
@@ -61,7 +66,7 @@ export function WorkspaceShell({ children }: Props) {
-
{children}
+
{children}
); } diff --git a/client/src/features/workspace/graph/WorkspaceGraphView.tsx b/client/src/features/workspace/graph/WorkspaceGraphView.tsx index 333a099..39bb8b0 100644 --- a/client/src/features/workspace/graph/WorkspaceGraphView.tsx +++ b/client/src/features/workspace/graph/WorkspaceGraphView.tsx @@ -53,10 +53,15 @@ export function WorkspaceGraphView({ projectId }: Props) { return (
-
+

{project.data?.name}

-
+ {/* + * Same frosted-card treatment as the Hero's GraphStage: the particle background now mounted + * behind the whole workspace (WorkspaceShell) would otherwise bleed straight through React + * Flow's transparent dot grid and compete with node/edge legibility. + */} +
{/* * `h-full` on GraphEngine's own wrapper can resolve to 0 here: this ancestor's height * comes purely from flex-grow (no explicit CSS height anywhere in the chain up to diff --git a/client/vitest.setup.ts b/client/vitest.setup.ts index f149f27..9264b6d 100644 --- a/client/vitest.setup.ts +++ b/client/vitest.setup.ts @@ -1 +1,16 @@ import "@testing-library/jest-dom/vitest"; + +// jsdom doesn't implement matchMedia. Anything using useReducedMotion (BackgroundLayer and its +// consumers: the Hero, /login, /register, WorkspaceShell) needs this to render in tests at all. +if (!window.matchMedia) { + window.matchMedia = (query: string) => ({ + matches: false, + media: query, + onchange: null, + addListener: () => {}, + removeListener: () => {}, + addEventListener: () => {}, + removeEventListener: () => {}, + dispatchEvent: () => false, + }) as unknown as MediaQueryList; +}