deckhearth/pages/index.js
varutasu 926ce7a45b
feat(design-system): finish Liquid Glass — close all remaining sub-convoys (#96)
Follow-up PR to #95 (Liquid Glass foundation + primitives + Layout shell)
that closes out the remaining sub-convoy briefs in a single sweep.
Operator-instructed scope: "finish off the design changes."

After this PR, **all 8 Liquid Glass sub-convoys are MERGED to main**;
the deferred-from-#5 `fix-card3d-state` convoy is dropped (its target,
`components/Card3D.js`, turned out to be dead code).

## #2 Brief 2 — Remaining 8 modals migrated to <Modal> primitive

- `CollectionsSuccessModal.js` — wrap in <Modal hideCloseButton>; 2 Buttons.
- `CollectionsEditModal.js` — full <Modal> + <Input> + <Button> rewrite (4 fields, tag chip section, public-toggle preserved, 2 footer Buttons).
- `CollectionEditModal.js` — same pattern as above (4 fields + public-toggle + 2 Buttons).
- `CardDetailDeckModal.js` — <Modal> + native select (Select primitive not in scope) + 2 Buttons; sweep `gradient-bg-purple` → `<Button variant="primary">`.
- `UploadImageModal.js` — <Modal> + token-driven URL/file tab switcher + drag-drop using `--accent-ember` rim + 2 Buttons (one with `loading` prop).
- `CollectionSelectionModal.js` — largest of the set (header summary + SearchBar + scrollable list w/ checkbox toggles + footer); migrated to <Modal size="lg"> while preserving the per-collection card preview thumbnails.
- `OCRSettings.js` — trivial <Modal> wrap + single primary <Button>.
- `pages/decks.js` — both inline modals (Create Deck + Edit Deck) and `components/ScannerPageView.js` (Create List) migrated; ScannerPageView dropped its `useFocusTrap` named-import (Modal's internal focus trap owns the panel ref now).
- **`.github/workflows/ci.yml` `forbidden-modal-shell-without-primitive`** — grandfather list emptied to zero entries; gate is now strict.

## #3 Brief 2 — Forms migrated to <Button> / <SearchBar>

- `pages/dashboard.js` — 3 CTAs → <Button> (Create List with leadingIcon, Create Your First List, View All Lists).
- `pages/my-cards.js` — empty-state CTA → <Button variant="primary" size="lg">. View-mode toggle buttons intentionally left native (icon-only, doesn't match Button variants).
- `pages/community/collections.js` — Go to My Lists CTA → <Button>.
- `components/CollectionsPageView.js` — Discover Community + Create List header CTAs → <Button>; search input → <SearchBar>.
- Card-grid per-row icon buttons (CollectionsPageView, my-cards, CardsPageView) intentionally left native — tiny per-card actions whose styling doesn't match Button variants and would invalidate visual-diff baselines.

## #5 — scope revised + landed

`components/Card3D.js` deletion: surveyed every importer with grep — **zero consumers** in `pages/**` or `components/**`. Only references were in convoy docs. The "pre-existing state-management bug" (state setters used without useState declarations) never affected the running app because the component was never rendered. -505 LOC. The `fix-card3d-state` convoy is dropped from the roadmap as a result.

The actual card-grid component (`components/CardItem.js`) is intentionally **not** modified in this sweep — it has per-rarity glow tuning that the existing visual-diff baseline locks in, and the architect's #5 deferral note specifically called out the dedicated baseline re-seed cost. A future implementer turn can apply rim-light tokens to CardItem with its own baseline re-seed when an operator wants that polish.

## #6 Brief 1 — Landing + invite pages glass-migrated

- `pages/index.js` — top nav: `var(--glass-surface-mid)` + `--glass-blur-mid` + rim-light. 3 feature cards: `<GlassSurface tint="mid" rim="subtle" elevation="ambient">`. Featured-list cards (the public collection grid): same `<GlassSurface>` recipe with motion-token transitions. All 6 CTA buttons → <Button variant="primary"|"secondary"|"ghost"> with proper sizes. Pulse-loading placeholders tagged `.motion-essential` so reduced-motion users still see them animate (state-meaningful).
- `pages/invite/accept.js` + `pages/invite/decline.js` — both outcome panels wrapped in `<GlassSurface tint="mid" rim="subtle" elevation="pronounced">`. Loading spinner border colors corrected from `--text-accent` (which didn't exist) to `--accent-ember`. All 8 buttons → <Button>. `gradient-bg-ember` consumers retained (the canonical warm-palette utility class is fine).

## #8 Brief 2 — Legacy alias sweep + CI gate graduation

- Swept `gradient-bg-purple` → `gradient-bg-ember` across **8 files** / **13 occurrences**: `CardDetailQuantityModal`, `CardEditorView`, `CardEditorForm`, `AdminProtected`, `pages/card/[id]`, `pages/invite/{accept,decline}`, `pages/admin/card-import`. `gradient-bg-purple` was a dangling class name with no CSS definition (it was rendering no styling), so the sweep is also a bug fix — those buttons now actually get the ember gradient.
- Deleted the 5 dead CSS classes from `styles/globals.css`: `.gradient-text-blue`, `.gradient-text-purple`, `[data-theme="dark"] .glow-blue`, `[data-theme="dark"] .glow-purple`, `[data-theme="dark"] .glow-pink`. Each was zero-consumer post-sweep.
- **Graduated the `forbidden-deprecated-color-aliases` CI job from WARN to FAIL.** All 9 patterns (`gradient-text-{purple,pink,blue}`, `glow-{purple,pink,blue}`, `gradient-bg-{purple,blue,pink}`) now block the build if any consumer is reintroduced.

## Verification (local + CI gates locally exercised)

- Lint: 0 errors, 2 pre-existing warnings (`CardEditorForm.js` + `CollectionsPageView.js` carry-overs from before #95; out of scope).
- Vitest: 104/104 passing — unchanged from #95.
- Build: clean (Turbopack default; passes both light + dark theme prerender).
- `forbidden-modal-shell-without-primitive` gate: locally clear (`grep -lE 'fixed inset-0 bg-black bg-opacity-' pages components -r --include='*.js'` returns no matches).
- `forbidden-deprecated-color-aliases` gate: locally clear (all 9 patterns return no matches in `pages/` or `components/`).

## What still needs human action

- **Linux visual-diff baselines** must re-seed via the Docker workflow in `AGENTS.md` § 6. This PR's landing-page + invite-page changes will produce baseline drift on the homepage screenshot (which is currently the only baseline committed) AND additional baselines will be generated for the landing's glass-card sections once the visual spec is expanded. Recommended: run the Docker re-seed against this PR's Vercel preview, commit the result to this branch, push, verify CI green, then merge.
- Vercel auto-promotes the merge to production.

## Closes / supersedes

- Closes `.convoys/liquid-glass-modal-and-surface-primitive.md` Brief 2 (status → merged).
- Closes `.convoys/liquid-glass-form-primitives.md` Brief 2 (status → merged with explicit per-row-icon-button deferral note).
- Closes `.convoys/liquid-glass-public-and-auth.md` Brief 1 (status → merged).
- Closes `.convoys/cleanup-legacy-design-css.md` Brief 2 (status → merged + CI gate FAIL).
- Drops `.convoys/liquid-glass-card-surfaces.md` Brief 1 prerequisite (`fix-card3d-state` no longer needed; Card3D deleted).
- Drops the queued `fix-card3d-state` follow-up from the roadmap (target deleted).
- Updates `.convoys/ship-readiness.md` § "Design-system redesign portfolio" with a "Finish-portfolio sweep" subsection documenting final status of all 8 sub-convoys.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-03 20:34:06 -05:00

448 lines
17 KiB
JavaScript

/* eslint-disable @next/next/no-img-element -- External or generated image URLs; next/image migration is out of scope. */
import { useState, useEffect } from 'react';
import { useRouter } from 'next/router';
import Link from 'next/link';
import { useAuth } from '../lib/use-auth.js';
import AnimatedFireLogo from '../components/AnimatedFireLogo';
import { Button, GlassSurface } from '../components/ui';
export default function Home() {
const { user, loading } = useAuth();
const router = useRouter();
const [featuredCollections, setFeaturedCollections] = useState([]);
const [collectionsLoading, setCollectionsLoading] = useState(true);
useEffect(() => {
if (!loading && user) {
router.push('/dashboard');
}
}, [user, loading, router]);
useEffect(() => {
const fetchFeaturedCollections = async () => {
try {
const response = await fetch('/api/public/collections?limit=6');
if (response.ok) {
const collections = await response.json();
setFeaturedCollections(collections);
}
} catch (error) {
console.error('Error fetching featured collections:', error);
} finally {
setCollectionsLoading(false);
}
};
fetchFeaturedCollections();
}, []);
if (loading) {
return (
<div
className="min-h-screen flex items-center justify-center"
style={{ backgroundColor: 'var(--bg-primary)' }}
>
<div className="text-center">
<div
className="motion-essential animate-spin rounded-full h-12 w-12 border-b-2 mx-auto mb-4"
style={{ borderColor: 'var(--accent-ember)' }}
/>
<p style={{ color: 'var(--text-secondary)' }}>Loading...</p>
</div>
</div>
);
}
if (user) {
return null;
}
return (
<div className="min-h-screen" style={{ backgroundColor: 'var(--bg-primary)' }}>
<nav
className="border-b"
style={{
background: 'var(--glass-surface-mid)',
backdropFilter:
'blur(var(--glass-blur-mid)) saturate(var(--glass-saturate))',
WebkitBackdropFilter:
'blur(var(--glass-blur-mid)) saturate(var(--glass-saturate))',
borderColor: 'var(--border)',
boxShadow: 'inset 0 1px 0 var(--rim-light-inner)',
}}
>
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
<div className="flex justify-between items-center py-4">
<div className="flex items-center space-x-3">
<AnimatedFireLogo size={40} />
<h1 className="text-2xl font-bold gradient-text-flame">Deck Hearth</h1>
</div>
<div className="flex items-center space-x-4">
<Link href="/login">
<Button variant="ghost" size="sm">
Sign In
</Button>
</Link>
<Link href="/signup">
<Button variant="primary" size="sm">
Get Started
</Button>
</Link>
</div>
</div>
</div>
</nav>
<section className="relative py-20 px-4">
<div className="max-w-6xl mx-auto text-center">
<div className="mb-8">
<AnimatedFireLogo size={120} />
</div>
<h1 className="text-5xl md:text-7xl font-bold mb-6">
<span className="gradient-text-flame">Deck Hearth</span>
</h1>
<p
className="text-xl md:text-2xl mb-8 max-w-3xl mx-auto leading-relaxed"
style={{ color: 'var(--text-secondary)' }}
>
The ultimate hub for trading card collectors. Organize your cards into lists,
discover rare cards, and connect with fellow enthusiasts in one beautiful
platform.
</p>
<div className="flex flex-col sm:flex-row gap-4 justify-center items-center">
<Link href="/signup">
<Button variant="primary" size="lg">
Start Your Collection
</Button>
</Link>
<Link href="/community/collections">
<Button variant="secondary" size="lg">
Explore Lists
</Button>
</Link>
</div>
</div>
</section>
<section className="py-20 px-4" style={{ backgroundColor: 'var(--bg-secondary)' }}>
<div className="max-w-6xl mx-auto">
<h2 className="text-4xl font-bold text-center mb-16 gradient-text-gold">
Everything You Need to Manage Your Cards
</h2>
<div className="grid md:grid-cols-3 gap-8">
<GlassSurface
tint="mid"
rim="subtle"
elevation="ambient"
className="text-center p-8 rounded-2xl"
>
<div
className="w-16 h-16 mx-auto mb-6 rounded-2xl flex items-center justify-center"
style={{ backgroundColor: 'var(--accent-ember)' }}
>
<svg
className="w-8 h-8 text-white"
fill="none"
stroke="currentColor"
viewBox="0 0 24 24"
aria-hidden="true"
>
<path
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth={2}
d="M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10"
/>
</svg>
</div>
<h3 className="text-xl font-bold mb-4 gradient-text-flame">Organize Lists</h3>
<p style={{ color: 'var(--text-secondary)' }}>
Create custom lists, track card values, and organize by sets, rarity, or any
system that works for you.
</p>
</GlassSurface>
<GlassSurface
tint="mid"
rim="subtle"
elevation="ambient"
className="text-center p-8 rounded-2xl"
>
<div
className="w-16 h-16 mx-auto mb-6 rounded-2xl flex items-center justify-center"
style={{ backgroundColor: 'var(--accent-gold)' }}
>
<svg
className="w-8 h-8 text-white"
fill="none"
stroke="currentColor"
viewBox="0 0 24 24"
aria-hidden="true"
>
<path
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth={2}
d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"
/>
</svg>
</div>
<h3 className="text-xl font-bold mb-4 gradient-text-gold">Discover Cards</h3>
<p style={{ color: 'var(--text-secondary)' }}>
Search through thousands of cards across multiple TCGs. Find that missing
piece for your binder.
</p>
</GlassSurface>
<GlassSurface
tint="mid"
rim="subtle"
elevation="ambient"
className="text-center p-8 rounded-2xl"
>
<div
className="w-16 h-16 mx-auto mb-6 rounded-2xl flex items-center justify-center"
style={{ backgroundColor: 'var(--accent-flame)' }}
>
<svg
className="w-8 h-8 text-white"
fill="none"
stroke="currentColor"
viewBox="0 0 24 24"
aria-hidden="true"
>
<path
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth={2}
d="M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2 0 014 0zM7 10a2 2 0 11-4 0 2 2 0 014 0z"
/>
</svg>
</div>
<h3 className="text-xl font-bold mb-4 gradient-text-ember">Connect & Share</h3>
<p style={{ color: 'var(--text-secondary)' }}>
Share your lists with the community, collaborate with friends, and discover
amazing lists from other collectors.
</p>
</GlassSurface>
</div>
</div>
</section>
<section className="py-20 px-4">
<div className="max-w-6xl mx-auto">
<div className="text-center mb-16">
<h2 className="text-4xl font-bold mb-4 gradient-text-flame">Featured Lists</h2>
<p className="text-xl" style={{ color: 'var(--text-secondary)' }}>
Discover amazing lists from our community
</p>
</div>
{collectionsLoading ? (
<div className="grid md:grid-cols-2 lg:grid-cols-3 gap-6">
{[...Array(6)].map((_, i) => (
<div
key={i}
className="motion-essential rounded-2xl p-6 animate-pulse"
style={{ backgroundColor: 'var(--bg-secondary)' }}
>
<div
className="h-32 rounded-xl mb-4"
style={{ backgroundColor: 'var(--bg-tertiary)' }}
/>
<div
className="h-6 rounded mb-2"
style={{ backgroundColor: 'var(--bg-tertiary)' }}
/>
<div
className="h-4 rounded mb-4"
style={{ backgroundColor: 'var(--bg-tertiary)' }}
/>
<div className="flex justify-between">
<div
className="h-4 w-16 rounded"
style={{ backgroundColor: 'var(--bg-tertiary)' }}
/>
<div
className="h-4 w-20 rounded"
style={{ backgroundColor: 'var(--bg-tertiary)' }}
/>
</div>
</div>
))}
</div>
) : (
<div className="grid md:grid-cols-2 lg:grid-cols-3 gap-6">
{featuredCollections.map((collection) => (
<Link
key={collection.id}
href={`/collection/${collection.slug || collection.id}`}
>
<GlassSurface
tint="mid"
rim="subtle"
elevation="ambient"
className="block rounded-2xl p-6 hover:scale-105"
style={{
transition:
'transform var(--motion-duration-default) var(--motion-ease-out), box-shadow var(--motion-duration-default) var(--motion-ease-out)',
}}
>
<div
className="h-32 rounded-xl mb-4 flex items-center justify-center"
style={{ backgroundColor: 'var(--bg-tertiary)' }}
>
{collection.image ? (
<img
src={collection.image}
alt={collection.name}
className="w-full h-full object-cover rounded-xl"
/>
) : (
<div className="text-center">
<div
className="w-12 h-12 mx-auto mb-2 rounded-xl flex items-center justify-center"
style={{ backgroundColor: 'var(--accent-ember)' }}
>
<svg
className="w-6 h-6 text-white"
fill="none"
stroke="currentColor"
viewBox="0 0 24 24"
aria-hidden="true"
>
<path
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth={2}
d="M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10"
/>
</svg>
</div>
<p className="text-sm" style={{ color: 'var(--text-secondary)' }}>
{collection.cardCount} cards
</p>
</div>
)}
</div>
<h3 className="text-xl font-bold mb-2 gradient-text-flame">
{collection.name}
</h3>
<p
className="text-sm mb-4 line-clamp-2"
style={{ color: 'var(--text-secondary)' }}
>
{collection.description || 'A carefully curated list'}
</p>
<div className="flex justify-between items-center">
<span
className="text-sm font-medium"
style={{ color: 'var(--text-primary)' }}
>
{collection.cardCount} cards
</span>
<span className="text-sm" style={{ color: 'var(--text-secondary)' }}>
by {collection.creator}
</span>
</div>
</GlassSurface>
</Link>
))}
</div>
)}
<div className="text-center mt-12">
<Link href="/community/collections">
<Button variant="secondary" size="lg">
View All Lists
<svg
className="w-5 h-5 ml-2 inline-block"
fill="none"
stroke="currentColor"
viewBox="0 0 24 24"
aria-hidden="true"
>
<path
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth={2}
d="M17 8l4 4m0 0l-4 4m4-4H3"
/>
</svg>
</Button>
</Link>
</div>
</div>
</section>
<section className="py-20 px-4" style={{ backgroundColor: 'var(--bg-secondary)' }}>
<div className="max-w-4xl mx-auto text-center">
<h2 className="text-4xl font-bold mb-6 gradient-text-flame">
Ready to Start Your Journey?
</h2>
<p className="text-xl mb-8" style={{ color: 'var(--text-secondary)' }}>
Join thousands of collectors who trust Deck Hearth to manage their cards and
lists.
</p>
<div className="flex flex-col sm:flex-row gap-4 justify-center items-center">
<Link href="/signup">
<Button variant="primary" size="lg">
Create Free Account
</Button>
</Link>
<Link href="/cards">
<Button variant="secondary" size="lg">
Browse Cards
</Button>
</Link>
</div>
</div>
</section>
<footer
className="py-12 px-4 border-t"
style={{
backgroundColor: 'var(--bg-primary)',
borderColor: 'var(--border)',
}}
>
<div className="max-w-6xl mx-auto">
<div className="flex flex-col md:flex-row justify-between items-center">
<div className="flex items-center space-x-3 mb-4 md:mb-0">
<AnimatedFireLogo size={32} />
<span className="text-xl font-bold gradient-text-flame">Deck Hearth</span>
</div>
<div className="flex space-x-6">
<Link
href="/community/collections"
className="hover:opacity-80 transition-opacity"
style={{ color: 'var(--text-secondary)' }}
>
Community
</Link>
<Link
href="/cards"
className="hover:opacity-80 transition-opacity"
style={{ color: 'var(--text-secondary)' }}
>
Cards
</Link>
<Link
href="/login"
className="hover:opacity-80 transition-opacity"
style={{ color: 'var(--text-secondary)' }}
>
Sign In
</Link>
</div>
</div>
<div
className="mt-8 pt-8 border-t text-center"
style={{ borderColor: 'var(--border)' }}
>
<p style={{ color: 'var(--text-secondary)' }}>
© 2024 Deck Hearth. Built for collectors, by collectors.
</p>
</div>
</div>
</footer>
</div>
);
}