The 669 // comments sitting right above a function, method or hook become /** */ blocks, unchanged in wording; eslint directives stay right above the line they target. website/AGENTS.md now asks for JSDoc on function comments and // inside function bodies. ExpeditionPlanner.jsx grew past 300 lines and gets its full header, as the header test requires. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
22 lines
1.2 KiB
JavaScript
22 lines
1.2 KiB
JavaScript
/**
|
|
* @file 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 : "";
|
|
}
|