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

@ -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 : "";
}