import { useState, type ReactNode } from "react"; import { cn } from "@/lib/utils"; import type { BadgeDef, BadgeStato, Grado } from "@/lib/badges"; import { gradoMeta, gradiOrdine, descrizioneSoglie } from "@/lib/badges"; import { Barra } from "@/components/motion/Barra"; import { Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerTitle, DrawerTrigger, } from "@/components/ui/drawer"; function DettaglioBadge({ def, stato }: { def: BadgeDef; stato?: BadgeStato }) { const Icon = def.icon; const grado = stato?.grado ?? null; const meta = grado ? gradoMeta[grado] : null; const prossimo = stato?.prossimo ?? null; return (
Stato attuale
{grado ? ( {meta?.label} ) : ( In progresso )}{stato.valore} {def.unita}
{stato.prossimaSoglia ? ( <>Mancano {stato.prossimaSoglia - stato.valore} {def.unita} per il{" "} {gradoMeta[stato.prossimo as Grado].label.toLowerCase()}
> ) : (Hai raggiunto il livello massimo.
)}Soglie
{gm.label}
{def.soglie[g]}
{def.unita}
“{def.celebrazione}”
) : null}