Update the Aniimo catalog and regional filters
All checks were successful
Validate and deploy Sokko G / validate (push) Successful in 18m8s
Validate and deploy Sokko G / deploy (push) Successful in 9s

This commit is contained in:
Shinuwa 2026-10-30 00:03:04 +01:00
parent c08452d5a4
commit ae10661b63
62 changed files with 2799 additions and 130 deletions

View file

@ -24,7 +24,8 @@ function CardFaces({ variant, t, content, checklist, statsMax }) {
<div className="aniimo-card-inner">
<div className="aniimo-face aniimo-front nds-card" aria-hidden={flipped} inert={flipped}>
<div className="aniimo-portrait">
<img src={variant.image} alt={t(variant.name)} width="512" height="840" loading="lazy" />
{variant.image ? <img src={variant.image} alt={t(variant.name)} width="512" height="840" loading="lazy" /> : <div className="aniimo-portrait-placeholder" role="img" aria-label={`${t(variant.name)} — ${content.portraitUnavailable}`}><Icon name="picture" /><span>{content.portraitUnavailable}</span></div>}
<span className="aniimo-region">{t(variant.region)}</span>
<span className="aniimo-number">N° {variant.aniimoId}</span>
<GuideChecklistCheckbox checklist={checklist} itemKey={variant.key} />
</div>
@ -43,8 +44,9 @@ function CardFaces({ variant, t, content, checklist, statsMax }) {
<div className="aniimo-card-body aniimo-back-details nds-scrollbox" data-variant="ghost" role="region" aria-label={`${content.showBack} — ${t(variant.name)}`} tabIndex="0">
<div className="aniimo-back-summary">
<div><h3>{content.elements}</h3><Attributes values={variant.elements} t={t} /></div>
<div><h3>{content.role}</h3><Attributes values={[variant.role]} t={t} /></div>
<div><h3>{content.role}</h3>{variant.role ? <Attributes values={[variant.role]} t={t} /> : <span className="nds-badge" data-variant="neutral">{content.unknownRole}</span>}</div>
</div>
{variant.data_gaps?.length > 0 && <p className="nds-inline-notice" data-variant="info">{content.unverifiedData}</p>}
<h3>{content.abilities}</h3>
<ul className="aniimo-abilities">{variant.homeland_abilities.map((ability) => <li key={ability.type}>
<img src={aniimoAsset(ability.type)} alt="" width="24" height="24" />
@ -81,7 +83,7 @@ export function AniimoCard({ variants, t, content, checklist, statsMax }) {
target.parentElement.children[index].focus();
}
return (
<article className="aniimo-result" data-checklist-complete={checklist.isCompleted(variant.key) || undefined} data-aniimo={variant.aniimoId} data-form={variant.form} aria-label={t(variant.name)}>
<article className="aniimo-result" data-checklist-complete={checklist.isCompleted(variant.key) || undefined} data-aniimo={variant.aniimoId} data-uid={variant.aniimoUid} data-region={variant.region} data-form={variant.form} aria-label={t(variant.name)}>
<div className="aniimo-tabs-slot">
{multiple && <div className="aniimo-tabs nds-radio-button-group" data-size="xs" role="tablist" aria-label={`${content.variants} — ${t(variant.name)}`}>
{variants.map((item, index) => <Tooltip as="button" content={t(item.form)} aria-label={t(item.form)} key={item.key} type="button" role="tab" data-form={item.form} id={`${id}-${item.form}`} aria-controls={`${id}-panel`} aria-selected={item.key === variant.key} tabIndex={item.key === variant.key ? 0 : -1} className={item.key === variant.key ? "active" : ""} onClick={() => setSelectedKey(item.key)} onKeyDown={(event) => {

View file

@ -40,6 +40,7 @@ export function AniimoFilters({ filters, onChange, options, t, content }) {
const activeBadges = [
...(filters.name.trim() ? [{ id: "name", label: `${content.name} : ${filters.name.trim()}`, onRemove: () => onChange({ ...filters, name: "" }) }] : []),
...(filters.prismanaOnly ? [{ id: "prismana", label: content.prismana, onRemove: () => onChange({ ...filters, prismanaOnly: false }) }] : []),
...filters.regions.map((option) => ({ id: `region-${option}`, label: `${content.regions} : ${t(option)}`, onRemove: () => toggle("regions", option, false) })),
...filters.roles.map((option) => ({ id: `role-${option}`, label: `${content.roles} : ${t(option)}`, onRemove: () => toggle("roles", option, false) })),
...filters.elements.map((option) => ({ id: `element-${option}`, label: `${content.elements} : ${t(option)}`, onRemove: () => toggle("elements", option, false) })),
...Object.entries(filters.abilities).map(([option, level]) => ({ id: `ability-${option}`, label: `${t(option)} ${filters.abilityExact ? "=" : "≥"} ${level}`, onRemove: () => updateAbility(option, 0) }))
@ -56,6 +57,9 @@ export function AniimoFilters({ filters, onChange, options, t, content }) {
<img src="/static/icons/prismana.svg" alt="" width="16" height="16" />
<span className="nds-filter-option-label">{content.prismana}</span>
</button>
<GameFilterDropdown label={content.regions} count={filters.regions.length}>
{() => <FilterCheckboxOptions filterKey="regions" label={content.regions} values={options.regions} selected={filters.regions} t={t} onToggle={toggle} withIcons={false} />}
</GameFilterDropdown>
<GameFilterDropdown label={content.roles} count={filters.roles.length} icon="shield" columns={2}>
{() => <FilterCheckboxOptions filterKey="roles" label={content.roles} values={options.roles} selected={filters.roles} t={t} onToggle={toggle} />}
</GameFilterDropdown>
@ -93,13 +97,13 @@ export function AniimoFilters({ filters, onChange, options, t, content }) {
);
}
function FilterCheckboxOptions({ filterKey, label, values, selected, t, onToggle }) {
function FilterCheckboxOptions({ filterKey, label, values, selected, t, onToggle, withIcons = true }) {
return (
<div className="nds-filter-menu-options aniimo-filter-options aniimo-chip-options" role="region" aria-label={label}>
{values.map((option) => (
<label key={option} className={`filter-chip nds-chip nds-filter-menu-option ${selected.includes(option) ? "active" : ""}`} data-size="sm">
<label key={option} className={`filter-chip nds-chip nds-filter-menu-option ${selected.includes(option) ? "active" : ""}`} data-size="sm" data-with-icons={withIcons}>
<input className="nds-checkbox" data-size="sm" type="checkbox" checked={selected.includes(option)} onChange={(event) => onToggle(filterKey, option, event.target.checked)} />
<img src={aniimoAsset(option)} alt="" width="16" height="16" />
{withIcons && <img src={aniimoAsset(option)} alt="" width="16" height="16" />}
<span>{t(option)}</span>
</label>
))}

View file

@ -17,7 +17,7 @@ function AniimoListing({ game, aniimo, filters, setFilters, content }) {
const filtered = useMemo(() => filterAniimoVariants(aniimo.variants, active), [aniimo.variants, active]);
const visible = filtered.filter((variant) => checklist.isVisible(variant.key));
const groups = useMemo(() => groupAniimoVariants(visible), [visible]);
const totalAniimos = useMemo(() => new Set(aniimo.variants.map((variant) => variant.aniimoId)).size, [aniimo.variants]);
const totalAniimos = useMemo(() => new Set(aniimo.variants.map((variant) => variant.aniimoUid)).size, [aniimo.variants]);
const t = (key) => aniimoLabel(aniimo.translations, key);
const cards = active.grouped ? groups : visible.map((variant) => [variant]);
const update = (next) => setFilters((current) => ({ ...current, aniimo: next }));
@ -48,7 +48,7 @@ function AniimoListing({ game, aniimo, filters, setFilters, content }) {
<section className="game-layout aniimo-layout">
<aside className="game-filters"><AniimoFilters filters={active} onChange={update} options={aniimo.filterOptions} t={t} content={content} /></aside>
<section className="game-results" aria-label={content.results}>
{cards.length ? <div className="game-grid aniimo-grid">{cards.map((variants) => <AniimoCard key={active.grouped ? variants[0].aniimoId : variants[0].key} variants={variants} t={t} content={content} checklist={checklist} statsMax={statsMax} />)}</div> : <div className="empty nds-empty-state"><h2>{content.emptyTitle}</h2><p>{content.emptyText}</p></div>}
{cards.length ? <div className="game-grid aniimo-grid">{cards.map((variants) => <AniimoCard key={active.grouped ? variants[0].aniimoUid : variants[0].key} variants={variants} t={t} content={content} checklist={checklist} statsMax={statsMax} />)}</div> : <div className="empty nds-empty-state"><h2>{content.emptyTitle}</h2><p>{content.emptyText}</p></div>}
</section>
</section>
</>;

View file

@ -1,6 +1,6 @@
// Rôle : prépare les variantes Aniimo et applique les critères avant leur regroupement.
export function createAniimoFilters() {
return { name: "", prismanaOnly: false, elements: [], roles: [], abilities: {}, elementsLogic: "and", abilityExact: false, grouped: true };
return { name: "", prismanaOnly: false, regions: [], elements: [], roles: [], abilities: {}, elementsLogic: "and", abilityExact: false, grouped: true };
}
export const ANIIMO_STATS = ["hp", "atk", "p_def", "m_def", "break", "regen"];
@ -23,20 +23,26 @@ function normalizeName(value) {
}
export function prepareAniimoData(aniimos, translations, englishTranslations) {
const variants = aniimos.flatMap((aniimo) => aniimo.variations.map((variation) => ({
const orderedAniimos = [...aniimos].sort((left, right) => Number(left.region === "special") - Number(right.region === "special"));
const variants = orderedAniimos.flatMap((aniimo) => aniimo.variations.map((variation) => ({
...variation,
aniimoId: aniimo.id,
aniimoUid: aniimo.uid,
region: aniimo.region,
name: aniimo.name,
key: `${aniimo.id}:${variation.form}`,
image: aniimoAsset(`${aniimo.name}__${variation.form}`),
key: `${aniimo.uid}:${variation.form}`,
image: variation.image === null ? null : aniimoAsset(`${aniimo.name}__${variation.form}`),
searchNames: [aniimo.name, translations[aniimo.name], englishTranslations[aniimo.name]].filter(Boolean).map(normalizeName)
})));
const sorted = (values) => [...new Set(values)].sort((a, b) => aniimoLabel(translations, a).localeCompare(aniimoLabel(translations, b), "fr"));
const regions = sorted(variants.map((variant) => variant.region));
regions.sort((left, right) => Number(left === "special") - Number(right === "special"));
return {
variants,
filterOptions: {
regions,
elements: sorted(variants.flatMap((variant) => variant.elements)),
roles: sorted(variants.map((variant) => variant.role)),
roles: sorted(variants.map((variant) => variant.role).filter(Boolean)),
abilities: sorted(variants.flatMap((variant) => variant.homeland_abilities.map((ability) => ability.type)))
}
};
@ -52,6 +58,7 @@ export function filterAniimoVariants(variants, filters) {
return variants.filter((variant) => (
(!search || variant.searchNames.some((name) => name.includes(search)))
&& (!filters.prismanaOnly || variant.form === "prismana_form")
&& (!filters.regions.length || filters.regions.includes(variant.region))
&& matchesSelection(filters.elements, filters.elementsLogic, (element) => variant.elements.includes(element))
&& (!filters.roles.length || filters.roles.includes(variant.role))
&& abilities.every(([type, level]) => variant.homeland_abilities.some((ability) => ability.type === type && (filters.abilityExact ? ability.level === level : ability.level >= level)))
@ -61,8 +68,8 @@ export function filterAniimoVariants(variants, filters) {
export function groupAniimoVariants(variants) {
const groups = new Map();
for (const variant of variants) {
if (!groups.has(variant.aniimoId)) groups.set(variant.aniimoId, []);
groups.get(variant.aniimoId).push(variant);
if (!groups.has(variant.aniimoUid)) groups.set(variant.aniimoUid, []);
groups.get(variant.aniimoUid).push(variant);
}
return [...groups.values()];
}

View file

@ -14,6 +14,7 @@
}
.aniimo-chip-options { gap: 6px; }
.aniimo-chip-options .filter-chip { min-width: 0; }
.aniimo-chip-options .nds-filter-menu-option[data-with-icons="false"] { grid-template-columns: 18px minmax(0, 1fr); }
.aniimo-ability-options { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 12px; overflow: visible; }
.aniimo-ability-column { display: grid; min-width: 0; align-content: start; gap: 6px; }
.aniimo-ability-column:first-child { padding-right: 12px; border-right: 1px solid var(--color-border); }
@ -142,6 +143,17 @@
overflow: hidden;
img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center; }
}
.aniimo-portrait-placeholder {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: var(--space-3);
height: 100%;
color: var(--color-text-muted);
font-size: var(--font-size-sm);
}
.aniimo-region,
.aniimo-number {
position: absolute;
bottom: 10px;
@ -158,7 +170,8 @@
line-height: 1.2;
pointer-events: none;
}
// Les deux portraits de Petit Esprit de Feu ont davantage de vide sous le personnage.
.aniimo-region { top: 10px; bottom: auto; max-width: calc(100% - 20px); }
// Les deux portraits d’Elfe solidaire ont davantage de vide sous le personnage.
.aniimo-result[data-aniimo="11001"] .aniimo-portrait img { object-position: center 20%; }
.aniimo-card-body {
padding: 10px 12px;