Add the Sokko TCG collectible card mini-game
Add the server-backed card game: Discord login, recharging pack openings, album, trades, gifts, stardust shop, campaign codes and its administration, stored in SQLite and disabled in production until configured. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
243465720f
commit
5ce35cd7ba
193 changed files with 12159 additions and 28 deletions
44
website/src/features/cards/CardsDashboard.jsx
Normal file
44
website/src/features/cards/CardsDashboard.jsx
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
// Rôle : fournit le cadre commun des tableaux de bord joueur et administration (menu de sections et encart associé, compte, chiffres clés).
|
||||
import { createContext, useContext, useState } from "react";
|
||||
import { createPortal } from "react-dom";
|
||||
|
||||
const AsideSlotContext = createContext(null);
|
||||
|
||||
export function CardsDashboardLayout({ label, groups, active, hrefFor, switchLink = null, busy = false, children }) {
|
||||
const [asideSlot, setAsideSlot] = useState(null);
|
||||
return <div className="nebula-dashboard-shell">
|
||||
<div className="nebula-dashboard-aside">
|
||||
{switchLink && <a className="nds-button" data-size="sm" data-variant="secondary" href={switchLink.href}>{switchLink.label}</a>}
|
||||
<nav className="nebula-dashboard-nav" aria-label={label}>
|
||||
{groups.map((items) => <div key={items[0][0]} className="nebula-dashboard-nav-group">
|
||||
{items.map(([id, itemLabel, count]) => <a key={id} className="nebula-dashboard-nav-item" href={hrefFor(id)} aria-current={active === id ? "page" : undefined}>{itemLabel}{count > 0 && <span className="nds-badge" data-variant="gold">{count}</span>}</a>)}
|
||||
</div>)}
|
||||
</nav>
|
||||
<div ref={setAsideSlot} className="nebula-dashboard-aside-slot" />
|
||||
</div>
|
||||
<div className="nebula-dashboard-section" data-section={active} aria-busy={busy || undefined}>
|
||||
<AsideSlotContext.Provider value={asideSlot}>{children}</AsideSlotContext.Provider>
|
||||
</div>
|
||||
</div>;
|
||||
}
|
||||
|
||||
// Place un encart propre à la section sous le menu, tout en gardant son état dans le panneau qui le déclare.
|
||||
export function DashboardAside({ children }) {
|
||||
const slot = useContext(AsideSlotContext);
|
||||
return slot ? createPortal(children, slot) : null;
|
||||
}
|
||||
|
||||
export function CardsAccount({ player, onLogout }) {
|
||||
return <div className="nebula-dashboard-account">
|
||||
<span className="nebula-dashboard-account-player">{player.avatarUrl ? <img src={player.avatarUrl} alt="" referrerPolicy="no-referrer" /> : <i aria-hidden="true">✦</i>}<span>{player.displayName}</span></span>
|
||||
{onLogout && <button className="nds-button" data-size="sm" data-variant="secondary" type="button" onClick={onLogout}>Déconnexion</button>}
|
||||
</div>;
|
||||
}
|
||||
|
||||
export function DashboardStat({ value, label, detail }) {
|
||||
return <article className="nds-panel nebula-dashboard-stat">
|
||||
<span className="nebula-dashboard-stat-label">{label}</span>
|
||||
<strong>{value}</strong>
|
||||
{detail && <small>{detail}</small>}
|
||||
</article>;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue