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
|
|
@ -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]);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue