Reorganise the visual lab and mythic variations around a Holo and Particles panel

The visual lab becomes a single bench: one thumbnail per holographic effect picks
the effect, and a large card sits beside the shared customisation panel. The
mythic editor shows its variations as a row of thumbnails above the settings of
the selected one, with a large card preview, and saves them with a single
Enregistrer / Annuler pair instead of saving each slider. Formats and effects
whose files a card lacks stay in their menu, disabled at the bottom with the
missing files listed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Shinuwa 2026-11-22 14:33:18 +01:00
parent 808adadc0c
commit 9f70bea523
13 changed files with 621 additions and 343 deletions

View file

@ -0,0 +1,52 @@
// Rôle : panneau de personnalisation d'une variation mythique, partagé par l'Atelier visuel (aperçu seul) et l'éditeur des
// variations (enregistré par ses boutons) : onglet « Holo » (format, effet, palette, paliers) et onglet « Particules ».
import { useState } from "react";
import { SelectDropdown } from "../../../components/SelectDropdown.jsx";
import { Tabs } from "../../../components/Tabs.jsx";
import { EffectTuningFields } from "./EffectTuningFields.jsx";
import { variationSummary } from "./effectTuning.js";
import { effectMissingHint, fittingFormat, formatMissingHint } from "./finishAvailability.js";
import { SwatchDropdown } from "./SwatchDropdown.jsx";
const TABS = [{ id: "holo", label: "Holo" }, { id: "particles", label: "Particules" }];
// Options désactivées en bas de liste, chaque groupe gardant l'ordre du catalogue.
const enabledFirst = (left, right) => Number(left.disabled) - Number(right.disabled);
// `value` : { formatId, effectPresetId, paletteId, intensity, level }. `showEffect` masque le menu d'effet quand l'effet se
// choisit ailleurs (miniatures de l'Atelier). Un format ou un effet dont la carte n'a pas les fichiers reste visible mais
// désactivé, en bas de liste, avec la liste des fichiers manquants.
// `children` reçoit les actions (Enregistrer, Annuler) sous le résumé.
export function VariationCustomizer({ catalog, card, value, showEffect = true, disabled = false, notice = null, onChange, children = null }) {
const [tab, setTab] = useState("holo");
const effect = catalog.effectPresets.find((item) => item.id === value.effectPresetId);
const activeLabel = TABS.find((item) => item.id === tab).label;
const formatOptions = catalog.cardFormats.map((format) => {
const hint = formatMissingHint(card, value.effectPresetId, format.id);
return { value: format.id, label: format.label, disabled: Boolean(hint), hint };
}).toSorted(enabledFirst);
const effectOptions = catalog.effectPresets.map((item) => {
const hint = effectMissingHint(catalog, card, item.id);
return { value: item.id, label: item.label, disabled: Boolean(hint), hint };
}).toSorted(enabledFirst);
const changeEffect = (effectPresetId) => onChange({ ...value, effectPresetId, formatId: fittingFormat(catalog, card, effectPresetId, value.formatId) });
return <div className="nebula-admin-customizer">
<Tabs className="nebula-admin-customizer-tabs" tabs={TABS} activeTab={tab} onChange={setTab} />
<div className="nebula-admin-customizer-panel" role="tabpanel" aria-label={activeLabel} data-tab={tab}>
{tab === "holo" ? <>
<div className="nebula-admin-customizer-choices">
{card.fullImage && <SelectDropdown className="nebula-admin-inline-field" label="Format" size="sm" value={value.formatId} disabled={disabled} options={formatOptions} onChange={(formatId) => onChange({ ...value, formatId })} />}
{showEffect && <SelectDropdown className="nebula-admin-inline-field" label="Effet" size="sm" value={value.effectPresetId} disabled={disabled} options={effectOptions} onChange={changeEffect} />}
<SwatchDropdown className="nebula-admin-inline-field" label="Palette" accessibleLabel="Palette holographique" value={value.paletteId} options={catalog.effectPalettes} disabled={disabled} onChange={(paletteId) => onChange({ ...value, paletteId })} />
</div>
<EffectTuningFields catalog={catalog} effect={effect} value={value} disabled={disabled} onChange={(tuning) => onChange({ ...value, ...tuning })} />
</> : <>
<SelectDropdown className="nebula-admin-inline-field" label="Animation" size="sm" disabled value="" options={[{ value: "", label: "Aucune" }]} onChange={() => {}} />
<p className="nebula-form-help">Les animations de particules arrivent une par une.</p>
</>}
</div>
{notice}
<p className="nebula-admin-customizer-summary">{variationSummary(catalog, card, value)}</p>
{children && <div className="nds-toolbar nebula-admin-customizer-actions">{children}</div>}
</div>;
}