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
|
|
@ -468,3 +468,4 @@
|
||||||
{"id":"int-5aaf018ecb831aae1f611786a3de9c70","kind":"field_change","created_at":"2026-11-24T14:37:43.987814761Z","actor":"Shinuwa","issue_id":"sokko-g-94pl","extra":{"field":"status","new_value":"closed","old_value":"in_progress","reason":"Mythique prismatique, tokens de rareté centralisés, symboles dans l'historique ; check et e2e cartes verts"}}
|
{"id":"int-5aaf018ecb831aae1f611786a3de9c70","kind":"field_change","created_at":"2026-11-24T14:37:43.987814761Z","actor":"Shinuwa","issue_id":"sokko-g-94pl","extra":{"field":"status","new_value":"closed","old_value":"in_progress","reason":"Mythique prismatique, tokens de rareté centralisés, symboles dans l'historique ; check et e2e cartes verts"}}
|
||||||
{"id":"int-03398e7ce6431c7affd16e514918aa37","kind":"field_change","created_at":"2026-11-24T21:54:50.806535658Z","actor":"Shinuwa","issue_id":"sokko-g-uv2n","extra":{"field":"status","new_value":"closed","old_value":"in_progress","reason":"Sujet, thème, indices au choix et recherche par mots proches en place ; check, E2E, production, assets et E2E cartes verts"}}
|
{"id":"int-03398e7ce6431c7affd16e514918aa37","kind":"field_change","created_at":"2026-11-24T21:54:50.806535658Z","actor":"Shinuwa","issue_id":"sokko-g-uv2n","extra":{"field":"status","new_value":"closed","old_value":"in_progress","reason":"Sujet, thème, indices au choix et recherche par mots proches en place ; check, E2E, production, assets et E2E cartes verts"}}
|
||||||
{"id":"int-a8de03cbd694d8b55d196658cfd983e8","kind":"field_change","created_at":"2026-11-24T22:48:44.872754074Z","actor":"Shinuwa","issue_id":"sokko-g-z30j","extra":{"field":"status","new_value":"closed","old_value":"in_progress","reason":"Thème du nom à la place de la rareté, dès 3 essais ratés ; check et E2E cartes verts"}}
|
{"id":"int-a8de03cbd694d8b55d196658cfd983e8","kind":"field_change","created_at":"2026-11-24T22:48:44.872754074Z","actor":"Shinuwa","issue_id":"sokko-g-z30j","extra":{"field":"status","new_value":"closed","old_value":"in_progress","reason":"Thème du nom à la place de la rareté, dès 3 essais ratés ; check et E2E cartes verts"}}
|
||||||
|
{"id":"int-713bb81bbe6b5a692cc892313d4a7a78","kind":"field_change","created_at":"2026-11-25T08:36:07.250219052Z","actor":"Shinuwa","issue_id":"sokko-g-gaen","extra":{"field":"status","new_value":"closed","old_value":"open","reason":"Réglages verrouillés (Boutique, Guilde, Collections) jusqu'au rechargement des données ; E2E avec requêtes ralenties, qui échoue sans le correctif."}}
|
||||||
|
|
|
||||||
|
|
@ -1521,6 +1521,13 @@ test("administrator navigates sections, manages mythic content and previews visu
|
||||||
await expect(eclatsArticle).toContainText("Fermé aux joueurs");
|
await expect(eclatsArticle).toContainText("Fermé aux joueurs");
|
||||||
const eclatPrice = eclatsArticle.getByLabel("Prix d’un Éclat d’étoile");
|
const eclatPrice = eclatsArticle.getByLabel("Prix d’un Éclat d’étoile");
|
||||||
await expect(eclatPrice).toHaveValue("3");
|
await expect(eclatPrice).toHaveValue("3");
|
||||||
|
// Machine lente simulée : les champs restent verrouillés de l'enregistrement au rechargement des données, sinon le formulaire
|
||||||
|
// recréé à son arrivée efface une saisie commencée entre les deux.
|
||||||
|
const slowRequests = /\/api\/cards\/admin\/(dashboard|expeditions\/settings)$/;
|
||||||
|
await page.route(slowRequests, async (route) => {
|
||||||
|
await new Promise((resolve) => globalThis.setTimeout(resolve, 600));
|
||||||
|
await route.continue();
|
||||||
|
});
|
||||||
for (const price of ["4", "3"]) {
|
for (const price of ["4", "3"]) {
|
||||||
await eclatPrice.fill(price);
|
await eclatPrice.fill(price);
|
||||||
await articlesForm.getByRole("button", { name: "Appliquer" }).click();
|
await articlesForm.getByRole("button", { name: "Appliquer" }).click();
|
||||||
|
|
@ -1528,6 +1535,8 @@ test("administrator navigates sections, manages mythic content and previews visu
|
||||||
await expect(eclatPrice).toHaveValue(price);
|
await expect(eclatPrice).toHaveValue(price);
|
||||||
await expect(articlesForm.getByRole("button", { name: "Appliquer" })).toBeDisabled();
|
await expect(articlesForm.getByRole("button", { name: "Appliquer" })).toBeDisabled();
|
||||||
}
|
}
|
||||||
|
await expect(eclatPrice).toBeEnabled();
|
||||||
|
await page.unroute(slowRequests);
|
||||||
await expect(eclatsArticle).toContainText("Premier niveau d’une légendaire (70 Éclats) = 210 poussières.");
|
await expect(eclatsArticle).toContainText("Premier niveau d’une légendaire (70 Éclats) = 210 poussières.");
|
||||||
await noOverflow();
|
await noOverflow();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -39,9 +39,9 @@ function PackActivity({ activity }) {
|
||||||
</span>;
|
</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">
|
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="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) => {
|
<div className="nebula-admin-collection-index">{catalog.collections.map((collection) => {
|
||||||
const { cards, editions, activeMythics } = collectionStats(catalog, lookup, collection);
|
const { cards, editions, activeMythics } = collectionStats(catalog, lookup, collection);
|
||||||
|
|
@ -177,7 +177,7 @@ function CollectionCards({ catalog, lookup, collection, dashboard, onConfigure }
|
||||||
</section>;
|
</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 [expandedCardId, setExpandedCardId] = useState(null);
|
||||||
const { cards, editions, activeMythics } = collectionStats(catalog, lookup, collection);
|
const { cards, editions, activeMythics } = collectionStats(catalog, lookup, collection);
|
||||||
|
|
||||||
|
|
@ -199,7 +199,7 @@ function CollectionPage({ catalog, lookup, collection, dashboard, mutateCatalog,
|
||||||
</div>
|
</div>
|
||||||
</article>
|
</article>
|
||||||
{/* Le paquet de la boutique puise dans les autres collections : rappel de ses sources et part de ses propres cartes. */}
|
{/* 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 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>}
|
{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. */}
|
{/* 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 }) {
|
export function AdminCollections({ catalog, lookup, dashboard, mutateCatalog, runMutation, refreshDashboard, busy, settingsBusy, collectionId }) {
|
||||||
if (!collectionId) return <CollectionsIndex catalog={catalog} lookup={lookup} dashboard={dashboard} busy={busy} runMutation={runMutation} refreshDashboard={refreshDashboard} />;
|
if (!collectionId) return <CollectionsIndex catalog={catalog} lookup={lookup} dashboard={dashboard} settingsBusy={settingsBusy} runMutation={runMutation} refreshDashboard={refreshDashboard} />;
|
||||||
const collection = lookup.collections.get(collectionId);
|
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>;
|
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.
|
// 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;
|
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">
|
return <section className="nebula-dashboard" aria-labelledby="nebula-admin-title">
|
||||||
<header className="nds-panel nebula-admin-heading">
|
<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 === "visual-lab" && <AdminVisualLab catalog={catalog} lookup={lookup} />}
|
||||||
{activeSection === "history" && <AdminHistory catalog={catalog} refreshedAt={dashboard?.generatedAt} />}
|
{activeSection === "history" && <AdminHistory catalog={catalog} refreshedAt={dashboard?.generatedAt} />}
|
||||||
{activeSection === "codes" && <AdminDistributions {...shared} mutateCampaigns={mutateCampaigns} />}
|
{activeSection === "codes" && <AdminDistributions {...shared} mutateCampaigns={mutateCampaigns} />}
|
||||||
{activeSection === "shop" && <AdminShop {...shared} refreshDashboard={refresh} />}
|
{activeSection === "shop" && <AdminShop {...shared} busy={settingsBusy} />}
|
||||||
{activeSection === "guild" && <AdminGuild {...shared} refreshDashboard={refresh} tab={subsection} />}
|
{activeSection === "guild" && <AdminGuild {...shared} busy={settingsBusy} tab={subsection} />}
|
||||||
</CardsDashboardLayout>
|
</CardsDashboardLayout>
|
||||||
</section>;
|
</section>;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue