deckhearth/components/CardEditorSearchPanel.js
varutasu 19050cf1bc
feat(design-system): sweep authenticated body-content panels to glass (#97)
PR #95/#96 shipped the Liquid Glass foundation (tokens, primitives, gates)
plus Layout shell, modals, landing, auth pages, and form CTAs — but body-
content panels on authenticated pages (admin Card Editor, admin Card
Import, admin Submissions, dashboard, my-cards, settings, scanner panels,
card detail price cards, popovers) were still rendering as flat
var(--bg-secondary) cards. Result: the admin Tools screen and several
core pages looked unchanged after the redesign.

This sweep adds a `.glass-panel` / `.glass-panel-strong` utility
(<GlassSurface tint=mid/high rim=subtle elevation=ambient/pronounced
blur=mid/high> in class form) and applies it across 18 surfaces:

  * Admin Card Editor view, search panel, form (5 sections), preview
  * Admin Card Import navigation + 3 body cards + sync panel
  * Admin Card Submissions list items
  * Dashboard stat cards + empty-state + grid items (5 surfaces)
  * My-cards empty-state CTA card
  * Settings panels (3)
  * Scanner page settings + grid + queue + bulk toolbar + dialog
  * Scanner destination picker + camera status banner + disambiguation
  * Card detail price cards (Current / TCGPlayer / CardKingdom)
  * Permission indicator tooltips
  * Collections page header card
  * Card detail view price cards

Also migrates the lingering admin Card Editor "Card Editor / Card Import"
nav buttons and the "Save Changes" / "Import Cards" / "Run catalog sync"
CTAs to the <Button> primitive (consistent loading + disabled states).

Page header bands (full-bleed strips with border-bottom on dashboard,
my-cards, cards, collections, community/collections, collection/[id])
are intentionally left solid — they're not card-shaped surfaces and
stacking glass-on-glass directly below the already-glass topbar would
muddy the hierarchy.

Tests: lint clean, vitest 104/104, build green. The visual diff
baseline will need refresh because the homepage spec is unaffected
(it targets the unauthenticated landing page) but the dashboard/
admin/scanner surfaces will diff if/when we add baselines for them.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-03 21:28:52 -05:00

98 lines
3.4 KiB
JavaScript

/* eslint-disable @next/next/no-img-element -- External card image URLs; next/image migration is out of scope. */
import { SearchBar } from './ui';
/**
* Admin card editor: search input + result grid for picking a card to edit.
*/
export default function CardEditorSearchPanel({
searchQuery,
onSearchQueryChange,
searchLoading,
searchResults,
onSelectCard,
}) {
return (
<div className="glass-panel mb-8 p-6 rounded-xl">
<h2
className="text-xl font-semibold mb-4"
style={{ color: 'var(--text-primary)' }}
>
Find Card to Edit
</h2>
<div className="flex gap-4 mb-4">
<div className="flex-1">
<SearchBar
value={searchQuery}
onChange={(e) => onSearchQueryChange(e.target.value)}
onClear={() => onSearchQueryChange('')}
placeholder="Search for cards by name…"
/>
</div>
</div>
{searchLoading && (
<div className="text-center py-4">
<div
className="motion-essential animate-spin rounded-full h-8 w-8 border-b-2 mx-auto"
style={{ borderColor: 'var(--accent-ember)' }}
/>
</div>
)}
{searchResults.length > 0 && (
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
{searchResults.map((searchCard) => (
<button
type="button"
key={searchCard.id}
onClick={() => onSelectCard(searchCard)}
className="glass-panel p-4 rounded-lg cursor-pointer text-left hover:scale-[1.02] focus:outline-none focus-visible:ring-2"
style={{
transition:
'transform var(--motion-duration-default) var(--motion-ease-out), box-shadow var(--motion-duration-default) var(--motion-ease-out)',
'--tw-ring-color': 'var(--accent-ember)',
}}
>
<div className="flex items-center gap-3">
<div
className="w-12 h-16 rounded-lg overflow-hidden flex-shrink-0"
style={{ backgroundColor: 'var(--bg-tertiary)' }}
>
{searchCard.image_url ? (
<img
src={searchCard.image_url}
alt={searchCard.name}
className="w-full h-full object-cover"
/>
) : (
<div
className="w-full h-full flex items-center justify-center text-xs"
style={{ color: 'var(--text-secondary)' }}
>
{searchCard.game}
</div>
)}
</div>
<div className="flex-1">
<h3
className="font-semibold"
style={{ color: 'var(--text-primary)' }}
>
{searchCard.name}
</h3>
<p className="text-sm" style={{ color: 'var(--text-secondary)' }}>
{searchCard.set_name} {searchCard.game}
</p>
<p className="text-sm" style={{ color: 'var(--text-secondary)' }}>
{searchCard.rarity}
</p>
</div>
</div>
</button>
))}
</div>
)}
</div>
);
}