"use client"; import { Button } from "@/components/ui/button"; import { LayoutGridIcon, ListIcon, RotateCwIcon, ScissorsIcon, ShuffleIcon, SlidersHorizontalIcon, TrashIcon, } from "lucide-react"; import { findLockerEmptySpot, getAssetTypeLabel, getLockerGridOccupancy, getLockerItemFootprint, type LockerGridItem, lockerIsRotatable, lockerIsStackable, } from "@/lib/locker"; interface LockerGridToolbarProps { gridWidth: number; gridHeight: number; items: LockerGridItem[]; selectedItem: LockerGridItem | null; viewMode: "grid" | "list"; onViewModeChange: (mode: "grid" | "list") => void; onAutoArrange: () => Promise; onRotate: (entryId: string) => Promise; onRemove: (entryId: string) => Promise; onSplit: (entryId: string, amount: number) => Promise; onCustomize: () => void; } export function LockerGridToolbar({ gridWidth, gridHeight, items, selectedItem, viewMode, onViewModeChange, onAutoArrange, onRotate, onRemove, onSplit, onCustomize, }: LockerGridToolbarProps) { const occupancy = getLockerGridOccupancy(items, gridWidth, gridHeight); const asset = selectedItem?.asset ?? null; const fp = selectedItem && asset ? getLockerItemFootprint(asset, selectedItem.rotated) : null; const displayName = selectedItem?.equipment?.customName?.trim() || asset?.name || null; const hasCustomName = selectedItem?.equipment?.customName?.trim() != null && selectedItem.equipment.customName.trim() !== ""; const canSplit = selectedItem && asset && fp ? findLockerEmptySpot(items, fp.width, fp.height, gridWidth, gridHeight) !== null : false; return (
{selectedItem && asset && (
{displayName}
{selectedItem.quantity.toLocaleString()}× · {getAssetTypeLabel(asset.assetType)} {hasCustomName && asset && displayName !== asset.name && ` · as "${asset.name}"`} {fp && ` · ${fp.width}x${fp.height}`} {selectedItem.rotated && " · rotated"}
{asset?.assetType === "weapon" && ( )} {lockerIsRotatable(asset) && ( )} {lockerIsStackable(asset) && selectedItem.quantity > 1 && ( )}
)}
); }