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
|
|
@ -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 (
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue