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
|
|
@ -5,11 +5,10 @@ import { Icon } from "./Icon.jsx";
|
|||
import { ImportButton } from "./ImportButton.jsx";
|
||||
import { Tooltip } from "./Tooltip.jsx";
|
||||
|
||||
export function Shell({ route, content, games, drawerGameId = "", drawerVisible = false, compactGameLayout = false, reducedSidebar = false, cardsEnabled = false, actions, onOpenAutoBackup, children }) {
|
||||
const gameId = route.split("/")[1] === "games" ? route.split("/")[2] || "" : "";
|
||||
const game = games.find((item) => item.id === gameId);
|
||||
// `toolboxTargetId` : le jeu (sa toolbox liée) ou Sokko TCG (une toolbox au choix) dont la page ouvre le tiroir, sinon vide.
|
||||
export function Shell({ route, content, toolboxTargetId = "", drawerGameId = "", drawerVisible = false, compactGameLayout = false, reducedSidebar = false, cardsEnabled = false, actions, onOpenAutoBackup, children }) {
|
||||
const topbarLabel = route === "/design-system" && import.meta.env.DEV ? "Design system" : route.startsWith("/toolbox") || route.startsWith("/receive/") ? content.topbar.toolbox : route.startsWith("/games") ? content.topbar.games : route === "/library" ? content.topbar.library : route.startsWith("/cards") ? content.topbar.cards : content.topbar.dashboard;
|
||||
const toolboxOpen = Boolean(game && drawerGameId === game.id && drawerVisible);
|
||||
const toolboxOpen = Boolean(toolboxTargetId && drawerGameId === toolboxTargetId && drawerVisible);
|
||||
const toolboxLabel = toolboxOpen ? "Masquer la toolbox" : "Afficher la toolbox";
|
||||
const compactSidebar = Boolean(reducedSidebar || (!compactGameLayout && toolboxOpen));
|
||||
const compactToolboxVisible = Boolean(compactGameLayout && toolboxOpen);
|
||||
|
|
@ -80,17 +79,17 @@ export function Shell({ route, content, games, drawerGameId = "", drawerVisible
|
|||
<div className="content-shell">
|
||||
<header className="topbar">
|
||||
<div><strong>{topbarLabel}</strong></div>
|
||||
{game && (
|
||||
{toolboxTargetId && (
|
||||
<div className="topbar-actions">
|
||||
{compactGameLayout ? <div className="compact-game-view-switch nds-radio-button-group" role="tablist" aria-label={content.topbar.gameViewLabel}>
|
||||
<button ref={guideTabRef} type="button" role="tab" aria-selected={!compactToolboxVisible} className={!compactToolboxVisible ? "active" : ""} onClick={() => actions.setDrawerGameId("")}>{content.topbar.guideView}</button>
|
||||
<button ref={toolboxTabRef} type="button" role="tab" aria-selected={compactToolboxVisible} className={compactToolboxVisible ? "active" : ""} onClick={() => actions.setDrawerGameId(game.id)}>{content.topbar.toolboxView}</button>
|
||||
<button ref={guideTabRef} type="button" role="tab" aria-selected={!compactToolboxVisible} className={!compactToolboxVisible ? "active" : ""} onClick={() => actions.setDrawerGameId("")}>{route.startsWith("/cards") ? content.topbar.cardsView : content.topbar.guideView}</button>
|
||||
<button ref={toolboxTabRef} type="button" role="tab" aria-selected={compactToolboxVisible} className={compactToolboxVisible ? "active" : ""} onClick={() => actions.setDrawerGameId(toolboxTargetId)}>{content.topbar.toolboxView}</button>
|
||||
</div> : <button
|
||||
className={`drawer-button toolbox-button nds-button ${toolboxOpen ? "active" : ""}`}
|
||||
ref={wideToolboxButtonRef}
|
||||
data-size="sm"
|
||||
data-variant="primary"
|
||||
onClick={() => actions.setDrawerGameId(toolboxOpen ? "" : game.id)}
|
||||
onClick={() => actions.setDrawerGameId(toolboxOpen ? "" : toolboxTargetId)}
|
||||
aria-label={toolboxLabel}
|
||||
aria-pressed={toolboxOpen}
|
||||
title={toolboxLabel}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue