Open any toolbox from a list in Sokko TCG's toolbox drawer
All checks were successful
Validate and deploy Sokko G / validate (push) Successful in 23m40s
Validate and deploy Sokko G / deploy (push) Successful in 16s

Every Sokko TCG section now offers the top bar's toolbox button. Instead of
linking a toolbox, the drawer lists all toolboxes (linked to a game or not)
as wide rows with a large cover, opens the one chosen, and remembers it on
the device. Memos and alerts follow the toolbox shown.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Shinuwa 2026-11-30 14:31:53 +01:00
parent e8fe27a90f
commit 8253f74c90
17 changed files with 359 additions and 45 deletions

View file

@ -65,7 +65,9 @@ export function AppOverlays({
if (!name) return;
const toolbox = actions.createToolbox(name, gameId, { tutorial: createModal.tutorial === true });
if (toolbox && createModal.tutorial === true) setPendingTutorialToolboxId?.(toolbox.id);
if (toolbox && gameId) setDrawerGameId(gameId);
// Créée depuis le tiroir de Sokko TCG : elle s'y ouvre, sans liaison ni changement de page.
if (toolbox && createModal.onCreated) createModal.onCreated(toolbox);
else if (toolbox && gameId) setDrawerGameId(gameId);
else if (toolbox) {
navigate(`/toolbox/${toolbox.id}`);
scrollToTopAfterNavigation();

View file

@ -5,11 +5,10 @@ import { Icon } from "./Icon.jsx";
import { ImportButton } from "./ImportButton.jsx";
import { Tooltip } from "./Tooltip.jsx";
export function Shell({ route, content, games, drawerGameId = "", drawerVisible = false, compactGameLayout = false, reducedSidebar = false, cardsEnabled = false, actions, onOpenAutoBackup, children }) {
const gameId = route.split("/")[1] === "games" ? route.split("/")[2] || "" : "";
const game = games.find((item) => item.id === gameId);
// `toolboxTargetId` : le jeu (sa toolbox liée) ou Sokko TCG (une toolbox au choix) dont la page ouvre le tiroir, sinon vide.
export function Shell({ route, content, toolboxTargetId = "", drawerGameId = "", drawerVisible = false, compactGameLayout = false, reducedSidebar = false, cardsEnabled = false, actions, onOpenAutoBackup, children }) {
const topbarLabel = route === "/design-system" && import.meta.env.DEV ? "Design system" : route.startsWith("/toolbox") || route.startsWith("/receive/") ? content.topbar.toolbox : route.startsWith("/games") ? content.topbar.games : route === "/library" ? content.topbar.library : route.startsWith("/cards") ? content.topbar.cards : content.topbar.dashboard;
const toolboxOpen = Boolean(game && drawerGameId === game.id && drawerVisible);
const toolboxOpen = Boolean(toolboxTargetId && drawerGameId === toolboxTargetId && drawerVisible);
const toolboxLabel = toolboxOpen ? "Masquer la toolbox" : "Afficher la toolbox";
const compactSidebar = Boolean(reducedSidebar || (!compactGameLayout && toolboxOpen));
const compactToolboxVisible = Boolean(compactGameLayout && toolboxOpen);
@ -80,17 +79,17 @@ export function Shell({ route, content, games, drawerGameId = "", drawerVisible
<div className="content-shell">
<header className="topbar">
<div><strong>{topbarLabel}</strong></div>
{game && (
{toolboxTargetId && (
<div className="topbar-actions">
{compactGameLayout ? <div className="compact-game-view-switch nds-radio-button-group" role="tablist" aria-label={content.topbar.gameViewLabel}>
<button ref={guideTabRef} type="button" role="tab" aria-selected={!compactToolboxVisible} className={!compactToolboxVisible ? "active" : ""} onClick={() => actions.setDrawerGameId("")}>{content.topbar.guideView}</button>
<button ref={toolboxTabRef} type="button" role="tab" aria-selected={compactToolboxVisible} className={compactToolboxVisible ? "active" : ""} onClick={() => actions.setDrawerGameId(game.id)}>{content.topbar.toolboxView}</button>
<button ref={guideTabRef} type="button" role="tab" aria-selected={!compactToolboxVisible} className={!compactToolboxVisible ? "active" : ""} onClick={() => actions.setDrawerGameId("")}>{route.startsWith("/cards") ? content.topbar.cardsView : content.topbar.guideView}</button>
<button ref={toolboxTabRef} type="button" role="tab" aria-selected={compactToolboxVisible} className={compactToolboxVisible ? "active" : ""} onClick={() => actions.setDrawerGameId(toolboxTargetId)}>{content.topbar.toolboxView}</button>
</div> : <button
className={`drawer-button toolbox-button nds-button ${toolboxOpen ? "active" : ""}`}
ref={wideToolboxButtonRef}
data-size="sm"
data-variant="primary"
onClick={() => actions.setDrawerGameId(toolboxOpen ? "" : game.id)}
onClick={() => actions.setDrawerGameId(toolboxOpen ? "" : toolboxTargetId)}
aria-label={toolboxLabel}
aria-pressed={toolboxOpen}
title={toolboxLabel}

View file

@ -1,17 +1,17 @@
// Rôle : affiche en bas de page les mémos et alertes de tâches de la toolbox courante ou liée au jeu.
// Rôle : affiche en bas de page les mémos et alertes de tâches de la toolbox courante, liée au jeu, ou choisie dans Sokko TCG.
import { useEffect, useMemo, useState } from "react";
import { moduleStorageKey, normalizeMemosData } from "./storage/toolboxStorage.js";
import { MemosTicker } from "./modules/MemosTicker.jsx";
import { getPlannerTaskTickerItems, resolveMemosPlannerLink } from "./modules/memosPlannerUtils.js";
import { getDrawerToolboxId, getRouteToolboxTargetId } from "./toolboxTargets.js";
function getRouteToolboxId(route, links) {
function getRouteToolboxId(route, links, cardsToolboxId, toolboxes) {
const toolboxMatch = route.match(/^\/toolbox\/([^/]+)/);
if (toolboxMatch) return decodeURIComponent(toolboxMatch[1]);
const gameMatch = route.match(/^\/games\/([^/]+)/);
return gameMatch ? links[gameMatch[1]] || "" : "";
return getDrawerToolboxId(getRouteToolboxTargetId(route), links, cardsToolboxId, toolboxes);
}
export function GlobalMemosTicker({ route, toolboxes, links, moduleData, textContent }) {
export function GlobalMemosTicker({ route, toolboxes, links, cardsToolboxId = "", moduleData, textContent }) {
const [nowMs, setNowMs] = useState(() => Date.now());
useEffect(() => {
@ -20,7 +20,7 @@ export function GlobalMemosTicker({ route, toolboxes, links, moduleData, textCon
}, []);
const items = useMemo(() => {
const toolboxId = getRouteToolboxId(route, links);
const toolboxId = getRouteToolboxId(route, links, cardsToolboxId, toolboxes);
const toolbox = toolboxes.find((item) => item.id === toolboxId);
if (!toolbox) return [];
return toolbox.modules
@ -41,7 +41,7 @@ export function GlobalMemosTicker({ route, toolboxes, links, moduleData, textCon
...taskItems.map((item) => ({ ...item, id: `${module.id}:${item.id}` }))
];
});
}, [route, toolboxes, links, moduleData, nowMs, textContent?.taskAlertTemplate]);
}, [route, toolboxes, links, cardsToolboxId, moduleData, nowMs, textContent?.taskAlertTemplate]);
if (!items.length) return null;
return (

View file

@ -22,11 +22,23 @@ 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 }) {
// Couverture d'une toolbox : celle du jeu lié, sinon l'image choisie, sinon son icône. `rect` distingue une image (bandeau)
// d'une icône (à centrer sur le dégradé).
export function getToolboxCover(toolbox, game) {
const gameCoverImage = getGameCardCover(game);
const customCoverImage = !gameCoverImage && toolbox.customCover ? toolbox.customCover : "";
const coverImage = gameCoverImage || customCoverImage || toolbox.icon || DEFAULT_TOOLBOX_ICON;
const hasRectCover = Boolean(gameCoverImage || customCoverImage);
return {
src: gameCoverImage || customCoverImage || toolbox.icon || DEFAULT_TOOLBOX_ICON,
rect: Boolean(gameCoverImage || customCoverImage),
custom: Boolean(customCoverImage)
};
}
export function ToolboxCard({ toolbox, game, actions, reorder }) {
const cover = getToolboxCover(toolbox, game);
const customCoverImage = cover.custom ? cover.src : "";
const coverImage = cover.src;
const hasRectCover = cover.rect;
const className = [
"card",
"nds-card",

View file

@ -9,7 +9,7 @@ import { StorageQuota } from "../../components/StorageQuota.jsx";
import { useGroupedReorder } from "../../hooks/useGroupedReorder.js";
import { useInlineEdit } from "../../hooks/useInlineEdit.js";
import { compressImage } from "../../utils/imageCompression.js";
import { getGameCardCover, ToolboxCard, ToolboxGameIcon, ToolboxIconPicker } from "./ToolboxCard.jsx";
import { getGameCardCover, getToolboxCover, ToolboxCard, ToolboxGameIcon, ToolboxIconPicker } from "./ToolboxCard.jsx";
import { AddToolControls, ToolboxModules } from "./modules/index.jsx";
import { getMemosDataAfterPlannerRemoval } from "./modules/memosPlannerUtils.js";
import { ToolboxSpaces } from "./ToolboxSpaces.jsx";
@ -333,7 +333,7 @@ function ToolboxView({ siteContent, toolbox, toolboxGame, embedded, actions, sto
<EditableTitle className="toolbox-title" value={toolbox.name} fallback="Nouvelle toolbox" tutorialTarget="title" onSave={(name) => name !== toolbox.name && updateToolbox({ ...toolbox, name })} />
)}
</div>
{toolboxGame && (
{(embedded || toolboxGame) && (
<a
className="toolbox-hero-link nds-button"
data-size="sm"
@ -432,11 +432,14 @@ function ToolboxView({ siteContent, toolbox, toolboxGame, embedded, actions, sto
);
}
export function ToolboxDrawer({ gameId, game, siteContent, toolboxes, links, actions, storageUsage, storageReady = true, getModuleData, updateToolbox, updateModuleData, addImageFiles, visible = true, compact = false }) {
// Tiroir de toolbox. Sur une page de jeu, il montre la toolbox liée au jeu (`toolboxId`). Dans Sokko TCG (`chooser`), aucune liaison :
// il liste toutes les toolboxes, ouvre celle choisie et « Changer de toolbox » ramène à la liste.
export function ToolboxDrawer({ gameId, game, toolboxId = "", chooser = null, siteContent, toolboxes, links, actions, storageUsage, storageReady = true, getModuleData, updateToolbox, updateModuleData, addImageFiles, visible = true, compact = false }) {
const checklist = useGuideChecklist();
const guideChecklist = checklist.available && checklist.guideId.split("/")[0] === gameId ? checklist : undefined;
const selectedId = links[gameId] || "";
const guideChecklist = !chooser && checklist.available && checklist.guideId.split("/")[0] === gameId ? checklist : undefined;
const selectedId = toolboxId;
const toolbox = toolboxes.find((item) => item.id === selectedId);
const chooserText = siteContent.toolboxes.drawer.chooser;
const [width, setWidth] = useState(DRAWER_INITIAL_WIDTH);
const panelRef = useRef(null);
@ -479,19 +482,23 @@ export function ToolboxDrawer({ gameId, game, siteContent, toolboxes, links, act
<div className="drawer-content">
<header>
<div>
<p className="eyebrow">Toolbox liée</p>
<div className="drawer-toolbox-actions nds-toolbar" aria-label="Actions toolbox liée">
<p className="eyebrow">{chooser ? chooserText.eyebrow : "Toolbox liée"}</p>
{chooser ? toolbox && <div className="drawer-toolbox-actions nds-toolbar" aria-label={chooserText.actionsLabel}>
<button className="nds-button" data-size="sm" data-variant="secondary" type="button" onClick={() => chooser.onChoose("")}><Icon name="back" />{chooserText.changeLabel}</button>
<button className="drawer-action-button nds-icon-button" data-size="sm" onClick={() => actions.exportToolbox(selectedId)} aria-label={`Exporter ${toolbox.name}`} title="Exporter"><Icon name="export" /></button>
{actions.sharingEnabled && <button className="drawer-action-button nds-icon-button" data-size="sm" onClick={() => actions.openShareToolbox(selectedId)} aria-label={`Envoyer ${toolbox.name}`} title="Envoyer"><Icon name="share" /></button>}
</div> : <div className="drawer-toolbox-actions nds-toolbar" aria-label="Actions toolbox liée">
<button className="drawer-action-button nds-icon-button" data-size="sm" onClick={() => actions.setLinkModalGameId(gameId)} aria-label="Lier une toolbox" title="Lier"><Icon name="link" /></button>
<ImportButton className="drawer-action-button nds-icon-button import-icon-button" data-size="sm" ariaLabel="Importer une toolbox" title="Importer" icon="import" onFile={(file) => actions.importToolbox(file, gameId)} />
<button className="drawer-action-button nds-icon-button" data-size="sm" onClick={() => actions.exportToolbox(selectedId)} disabled={!selectedId} aria-label="Exporter la toolbox liée" title="Exporter"><Icon name="export" /></button>
{actions.sharingEnabled && <button className="drawer-action-button nds-icon-button" data-size="sm" onClick={() => actions.openShareToolbox(selectedId)} disabled={!selectedId} aria-label="Envoyer la toolbox liée" title="Envoyer"><Icon name="share" /></button>}
</div>
</div>}
</div>
<button className="drawer-close-button nds-icon-button" data-size="sm" onClick={() => actions.setDrawerGameId("")} aria-label="Fermer" title="Fermer"><Icon name="close" /></button>
</header>
{toolbox ? <ToolboxView siteContent={siteContent} toolbox={toolbox} toolboxGame={game} embedded actions={actions} storageUsage={storageUsage} storageReady={storageReady} getModuleData={getModuleData} updateToolbox={updateToolbox} updateModuleData={updateModuleData} addImageFiles={addImageFiles} guideChecklist={guideChecklist} /> : (
<ToolboxDrawerEmptyState gameId={gameId} toolboxes={toolboxes} links={links} actions={actions} content={siteContent.toolboxes.drawer} />
)}
{toolbox ? <ToolboxView key={toolbox.id} siteContent={siteContent} toolbox={toolbox} toolboxGame={game} embedded actions={actions} storageUsage={storageUsage} storageReady={storageReady} getModuleData={getModuleData} updateToolbox={updateToolbox} updateModuleData={updateModuleData} addImageFiles={addImageFiles} guideChecklist={guideChecklist} />
: chooser ? <ToolboxDrawerChooser toolboxes={toolboxes} getToolboxGame={chooser.getToolboxGame} onChoose={chooser.onChoose} actions={actions} content={chooserText} />
: <ToolboxDrawerEmptyState gameId={gameId} toolboxes={toolboxes} links={links} actions={actions} content={siteContent.toolboxes.drawer} />}
<StorageQuota usage={storageUsage} />
</div>
</section>
@ -499,6 +506,32 @@ export function ToolboxDrawer({ gameId, game, siteContent, toolboxes, links, act
);
}
// Liste du tiroir de Sokko TCG : une bande par toolbox (grande illustration, nom, jeu lié), dans l'ordre de la page Toolboxes.
// Une nouvelle toolbox s'ouvre aussitôt dans le tiroir, sans être liée à rien.
function ToolboxDrawerChooser({ toolboxes, getToolboxGame, onChoose, actions, content }) {
const create = () => actions.setCreateModal({ onCreated: (toolbox) => onChoose(toolbox.id) });
if (!toolboxes.length) return <section className="empty nds-empty-state drawer-toolbox-chooser-empty">
<p>{content.emptyText}</p>
<button className="nds-button" data-size="sm" data-variant="primary" type="button" onClick={create}><Icon name="add" />{content.createLabel}</button>
</section>;
return <section className="drawer-toolbox-chooser" aria-labelledby="drawer-toolbox-chooser-title">
<h2 id="drawer-toolbox-chooser-title">{content.title}</h2>
<ul className="drawer-toolbox-chooser-list">
{toolboxes.map((toolbox) => {
const game = getToolboxGame(toolbox);
const cover = getToolboxCover(toolbox, game);
return <li key={toolbox.id} className="nds-list-row drawer-toolbox-chooser-row">
<button type="button" onClick={() => onChoose(toolbox.id)}>
<span className="drawer-toolbox-chooser-cover" data-shape={cover.rect ? "image" : "icon"}><img src={cover.src} alt="" loading="lazy" /></span>
<span className="drawer-toolbox-chooser-text"><strong>{toolbox.name}</strong><small>{game ? game.title : content.freeLabel}</small></span>
</button>
</li>;
})}
</ul>
<button className="nds-button drawer-toolbox-chooser-create" data-size="sm" data-variant="dashed" type="button" onClick={create}><Icon name="add" />{content.createLabel}</button>
</section>;
}
function ToolboxDrawerEmptyState({ gameId, toolboxes, links, actions, content }) {
const linkedToolboxIds = useMemo(() => new Set(Object.values(links).filter(Boolean)), [links]);
const availableToolboxes = useMemo(

View file

@ -0,0 +1,19 @@
// Rôle : nomme les pages qui ouvrent le tiroir de toolbox : la page d'un jeu (sa toolbox liée), ou Sokko TCG dans toutes ses
// sections, où le joueur choisit n'importe laquelle de ses toolboxes dans une liste, sans liaison.
export const CARDS_TOOLBOX_TARGET_ID = "sokko-tcg";
// Le même tiroir reste ouvert d'une section de Sokko TCG à l'autre (Guilde, Expéditions, Collection…), administration comprise.
export function getRouteToolboxTargetId(route) {
const gameMatch = route.match(/^\/games\/([^/]+)/);
// `/games/sokko-tcg` n'est pas une page de jeu : elle n'ouvre pas le tiroir de Sokko TCG.
if (gameMatch) return gameMatch[1] === CARDS_TOOLBOX_TARGET_ID ? "" : gameMatch[1];
return route === "/cards" || route.startsWith("/cards/") ? CARDS_TOOLBOX_TARGET_ID : "";
}
// Toolbox affichée par le tiroir : celle liée au jeu, ou celle choisie dans Sokko TCG tant qu'elle existe encore.
export function getDrawerToolboxId(targetId, links, cardsToolboxId, toolboxes) {
if (!targetId) return "";
if (targetId !== CARDS_TOOLBOX_TARGET_ID) return links[targetId] || "";
return cardsToolboxId && toolboxes.some((toolbox) => toolbox.id === cardsToolboxId) ? cardsToolboxId : "";
}

View file

@ -0,0 +1,27 @@
// Rôle : retient, sur cet appareil, la toolbox choisie dans le tiroir de Sokko TCG, pour la rouvrir directement à la visite suivante.
// Une préférence d'affichage, pas une donnée de toolbox : elle n'entre ni dans les liaisons ni dans les exports.
import { useCallback, useState } from "react";
const CARDS_TOOLBOX_STORAGE_KEY = "sokkog:cards-toolbox";
function readChoice() {
try {
return globalThis.localStorage?.getItem(CARDS_TOOLBOX_STORAGE_KEY) || "";
} catch {
return "";
}
}
export function useCardsToolboxChoice() {
const [toolboxId, setToolboxId] = useState(readChoice);
const choose = useCallback((nextId) => {
setToolboxId(nextId || "");
try {
if (nextId) globalThis.localStorage?.setItem(CARDS_TOOLBOX_STORAGE_KEY, nextId);
else globalThis.localStorage?.removeItem(CARDS_TOOLBOX_STORAGE_KEY);
} catch {
// Stockage refusé (navigation privée, quota) : le choix vaut pour la session.
}
}, []);
return [toolboxId, choose];
}

View file

@ -4,11 +4,11 @@ import { getCalendarAlertOffsets, getCurrentCalendarOccurrence, getNextCalendarA
import { getCountdownTargetMs } from "../features/toolboxes/modules/timerUtils.js";
import { moduleStorageKey } from "../features/toolboxes/storage/toolboxStorage.js";
export function getVisibleToolboxIds(route, drawerGameId, links) {
// `drawerToolboxId` : la toolbox affichée par le tiroir (liée au jeu, ou choisie dans Sokko TCG), vide tant qu'il est masqué.
export function getVisibleToolboxIds(route, drawerToolboxId) {
const visibleIds = new Set();
const toolboxMatch = route.match(/^\/toolbox\/([^/]+)/);
if (toolboxMatch?.[1]) visibleIds.add(toolboxMatch[1]);
const drawerToolboxId = drawerGameId ? links[drawerGameId] : "";
if (drawerToolboxId) visibleIds.add(drawerToolboxId);
return visibleIds;
}
@ -25,13 +25,13 @@ function formatAlertMessage(template, toolbox, label) {
.replaceAll("{toolbox}", toolbox.name);
}
export function useToolboxAlerts({ toolboxes, moduleData, links, route, drawerGameId, normalizeTimerData, normalizeCalendarData, textContent, notify }) {
export function useToolboxAlerts({ toolboxes, moduleData, route, drawerToolboxId, normalizeTimerData, normalizeCalendarData, textContent, notify }) {
const previousTargetsRef = useRef(new Map());
const resumedCalendarEventsRef = useRef(new Set());
const lastTickRef = useRef(null);
useEffect(() => {
const visibleToolboxIds = getVisibleToolboxIds(route, drawerGameId, links);
const visibleToolboxIds = getVisibleToolboxIds(route, drawerToolboxId);
const timerAlertTemplate = textContent?.timer?.alertMessage || "Compte à rebours terminé : {label}";
const calendarAlertTemplate = textContent?.calendar?.alertMessage || "Événement à venir : {label}";
const calendarResumeTemplate = textContent?.calendar?.resumeAlertMessage || "Événement en cours : {label}";
@ -96,5 +96,5 @@ export function useToolboxAlerts({ toolboxes, moduleData, links, route, drawerGa
tick();
const intervalId = window.setInterval(tick, 500);
return () => window.clearInterval(intervalId);
}, [drawerGameId, links, moduleData, normalizeCalendarData, normalizeTimerData, notify, route, textContent, toolboxes]);
}, [drawerToolboxId, moduleData, normalizeCalendarData, normalizeTimerData, notify, route, textContent, toolboxes]);
}

View file

@ -19,6 +19,8 @@ import { useHashRoute } from "./router/hashRouter.js";
import { normalizeCalendarData, normalizeTimerData } from "./features/toolboxes/storage/toolboxStorage.js";
import { useAutoBackup } from "./features/toolboxes/storage/useAutoBackup.js";
import { GlobalMemosTicker } from "./features/toolboxes/GlobalMemosTicker.jsx";
import { CARDS_TOOLBOX_TARGET_ID, getDrawerToolboxId, getRouteToolboxTargetId } from "./features/toolboxes/toolboxTargets.js";
import { useCardsToolboxChoice } from "./features/toolboxes/useCardsToolboxChoice.js";
import { useMediaQuery } from "./hooks/useMediaQuery.js";
import { useCardsConfig } from "./features/cards/useCardsConfig.js";
import { useSharesConfig } from "./features/toolboxes/sharing/useSharesConfig.js";
@ -70,6 +72,7 @@ function App() {
const [drawerGameId, setDrawerGameId] = useState("");
const [drawerVisible, setDrawerVisible] = useState(false);
const [drawerContext, setDrawerContext] = useState({ route, compactGameLayout });
const [cardsToolboxId, setCardsToolboxId] = useCardsToolboxChoice();
const [image, setImage] = useState(null);
const [pendingTutorialToolboxId, setPendingTutorialToolboxId] = useState("");
const [notifications, setNotifications] = useState([]);
@ -100,7 +103,7 @@ function App() {
if (drawerContext.route !== route || drawerContext.compactGameLayout !== compactGameLayout) {
setDrawerContext({ route, compactGameLayout });
const activeGameId = route.match(/^\/games\/([^/]+)/)?.[1] || "";
const activeGameId = getRouteToolboxTargetId(route);
if (activeGameId !== drawerGameId) {
setDrawerGameId("");
setDrawerVisible(false);
@ -157,6 +160,11 @@ function App() {
return capitalize ? value.charAt(0).toUpperCase() + value.slice(1) : value;
};
const getGame = (gameId) => games.find((item) => item.id === gameId);
// La page courante propose le tiroir : un jeu connu (sa toolbox liée), ou Sokko TCG quand le jeu est ouvert (une toolbox au choix).
const routeToolboxTargetId = getRouteToolboxTargetId(route);
const shellToolboxTargetId = routeToolboxTargetId === CARDS_TOOLBOX_TARGET_ID ? (cardsConfig.enabled ? routeToolboxTargetId : "") : getGame(routeToolboxTargetId) ? routeToolboxTargetId : "";
const drawerToolboxId = getDrawerToolboxId(drawerGameId, store.links, cardsToolboxId, store.toolboxes);
const cardsDrawer = drawerGameId === CARDS_TOOLBOX_TARGET_ID;
const getToolboxGameId = (toolbox) => Object.entries(store.links).find(([, toolboxId]) => toolboxId === toolbox?.id)?.[0] || "";
const getToolboxGame = (toolbox) => getGame(getToolboxGameId(toolbox));
@ -177,9 +185,8 @@ function App() {
useToolboxAlerts({
toolboxes: store.toolboxes,
moduleData: store.moduleData,
links: store.links,
route,
drawerGameId: drawerVisible ? drawerGameId : "",
drawerToolboxId: drawerVisible ? drawerToolboxId : "",
normalizeTimerData,
normalizeCalendarData,
textContent: siteContent?.toolboxes?.modules,
@ -223,7 +230,7 @@ function App() {
<Shell
route={route}
content={siteContent}
games={games}
toolboxTargetId={shellToolboxTargetId}
drawerGameId={drawerGameId}
drawerVisible={drawerVisible}
compactGameLayout={compactGameLayout}
@ -270,7 +277,9 @@ function App() {
<Suspense fallback={null}>
<ToolboxDrawer
gameId={drawerGameId}
game={getGame(drawerGameId)}
game={cardsDrawer ? undefined : getGame(drawerGameId)}
toolboxId={drawerToolboxId}
chooser={cardsDrawer ? { onChoose: setCardsToolboxId, getToolboxGame } : null}
siteContent={siteContent}
toolboxes={store.toolboxes}
links={store.links}
@ -290,6 +299,7 @@ function App() {
route={route}
toolboxes={store.toolboxes}
links={store.links}
cardsToolboxId={cardsToolboxId}
moduleData={store.moduleData}
textContent={siteContent.toolboxes.modules.memos}
/>

View file

@ -71,6 +71,98 @@ body.is-resizing-drawer * {
gap: var(--space-4);
}
/* Tiroir de Sokko TCG : une bande par toolbox. L'illustration occupe une large part de la bande (bandeau 2:1 comme les
couvertures de jeu, jusqu'à leur taille native de 240 × 120), puis le nom et le jeu lié. */
.drawer-toolbox-chooser {
display: grid;
gap: var(--space-4);
}
.drawer-toolbox-chooser h2 {
font-size: var(--font-size-md);
}
.drawer-toolbox-chooser-list {
display: grid;
gap: var(--space-3);
margin: 0;
padding: 0;
list-style: none;
}
.drawer-toolbox-chooser-row button {
min-height: 0;
gap: var(--space-4);
padding: var(--space-2);
cursor: pointer;
}
.drawer-toolbox-chooser-row button:focus-visible {
outline: 2px solid var(--color-accent-gold);
outline-offset: -2px;
}
.drawer-toolbox-chooser-cover {
display: grid;
flex: 0 0 min(240px, 42%);
aspect-ratio: 2 / 1;
overflow: hidden;
place-items: center;
border-radius: var(--radius-sm);
background: var(--gradient-nebula);
}
.drawer-toolbox-chooser-cover img {
width: 100%;
height: 100%;
object-fit: cover;
transition: transform 0.2s ease;
}
.drawer-toolbox-chooser-row:hover .drawer-toolbox-chooser-cover[data-shape="image"] img {
transform: scale(1.04);
}
.drawer-toolbox-chooser-cover[data-shape="icon"] img {
width: 40%;
height: 70%;
object-fit: contain;
}
.drawer-toolbox-chooser-text {
display: grid;
min-width: 0;
gap: var(--space-1);
text-align: left;
}
.drawer-toolbox-chooser-text strong,
.drawer-toolbox-chooser-text small {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.drawer-toolbox-chooser-text strong {
font-size: var(--font-size-lg);
}
.drawer-toolbox-chooser-text small {
color: var(--color-text-muted);
font-size: var(--font-size-sm);
font-weight: 700;
}
@media (prefers-reduced-motion: reduce) {
.drawer-toolbox-chooser-cover img {
transition: none;
}
}
.drawer-toolbox-chooser-create {
justify-self: start;
}
.drawer-link-existing h2 {
font-size: var(--font-size-md);
}