Add local automatic backups and Aniimo regions lists
All checks were successful
Deploy Sokko G / deploy (push) Successful in 18s
All checks were successful
Deploy Sokko G / deploy (push) Successful in 18s
This commit is contained in:
parent
2255de94a7
commit
0a3bb4dffd
24 changed files with 908 additions and 16 deletions
18
website/src/features/games/aniimo/AniimoLists.jsx
Normal file
18
website/src/features/games/aniimo/AniimoLists.jsx
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
// Rôle : affiche les listes Aniimo exportables en checklist.
|
||||
import { useState } from "react";
|
||||
import { GameListsPage } from "../GameListsPage.jsx";
|
||||
|
||||
export function AniimoLists({ game, aniimo, linkedToolboxId, actions }) {
|
||||
const lists = aniimo.lists || [];
|
||||
const [selectedListId, setSelectedListId] = useState("");
|
||||
return (
|
||||
<GameListsPage
|
||||
game={game}
|
||||
lists={lists}
|
||||
selectedListId={selectedListId}
|
||||
onSelectList={setSelectedListId}
|
||||
linkedToolboxId={linkedToolboxId}
|
||||
onCreateChecklist={(list) => actions.createChecklistFromList(game.id, list)}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
|
@ -6,6 +6,7 @@ import { Icon } from "../../../components/Icon.jsx";
|
|||
import { GameBreadcrumb } from "../GameBreadcrumb.jsx";
|
||||
import { AniimoCard } from "./AniimoCard.jsx";
|
||||
import { AniimoFilters } from "./AniimoFilters.jsx";
|
||||
import { AniimoLists } from "./AniimoLists.jsx";
|
||||
import { getAniimoStatsMax, aniimoLabel, filterAniimoVariants, groupAniimoVariants } from "./utils.js";
|
||||
|
||||
function AniimoListing({ game, aniimo, filters, setFilters, content }) {
|
||||
|
|
@ -41,11 +42,19 @@ function AniimoListing({ game, aniimo, filters, setFilters, content }) {
|
|||
</>;
|
||||
}
|
||||
|
||||
export function AniimoPage({ category, game, aniimo, filters, setFilters, siteContent }) {
|
||||
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>;
|
||||
return <AniimoLists game={game} aniimo={aniimo} linkedToolboxId={links?.[game.id] || ""} actions={actions} />;
|
||||
}
|
||||
if (category !== "aniimos") return <>
|
||||
<section className="game-hero" style={{ "--game-hero-image": `url("${game.images.heroBg}")` }}><div><p className="eyebrow">{game.eyebrow}</p><h1>{game.title}</h1><p>{game.summary}</p></div></section>
|
||||
<section className="game-home-grid"><a className="feature game-home-card aniimo-home-card" href="#/games/aniimo/aniimos"><img src={game.images.aniimosCover} alt="" /><strong>{content.title}</strong><span>{content.homeDescription}</span></a></section>
|
||||
<section className="game-home-grid">
|
||||
<a className="feature game-home-card aniimo-home-card" href="#/games/aniimo/aniimos"><img src={game.images.aniimosCover} alt="" /><strong>{content.title}</strong><span>{content.homeDescription}</span></a>
|
||||
<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>;
|
||||
|
|
|
|||
|
|
@ -134,16 +134,19 @@ export const INITIAL_ANIIMO_STATE = {
|
|||
error: "",
|
||||
translations: {},
|
||||
variants: [],
|
||||
filterOptions: { elements: [], roles: [], abilities: [] }
|
||||
filterOptions: { elements: [], roles: [], abilities: [] },
|
||||
lists: []
|
||||
};
|
||||
|
||||
export async function loadAniimoData(signal) {
|
||||
const responses = await Promise.all([
|
||||
fetch("/data/aniimo/aniimos.json", { signal }),
|
||||
fetch("/data/aniimo/i18n/fr.json", { signal }),
|
||||
fetch("/data/aniimo/i18n/en.json", { signal })
|
||||
fetch("/data/aniimo/i18n/en.json", { signal }),
|
||||
fetch("/data/aniimo/lists/index.json", { signal })
|
||||
]);
|
||||
if (responses.some((response) => !response.ok)) throw new Error("Les données Aniimo sont indisponibles.");
|
||||
const [aniimos, translations, englishTranslations] = await Promise.all(responses.map((response) => response.json()));
|
||||
return { loaded: true, loading: false, error: "", translations, englishTranslations, ...prepareAniimoData(aniimos, translations, englishTranslations) };
|
||||
const [aniimos, translations, englishTranslations, listIndex] = await Promise.all(responses.map((response) => response.json()));
|
||||
const lists = await loadGameLists("aniimo", listIndex, signal);
|
||||
return { loaded: true, loading: false, error: "", translations, englishTranslations, lists, ...prepareAniimoData(aniimos, translations, englishTranslations) };
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue