import { useState, useMemo } from 'react'; import { useSeoMeta } from '@unhead/react'; import { Layout } from '@/components/Layout'; import { Input } from '@/components/ui/input'; import { cn } from '@/lib/utils'; import { GLOSSARY, TOTAL_TRICKS, searchTricks, type FlatTrick, } from '@/lib/glossary'; import { BookOpen, Search, X } from 'lucide-react'; function TrickRow({ trick }: { trick: { name: string; aka?: string[]; desc: string } }) { return (

{trick.name}

{trick.aka && trick.aka.length > 0 && (

a.k.a. {trick.aka.join(' · ')}

)}

{trick.desc}

); } export default function GlossaryPage() { const [query, setQuery] = useState(''); const [activeCat, setActiveCat] = useState(null); useSeoMeta({ title: 'Trick Glossary · SkateSpots', description: `The complete skateboarding glossary — ${TOTAL_TRICKS} entries covering flips, grinds, slides, grabs, airs, lip tricks, handplants, freestyle, transition terms, stance & hardware, with alternate names.`, }); const isSearching = query.trim().length > 0; const searchResults: FlatTrick[] = useMemo( () => (isSearching ? searchTricks(query) : []), [query, isSearching], ); const visibleCategories = useMemo( () => (activeCat ? GLOSSARY.filter((c) => c.id === activeCat) : GLOSSARY), [activeCat], ); return (
{/* Hero */}

TRICK GLOSSARY

{TOTAL_TRICKS} entries · tricks, transition, freestyle, stance & hardware

{/* Search */}
setQuery(e.target.value)} placeholder="Search tricks or nicknames — tre flip, crooks, method…" className="h-11 rounded-xl border-white/10 bg-black/40 pl-9 pr-9 text-white placeholder:text-gray-500 focus-visible:ring-red-500/40" /> {query && ( )}
{/* Category filter pills — hidden while searching */} {!isSearching && (
{GLOSSARY.map((cat) => ( ))}
)} {/* Search results */} {isSearching ? (

{searchResults.length} result{searchResults.length === 1 ? '' : 's'} for “{query}”

{searchResults.length === 0 ? (

No tricks match that. Try a nickname like “tre flip”, “crooks”, or “melon”.

) : (
{searchResults.map((t) => (

{t.categoryGlyph} {t.categoryTitle}

))}
)}
) : ( /* Category sections */
{visibleCategories.map((cat) => (

{cat.glyph} {cat.title}

{cat.tricks.length} tricks

{cat.blurb}

{cat.tricks.map((t) => ( ))}
))}
)} {/* Footer note */}

Know a trick or nickname we missed? Tricks pick up different names in every scene — hit up{' '} {' '} and let us know.

); }