// Rôle : affiche une toolbox dans la liste, avec actions rapides et icône personnalisable. import React from "react"; import { CompactDropdown } from "../../components/CompactDropdown.jsx"; import { Icon } from "../../components/Icon.jsx"; import { DEFAULT_TOOLBOX_ICON, normalizeToolboxIcon, TOOLBOX_ICONS } from "./storage/toolboxStorage.js"; export function getGameCardCover(game) { return game?.images?.cardCover || game?.image || ""; } export function getGameCardBackground(game) { return game?.cover || "var(--gradient-nebula)"; } export function formatDate(value) { return new Intl.DateTimeFormat("fr-FR", { dateStyle: "medium", timeStyle: "short" }).format(new Date(value)); } export function ToolboxCard({ toolbox, game, actions, reorder }) { const gameCoverImage = getGameCardCover(game); const coverImage = gameCoverImage || toolbox.icon || DEFAULT_TOOLBOX_ICON; const className = [ "card", "toolbox-card", reorder.isItemDragging(toolbox.id) ? "is-dragging" : "", reorder.isItemDropTarget(toolbox.id) ? "is-drop-target" : "", reorder.getDropPlacement("item", toolbox.id) === "after" ? "drop-after" : "" ].filter(Boolean).join(" "); return (
{game

{game ? game.title : "Toolbox libre"}

{toolbox.name}

Modifiée le {formatDate(toolbox.updatedAt)}
); } export function ToolboxIconPicker({ toolbox, onChange }) { const icon = normalizeToolboxIcon(toolbox.icon); return ( ( )} > {({ close }) => ( <> {TOOLBOX_ICONS.map((path) => ( ))} )} ); } export function ToolboxGameIcon({ game }) { const gameCoverImage = getGameCardCover(game); return (
); }