import { ImageIcon, CircleDollarSign, Gift, Zap } from "lucide-react"; import { cn } from "../../lib/utils"; import { type Draft, TYPE_META, RARITY_META, LOOT_TYPE_META, } from "./ItemStudioTypes"; // ===== Item Preview Card ===== export function ItemPreviewCard({ draft, previewImageSrc, }: { draft: Draft; previewImageSrc: string | null; }) { const rarity = RARITY_META[draft.rarity]; const type = TYPE_META[draft.type]; const TypeIcon = type.icon; const lootboxEffect = draft.effects.find((e) => e.kind === "LOOTBOX"); return (
{/* Image area */}
{previewImageSrc ? ( Preview { e.currentTarget.style.opacity = "0.2"; }} /> ) : (
No image
)} {draft.rarity}
{/* Info */}

{draft.name.trim() ? ( draft.name ) : ( Item name... )}

{type.label}
{draft.description.trim() && (

{draft.description}

)} {draft.price && Number(draft.price) > 0 && (
{parseInt(draft.price).toLocaleString()} coins
)} {/* Lootbox pool mini-preview */} {lootboxEffect && lootboxEffect.pool.length > 0 && (
Lootbox ยท {lootboxEffect.pool.length} outcome {lootboxEffect.pool.length !== 1 ? "s" : ""}
{/* Stacked bar */} {(() => { const total = lootboxEffect.pool.reduce( (s, e) => s + Number(e.weight || 0), 0 ); return (
{lootboxEffect.pool.map((e) => { const pct = total > 0 ? (Number(e.weight || 0) / total) * 100 : 0; return (
); })}
); })()}
)} {(draft.effects.length > 0 || draft.consume) && !lootboxEffect && (
{draft.consume && ( Consumed on use )} {draft.effects.length > 0 && ( {draft.effects.length} effect {draft.effects.length !== 1 ? "s" : ""} )}
)}
); }