Let players compare card stats in the collection, rebalance card profiles with a full refunded reset of upgrades, and fix best boosts that sometimes fired in the previous zone
All checks were successful
Validate and deploy Sokko G / validate (push) Successful in 25m4s
Validate and deploy Sokko G / deploy (push) Successful in 18s

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Shinuwa 2026-12-04 23:17:23 +01:00
parent 4a44306e30
commit 3590df5e1e
31 changed files with 1515 additions and 211 deletions

File diff suppressed because it is too large Load diff

View file

@ -168,7 +168,34 @@
"collection": {
"eyebrow": "Mes cartes",
"title": "Ma collection",
"resetFilters": "Réinitialiser les filtres"
"resetFilters": "Réinitialiser les filtres",
"views": { "label": "Affichage de la collection", "album": "Album", "stats": "Stats" },
"stats": {
"label": "Stats des cartes",
"modeLabel": "Lecture",
"modes": { "profile": "Profil", "current": "Stats actuelles" },
"modeHelp": {
"profile": "Profil : la répartition naturelle de la carte, en pourcentage, la même quelle que soit sa rareté ou son niveau. L’Équipe du jour et la Course n’utilisent que celle-ci.",
"current": "Stats actuelles : ce que la carte apporte aujourd’hui en Expédition, niveau, répartition des points et équipement compris."
},
"build": "Build",
"buildHelpNone": "Choisissez une ou plusieurs stats pour classer vos cartes.",
"buildHelp": "Cartes classées par la plus faible des stats choisies, puis par leur somme : une carte faible dans l’une d’elles descend.",
"columns": { "card": "Carte", "shape": "Profil", "power": "Puissance" },
"level": "Niv. {level} / {max}",
"open": "Ouvrir la fiche de {card}",
"shapeFilter": "Profil",
"shapes": { "specialist": "Spécialiste", "duo": "Duo", "trio": "Trio", "versatile": "Polyvalente", "balanced": "Équilibrée" },
"shapeHelp": {
"specialist": "Une stat nettement au-dessus des autres (10 points d’avance ou plus).",
"duo": "Deux stats fortes et proches, nettement au-dessus des deux autres.",
"trio": "Trois stats fortes et proches, la quatrième nettement en dessous.",
"versatile": "Des stats qui descendent en pente douce, sans écart net entre elles.",
"balanced": "Les quatre stats à 10 points d’écart ou moins."
},
"empty": "Vos cartes rares, épiques, légendaires et mythiques apparaîtront ici avec leurs stats.",
"noMatch": "Aucune carte ne correspond à ces filtres."
}
},
"history": {
"pendingCards": "Cartes à révéler"

View file

@ -1,5 +1,11 @@
/**
* @file Affiche l'album, ses progressions, ses filtres, le recyclage des doublons et le détail des éditions.
* @file Affiche la collection du joueur : l'album (progressions par collection, filtres, recyclage des doublons, détail des
* éditions) ou l'affichage « Stats » des cartes possédées des Expéditions, pour comparer leurs profils et classer un build.
*
* Utilisé par : CardsPage.jsx (section « collection »), en version complète et en mode mobile.
* Attention : les filtres Recherche, Collection et Rareté valent pour les deux affichages ; Possession n'existe que dans l'album
* (l'affichage Stats ne montre que des cartes possédées), Profil que dans l'affichage Stats.
* @see website/src/features/cards/cardStats.js
*/
import { useMemo, useState } from "react";
@ -8,8 +14,11 @@ import { SelectDropdown } from "../../components/SelectDropdown.jsx";
import { Tooltip } from "../../components/Tooltip.jsx";
import { ActiveFilterBadges } from "../games/ActiveFilterBadges.jsx";
import { ConfirmModal } from "../../components/ToolboxModals.jsx";
import { Tabs } from "../../components/Tabs.jsx";
import { CardDetailModal } from "./CardDetailModal.jsx";
import { CardsFilterMenu } from "./CardsFilterMenu.jsx";
import { PROFILE_SHAPES, rankRows, statRows } from "./cardStats.js";
import { CollectionStats } from "./CollectionStats.jsx";
import { DashboardAside } from "./CardsDashboard.jsx";
import { recycleDuplicates } from "./cardsApi.js";
import { readCollection, visibleCollections } from "./collectionState.js";
@ -21,6 +30,7 @@ import { frenchList, rarityAdjective } from "./rarityWords.js";
import { useCardsHref } from "./useCardsHref.js";
const OWNERSHIP_OPTIONS = [{ value: "owned", label: "Possédées" }, { value: "missing", label: "Manquantes" }, { value: "duplicates", label: "Doublons" }];
const VIEWS = ["album", "stats"];
const countDuplicates = (count) => `${count} doublon${count > 1 ? "s" : ""}`;
export function CollectionPanel({ catalog, state, runMutation, busy, headingContent, recyclingContent: content, cardSheetContent, onStartTransfer }) {
@ -29,6 +39,11 @@ export function CollectionPanel({ catalog, state, runMutation, busy, headingCont
const [collectionIds, setCollectionIds] = useState([]);
const [rarities, setRarities] = useState([]);
const [ownership, setOwnership] = useState([]);
const [view, setView] = useState("album");
const [statMode, setStatMode] = useState("profile");
const [targets, setTargets] = useState([]);
const [shapes, setShapes] = useState([]);
// Fiche ouverte : la carte et son onglet (« Amélioration » depuis l'affichage Stats).
const [selected, setSelected] = useState(null);
const [confirmingRecycle, setConfirmingRecycle] = useState(false);
const [recycleNotice, setRecycleNotice] = useState("");
@ -41,15 +56,22 @@ export function CollectionPanel({ catalog, state, runMutation, busy, headingCont
const normalizedSearch = search.trim().toLocaleLowerCase("fr");
const collections = visibleCollections(catalog, owned.ownedCardIds);
const visibleCollectionIds = new Set(collections.map((collection) => collection.id));
// Recherche, collection et rareté : communes aux deux affichages. Une carte inconnue ne se cherche que par son nom : sa
// description, cachée, est un indice de la Carte du jour.
const matchesCommon = (card, edition, quantity) => visibleCollectionIds.has(card.collectionId)
&& (!normalizedSearch || `${card.name} ${quantity > 0 ? card.description : ""}`.toLocaleLowerCase("fr").includes(normalizedSearch))
&& (!collectionIds.length || collectionIds.includes(card.collectionId))
&& (!rarities.length || rarities.includes(edition.rarity));
const editions = catalog.editions.filter((edition) => {
const card = cards.get(edition.cardId);
const quantity = quantities.get(edition.id) || 0;
// Une carte inconnue ne se cherche que par son nom : sa description, cachée, est un indice de la Carte du jour.
return visibleCollectionIds.has(card.collectionId) && (!normalizedSearch || `${card.name} ${quantity > 0 ? card.description : ""}`.toLocaleLowerCase("fr").includes(normalizedSearch))
&& (!collectionIds.length || collectionIds.includes(card.collectionId))
&& (!rarities.length || rarities.includes(edition.rarity))
return matchesCommon(cards.get(edition.cardId), edition, quantity)
&& (!ownership.length || ownership.includes("owned") && quantity > 0 || ownership.includes("missing") && quantity === 0 || ownership.includes("duplicates") && quantity > 1);
});
const allStatRows = useMemo(() => statRows(catalog, state), [catalog, state]);
const shownStatRows = rankRows(allStatRows.filter((row) => matchesCommon(row.card, row.edition, 1) && (!shapes.length || shapes.includes(row.shape))), targets, statMode);
const hasCurrent = allStatRows.some((row) => row.current);
const currentMax = Math.max(0, ...allStatRows.flatMap((row) => (row.current ? Object.values(row.current) : [])));
const statsContent = headingContent.stats;
/** Éditions hors promotion d'une collection, décomptées dans les titres de l'album. */
function collectionEditionsOf(collection) {
@ -61,6 +83,7 @@ export function CollectionPanel({ catalog, state, runMutation, busy, headingCont
setCollectionIds([]);
setRarities([]);
setOwnership([]);
setShapes([]);
}
async function recycleAll() {
@ -82,15 +105,22 @@ export function CollectionPanel({ catalog, state, runMutation, busy, headingCont
const showingDuplicates = ownership.includes("duplicates");
const collectionOptions = collections.map((item) => ({ value: item.id, label: item.name }));
const rarityOptions = catalog.rarities.map((item) => ({ value: item.id, label: item.label }));
const shapeOptions = PROFILE_SHAPES.map((id) => ({ value: id, label: statsContent.shapes[id] }));
const activeFilters = [
...(search.trim() ? [{ id: "search", label: `Recherche : ${search.trim()}`, onRemove: () => setSearch("") }] : []),
...collectionOptions.filter((option) => collectionIds.includes(option.value)).map((option) => ({ id: `collection-${option.value}`, label: `Collection : ${option.label}`, onRemove: () => setCollectionIds(collectionIds.filter((value) => value !== option.value)) })),
...rarityOptions.filter((option) => rarities.includes(option.value)).map((option) => ({ id: `rarity-${option.value}`, label: `Rareté : ${option.label}`, onRemove: () => setRarities(rarities.filter((value) => value !== option.value)) })),
...OWNERSHIP_OPTIONS.filter((option) => ownership.includes(option.value)).map((option) => ({ id: `ownership-${option.value}`, label: `Possession : ${option.label}`, onRemove: () => setOwnership(ownership.filter((value) => value !== option.value)) }))
...(view === "album" ? OWNERSHIP_OPTIONS : []).filter((option) => ownership.includes(option.value)).map((option) => ({ id: `ownership-${option.value}`, label: `Possession : ${option.label}`, onRemove: () => setOwnership(ownership.filter((value) => value !== option.value)) })),
...(view === "stats" ? shapeOptions : []).filter((option) => shapes.includes(option.value)).map((option) => ({ id: `shape-${option.value}`, label: `${statsContent.shapeFilter} : ${option.label}`, onRemove: () => setShapes(shapes.filter((value) => value !== option.value)) }))
];
return <>
<div className="nds-section-heading nebula-section-heading"><div><p className="eyebrow">{headingContent.eyebrow}</p><h2>{headingContent.title}</h2></div></div>
<div className="nds-section-heading nebula-section-heading">
<div><p className="eyebrow">{headingContent.eyebrow}</p><h2>{headingContent.title}</h2></div>
<div className="nebula-collection-views" role="group" aria-label={headingContent.views.label}>
<Tabs tabs={VIEWS.map((id) => ({ id, label: headingContent.views[id] }))} activeTab={view} onChange={setView} />
</div>
</div>
{recycling.count > 0 && <DashboardAside>
<section className="nds-panel nebula-recycle-box" aria-label={content.barLabel}>
<StardustBalance value={wallet.stardust} />
@ -98,7 +128,7 @@ export function CollectionPanel({ catalog, state, runMutation, busy, headingCont
{preview.count ? <p><strong>{countDuplicates(preview.count)}</strong> à recycler pour <strong>+{formatStardust(preview.stardust)}</strong></p> : <p>{content.none}</p>}
<div className="nebula-recycle-box-actions">
<button className="nds-button" data-size="sm" data-variant="primary" type="button" disabled={busy || Boolean(state.pendingOpening) || !preview.count} onClick={() => setConfirmingRecycle(true)}>{content.allButton}</button>
<button className="nds-button" data-size="sm" data-variant="secondary" type="button" onClick={() => setOwnership(showingDuplicates ? [] : ["duplicates"])}>{showingDuplicates ? content.viewAll : content.viewDuplicates}</button>
<button className="nds-button" data-size="sm" data-variant="secondary" type="button" onClick={() => { setView("album"); setOwnership(showingDuplicates ? [] : ["duplicates"]); }}>{showingDuplicates ? content.viewAll : content.viewDuplicates}</button>
</div>
{state.pendingOpening && <p className="nebula-form-help">{content.pending} <a href={cardsHref("packs")}>{content.pendingAction}</a></p>}
</section>
@ -108,11 +138,15 @@ export function CollectionPanel({ catalog, state, runMutation, busy, headingCont
<label className="nds-filter-search"><span className="sr-only">Recherche</span><input className="nds-input" data-size="sm" type="search" value={search} placeholder="Rechercher..." onChange={(event) => setSearch(event.target.value)} /></label>
<CardsFilterMenu label="Collection" options={collectionOptions} selected={collectionIds} onChange={setCollectionIds} />
<CardsFilterMenu label="Rareté" options={rarityOptions} selected={rarities} onChange={setRarities} />
<CardsFilterMenu label="Possession" options={OWNERSHIP_OPTIONS} selected={ownership} onChange={setOwnership} />
{view === "album" ? <CardsFilterMenu label="Possession" options={OWNERSHIP_OPTIONS} selected={ownership} onChange={setOwnership} />
: <CardsFilterMenu label={statsContent.shapeFilter} options={shapeOptions} selected={shapes} onChange={setShapes} />}
<Tooltip as="button" className="filter-reset-button nds-icon-button nds-filter-reset" content={headingContent.resetFilters} data-size="xs" type="button" aria-label={headingContent.resetFilters} onClick={resetFilters}><Icon name="rubber" /></Tooltip>
<ActiveFilterBadges items={activeFilters} />
</section>
<section aria-label="Cartes de la collection">
{view === "stats" ? <CollectionStats catalog={catalog} rows={shownStatRows} total={allStatRows.length} mode={hasCurrent ? statMode : "profile"} onModeChange={setStatMode}
targets={targets} onTargetsChange={setTargets} hasCurrent={hasCurrent} currentMax={currentMax} content={statsContent} statNames={cardSheetContent.stats}
onSelect={(row) => setSelected({ entry: { edition: row.edition, card: row.card }, tab: "improve" })} />
: <section aria-label="Cartes de la collection">
{editions.length ? <div className="nebula-album-groups">{collections.map((collection) => {
const shownEditions = editions.filter((edition) => cards.get(edition.cardId).collectionId === collection.id);
if (!shownEditions.length) return null;
@ -129,13 +163,13 @@ export function CollectionPanel({ catalog, state, runMutation, busy, headingCont
const quantity = quantities.get(edition.id) || 0;
const discovered = quantity > 0;
return <div key={edition.id} className="nebula-album-entry" data-missing={!quantity || undefined} data-undiscovered={!discovered || undefined}>
<NebulaCard catalog={catalog} entry={entry} quantity={quantity} size="md" concealed={!discovered} backCollection={collection} onSelect={discovered ? () => setSelected(entry) : undefined} />
<NebulaCard catalog={catalog} entry={entry} quantity={quantity} size="md" concealed={!discovered} backCollection={collection} onSelect={discovered ? () => setSelected({ entry, tab: "card" }) : undefined} />
{discovered && favorites.has(edition.id) && <span className="nebula-favorite-mark" aria-label="Favorite">★</span>}
</div>;
})}</div>
</section>;
})}</div> : <div className="nds-empty-state"><p>Aucune édition ne correspond à ces filtres.</p></div>}
</section>
</section>}
{confirmingRecycle && <ConfirmModal
title={fillTemplate(content.confirmTitle, { count: countDuplicates(preview.count) })}
message={fillTemplate(content.confirmText, { rarities: frenchList(chosenRarities.map((rarity) => rarityAdjective(catalog, rarity.id, 2))), stardust: formatStardust(preview.stardust) })}
@ -148,6 +182,6 @@ export function CollectionPanel({ catalog, state, runMutation, busy, headingCont
{/* Seules les raretés recyclées cette fois, avec ce que rapporte chacun de leurs doublons. */}
<ul className="nebula-shop-rates" aria-label={content.ratesLabel}>{chosenRarities.map((rarity) => <li key={rarity.id} data-rarity={rarity.id}><span>{rarity.label}</span><StardustBalance value={shop.stardustValues[rarity.id] ?? 0} /></li>)}</ul>
</ConfirmModal>}
{selected && <CardDetailModal catalog={catalog} state={state} entry={selected} content={cardSheetContent} runMutation={runMutation} busy={busy} onClose={() => setSelected(null)} onStartTransfer={onStartTransfer} />}
{selected && <CardDetailModal catalog={catalog} state={state} entry={selected.entry} initialTab={selected.tab} content={cardSheetContent} runMutation={runMutation} busy={busy} onClose={() => setSelected(null)} onStartTransfer={onStartTransfer} />}
</>;
}

View file

@ -0,0 +1,101 @@
/**
* @file Affichage « Stats » de la collection : les cartes possédées des Expéditions en tableau (type de profil, quatre stats en
* barres, Puissance et niveau), lues en Profil ou en Stats actuelles, et classées pour un build de une à quatre stats.
*
* Attention :
* - En demi-écran (section de moins de 760 px), les en-têtes des stats et les types de profil passent en icônes seules : leur
* nom reste dans l'infobulle et le nom accessible.
* - En mode mobile, le tableau se replie en fiches (styles sous `.nebula-mobile`) ; chaque stat garde son icône et son nom
* accessible dans sa cellule, puisque l'en-tête n'est plus visible.
* @see website/src/features/cards/cardStats.js
*/
import { Tabs } from "../../components/Tabs.jsx";
import { Tooltip } from "../../components/Tooltip.jsx";
import { PROFILE_MAX_SHARE, rowValues, STAT_MODES } from "./cardStats.js";
import { formatDecimal, STAT_IDS } from "./expeditions/expeditionFormat.js";
import { MaskIcon } from "./expeditions/ExpeditionLabels.jsx";
import { fillTemplate } from "./textFormat.js";
const statColor = (stat) => `var(--color-stat-${stat})`;
/**
* Type de profil d'une carte : son nom, les icônes de ses stats fortes, et ce qu'il veut dire au survol. Le texte lu par un lecteur
* d'écran (« Duo : Bravoure, Fortune ») reste présent quand le nom visible est masqué en demi-écran.
*/
function ShapeBadge({ row, content, statNames }) {
const colors = row.stats.length ? row.stats.map(statColor) : [row.shape === "balanced" ? statColor("balanced") : "var(--color-text-secondary)"];
const names = row.stats.map((stat) => statNames[stat]).join(", ");
return <Tooltip className="nebula-shape-badge" data-shape={row.shape} content={content.shapeHelp[row.shape]} tabIndex={-1} style={{ "--shape-start": colors[0], "--shape-end": colors.at(-1) }}>
{row.shape === "balanced" ? <MaskIcon name="balanced" /> : row.stats.map((stat) => <span key={stat} className="nebula-shape-badge-stat" style={{ "--specialty": statColor(stat) }}><MaskIcon name={stat} /></span>)}
<span className="nebula-shape-badge-label" aria-hidden="true">{content.shapes[row.shape]}</span>
<span className="sr-only">{names ? `${content.shapes[row.shape]} : ${names}` : content.shapes[row.shape]}</span>
</Tooltip>;
}
/**
* `rows` : lignes déjà filtrées et classées (cardStats.js) ; `mode` : « profile » ou « current » ; `targets` : stats du build ;
* `currentMax` : plus haute stat actuelle de la collection, l'échelle des barres en Stats actuelles ; `onSelect(row)` ouvre la fiche.
*/
export function CollectionStats({ catalog, rows, total, mode, onModeChange, targets, onTargetsChange, hasCurrent, currentMax, content, statNames, onSelect }) {
const scale = mode === "current" ? Math.max(1, currentMax) : PROFILE_MAX_SHARE;
const rarityLabel = (id) => catalog.rarities.find((rarity) => rarity.id === id)?.label ?? id;
const valueText = (value) => (value == null ? "—" : mode === "profile" ? `${value}\u202f%` : formatDecimal(value));
return <section className="nebula-collection-stats" aria-label={content.label}>
<div className="nebula-collection-stats-tools">
{hasCurrent && <div className="nebula-collection-stats-mode">
<span className="nebula-form-help">{content.modeLabel}</span>
<Tabs tabs={STAT_MODES.map((id) => ({ id, label: content.modes[id] }))} activeTab={mode} onChange={onModeChange} />
</div>}
<div className="nebula-collection-build" role="group" aria-label={content.build}>
<span className="nebula-form-help">{content.build}</span>
{STAT_IDS.map((stat) => {
const on = targets.includes(stat);
return <button key={stat} type="button" className="nds-button" data-size="sm" data-variant={on ? "primary" : "secondary"} aria-pressed={on} style={{ "--specialty": statColor(stat) }}
onClick={() => onTargetsChange(on ? targets.filter((item) => item !== stat) : STAT_IDS.filter((item) => item === stat || targets.includes(item)))}>
<MaskIcon name={stat} />{statNames[stat]}
</button>;
})}
</div>
</div>
<p className="nebula-form-help nebula-collection-stats-help">{content.modeHelp[mode]} {targets.length ? content.buildHelp : content.buildHelpNone}</p>
{!total ? <div className="nds-empty-state"><p>{content.empty}</p></div> : !rows.length ? <div className="nds-empty-state"><p>{content.noMatch}</p></div>
: <div className="nebula-collection-stats-scroll"><table className="nebula-collection-stats-table" data-mode={mode}>
<caption className="sr-only">{content.label}</caption>
<thead><tr>
<th scope="col">{content.columns.card}</th>
<th scope="col">{content.columns.shape}</th>
{STAT_IDS.map((stat) => <th key={stat} scope="col" data-stat={stat} data-target={targets.includes(stat) || undefined} style={{ "--specialty": statColor(stat) }} aria-label={statNames[stat]}>
<Tooltip className="nebula-collection-stats-head" content={statNames[stat]} tabIndex={-1}><MaskIcon name={stat} /><span className="nebula-collection-stats-label">{statNames[stat]}</span></Tooltip>
</th>)}
<th scope="col">{content.columns.power}</th>
</tr></thead>
<tbody>{rows.map((row) => {
const values = rowValues(row, mode);
return <tr key={row.edition.id} data-rarity={row.edition.rarity}>
<th scope="row">
<button type="button" className="nebula-collection-stats-card" aria-label={fillTemplate(content.open, { card: row.card.name })} onClick={() => onSelect(row)}>
<span className="nebula-collection-stats-thumb" aria-hidden="true">{row.card.image && <img src={row.card.image} alt="" loading="lazy" />}</span>
<span className="nebula-collection-stats-name"><strong>{row.card.name}</strong><small>{rarityLabel(row.edition.rarity)}</small></span>
</button>
</th>
<td><ShapeBadge row={row} content={content} statNames={statNames} /></td>
{STAT_IDS.map((stat) => {
const value = values?.[stat] ?? null;
return <td key={stat} data-stat={stat} data-target={targets.includes(stat) || undefined} style={{ "--specialty": statColor(stat) }}>
<span className="nebula-collection-stat">
<MaskIcon name={stat} /><span className="sr-only">{statNames[stat]} : </span>
<strong>{valueText(value)}</strong>
<span className="nebula-collection-stat-bar" aria-hidden="true"><span style={{ width: `${Math.min(100, ((value ?? 0) / scale) * 100)}%` }} /></span>
</span>
</td>;
})}
<td className="nebula-collection-stats-power">
<span className="sr-only">{content.columns.power} : </span><strong>{row.power ?? "—"}</strong>
{row.level != null && <small>{fillTemplate(content.level, { level: row.level, max: row.maxLevel })}</small>}
</td>
</tr>;
})}</tbody>
</table></div>}
</section>;
}

View file

@ -34,7 +34,8 @@ const EVENT_LABELS = {
item_used: "Objet utilisé",
destination_starter: "Carte de destination offerte",
card_plan_changed: "Plan de progression choisi",
item_bought: "Objets achetés en boutique"
item_bought: "Objets achetés en boutique",
card_progress_reset: "Améliorations remises à zéro"
};
const SHOP_ITEM_NAMES = { oblivion: "Parchemin d’oubli", windRose: "Rose des vents" };
@ -103,6 +104,11 @@ function HistoryDetail({ entry, catalog }) {
}
if (entry.type === "destination_starter") return <span>{cardReference(details.editionId, catalog)} · par la Guilde des Veilleurs</span>;
if (entry.type === "card_plan_changed") return <span>{[cardReference(entry.entityId, catalog), PLAN_NAMES[details.plan] || details.plan, details.oblivion && "un Parchemin d’oubli utilisé"].filter(Boolean).join(" · ")}</span>;
if (entry.type === "card_progress_reset") {
const plural = (count, word) => `${count} ${word}${count > 1 ? "s" : ""}`;
const gains = [details.eclats + details.xpEclats > 0 && `+${details.eclats + details.xpEclats} Éclats`, details.duplicates > 0 && `${plural(details.duplicates, "doublon")} rendu${details.duplicates > 1 ? "s" : ""}`, details.oblivion > 0 && `${plural(details.oblivion, "Parchemin")} d’oubli rendu${details.oblivion > 1 ? "s" : ""}`].filter(Boolean);
return <span>{[`${plural(details.cards, "carte")} · nouveaux profils de stats`, ...gains].join(" · ")}</span>;
}
if (entry.type === "item_bought") return <span>{details.count} × {SHOP_ITEM_NAMES[details.item] || details.item} · −{formatStardust(details.stardust)} d’étoiles</span>;
if (entry.type === "eclats_converted") return <span>+{details.eclats} Éclats · −{formatStardust(details.stardust)} d’étoiles</span>;
if (entry.type === "opening_purchased") return <span>{details.count > 1 && `${details.count} ouvertures · `}−{formatStardust(details.stardust ?? details.price)} d’étoiles</span>;

View file

@ -32,9 +32,9 @@ quête de la Guilde et le rendu des cartes ont leur sous-dossier.
| racine : `CardsPage`, `cardsApi.js`, `cardCache.js`, `cardsReserve.js`, `useCardsConfig.js`, `CardsDashboard` | Page, appels au serveur, cache, configuration, cadre des tableaux de bord |
| racine : `cardsRoutes.js`, `useCardsHref.js` | Adresses des sections en version complète et en mode mobile, sections proposées sur téléphone (`MOBILE_SECTIONS`), règle de redirection ; liens internes des panneaux (`useCardsHref`) |
| racine : `useDayEnded.js` | Passage de minuit pour la Carte du jour, le Miroir et la Course : la partie commencée la veille reste affichée et jouable, un bandeau propose ensuite celle du nouveau jour |
| racine : `CardsHomePanel`, `DailyTip`, `PackPanel`, `OpeningReserve`, `CollectionPanel`, `CardDetailModal`, `ShopPanel`, `TransfersPanel`, `TransferComposer`, `HistoryPanel`, `AccountPanel`, `PrivacyNotice` | Sections du joueur hors Guilde (`DailyTip` est l'« Astuce du jour » de l'accueil, pas la Carte du jour) |
| racine : `CardsHomePanel`, `DailyTip`, `PackPanel`, `OpeningReserve`, `CollectionPanel`, `CollectionStats`, `CardDetailModal`, `ShopPanel`, `TransfersPanel`, `TransferComposer`, `HistoryPanel`, `AccountPanel`, `PrivacyNotice` | Sections du joueur hors Guilde (`DailyTip` est l'« Astuce du jour » de l'accueil, pas la Carte du jour). La collection a deux affichages : l'album et « Stats » (`CollectionStats`), qui compare les profils des cartes possédées des Expéditions et classe un build |
| racine : `GuildPanel`, `guildQuests.js` | Hall de la Guilde et liste des quêtes |
| racine : `textFormat.js`, `stardustFormat.js`, `rarityWords.js`, `rewardText.js`, `collectionState.js`, `dropRates.js`, `Currency.jsx` | Règles d'affichage partagées. `textFormat.js` contient `fillTemplate` (remplissage des textes de `site.json`) et `formatCountdown` |
| racine : `textFormat.js`, `stardustFormat.js`, `rarityWords.js`, `rewardText.js`, `collectionState.js`, `cardStats.js`, `dropRates.js`, `Currency.jsx` | Règles d'affichage partagées. `cardStats.js` donne le type de profil d'une carte (Spécialiste, Duo, Trio, Polyvalente, Équilibrée) et le classement d'un build (la plus faible des stats choisies, puis leur somme). `textFormat.js` contient `fillTemplate` (remplissage des textes de `site.json`) et `formatCountdown` |
| `daily/` | Carte du jour (`dailyFormat.js` : recherche par nom, verdict d'un essai, texte à partager) |
| `expeditions/` | Expéditions, amélioration des cartes (`CardPlan`, `AwakeningPicker`), `expeditionFormat.js` |
| `team/` | Équipe du jour et Course des courants (`Race*`, `raceRun.js`) |

View file

@ -0,0 +1,87 @@
/**
* @file Règles d'affichage de l'outil de stats de la collection : profil d'une carte, son type (Spécialiste, Duo, Trio,
* Polyvalente, Équilibrée), lignes des cartes possédées et classement d'un build.
*
* Utilisé par : CollectionPanel.jsx et CollectionStats.jsx ; tests/nebula-cards.test.mjs.
* Attention :
* - Le type décrit la forme du profil pour construire un build. Ce n'est pas la spécialité des mini-jeux d'équipe
* (`specialtiesOf`, services/cards/team-rules.js), où une double spécialité exige deux stats à égalité ; seul le seuil
* d'« Équilibrée » (10 points d'écart au plus) est le même.
* - Seules les cartes possédées apparaissent : le profil d'une carte manquante resterait un indice de la Carte du jour.
* @see docs/expeditions/equilibrage.md
*/
import { STAT_IDS } from "./expeditions/expeditionFormat.js";
export const PROFILE_SHAPES = ["specialist", "duo", "trio", "versatile", "balanced"];
export const STAT_MODES = ["profile", "current"];
// Écart, en points de profil, qui sépare une stat forte des suivantes ; même valeur que BALANCED_SPREAD de l'Équipe du jour.
const SHAPE_GAP = 10;
// Part maximale d'une stat dans un profil (MAX_PROFILE_SHARE de services/cards/catalog.js) : l'échelle des barres en lecture Profil.
export const PROFILE_MAX_SHARE = 50;
const EXPEDITION_RARITIES = new Set(["rare", "epic", "legendary", "mythic"]);
/**
* Profil d'expédition d'une carte (pourcentages des quatre stats) : le sien, sinon celui de sa collection, ou null. Pour une édition
* mythique (`rarity`), le `mythicProfile` de sa légendaire quand il existe, comme editionExpeditionData côté serveur.
*/
export function cardProfile(catalog, card, rarity = null) {
if (!card || card.kind === "destination") return null;
if (rarity === "mythic" && card.expedition?.mythicProfile) return card.expedition.mythicProfile;
return card.expedition?.profile ?? catalog.collections.find((collection) => collection.id === card.collectionId)?.expedition?.profile ?? null;
}
/**
* Type d'un profil, lu de la plus haute stat à la plus basse : « balanced » si l'écart total ne dépasse pas 10 points, sinon la
* première cassure d'au moins 10 points donne « specialist » (une stat devant), « duo » (deux) ou « trio » (trois) ; sans cassure
* nette, « versatile ». `stats` : les stats fortes, de la plus haute à la plus basse (vide pour balanced et versatile).
*/
export function profileShape(profile) {
const order = [...STAT_IDS].sort((a, b) => profile[b] - profile[a]);
const values = order.map((stat) => profile[stat]);
if (values[0] - values[3] <= SHAPE_GAP) return { shape: "balanced", stats: [] };
const breakAt = [0, 1, 2].find((index) => values[index] - values[index + 1] >= SHAPE_GAP);
if (breakAt === undefined) return { shape: "versatile", stats: [] };
return { shape: ["specialist", "duo", "trio"][breakAt], stats: order.slice(0, breakAt + 1) };
}
/**
* Lignes de l'outil de stats : une par édition possédée qui peut partir en équipe (rare ou mieux, avec un profil), dans l'ordre
* du catalogue. `current` : stats actuelles (niveau, plan et équipement compris) envoyées par le serveur dans `cardProgress`,
* ou null quand il n'en donne pas.
*/
export function statRows(catalog, state) {
const owned = new Set(state.collection.map((entry) => entry.editionId));
const progress = new Map((state.cardProgress ?? []).map((item) => [item.editionId, item]));
const cards = new Map(catalog.cards.map((card) => [card.id, card]));
return catalog.editions.flatMap((edition, index) => {
const card = cards.get(edition.cardId);
const profile = owned.has(edition.id) && EXPEDITION_RARITIES.has(edition.rarity) ? cardProfile(catalog, card, edition.rarity) : null;
if (!profile) return [];
const item = progress.get(edition.id);
return [{ edition, card, order: index, profile, ...profileShape(profile), current: item?.stats ?? null, power: item?.power ?? null, level: item?.level ?? null, maxLevel: item?.maxLevel ?? null }];
});
}
/** Valeurs d'une ligne dans une lecture : `profile` (pourcentages) ou `current` (stats actuelles ; aucune si le serveur n'en donne pas). */
export const rowValues = (row, mode) => (mode === "current" ? row.current ?? {} : row.profile);
/**
* Note d'un build : la plus faible des stats choisies (une carte faible dans l'une d'elles descend), puis leur somme. Sans stat
* choisie, null.
*/
export function buildScore(values, targets) {
if (!targets.length) return null;
const picked = targets.map((stat) => values[stat] ?? 0);
return { min: Math.min(...picked), sum: picked.reduce((total, value) => total + value, 0) };
}
/**
* Classe les lignes pour un build : la plus faible des stats choisies d'abord, puis leur somme, puis la Puissance, puis l'ordre du
* catalogue. Sans stat choisie, l'ordre du catalogue.
*/
export function rankRows(rows, targets, mode) {
if (!targets.length) return [...rows].sort((a, b) => a.order - b.order);
const scored = rows.map((row) => ({ row, score: buildScore(rowValues(row, mode), targets) }));
return scored.sort((a, b) => b.score.min - a.score.min || b.score.sum - a.score.sum || (b.row.power ?? 0) - (a.row.power ?? 0) || a.row.order - b.row.order).map(({ row }) => row);
}

View file

@ -625,6 +625,53 @@ $diffraction-glitter-b: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/
.nebula-album-entry { position: relative; display: flex; justify-content: center; min-width: 0; }
.nebula-album-entry[data-missing] .nebula-card-face { filter: grayscale(0.78); opacity: 0.44; }
.nebula-album-entry[data-undiscovered] .nebula-card-tilt-surface { filter: grayscale(0.6) brightness(0.72); opacity: 0.7; }
// Affichage « Stats » de la collection (CollectionStats.jsx) : bascule Album / Stats, lecture et build, tableau des cartes possédées
// des Expéditions. Chaque stat garde sa couleur (--color-stat-*) avec son icône et son nom.
.nebula-collection-views { display: flex; align-items: center; }
.nebula-collection-stats { display: grid; gap: var(--space-3); min-width: 0; container-type: inline-size; }
.nebula-collection-stats-tools { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3) var(--space-6); }
.nebula-collection-stats-mode, .nebula-collection-build { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.nebula-collection-build .nds-button { gap: 6px; }
.nebula-collection-build .nds-button[data-variant="secondary"] .nebula-mask-icon { color: var(--specialty); }
.nebula-collection-stats-help { max-width: 90ch; margin: 0; }
.nebula-collection-stats-scroll { min-width: 0; overflow-x: auto; }
.nebula-collection-stats-table { width: 100%; border-collapse: collapse; font-size: var(--font-size-sm); }
.nebula-collection-stats-table :is(th, td) { padding: var(--space-2) 6px; border-bottom: 1px solid var(--color-border); text-align: left; vertical-align: middle; }
.nebula-collection-stats-table thead th { color: var(--color-text-secondary); font-size: var(--font-size-xs); font-weight: 700; white-space: nowrap; }
.nebula-collection-stats-table thead th .nebula-mask-icon { margin-right: 4px; color: var(--specialty); vertical-align: -2px; }
.nebula-collection-stats-table thead th[data-target] { color: var(--specialty); }
.nebula-collection-stats-table td[data-target] { background: color-mix(in srgb, var(--specialty) 9%, transparent); }
.nebula-collection-stats-table tbody tr:hover { background: var(--color-bg-hover); }
.nebula-collection-stats-card { display: flex; align-items: center; justify-content: flex-start; gap: var(--space-3); width: 100%; min-width: 0; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.nebula-collection-stats-card:focus-visible { outline: 2px solid var(--color-accent-gold); outline-offset: 2px; border-radius: var(--radius-sm); }
.nebula-collection-stats-card:hover strong { color: var(--color-accent-gold); }
.nebula-collection-stats-thumb { flex: none; width: 44px; height: 44px; overflow: hidden; border: 2px solid var(--card-rarity, var(--color-border)); border-radius: var(--radius-sm); background: var(--color-bg-deep); }
.nebula-collection-stats-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.nebula-collection-stats-name { display: grid; min-width: 0; }
.nebula-collection-stats-table tbody th { min-width: 170px; }
.nebula-collection-stats-name strong { line-height: 1.25; }
.nebula-collection-stats-name small { color: var(--card-rarity, var(--color-text-secondary)); font-size: var(--font-size-xs); font-weight: 700; }
.nebula-shape-badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px var(--space-2) 2px 4px; border: 1px solid transparent; border-radius: var(--radius-pill); background: linear-gradient(var(--color-bg-deep), var(--color-bg-deep)) padding-box, linear-gradient(90deg, var(--shape-start), var(--shape-end)) border-box; color: var(--color-text-primary); font-size: var(--font-size-xs); font-weight: 700; white-space: nowrap; }
.nebula-shape-badge > .nebula-mask-icon, .nebula-shape-badge-stat .nebula-mask-icon { width: 14px; height: 14px; }
.nebula-shape-badge > .nebula-mask-icon { color: var(--shape-start); }
.nebula-shape-badge-stat { display: inline-flex; color: var(--specialty); }
.nebula-collection-stat { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 4px; min-width: 64px; }
.nebula-collection-stat-bar { grid-column: 1 / -1; }
.nebula-collection-stat > .nebula-mask-icon { display: none; }
.nebula-collection-stat strong { font-variant-numeric: tabular-nums; }
.nebula-collection-stat-bar { height: 6px; overflow: hidden; border-radius: var(--radius-pill); background: rgba(255, 255, 255, 0.08); }
.nebula-collection-stat-bar > span { display: block; height: 100%; border-radius: inherit; background: var(--specialty); }
.nebula-collection-stats-power { white-space: nowrap; }
.nebula-collection-stats-power strong { font-variant-numeric: tabular-nums; }
.nebula-collection-stats-power small { display: block; color: var(--color-text-secondary); font-size: var(--font-size-xs); }
.nebula-collection-stats-head { display: inline-flex; align-items: center; }
// Demi-écran : icônes seules pour les en-têtes des stats et les types de profil (sauf Polyvalente, qui n'a pas d'icône).
@container (max-width: 760px) {
.nebula-collection-stats-label { display: none; }
.nebula-collection-stats-table thead th .nebula-mask-icon { width: 18px; height: 18px; margin-right: 0; }
.nebula-shape-badge:not([data-shape="versatile"]) .nebula-shape-badge-label { display: none; }
.nebula-shape-badge:not([data-shape="versatile"]) { padding-right: 4px; }
}
.nebula-favorite-mark { position: absolute; top: 6px; right: max(6px, calc((100% - 240px) / 2 + 6px)); z-index: 4; color: var(--color-accent-gold); filter: drop-shadow(0 1px 2px #000); }
// Derrière une carte animée, le flou plein écran de la modale serait recalculé à chaque image : un voile plus dense le remplace.
.nds-modal-backdrop:has(+ :is(.nebula-card-detail, .nebula-trade-composer)) { background: rgba(2, 3, 9, 0.86); backdrop-filter: none; }

View file

@ -82,6 +82,29 @@
// Collection : deux cartes par rangée.
.nebula-mobile .nebula-album-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); }
// Collection, affichage Stats : le tableau devient une fiche par carte (carte en haut, profil et Puissance, puis les quatre stats
// côte à côte avec leur icône) ; la lecture et le build passent sur toute la largeur, les stats du build en grille de quatre.
.nebula-mobile .nebula-collection-views .tabs { width: 100%; }
.nebula-mobile .nebula-collection-views .tabs > button { flex: 1 1 0; min-height: 44px; }
.nebula-mobile .nebula-collection-stats-tools { display: grid; gap: var(--space-3); }
.nebula-mobile .nebula-collection-build { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.nebula-mobile .nebula-collection-build > .nebula-form-help { grid-column: 1 / -1; }
.nebula-mobile .nebula-collection-build .nds-button { flex-direction: column; justify-content: center; gap: 2px; min-width: 0; min-height: 48px; padding-inline: 2px; font-size: var(--font-size-xs); }
.nebula-mobile .nebula-collection-stats-table, .nebula-mobile .nebula-collection-stats-table tbody { display: block; }
.nebula-mobile .nebula-collection-stats-table tbody th { min-width: 0; }
.nebula-mobile .nebula-collection-stats-table thead { display: none; }
.nebula-mobile .nebula-collection-stats-table tbody tr { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-2); padding: var(--space-3) 0; border-bottom: 1px solid var(--color-border); }
.nebula-mobile .nebula-collection-stats-table tbody :is(th, td) { padding: 0; border: 0; }
.nebula-mobile .nebula-collection-stats-table tbody th { grid-row: 1; grid-column: 1 / -1; }
.nebula-mobile .nebula-collection-stats-card { min-height: 44px; }
.nebula-mobile .nebula-collection-stats .nebula-shape-badge .nebula-shape-badge-label { display: inline; }
.nebula-mobile .nebula-collection-stats .nebula-shape-badge { padding-right: var(--space-2); }
.nebula-mobile .nebula-collection-stats-table tbody td:nth-child(2) { grid-row: 2; grid-column: 1 / 3; }
.nebula-mobile .nebula-collection-stats-power { display: flex; grid-row: 2; grid-column: 3 / -1; align-items: baseline; justify-content: flex-end; gap: var(--space-2); }
.nebula-mobile .nebula-collection-stats-power small { display: inline; }
.nebula-mobile .nebula-collection-stats-table td[data-stat] { grid-row: 3; padding: 4px; border-radius: var(--radius-sm); }
.nebula-mobile .nebula-collection-stat { grid-template-columns: auto minmax(0, 1fr); min-width: 0; }
.nebula-mobile .nebula-collection-stat > .nebula-mask-icon { display: inline-block; color: var(--specialty); }
// Expéditions : le Sac tient dans la largeur ; les textes d'aide des deux premières étapes, les descriptions des
// destinations et les grands emplacements vides sont retirés ou réduits, pour rapprocher le départ du haut de la page.