deckhearth/components
Randall Stillwell 79171e8b97 feat(layout): default user=null + Sign-in CTA when logged out (Brief 1 of fix-layout-default-user)
Closes the source-side half of P0 #7 from .convoys/ship-readiness.md.
The page-side sweep (Brief 2) follows in a separate commit.

components/Layout.js:
  - Default user prop is now null (was hardcoded to
    { email: 'me@randallstillwell.com', role: 'user' })
  - UserProfileDropdown renders a "Sign in" link to /login when
    user === null instead of the maintainer's email + auth-only menu
    items (Decision A1)
  - All user.* accesses guarded with optional chaining or null checks
  - useState hook stays above the new null-user early return to satisfy
    rules-of-hooks (boot-the-brief caught this on the first try;
    see AGENTS.md Gotcha #11.5)

test/components/Layout.test.js (new):
  - First jsdom test in the repo (Decision D2)
  - 5 regression-lock assertions: no maintainer email ever rendered
    (prop omitted, prop=null), Sign-in link exists with href=/login,
    supplied email renders when prop is set, no "Guest" placeholder
    (locks A1 copy choice)
  - Mocks next/link, next/router (prefetch, replace, events, query),
    and theme-context.useTheme for jsdom safety under Next 16

package.json + package-lock.json:
  - Add jsdom@^29 and @testing-library/react@^16 to devDependencies
  - @testing-library/dom@^10 added explicitly (peer auto-install
    skipped it under npm 11; brief anticipated this fallback)

vitest.config.js (deviation from brief — see PR description):
  - Add esbuild { loader: 'jsx', jsx: 'automatic' } so vitest can
    parse JSX in .js files. Required to import any React component
    written in the repo's Next.js pages-router .js convention
    (AGENTS.md Gotcha #9). The brief said "no change" to this file,
    but JSX-in-.js parsing is a hard prerequisite for the new test
    to import components/Layout.js — the alternatives (rename test
    to .test.jsx; rewrite test in React.createElement) either break
    the test glob or still hit the same Layout.js parse failure.
    Other tests are unaffected (they import non-JSX modules).

Smoke output: see PR description.

addresses: P0 #7 from .convoys/ship-readiness.md (last P0 ship-blocker)
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-24 14:22:20 -05:00
..
AdminProtected.js Fixed SSR and null user issues for production deployment 2025-07-24 17:04:06 -05:00
AnimatedFireLogo.js 🎯 Replace Complex Logo with Clean Static SVG 2025-07-28 10:59:11 -05:00
AuthLayout.js 🔥 Add Fire Glow Login Background 2025-07-28 09:51:39 -05:00
BulkSelectionToolbar.js 🔥 Transform to Deck Hearth Fire-Inspired Design 2025-07-26 08:30:07 -05:00
CameraScanner.js Marker: Fixed card queue property mismatch - cards now properly separate in scanner queue 2025-08-01 17:41:42 -05:00
CardItem.js 🔥 Primary Red Add Button + Static Rarity Shadows 2025-07-26 09:17:22 -05:00
CollaboratorFacepile.js 🔧 Fixed Cards Page API Response Format 2025-07-25 23:16:35 -05:00
CollectionSelectionModal.js 🔧 Fix System Collections & Database Schema Issues 2025-07-27 19:17:55 -05:00
Layout.js feat(layout): default user=null + Sign-in CTA when logged out (Brief 1 of fix-layout-default-user) 2026-05-24 14:22:20 -05:00
Layout.js.backup 🚀 Implement Mobile-First Navigation System 2025-08-01 18:18:21 -05:00
LoginCTA.js Major Scanner Improvements 2025-07-29 14:19:48 -05:00
ManaSymbols.js Major Scanner Improvements 2025-07-29 14:19:48 -05:00
ManaSymbolSettings.js Major Scanner Improvements 2025-07-29 14:19:48 -05:00
MobileNavigation.js 🚀 Implement Mobile-First Navigation System 2025-08-01 18:18:21 -05:00
OCRSettings.js Major Scanner Improvements 2025-07-29 14:19:48 -05:00
PermissionIndicator.js 🔄 Simplified Permission Model & UX Improvements 2025-07-25 10:29:45 -05:00
ProtectedRoute.js Major Scanner Improvements 2025-07-29 14:19:48 -05:00
ShareModal.js 🔥 Transform to Deck Hearth Fire-Inspired Design 2025-07-26 08:30:07 -05:00
UploadImageModal.js 🚀 Implemented Complete Collection Functionality 2025-07-25 22:28:52 -05:00