import { useState, type ReactNode } from "react";
import { cn } from "@/lib/utils";
import type { Giocatore } from "@/lib/crapp-data";
import {
collezioneBadge,
gradoMeta,
iconaSegreto as Lucchetto,
mancanoPer,
microcopyBadge,
prossimoTraguardo,
type BadgeStato,
} from "@/lib/badges";
import {
badgeSocialVinti,
categorieSocial,
type VotoSocial,
type CategoriaSocial,
} from "@/lib/badge-social";
import { Reveal } from "@/components/motion/Reveal";
import { Barra } from "@/components/motion/Barra";
import { Numero } from "@/components/motion/Numero";
import { BadgeDrawer } from "@/components/crapp/BadgeDrawer";
import {
Drawer,
DrawerClose,
DrawerContent,
DrawerDescription,
DrawerHeader,
DrawerTitle,
DrawerTrigger,
} from "@/components/ui/drawer";
function CardBadge({ b, opaco, indice = 0 }: { b: BadgeStato; opaco?: boolean; indice?: number }) {
const Icon = b.def.icon;
const meta = b.grado ? gradoMeta[b.grado] : null;
return (
{b.def.nome}
{b.valore} {b.def.unita}
{mancanoPer(b)} {microcopyBadge(b)} {microcopyBadge(b)}
Vinto
{conteggio}{" "}
{conteggio === 1 ? "volta" : "volte"}
Collezione badge
Prossimo traguardo
{vicino.def.nome}
{mancanoPer(vicino)} ยท {microcopyBadge(vicino)}
Sbloccati ({c.sbloccati.length})
In progresso ({c.inProgresso.length})
Votati dai compagni
{cat.emoji}
{cat.nome}
Vinto {social[cat.id]} {social[cat.id] === 1 ? "volta" : "volte"}
Badge segreti
{b.def.nome}
{b.def.celebrazione ?? "Badge segreto sbloccato."}
???
Badge segreto da scoprire