Open any toolbox from a list in Sokko TCG's toolbox drawer
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:
parent
e8fe27a90f
commit
8253f74c90
17 changed files with 359 additions and 45 deletions
19
website/src/features/toolboxes/toolboxTargets.js
Normal file
19
website/src/features/toolboxes/toolboxTargets.js
Normal 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 : "";
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue