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>
22 lines
1.8 KiB
JavaScript
22 lines
1.8 KiB
JavaScript
// Rôle : menus de forme et de palette des particules d'ouverture mythique ; la valeur héritée n'apparaît qu'une fois.
|
|
import { SelectDropdown } from "../../../components/SelectDropdown.jsx";
|
|
import { MATCH_HOLO_PALETTE_ID, MATCH_HOLO_PALETTE_LABEL } from "../openingEffects.js";
|
|
|
|
const SOURCE_SUFFIXES = { default: "défaut", collection: "hérité de la collection", card: "hérité de la carte" };
|
|
|
|
// L'option héritée porte la valeur vide : la choisir revient à suivre le niveau supérieur.
|
|
// Une valeur enregistrée identique à la valeur héritée s'affiche donc aussi comme héritée.
|
|
function InheritableSelect({ label, options, value, inherited, disabled, onChange }) {
|
|
const selected = value && value !== inherited.id ? value : "";
|
|
return <SelectDropdown label={label} value={selected} disabled={disabled} options={options.map((option) => option.id === inherited.id
|
|
? { value: "", label: `${option.label} (${SOURCE_SUFFIXES[inherited.source]})` }
|
|
: { value: option.id, label: option.label })} onChange={(next) => onChange(next || null)} />;
|
|
}
|
|
|
|
export function MythicOpeningFields({ catalog, value, inherited, onChange, disabled = false }) {
|
|
const paletteOptions = [...catalog.particlePalettes, { id: MATCH_HOLO_PALETTE_ID, label: MATCH_HOLO_PALETTE_LABEL }];
|
|
return <div className="nebula-admin-opening-fields">
|
|
<InheritableSelect label="Forme de particules" options={catalog.particleShapes} value={value.particleShapeId} inherited={inherited.shape} disabled={disabled} onChange={(particleShapeId) => onChange({ ...value, particleShapeId })} />
|
|
<InheritableSelect label="Palette de particules" options={paletteOptions} value={value.particlePaletteId} inherited={inherited.palette} disabled={disabled} onChange={(particlePaletteId) => onChange({ ...value, particlePaletteId })} />
|
|
</div>;
|
|
}
|