Add recovery for public data loading failures
This commit is contained in:
parent
1171eee510
commit
daa5eba8bd
14 changed files with 186 additions and 58 deletions
|
|
@ -1,5 +1,5 @@
|
|||
// Rôle : liste les jeux déclarés dans le contenu éditable.
|
||||
export function GamesPage({ siteContent, games, gamesError }) {
|
||||
// Rôle : liste les jeux déclarés et permet de reprendre le chargement de leur catalogue.
|
||||
export function GamesPage({ siteContent, games, gamesError, gamesLoading, retryGames }) {
|
||||
const content = siteContent.gamesPage;
|
||||
|
||||
return (
|
||||
|
|
@ -12,6 +12,10 @@ export function GamesPage({ siteContent, games, gamesError }) {
|
|||
</div>
|
||||
</section>
|
||||
<section className="game-list">
|
||||
{gamesError && games.length > 0 && <div className="nds-inline-notice" data-variant="warning" role="alert">
|
||||
<span>{gamesError}</span>
|
||||
<button className="nds-button" data-size="sm" type="button" onClick={retryGames}>{content.retryLabel}</button>
|
||||
</div>}
|
||||
{games.length ? games.map((game) => (
|
||||
<article className="card nds-card game-card" data-variant="interactive" key={game.id}>
|
||||
<a
|
||||
|
|
@ -37,9 +41,10 @@ export function GamesPage({ siteContent, games, gamesError }) {
|
|||
</div>
|
||||
</article>
|
||||
)) : (
|
||||
<div className="empty nds-empty-state">
|
||||
<h2>{content.emptyTitle}</h2>
|
||||
<p>{gamesError || content.emptyText}</p>
|
||||
<div className="empty nds-empty-state" aria-busy={gamesLoading}>
|
||||
<h2>{gamesLoading ? content.loadingTitle : content.emptyTitle}</h2>
|
||||
<p>{gamesLoading ? content.loadingText : gamesError || content.emptyText}</p>
|
||||
{gamesError && <button className="nds-button" data-size="sm" data-variant="primary" type="button" onClick={retryGames}>{content.retryLabel}</button>}
|
||||
</div>
|
||||
)}
|
||||
</section>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue