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
24
website/src/features/cards/admin/SwatchDropdown.jsx
Normal file
24
website/src/features/cards/admin/SwatchDropdown.jsx
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
// Rôle : sélecteur compact avec pastilles de couleurs pour les palettes et formes de l'administration.
|
||||
import { useId } from "react";
|
||||
import { CompactDropdown } from "../../../components/CompactDropdown.jsx";
|
||||
|
||||
export function PaletteSwatches({ colors = [], compact = false }) {
|
||||
return <span className="nebula-admin-palette" data-compact={compact || undefined} aria-hidden="true">{colors.map((color) => <i key={color} style={{ backgroundColor: color }} />)}</span>;
|
||||
}
|
||||
|
||||
export function SwatchDropdown({ label, accessibleLabel = label, value, options, onChange, disabled = false, emptyLabel = "Aucune", className = "" }) {
|
||||
const fieldId = useId();
|
||||
const menuId = `${fieldId}-menu`;
|
||||
const selected = options.find((item) => item.id === value);
|
||||
|
||||
return <div className={`nebula-admin-palette-field ${className}`.trim()}><span id={fieldId}>{label}</span><CompactDropdown
|
||||
className="nebula-admin-palette-dropdown"
|
||||
autoPlace
|
||||
menuClassName="nebula-admin-palette-menu nds-popover"
|
||||
menuProps={{ id: menuId, role: "dialog", "aria-labelledby": fieldId }}
|
||||
label={accessibleLabel}
|
||||
renderTrigger={({ open, toggle, triggerRef }) => <button ref={triggerRef} className={`nds-select-trigger nebula-admin-palette-trigger ${open ? "active" : ""}`} data-size="sm" type="button" disabled={disabled} aria-controls={menuId} aria-expanded={open} aria-haspopup="dialog" aria-label={`${accessibleLabel} : ${selected?.label || emptyLabel}`} onClick={toggle}><strong>{selected?.label || emptyLabel}</strong>{selected?.colors && <PaletteSwatches colors={selected.colors} compact />}</button>}
|
||||
>
|
||||
{({ close }) => <div className="nebula-admin-palette-options">{options.map((item) => <button key={item.id} className="nds-button nebula-admin-palette-option" data-size="sm" data-variant="secondary" type="button" aria-pressed={item.id === value} onClick={() => { onChange(item.id); close(); }}><span>{item.label}</span>{item.colors && <PaletteSwatches colors={item.colors} compact />}</button>)}</div>}
|
||||
</CompactDropdown></div>;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue