Keep the administration settings locked until their data reloads after a save
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
d5c2900eed
commit
2858b3e359
4 changed files with 23 additions and 10 deletions
|
|
@ -39,9 +39,9 @@ function PackActivity({ activity }) {
|
|||
</span>;
|
||||
}
|
||||
|
||||
function CollectionsIndex({ catalog, lookup, dashboard, busy, runMutation, refreshDashboard }) {
|
||||
function CollectionsIndex({ catalog, lookup, dashboard, settingsBusy, runMutation, refreshDashboard }) {
|
||||
return <section className="nebula-admin-collections" aria-labelledby="nebula-admin-collections-title">
|
||||
<RechargeSetting key={dashboard?.rechargeSetting?.intervalMs || 0} setting={dashboard?.rechargeSetting} busy={busy} runMutation={runMutation} refreshDashboard={refreshDashboard} />
|
||||
<RechargeSetting key={dashboard?.rechargeSetting?.intervalMs || 0} setting={dashboard?.rechargeSetting} busy={settingsBusy} runMutation={runMutation} refreshDashboard={refreshDashboard} />
|
||||
<div className="nds-section-heading nebula-section-heading"><div><h3 id="nebula-admin-collections-title">Collections <span className="nds-badge" data-variant="neutral">{catalog.collections.length}</span></h3><p>Chaque collection est un paquet. Choisissez-en une pour l’ouvrir ou la fermer aux joueurs, régler ses taux de tirage et ses versions mythiques, et consulter ses cartes.</p></div></div>
|
||||
<div className="nebula-admin-collection-index">{catalog.collections.map((collection) => {
|
||||
const { cards, editions, activeMythics } = collectionStats(catalog, lookup, collection);
|
||||
|
|
@ -177,7 +177,7 @@ function CollectionCards({ catalog, lookup, collection, dashboard, onConfigure }
|
|||
</section>;
|
||||
}
|
||||
|
||||
function CollectionPage({ catalog, lookup, collection, dashboard, mutateCatalog, runMutation, refreshDashboard, busy }) {
|
||||
function CollectionPage({ catalog, lookup, collection, dashboard, mutateCatalog, runMutation, refreshDashboard, busy, settingsBusy }) {
|
||||
const [expandedCardId, setExpandedCardId] = useState(null);
|
||||
const { cards, editions, activeMythics } = collectionStats(catalog, lookup, collection);
|
||||
|
||||
|
|
@ -199,7 +199,7 @@ function CollectionPage({ catalog, lookup, collection, dashboard, mutateCatalog,
|
|||
</div>
|
||||
</article>
|
||||
{/* Le paquet de la boutique puise dans les autres collections : rappel de ses sources et part de ses propres cartes. */}
|
||||
{collection.packCategory === "shop" && <ShopPackContent catalog={catalog} collection={collection} dashboard={dashboard} busy={busy} runMutation={runMutation} refreshDashboard={refreshDashboard} />}
|
||||
{collection.packCategory === "shop" && <ShopPackContent catalog={catalog} collection={collection} dashboard={dashboard} busy={settingsBusy} runMutation={runMutation} refreshDashboard={refreshDashboard} />}
|
||||
{/* Collection des Expéditions : pas de paquet ; ses cartes arrivent par le butin, le Filet et l'atelier, une fois illustrées. */}
|
||||
{collection.packCategory === "expedition" && <p className="nds-inline-notice" data-variant="info">Cette collection ne s’obtient qu’en expédition : butin des destinations, Filet à étoiles filantes et atelier. Une carte n’y entre qu’une fois son illustration ajoutée au catalogue ({cards.filter((card) => card.image).length} sur {cards.length} illustrées).</p>}
|
||||
{/* Taux de tirage et ouverture mythique côte à côte quand la place le permet, empilés sinon. */}
|
||||
|
|
@ -216,10 +216,10 @@ function CollectionPage({ catalog, lookup, collection, dashboard, mutateCatalog,
|
|||
</>;
|
||||
}
|
||||
|
||||
export function AdminCollections({ catalog, lookup, dashboard, mutateCatalog, runMutation, refreshDashboard, busy, collectionId }) {
|
||||
if (!collectionId) return <CollectionsIndex catalog={catalog} lookup={lookup} dashboard={dashboard} busy={busy} runMutation={runMutation} refreshDashboard={refreshDashboard} />;
|
||||
export function AdminCollections({ catalog, lookup, dashboard, mutateCatalog, runMutation, refreshDashboard, busy, settingsBusy, collectionId }) {
|
||||
if (!collectionId) return <CollectionsIndex catalog={catalog} lookup={lookup} dashboard={dashboard} settingsBusy={settingsBusy} runMutation={runMutation} refreshDashboard={refreshDashboard} />;
|
||||
const collection = lookup.collections.get(collectionId);
|
||||
if (!collection) return <div className="nds-empty-state"><p>Cette collection n’existe pas.</p><a className="nds-button" data-variant="secondary" href="#/cards/admin/collections">Retour aux collections</a></div>;
|
||||
// La clé remet à zéro filtres et panneaux ouverts quand on change de collection.
|
||||
return <CollectionPage key={collection.id} catalog={catalog} lookup={lookup} collection={collection} dashboard={dashboard} mutateCatalog={mutateCatalog} runMutation={runMutation} refreshDashboard={refreshDashboard} busy={busy} />;
|
||||
return <CollectionPage key={collection.id} catalog={catalog} lookup={lookup} collection={collection} dashboard={dashboard} mutateCatalog={mutateCatalog} runMutation={runMutation} refreshDashboard={refreshDashboard} busy={busy} settingsBusy={settingsBusy} />;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,7 +58,10 @@ export function AdminPanel({ catalog, state, runMutation, busy, section, subsect
|
|||
return result;
|
||||
}
|
||||
|
||||
const shared = { catalog, lookup, state, dashboard, dashboardLoading: loading, refreshDashboard: refresh, runMutation, busy, now };
|
||||
// Un enregistrement recharge les données, qui recréent le formulaire du réglage : ses champs restent verrouillés jusque-là,
|
||||
// sinon une saisie commencée entre les deux serait effacée.
|
||||
const settingsBusy = busy || loading;
|
||||
const shared = { catalog, lookup, state, dashboard, dashboardLoading: loading, refreshDashboard: refresh, runMutation, busy, settingsBusy, now };
|
||||
|
||||
return <section className="nebula-dashboard" aria-labelledby="nebula-admin-title">
|
||||
<header className="nds-panel nebula-admin-heading">
|
||||
|
|
@ -89,8 +92,8 @@ export function AdminPanel({ catalog, state, runMutation, busy, section, subsect
|
|||
{activeSection === "visual-lab" && <AdminVisualLab catalog={catalog} lookup={lookup} />}
|
||||
{activeSection === "history" && <AdminHistory catalog={catalog} refreshedAt={dashboard?.generatedAt} />}
|
||||
{activeSection === "codes" && <AdminDistributions {...shared} mutateCampaigns={mutateCampaigns} />}
|
||||
{activeSection === "shop" && <AdminShop {...shared} refreshDashboard={refresh} />}
|
||||
{activeSection === "guild" && <AdminGuild {...shared} refreshDashboard={refresh} tab={subsection} />}
|
||||
{activeSection === "shop" && <AdminShop {...shared} busy={settingsBusy} />}
|
||||
{activeSection === "guild" && <AdminGuild {...shared} busy={settingsBusy} tab={subsection} />}
|
||||
</CardsDashboardLayout>
|
||||
</section>;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue