"use client"; import { useMemo, useState } from "react"; import type { Sticker, StickerCategory } from "../../types/passport"; import EmptyState from "../shared/EmptyState"; import ProgressBar from "../shared/ProgressBar"; import StatusPill, { type StatusTone } from "../shared/StatusPill"; interface StickerAlbumScreenProps { stickers: Sticker[]; onOpenPack: (stickerIds: string[]) => void; } function rarityTone(rarity: Sticker["rarity"]): StatusTone { switch (rarity) { case "legendary": return "gold"; case "epic": return "epic"; case "rare": return "info"; case "uncommon": return "success"; case "common": default: return "neutral"; } } export default function StickerAlbumScreen({ stickers, onOpenPack }: StickerAlbumScreenProps) { const [categoryFilter, setCategoryFilter] = useState("all"); const [latestPack, setLatestPack] = useState([]); const categories = useMemo( () => ["all", ...Array.from(new Set(stickers.map((sticker) => sticker.category)))] as const, [stickers], ); const filteredStickers = categoryFilter === "all" ? stickers : stickers.filter((sticker) => sticker.category === categoryFilter); const obtainedCount = stickers.filter((sticker) => sticker.obtained).length; const duplicateCount = stickers.reduce((total, sticker) => total + sticker.duplicateCount, 0); function openPack() { const missing = stickers.filter((sticker) => !sticker.obtained); const duplicates = stickers.filter((sticker) => sticker.obtained); const pack = [...missing.slice(0, 3), ...duplicates.slice(0, Math.max(0, 3 - missing.length))].slice( 0, 3, ); if (pack.length === 0) { return; } setLatestPack(pack); onOpenPack(pack.map((sticker) => sticker.id)); } return (

Sticker album

Open packs. Complete pages.

The virtual sticker book is the emotional collection layer: common crests, rare stadiums, epic stars, legendary moments, duplicates, and future trading.

{categories.map((category) => ( ))}
{latestPack.length > 0 ? (

Pack reveal

New pack opened

{latestPack.map((sticker) => (
{sticker.title}

{sticker.rarity}

))}
) : null} {filteredStickers.length === 0 ? ( ) : (
{filteredStickers.map((sticker) => (

{sticker.obtained ? sticker.title : "Mystery sticker"}

{sticker.obtained ? sticker.subtitle : sticker.setName}

{sticker.rarity} {sticker.obtained ? "Owned" : "Missing"} {sticker.duplicateCount > 0 ? ( +{sticker.duplicateCount} dupes ) : null}
))}
)}
); }