Add recovery for public data loading failures

This commit is contained in:
Shinuwa 2026-10-15 16:25:07 +02:00
parent 1171eee510
commit daa5eba8bd
14 changed files with 186 additions and 58 deletions

View file

@ -57,8 +57,8 @@ function AniimoListing({ game, aniimo, filters, setFilters, content }) {
export function AniimoPage({ category, game, aniimo, filters, setFilters, siteContent, links, actions }) {
const content = siteContent.aniimo;
if (category === "lists") {
if (!aniimo.loaded) return <section className="empty nds-empty-state" aria-busy="true"><h1>{content.loading}</h1></section>;
if (aniimo.error) return <section className="empty nds-empty-state" role="alert"><h1>{content.error}</h1><p>{aniimo.error}</p></section>;
if (aniimo.loading || !aniimo.loaded) return <section className="empty nds-empty-state" aria-busy="true"><h1>{content.loading}</h1></section>;
if (aniimo.error) return <section className="empty nds-empty-state" role="alert"><h1>{content.error}</h1><p>{aniimo.error}</p><button className="nds-button" data-size="sm" data-variant="primary" type="button" onClick={aniimo.retry}>{siteContent.gamesPage.retryLabel}</button></section>;
return <AniimoLists game={game} aniimo={aniimo} linkedToolboxId={links?.[game.id] || ""} actions={actions} />;
}
if (category !== "aniimos") return <>
@ -68,7 +68,7 @@ export function AniimoPage({ category, game, aniimo, filters, setFilters, siteCo
<a className="feature game-home-card" href="#/games/aniimo/lists"><span className="game-home-card-icon" aria-hidden="true"><span className="module-icon-svg module-icon-checklist" /></span><strong>Listes</strong><span>Données copiables au format checklist pour préparer vos suivis.</span></a>
</section>
</>;
if (!aniimo.loaded) return <section className="empty nds-empty-state" aria-busy="true"><h1>{content.loading}</h1></section>;
if (aniimo.error) return <section className="empty nds-empty-state" role="alert"><h1>{content.error}</h1><p>{aniimo.error}</p></section>;
if (aniimo.loading || !aniimo.loaded) return <section className="empty nds-empty-state" aria-busy="true"><h1>{content.loading}</h1></section>;
if (aniimo.error) return <section className="empty nds-empty-state" role="alert"><h1>{content.error}</h1><p>{aniimo.error}</p><button className="nds-button" data-size="sm" data-variant="primary" type="button" onClick={aniimo.retry}>{siteContent.gamesPage.retryLabel}</button></section>;
return <AniimoListing game={game} aniimo={aniimo} filters={filters} setFilters={setFilters} content={content} />;
}