Add a loot legend, a foldable Watcher's bag and a mythic halo, and move card sheet and power texts to site.json

- The destinations step opens with a legend of the four loots and what the
  green and red arrows mean.
- The Watcher's bag folds into a strip of item art and counts; the choice is
  kept by the browser.
- Mythic cards wear a slowly turning prismatic ring across the expedition
  screens; it is visual only.
- The card sheet and the stats distribution read their texts from
  cards.cardSheet, and power descriptions and their figures from
  cards.expeditions.powerText and powerDetails.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Shinuwa 2026-11-18 15:44:44 +01:00
parent 84b0d69b1f
commit 98ffe6562c
20 changed files with 361 additions and 129 deletions

View file

@ -381,3 +381,7 @@
{"id":"int-ebe370aa3b8a1fc6fb5fca83e807f606","kind":"field_change","created_at":"2026-11-18T13:58:46.756416964Z","actor":"Shinuwa","issue_id":"sokko-g-ff4c","extra":{"field":"status","new_value":"closed","old_value":"in_progress","reason":"Closed"}}
{"id":"int-8b0578b72aa8abdf70f472871fb536f8","kind":"field_change","created_at":"2026-11-18T14:00:20.954848588Z","actor":"Shinuwa","issue_id":"sokko-g-toxr","extra":{"field":"status","new_value":"closed","old_value":"in_progress","reason":"Closed"}}
{"id":"int-8afc0c2dd1a165d89a1b174179e86c61","kind":"field_change","created_at":"2026-11-18T14:04:48.317154369Z","actor":"Shinuwa","issue_id":"sokko-g-k5r5","extra":{"field":"status","new_value":"closed","old_value":"in_progress","reason":"Closed"}}
{"id":"int-889a51ae9d0abc78bd595016d6b37fbb","kind":"field_change","created_at":"2026-11-18T14:33:08.61353531Z","actor":"Shinuwa","issue_id":"sokko-g-v3u4.9","extra":{"field":"status","new_value":"closed","old_value":"in_progress","reason":"Closed"}}
{"id":"int-90df2fcebecd14255c48d5e8d81a4a72","kind":"field_change","created_at":"2026-11-18T14:34:44.803671161Z","actor":"Shinuwa","issue_id":"sokko-g-nz26","extra":{"field":"status","new_value":"closed","old_value":"in_progress","reason":"Closed"}}
{"id":"int-b698fa576eae0abf4d9fc1e419f3c017","kind":"field_change","created_at":"2026-11-18T14:36:20.893548004Z","actor":"Shinuwa","issue_id":"sokko-g-a5ai","extra":{"field":"status","new_value":"closed","old_value":"in_progress","reason":"Closed"}}
{"id":"int-da51bff9acf776eb69455d4eff19cec2","kind":"field_change","created_at":"2026-11-18T14:43:12.194977093Z","actor":"Shinuwa","issue_id":"sokko-g-ai7g","extra":{"field":"status","new_value":"closed","old_value":"in_progress","reason":"Closed"}}

View file

@ -1500,6 +1500,8 @@ retour secondaire vers la Guilde), puis deux onglets (`Tabs`) : « Préparer »
À la première visite, une `nds-modal` présente la carte de destination offerte face cachée (« Cadeau de la
Guilde ») : le joueur la retourne avec l'animation d'ouverture des paquets, puis « Préparer mon expédition »
la ferme pour de bon.
Une carte mythique porte dans les Expéditions (carte envoyée, choix de carte, voyage, équipe) un anneau prismatique qui tourne
lentement (fixe sans animation) ; c'est purement visuel, elle a les stats de sa légendaire.
La page se relit d'elle-même pour suivre les autres joueurs : toutes les 10 s tant qu'un groupe est affiché, toutes les 20 s
sinon (onglet visible seulement), au retour sur l'onglet et aux échéances d'inscription et de retour. Une relecture en échec
laisse la vue affichée avec un avis `warning` et « Réessayer » ; un premier chargement en échec affiche l'erreur et « Réessayer ».
@ -1527,7 +1529,8 @@ laisse la vue affichée avec un avis `warning` et « Réessayer » ; un premier
- sinon, « Rejoindre une expédition » (les expéditions ouvertes des autres, même carte avec « Rejoindre » ;
celle d'un lien d'invitation `#/cards/expeditions/<id>` est encadrée d'or, son inscription dépliée), le
Sac du Veilleur, puis trois étapes en `nds-panel` :
1. destinations du jour, de la plus facile à la plus difficile, sur deux colonnes (une seule sous 760 px) ; à droite du titre, tant que le joueur en a,
1. destinations du jour, de la plus facile à la plus difficile, sur deux colonnes (une seule sous 760 px), sous une légende du
butin (les quatre butins avec leur icône et leur nom, le sens des flèches vertes et rouges) ; à droite du titre, tant que le joueur en a,
le bouton secondaire `sm` de la Rose des vents, son illustration et sa quantité en tête, qui retire les destinations du jour (boutons à `aria-pressed`, contour or quand choisis ;
paysage en bandeau découpé par le masque en coup de pinceau `static/img/expeditions/brush-mask.webp`, sinon l'image
de sa carte dans le même bandeau ; badge `gold` des étoiles, les mêmes seul ou en groupe). En tête de carte, le paysage réduit et
@ -1591,7 +1594,8 @@ carte sa stat la plus haute). Le cadre du choix en cours a un contour or et port
d’oubli » la remet en « Personnalisé », tous les points à répartir (un profil les répartit tout seul). « Fermer » est sous
les deux onglets. L'équipement et la gravure se règlent depuis les Expéditions.
Aperçus et rapports ajoutent un badge `success` par Affinité et par Résonance.
Dans « Préparer », le Sac du Veilleur (`nds-panel`, absent tant que le joueur n'a aucun objet) présente les objets en grille
Dans « Préparer », le Sac du Veilleur (`nds-panel`, absent tant que le joueur n'a aucun objet) se replie : « Replier le Sac »
ne laisse que la rangée des objets (illustration et quantité) et « Ouvrir le Sac », choix gardé par ce navigateur. Déplié, il présente les objets en grille
de `nds-card` (colonnes de 190 px au moins) : l'illustration détourée de l'objet (6:5, `static/img/expeditions/items/` ou celle de la
boutique ; l'icône générique pour un objet qui n'en a pas) avec sa quantité en pastille, son nom, son usage, puis son action en bouton pleine
largeur ; sur téléphone, une carte compacte, l'illustration à gauche. L'Étoile guide, la Carte céleste et les Fragments

View file

@ -271,6 +271,77 @@ export function validateSiteContent(site) {
"cards.expeditions.powers.starNet",
"cards.expeditions.powers.stormLantern",
"cards.expeditions.powers.fogBell",
"cards.cardSheet.tabs.card",
"cards.cardSheet.tabs.improve",
"cards.cardSheet.owned",
"cards.cardSheet.collection",
"cards.cardSheet.finishes",
"cards.cardSheet.favoriteAdd",
"cards.cardSheet.favoriteRemove",
"cards.cardSheet.recycle",
"cards.cardSheet.give",
"cards.cardSheet.trade",
"cards.cardSheet.reserved",
"cards.cardSheet.busyUntil",
"cards.cardSheet.close",
"cards.cardSheet.summaryLabel",
"cards.cardSheet.power",
"cards.cardSheet.level",
"cards.cardSheet.atCap",
"cards.cardSheet.experience",
"cards.cardSheet.experienceValue",
"cards.cardSheet.statsLabel",
"cards.cardSheet.becomes",
"cards.cardSheet.gear",
"cards.cardSheet.stats.bravoure",
"cards.cardSheet.stats.endurance",
"cards.cardSheet.stats.fortune",
"cards.cardSheet.stats.orientation",
"cards.cardSheet.upgradeTitle",
"cards.cardSheet.upgradeEclats",
"cards.cardSheet.eclatsAmount",
"cards.cardSheet.upgradeDuplicate",
"cards.cardSheet.upgradeHelp",
"cards.cardSheet.plan.title",
"cards.cardSheet.plan.pointsGained",
"cards.cardSheet.plan.pointsLater",
"cards.cardSheet.plan.defaultOrCustom",
"cards.cardSheet.plan.default",
"cards.cardSheet.plan.custom",
"cards.cardSheet.plan.help.collection",
"cards.cardSheet.plan.help.free",
"cards.cardSheet.plan.profilesTitle",
"cards.cardSheet.plan.profiles.leader.label",
"cards.cardSheet.plan.profiles.leader.help",
"cards.cardSheet.plan.profiles.guardian.label",
"cards.cardSheet.plan.profiles.guardian.help",
"cards.cardSheet.plan.profiles.seeker.label",
"cards.cardSheet.plan.profiles.seeker.help",
"cards.cardSheet.plan.profiles.navigator.label",
"cards.cardSheet.plan.profiles.navigator.help",
"cards.cardSheet.plan.best",
"cards.cardSheet.plan.bestTitle",
"cards.cardSheet.plan.noPoints",
"cards.cardSheet.plan.left",
"cards.cardSheet.plan.allPlaced",
"cards.cardSheet.plan.cap",
"cards.cardSheet.plan.firstFree",
"cards.cardSheet.plan.removeNeedsReset",
"cards.cardSheet.plan.save",
"cards.cardSheet.plan.cancel",
"cards.cardSheet.plan.locked",
"cards.cardSheet.plan.reset",
"cards.cardSheet.plan.resetCount",
"cards.cardSheet.plan.resetBuy",
"cards.cardSheet.plan.resetHelp",
"cards.expeditions.powerText.longsight",
"cards.expeditions.powerText.rations",
"cards.expeditions.powerText.treasureMap",
"cards.expeditions.powerText.talisman",
"cards.expeditions.powerText.madCompass",
"cards.expeditions.powerText.starNet",
"cards.expeditions.powerText.stormLantern",
"cards.expeditions.powerText.fogBell",
"cards.expeditions.hiddenRequirements",
"cards.expeditions.requirementFactor",
"cards.expeditions.requirementsUncertain",
@ -304,6 +375,8 @@ export function validateSiteContent(site) {
"cards.expeditions.itemHelp.guideStar",
"cards.expeditions.itemHelp.skyChart",
"cards.expeditions.useItem",
"cards.expeditions.bagShow",
"cards.expeditions.bagHide",
"cards.expeditions.useItemLabel",
"cards.expeditions.improveCard",
"cards.expeditions.engraveTitle",
@ -408,6 +481,9 @@ export function validateSiteContent(site) {
"cards.expeditions.expired",
"cards.expeditions.reload",
"cards.expeditions.retry",
"cards.expeditions.lootLegendLabel",
"cards.expeditions.lootLegendUp",
"cards.expeditions.lootLegendDown",
"cards.expeditions.syncError",
"cards.expeditions.reportMeta",
"cards.expeditions.running",

View file

@ -181,6 +181,89 @@
"contactLabel": "Contact",
"contactMissing": "Contact non configuré sur ce serveur."
},
"cardSheet": {
"tabs": {
"card": "La carte",
"improve": "Amélioration"
},
"owned": "Exemplaires possédés",
"collection": "Collection",
"finishes": "Finitions",
"favoriteAdd": "Ajouter aux favoris",
"favoriteRemove": "Retirer des favoris",
"recycle": "Recycler un doublon (+{value})",
"give": "Donner",
"trade": "Échanger",
"reserved": "Les doublons de cette carte sont réservés par une proposition d’échange en cours.",
"busyUntil": "En expédition jusqu’à {date}.",
"close": "Fermer",
"summaryLabel": "Récapitulatif pour les Expéditions",
"power": "Puissance",
"level": "Niveau",
"atCap": "Puissance maximale atteinte",
"experience": "Expérience",
"experienceValue": "Expérience : {value} / 100",
"statsLabel": "Stats",
"becomes": " deviendrait ",
"gear": "{value} équipement",
"stats": {
"bravoure": "Bravoure",
"endurance": "Endurance",
"fortune": "Fortune",
"orientation": "Orientation"
},
"upgradeTitle": "Améliorer",
"upgradeEclats": "Améliorer · ",
"eclatsAmount": "{value} Éclats",
"upgradeDuplicate": "Améliorer avec un doublon",
"upgradeHelp": "Vous avez {eclats} Éclats. Chaque retour d’expédition donne aussi de l’expérience.",
"plan": {
"title": "Répartition des statistiques",
"pointsGained": "{count} point{s} gagné{s} en améliorant la carte.",
"pointsLater": "Chaque amélioration donne des points de stats, répartis selon ce choix.",
"defaultOrCustom": "Par défaut ou personnalisé",
"default": "Par défaut",
"custom": "Personnalisé",
"help": {
"collection": "Les points suivent le profil de la collection de la carte.",
"free": "Vous placez vous-même chaque point."
},
"profilesTitle": "Répartition automatique par profil",
"profiles": {
"leader": {
"label": "Meneur",
"help": "Surtout de la Bravoure, pour les destinations qui en demandent beaucoup."
},
"guardian": {
"label": "Gardien",
"help": "Surtout de l’Endurance, pour les destinations qui en demandent beaucoup."
},
"seeker": {
"label": "Chercheur",
"help": "Surtout de la Fortune, pour les destinations qui en demandent beaucoup."
},
"navigator": {
"label": "Navigateur",
"help": "Surtout de l’Orientation, pour les destinations qui en demandent beaucoup."
}
},
"best": "(le plus adapté à cette carte)",
"bestTitle": "Le plus adapté à cette carte",
"noPoints": "Aucun point à répartir pour l’instant : améliorez la carte.",
"left": "{count} point{s} à répartir",
"allPlaced": "Tous les points sont répartis.",
"cap": "Au plus {count} dans une même stat.",
"firstFree": "Premier choix gratuit : ensuite, le changer demandera de réinitialiser la répartition avec un Parchemin d’oubli.",
"removeNeedsReset": "Pour retirer des points déjà placés, réinitialisez la répartition.",
"save": "Valider",
"cancel": "Annuler",
"locked": "Cette carte est en expédition : sa répartition pourra changer à son retour.",
"reset": "Réinitialiser la répartition · 1 Parchemin d’oubli",
"resetCount": "Vous en avez {count}.",
"resetBuy": "Ils s’achètent dans la Boutique.",
"resetHelp": "La carte repasse en « Personnalisé », tous ses points à répartir : un profil les répartit tout seul."
}
},
"recycling": {
"barLabel": "Recyclage des doublons",
"viewDuplicates": "Voir les doublons",
@ -376,6 +459,9 @@
"requirementsFactTitle": "Exigences",
"requirementValue": "{stat} : {value}",
"lootTitle": "Butin",
"lootLegendLabel": "Légende du butin",
"lootLegendUp": "plus que d’habitude",
"lootLegendDown": "moins que d’habitude",
"lootNeutral": "Équilibré : ni bonus ni malus.",
"slotEmpty": "Place libre",
"remove": "Retirer",
@ -395,6 +481,8 @@
"limitedByStarsHelp": "Votre score est plafonné à celui d’une difficulté de {stars} ★ : renforcez la stat principale.",
"previewTitle": "Si l’expédition partait seule maintenant",
"powers": { "longsight": "Vue lointaine", "rations": "Marche forcée", "treasureMap": "Chasse au trésor", "talisman": "Prudence", "madCompass": "Coup de folie", "starNet": "Pêche céleste", "stormLantern": "Refuge", "fogBell": "Ralliement" },
"powerText": {"longsight": "Plus de chance de rapporter une carte, mais un trajet plus long.", "rations": "Un trajet plus court, mais moins de butin.", "treasureMap": "Rapporte toujours un objet rare en plus, mais le score baisse un peu.", "talisman": "Toujours une Réussite : jamais de Retour difficile, mais jamais de Triomphe.", "madCompass": "Bien plus de butin, mais des exigences incertaines : elles peuvent être plus basses ou plus hautes qu’affiché, et ne sont révélées qu’au retour.", "starNet": "Une chance de rapporter en plus une carte des Carnets des Veilleurs, mais un peu moins de Fortune.", "stormLantern": "Les dangers non parés font moins baisser les stats, mais le trajet est plus long.", "fogBell": "En groupe, le score de l’équipe augmente ; seul, vous rapportez moins de butin."},
"powerDetails": {"longsight": ["Chance de carte : +{longsightPackPct} %", "Trajet : +{longsightExtraHours} h"], "rations": ["Trajet : −{rationsTimePct} %", "Butin : −{rationsLootPct} %"], "treasureMap": ["Objet rare en plus : fragment, burin ou plan", "Score : −{treasureMapScorePct} %"], "talisman": ["Palier : toujours Réussite (butin ×1)", "Ni Retour difficile, ni Triomphe"], "madCompass": ["Butin : +{madCompassLootPct} %", "Exigences réelles : {madCompassMinPct} % à {madCompassMaxPct} %", "Révélées au retour"], "starNet": ["Carte des Carnets en plus : {starNetCardPct} %", "Fortune de l’équipe : −{starNetFortune}"], "stormLantern": ["Malus d’un danger subi : −{stormLanternDangerPct} %", "Trajet : +{stormLanternExtraHours} h"], "fogBell": ["Score en groupe : +{fogBellSynergyPct} %", "Butin seul : −{fogBellSoloLootPct} %"]},
"hiddenRequirements": "Coup de folie : les exigences réelles varient de {min} % à {max} % de celles affichées. Aucune prévision avant le retour.",
"requirementFactor": "Exigences réelles : {pct} %",
"requirementsUncertain": "≈ {value}",
@ -418,6 +506,8 @@
"items": { "fragment": "Fragment de carte au trésor", "engraving": "Burin de graveur", "plan": "Plan d’atelier", "anchor": "Ancre des Veilleurs", "guideStar": "Étoile guide", "skyChart": "Carte céleste", "oblivion": "Parchemin d’oubli", "windRose": "Rose des vents" },
"itemHelp": { "fragment": "Il en faut {count} : réunis, ils ajoutent une destination cachée, bien plus intéressante que celle de la Carte céleste.", "engraving": "Grave pour toujours une étiquette sur une commune, depuis l’atelier de gravure ou sous une commune posée sur votre carte.", "plan": "Sert à l’atelier, pour fabriquer une commune de pouvoir.", "anchor": "Rappelle une expédition solo en route, avec la part de butin déjà gagnée.", "guideStar": "Ajoute une destination supplémentaire à votre journée.", "skyChart": "Ajoute une destination supplémentaire avec un meilleur butin.", "oblivion": "Réinitialise la répartition des stats d’une carte personnage, pour les répartir autrement depuis sa fiche. S’achète en boutique.", "windRose": "Tire de nouvelles destinations pour la journée. Vos destinations bonus restent." },
"useItem": "Utiliser",
"bagShow": "Ouvrir le Sac",
"bagHide": "Replier le Sac",
"improveCard": "Améliorer la carte",
"engraveTitle": "Atelier de gravure",
"engraveHelp": "Un Burin grave pour toujours une étiquette sur une commune : posée sur une carte qui porte cette étiquette, elle passe en synergie. Vous avez {count} Burin{s}.",

View file

@ -11,60 +11,62 @@ import { recycleDuplicates, setFavorite, upgradeCard } from "./cardsApi.js";
import { CardPlan } from "./CardPlan.jsx";
import { CurrencyAmount } from "./Currency.jsx";
import { readCollection } from "./collectionState.js";
import { fillTemplate } from "./dailyShare.js";
import { MaskIcon } from "./ExpeditionLabels.jsx";
import { NebulaCard } from "./NebulaCard.jsx";
import { formatEclats } from "./expeditionFormat.js";
import { formatStardust } from "./stardustFormat.js";
const STATS = [["bravoure", "Bravoure"], ["endurance", "Endurance"], ["fortune", "Fortune"], ["orientation", "Orientation"]];
const STAT_IDS = ["bravoure", "endurance", "fortune", "orientation"];
const FOCUS_SELECTORS = { plan: ".nebula-card-plan" };
const TABS = [{ id: "card", label: "La carte" }, { id: "improve", label: "Amélioration" }];
const TAB_IDS = ["card", "improve"];
// Récapitulatif d'une carte des Expéditions : Puissance, niveau et expérience, puis ses quatre stats (équipement compris ; la part
// de l'équipement en petit dessous). `preview` : stats sans équipement de la répartition en cours de choix, montrées « 15 → 18 ».
function CardSummary({ progress, preview }) {
function CardSummary({ progress, preview, content }) {
const atCap = progress.nextCost == null;
return <section className="nebula-card-summary" aria-label="Récapitulatif pour les Expéditions">
return <section className="nebula-card-summary" aria-label={content.summaryLabel}>
<div className="nebula-card-summary-head">
<div className="nebula-card-summary-power"><span>Puissance</span><strong>{progress.power}</strong></div>
<div className="nebula-card-summary-power"><span>{content.power}</span><strong>{progress.power}</strong></div>
<div className="nebula-card-summary-level">
<span>Niveau <strong>{progress.level}</strong> / {progress.maxLevel}</span>
{atCap ? <small>Puissance maximale atteinte</small> : <>
<div className="nds-progress" data-size="sm" role="progressbar" aria-label="Expérience" aria-valuemin={0} aria-valuemax={100} aria-valuenow={progress.fieldXp}><span style={{ width: `${progress.fieldXp}%` }} /></div>
<small>Expérience : {progress.fieldXp} / 100</small>
<span>{content.level} <strong>{progress.level}</strong> / {progress.maxLevel}</span>
{atCap ? <small>{content.atCap}</small> : <>
<div className="nds-progress" data-size="sm" role="progressbar" aria-label={content.experience} aria-valuemin={0} aria-valuemax={100} aria-valuenow={progress.fieldXp}><span style={{ width: `${progress.fieldXp}%` }} /></div>
<small>{fillTemplate(content.experienceValue, { value: progress.fieldXp })}</small>
</>}
</div>
</div>
<ul className="nebula-card-summary-stats" aria-label="Stats">{STATS.map(([stat, label]) => {
<ul className="nebula-card-summary-stats" aria-label={content.statsLabel}>{STAT_IDS.map((stat) => {
const base = progress.baseStats?.[stat] ?? progress.stats[stat];
const gear = progress.stats[stat] - base;
const next = preview ? progress.stats[stat] + preview[stat] - base : progress.stats[stat];
return <li key={stat} data-trend={next > progress.stats[stat] ? "up" : next < progress.stats[stat] ? "down" : undefined}>
<span><MaskIcon name={stat} />{label}</span>
<strong>{next !== progress.stats[stat] ? <>{progress.stats[stat]} <span aria-hidden="true">→</span><span className="sr-only"> deviendrait </span>{next}</> : progress.stats[stat]}</strong>
{gear !== 0 && <small data-sign={gear > 0 ? "up" : "down"}>{gear > 0 ? "+" : "−"}{Math.abs(gear)} équipement</small>}
<span><MaskIcon name={stat} />{content.stats[stat]}</span>
<strong>{next !== progress.stats[stat] ? <>{progress.stats[stat]} <span aria-hidden="true">→</span><span className="sr-only">{content.becomes}</span>{next}</> : progress.stats[stat]}</strong>
{gear !== 0 && <small data-sign={gear > 0 ? "up" : "down"}>{fillTemplate(content.gear, { value: `${gear > 0 ? "+" : "−"}${Math.abs(gear)}` })}</small>}
</li>;
})}</ul>
</section>;
}
// Amélioration d'une carte rare ou mieux : Éclats, ou doublon de la même édition ; puis la répartition de ses statistiques.
function CardProgress({ state, progress, eclats, locked, busy, runMutation, onPreview }) {
function CardProgress({ state, progress, eclats, locked, busy, runMutation, onPreview, content }) {
const atCap = progress.nextCost == null;
return <>
{!atCap && <section className="nebula-card-upgrade" aria-labelledby="nebula-card-upgrade-title">
<h3 id="nebula-card-upgrade-title">Améliorer</h3>
<h3 id="nebula-card-upgrade-title">{content.upgradeTitle}</h3>
<div className="nds-toolbar">
<button className="nds-button" data-variant="primary" type="button" disabled={busy || eclats < progress.nextCost} onClick={() => runMutation(() => upgradeCard(progress.editionId, "eclats"))}>Améliorer · <CurrencyAmount kind="eclats">{formatEclats(progress.nextCost)} Éclats</CurrencyAmount></button>
{progress.spare > 0 && <button className="nds-button" data-variant="secondary" type="button" disabled={busy} onClick={() => runMutation(() => upgradeCard(progress.editionId, "duplicate"))}>Améliorer avec un doublon</button>}
<button className="nds-button" data-variant="primary" type="button" disabled={busy || eclats < progress.nextCost} onClick={() => runMutation(() => upgradeCard(progress.editionId, "eclats"))}>{content.upgradeEclats}<CurrencyAmount kind="eclats">{fillTemplate(content.eclatsAmount, { value: formatEclats(progress.nextCost) })}</CurrencyAmount></button>
{progress.spare > 0 && <button className="nds-button" data-variant="secondary" type="button" disabled={busy} onClick={() => runMutation(() => upgradeCard(progress.editionId, "duplicate"))}>{content.upgradeDuplicate}</button>}
</div>
<p className="nebula-form-help">Vous avez {formatEclats(eclats)} Éclats. Chaque retour d’expédition donne aussi de l’expérience.</p>
<p className="nebula-form-help">{fillTemplate(content.upgradeHelp, { eclats: formatEclats(eclats) })}</p>
</section>}
<CardPlan key={`${progress.plan.id}-${progress.plan.points}-${JSON.stringify(progress.plan.allocation)}`} progress={progress} oblivions={state.items?.oblivion ?? 0} locked={locked} busy={busy} runMutation={runMutation} onPreview={onPreview} />
<CardPlan key={`${progress.plan.id}-${progress.plan.points}-${JSON.stringify(progress.plan.allocation)}`} progress={progress} oblivions={state.items?.oblivion ?? 0} locked={locked} busy={busy} runMutation={runMutation} onPreview={onPreview} content={content.plan} statNames={content.stats} />
</>;
}
export function CardDetailModal({ catalog, state, entry, runMutation, busy, onClose, onStartTransfer = null, focus = null, initialTab = "card" }) {
// `content` : textes cards.cardSheet.
export function CardDetailModal({ catalog, state, entry, content, runMutation, busy, onClose, onStartTransfer = null, focus = null, initialTab = "card" }) {
const dialogRef = useRef(null);
useEffect(() => {
if (!focus) return undefined;
@ -85,24 +87,25 @@ export function CardDetailModal({ catalog, state, entry, runMutation, busy, onCl
const [tab, setTab] = useState(focus ? "improve" : initialTab);
// Sans progression (commune, destination), seulement la carte.
const activeTab = progress ? tab : "card";
const tabs = TAB_IDS.map((id) => ({ id, label: content.tabs[id] }));
const info = <>
{entry.card.description && <p className="nebula-card-detail-lore">{entry.card.description}</p>}
<dl><div><dt>Exemplaires possédés</dt><dd>{quantity}</dd></div><div><dt>Collection</dt><dd>{catalog.collections.find((item) => item.id === entry.card.collectionId)?.name}</dd></div><div><dt>Finitions</dt><dd>{entry.edition.finishIds.map((id) => catalog.finishes.find((item) => item.id === id)?.label).join(" · ")}</dd></div></dl>
<dl><div><dt>{content.owned}</dt><dd>{quantity}</dd></div><div><dt>{content.collection}</dt><dd>{catalog.collections.find((item) => item.id === entry.card.collectionId)?.name}</dd></div><div><dt>{content.finishes}</dt><dd>{entry.edition.finishIds.map((id) => catalog.finishes.find((item) => item.id === id)?.label).join(" · ")}</dd></div></dl>
<div className="nds-toolbar nebula-card-detail-actions">
<button className="nds-button" data-variant={favorites.has(entry.edition.id) ? "primary" : "secondary"} type="button" disabled={busy} aria-pressed={favorites.has(entry.edition.id)} onClick={() => runMutation(() => setFavorite(entry.edition.id, !favorites.has(entry.edition.id)))}>{favorites.has(entry.edition.id) ? "Retirer des favoris" : "Ajouter aux favoris"}</button>
{spare > 0 && <button className="nds-button" data-variant="secondary" type="button" disabled={busy} onClick={() => runMutation(() => recycleDuplicates(entry.edition.id))}>Recycler un doublon (+{formatStardust(value)})</button>}
<button className="nds-button" data-variant={favorites.has(entry.edition.id) ? "primary" : "secondary"} type="button" disabled={busy} aria-pressed={favorites.has(entry.edition.id)} onClick={() => runMutation(() => setFavorite(entry.edition.id, !favorites.has(entry.edition.id)))}>{favorites.has(entry.edition.id) ? content.favoriteRemove : content.favoriteAdd}</button>
{spare > 0 && <button className="nds-button" data-variant="secondary" type="button" disabled={busy} onClick={() => runMutation(() => recycleDuplicates(entry.edition.id))}>{fillTemplate(content.recycle, { value: formatStardust(value) })}</button>}
{spare > 0 && onStartTransfer && <>
<button className="nds-button" data-variant="secondary" type="button" onClick={() => onStartTransfer("gift", entry.edition.id)}>Donner</button>
<button className="nds-button" data-variant="secondary" type="button" onClick={() => onStartTransfer("trade", entry.edition.id)}>Échanger</button>
<button className="nds-button" data-variant="secondary" type="button" onClick={() => onStartTransfer("gift", entry.edition.id)}>{content.give}</button>
<button className="nds-button" data-variant="secondary" type="button" onClick={() => onStartTransfer("trade", entry.edition.id)}>{content.trade}</button>
</>}
</div>
{quantity > 1 && !spare && <p className="nebula-form-help">Les doublons de cette carte sont réservés par une proposition d’échange en cours.</p>}
{quantity > 1 && !spare && <p className="nebula-form-help">{content.reserved}</p>}
</>;
const improve = progress && <>
<CardSummary progress={progress} preview={previewStats} />
<CardSummary progress={progress} preview={previewStats} content={content} />
<CardProgress state={state} progress={progress} eclats={state.wallet.eclats ?? 0} locked={Boolean(expedition)} busy={busy} runMutation={runMutation}
onPreview={(stats) => setPreview({ key: planKey, stats })} />
onPreview={(stats) => setPreview({ key: planKey, stats })} content={content} />
</>;
return <Modal dialogClassName="confirm-modal nds-modal nebula-card-detail" labelledBy="nebula-card-detail-title" onRequestClose={onClose} dialogRef={dialogRef}>
@ -110,14 +113,14 @@ export function CardDetailModal({ catalog, state, entry, runMutation, busy, onCl
<div className="nebula-card-detail-side"><NebulaCard catalog={catalog} entry={entry} size="lg" /></div>
<div className="nebula-card-detail-main">
<header><p className="eyebrow">{catalog.rarities.find((item) => item.id === entry.edition.rarity)?.label}</p><h2 id="nebula-card-detail-title">{entry.card.name}</h2></header>
{expedition && <p className="nds-inline-notice" data-variant="info">En expédition jusqu’à {new Date(expedition.returnsAt).toLocaleString("fr-FR", { weekday: "long", hour: "2-digit", minute: "2-digit" })}.</p>}
{expedition && <p className="nds-inline-notice" data-variant="info">{fillTemplate(content.busyUntil, { date: new Date(expedition.returnsAt).toLocaleString("fr-FR", { weekday: "long", hour: "2-digit", minute: "2-digit" }) })}</p>}
{/* Une carte des Expéditions a deux onglets : la carte et son lore, puis son amélioration. */}
{progress && <Tabs className="nebula-card-detail-tabs" tabs={TABS} activeTab={activeTab} onChange={setTab} />}
<div className="nebula-card-detail-panel" role={progress ? "tabpanel" : undefined} aria-label={progress ? TABS.find((item) => item.id === activeTab).label : undefined}>
{progress && <Tabs className="nebula-card-detail-tabs" tabs={tabs} activeTab={activeTab} onChange={setTab} />}
<div className="nebula-card-detail-panel" role={progress ? "tabpanel" : undefined} aria-label={progress ? content.tabs[activeTab] : undefined}>
{activeTab === "improve" ? improve : info}
</div>
<div className="nds-toolbar nebula-card-detail-close">
<button className="nds-button" data-variant="secondary" type="button" onClick={onClose}>Fermer</button>
<button className="nds-button" data-variant="secondary" type="button" onClick={onClose}>{content.close}</button>
</div>
</div>
</div>

View file

@ -6,23 +6,21 @@
// « Personnalisé » reste gratuit.
import { useState } from "react";
import { setCardPlan } from "./cardsApi.js";
import { fillTemplate } from "./dailyShare.js";
import { MaskIcon } from "./ExpeditionLabels.jsx";
const STATS = [["bravoure", "Bravoure"], ["endurance", "Endurance"], ["fortune", "Fortune"], ["orientation", "Orientation"]];
const PROFILES = [
{ id: "leader", stat: "bravoure", label: "Meneur", help: "Surtout de la Bravoure, pour les destinations qui en demandent beaucoup." },
{ id: "guardian", stat: "endurance", label: "Gardien", help: "Surtout de l’Endurance, pour les destinations qui en demandent beaucoup." },
{ id: "seeker", stat: "fortune", label: "Chercheur", help: "Surtout de la Fortune, pour les destinations qui en demandent beaucoup." },
{ id: "navigator", stat: "orientation", label: "Navigateur", help: "Surtout de l’Orientation, pour les destinations qui en demandent beaucoup." }
];
const HELP = { collection: "Les points suivent le profil de la collection de la carte.", free: "Vous placez vous-même chaque point." };
const ZERO = Object.fromEntries(STATS.map(([stat]) => [stat, 0]));
const STATS = ["bravoure", "endurance", "fortune", "orientation"];
// Profils et la stat que chacun privilégie (libellés et aides : cards.cardSheet.plan.profiles).
const PROFILES = [{ id: "leader", stat: "bravoure" }, { id: "guardian", stat: "endurance" }, { id: "seeker", stat: "fortune" }, { id: "navigator", stat: "orientation" }];
const ZERO = Object.fromEntries(STATS.map((stat) => [stat, 0]));
const total = (stats) => Object.values(stats).reduce((sum, value) => sum + value, 0);
const toDraft = (allocation) => Object.fromEntries(STATS.map(([stat]) => [stat, String(allocation?.[stat] ?? 0)]));
const toAllocation = (draft) => Object.fromEntries(STATS.map(([stat]) => [stat, Math.max(0, Number.parseInt(draft[stat], 10) || 0)]));
const toDraft = (allocation) => Object.fromEntries(STATS.map((stat) => [stat, String(allocation?.[stat] ?? 0)]));
const toAllocation = (draft) => Object.fromEntries(STATS.map((stat) => [stat, Math.max(0, Number.parseInt(draft[stat], 10) || 0)]));
const plural = (count) => (count > 1 ? "s" : "");
// `locked` : la carte est en expédition, sa répartition ne change pas avant son retour.
export function CardPlan({ progress, oblivions, locked = false, busy, runMutation, onPreview = () => {} }) {
// `locked` : la carte est en expédition, sa répartition ne change pas avant son retour. `content` : textes cards.cardSheet.plan,
// `statNames` : noms des stats.
export function CardPlan({ progress, oblivions, content, statNames, locked = false, busy, runMutation, onPreview = () => {} }) {
const plan = progress.plan;
// Choix encore ouvert : premier choix, ou après une réinitialisation.
const open = !plan.paid;
@ -33,8 +31,8 @@ export function CardPlan({ progress, oblivions, locked = false, busy, runMutatio
const profile = PROFILES.find((item) => item.id === choice) || null;
const allocation = toAllocation(draft);
const left = plan.points - total(allocation);
const statsFor = (id, points) => (id === "free" ? Object.fromEntries(STATS.map(([stat]) => [stat, plan.levelBase[stat] + points[stat]])) : plan.previews[id]);
const unchangedFor = (id, points) => id === plan.id && (id !== "free" || STATS.every(([stat]) => points[stat] === placed[stat]));
const statsFor = (id, points) => (id === "free" ? Object.fromEntries(STATS.map((stat) => [stat, plan.levelBase[stat] + points[stat]])) : plan.previews[id]);
const unchangedFor = (id, points) => id === plan.id && (id !== "free" || STATS.every((stat) => points[stat] === placed[stat]));
const unchanged = unchangedFor(choice, allocation);
// Le profil qui donne à la carte sa stat la plus haute.
const best = PROFILES.reduce((top, item) => (plan.previews[item.id][item.stat] > plan.previews[top.id][top.stat] ? item : top), PROFILES[0]).id;
@ -61,39 +59,39 @@ export function CardPlan({ progress, oblivions, locked = false, busy, runMutatio
const reset = async () => {
if (await runMutation(() => setCardPlan(progress.editionId, "free", ZERO))) onPreview(null);
};
const removesPoints = free && plan.id === "free" && STATS.some(([stat]) => allocation[stat] < placed[stat]);
const removesPoints = free && plan.id === "free" && STATS.some((stat) => allocation[stat] < placed[stat]);
const editable = !locked && (open || plan.id === "free");
const option = (id, label, stat = null) => <button key={id} type="button" className="nds-button" data-size="sm" data-variant={id === choice ? "primary" : "secondary"} aria-pressed={id === choice}
disabled={busy || locked || (!open && id !== choice)} onClick={() => choose(id)}>
{stat && <MaskIcon name={stat} />}{label}{id === best && <span className="nebula-card-plan-best" aria-label="(le plus adapté à cette carte)" title="Le plus adapté à cette carte">★</span>}
{stat && <MaskIcon name={stat} />}{label}{id === best && <span className="nebula-card-plan-best" aria-label={content.best} title={content.bestTitle}>★</span>}
</button>;
// « Valider » et « Annuler » dans le cadre du choix en cours, sous ce qui a changé.
const actions = !unchanged && <div className="nebula-card-plan-actions">
{plan.id === "collection" && !free && <p className="nebula-form-help">Premier choix gratuit : ensuite, le changer demandera de réinitialiser la répartition avec un Parchemin d’oubli.</p>}
{removesPoints && <p className="nebula-form-help">Pour retirer des points déjà placés, réinitialisez la répartition.</p>}
{plan.id === "collection" && !free && <p className="nebula-form-help">{content.firstFree}</p>}
{removesPoints && <p className="nebula-form-help">{content.removeNeedsReset}</p>}
<div className="nds-toolbar">
<button className="nds-button" data-variant="primary" type="button" disabled={busy || locked || removesPoints} onClick={save}>Valider</button>
<button className="nds-button" data-variant="secondary" type="button" disabled={busy} onClick={cancel}>Annuler</button>
<button className="nds-button" data-variant="primary" type="button" disabled={busy || locked || removesPoints} onClick={save}>{content.save}</button>
<button className="nds-button" data-variant="secondary" type="button" disabled={busy} onClick={cancel}>{content.cancel}</button>
</div>
</div>;
return <section className="nebula-card-plan" aria-labelledby="nebula-card-plan-title">
<h3 id="nebula-card-plan-title">Répartition des statistiques</h3>
<h3 id="nebula-card-plan-title">{content.title}</h3>
<p className="nebula-form-help">{plan.points
? `${plan.points} point${plan.points > 1 ? "s" : ""} gagné${plan.points > 1 ? "s" : ""} en améliorant la carte.`
: "Chaque amélioration donne des points de stats, répartis selon ce choix."}</p>
? fillTemplate(content.pointsGained, { count: plan.points, s: plural(plan.points) })
: content.pointsLater}</p>
{/* Deux cadres : « Par défaut » ou « Personnalisé » (et ses points juste dessous), puis les profils ; le cadre du choix en cours
est souligné d'or. */}
<div role="group" aria-label="Par défaut ou personnalisé" className="nebula-card-plan-frame" data-active={!profile || undefined}>
<div className="nds-toolbar">{option("collection", "Par défaut")}{option("free", "Personnalisé")}</div>
{!profile && <p className="nebula-form-help">{HELP[choice]}</p>}
<div role="group" aria-label={content.defaultOrCustom} className="nebula-card-plan-frame" data-active={!profile || undefined}>
<div className="nds-toolbar">{option("collection", content.default)}{option("free", content.custom)}</div>
{!profile && <p className="nebula-form-help">{content.help[choice]}</p>}
{free && <div className="nebula-card-plan-points">
<p className="nebula-card-plan-left" role="status">{!plan.points ? "Aucun point à répartir pour l’instant : améliorez la carte." : <>
{left > 0 ? `${left} point${left > 1 ? "s" : ""} à répartir` : "Tous les points sont répartis."}
<small>{`Au plus ${plan.maxStatPoints} dans une même stat.`}</small>
<p className="nebula-card-plan-left" role="status">{!plan.points ? content.noPoints : <>
{left > 0 ? fillTemplate(content.left, { count: left, s: plural(left) }) : content.allPlaced}
<small>{fillTemplate(content.cap, { count: plan.maxStatPoints })}</small>
</>}</p>
{STATS.map(([stat, label]) => <label key={stat}><span><MaskIcon name={stat} />{label}</span>
{STATS.map((stat) => <label key={stat}><span><MaskIcon name={stat} />{statNames[stat]}</span>
<input className="nds-input" type="number" inputMode="numeric" min={open ? 0 : placed[stat]} max={plan.maxStatPoints} step="1" value={draft[stat]} disabled={busy || !editable || !plan.points}
onChange={(event) => setPoints(stat, event.target.value)} onBlur={() => { if (draft[stat] === "") setDraft((current) => ({ ...current, [stat]: "0" })); }} />
</label>)}
@ -101,15 +99,15 @@ export function CardPlan({ progress, oblivions, locked = false, busy, runMutatio
{!profile && actions}
</div>
<div role="group" aria-labelledby="nebula-card-plan-profiles" className="nebula-card-plan-frame" data-active={profile ? true : undefined}>
<h4 id="nebula-card-plan-profiles">Répartition automatique par profil</h4>
<div className="nds-toolbar">{PROFILES.map((item) => option(item.id, item.label, item.stat))}</div>
{profile && <p className="nebula-form-help">{profile.help}</p>}
<h4 id="nebula-card-plan-profiles">{content.profilesTitle}</h4>
<div className="nds-toolbar">{PROFILES.map((item) => option(item.id, content.profiles[item.id].label, item.stat))}</div>
{profile && <p className="nebula-form-help">{content.profiles[profile.id].help}</p>}
{profile && actions}
</div>
{locked && <p className="nebula-form-help">Cette carte est en expédition : sa répartition pourra changer à son retour.</p>}
{locked && <p className="nebula-form-help">{content.locked}</p>}
{!open && !locked && <div className="nebula-card-plan-reset">
<button className="nds-button" data-variant="secondary" type="button" disabled={busy || oblivions < 1} onClick={reset}>Réinitialiser la répartition · 1 Parchemin d’oubli</button>
<p className="nebula-form-help">{`Vous en avez ${oblivions}.${oblivions < 1 ? " Ils s’achètent dans la Boutique." : " La carte repasse en « Personnalisé », tous ses points à répartir : un profil les répartit tout seul."}`}</p>
<button className="nds-button" data-variant="secondary" type="button" disabled={busy || oblivions < 1} onClick={reset}>{content.reset}</button>
<p className="nebula-form-help">{`${fillTemplate(content.resetCount, { count: oblivions })} ${oblivions < 1 ? content.resetBuy : content.resetHelp}`}</p>
</div>}
</section>;
}

View file

@ -27,7 +27,7 @@ function GuildBanner({ state, content, guildContent }) {
</section>;
}
export function CardsHomePanel({ catalog, state, runMutation, busy, content, guildContent, onOpenPacks }) {
export function CardsHomePanel({ catalog, state, runMutation, busy, content, guildContent, cardSheetContent, onOpenPacks }) {
const [detailOpen, setDetailOpen] = useState(false);
const collectibleCards = catalog.cards.filter((card) => catalog.editions.some((edition) => edition.cardId === card.id && !edition.promotional));
const collectibleEditions = catalog.editions.filter((edition) => !edition.promotional);
@ -68,6 +68,6 @@ export function CardsHomePanel({ catalog, state, runMutation, busy, content, gui
<DashboardStat label={content.stardust} value={<StardustBalance value={state.wallet.stardust} />} />
<DashboardStat label={content.recyclable} value={state.recycling.count} />
</section>
{detailOpen && rarest && <CardDetailModal catalog={catalog} state={state} entry={rarest} runMutation={runMutation} busy={busy} onClose={() => setDetailOpen(false)} />}
{detailOpen && rarest && <CardDetailModal catalog={catalog} state={state} entry={rarest} content={cardSheetContent} runMutation={runMutation} busy={busy} onClose={() => setDetailOpen(false)} />}
</section>;
}

View file

@ -251,7 +251,8 @@ export function CardsPage({ siteContent, cardsConfig, playerSection = "", player
setTransferDraft({ type, editionId });
navigate("/cards/transfers");
};
const panelProps = { catalog, state, runMutation, busy: busy || offline };
// `cardSheetContent` : textes de la fiche d'une carte, ouverte depuis plusieurs panneaux.
const panelProps = { catalog, state, runMutation, busy: busy || offline, cardSheetContent: content.cardSheet };
const hero = <header className="page-hero nds-page-hero nebula-player-hero">
<div><p className="eyebrow">{content.eyebrow}</p><h1>{content.title}</h1><p>{content.description}</p></div>
<CardsAccount player={state.player} onLogout={offline ? null : logout} />
@ -275,7 +276,7 @@ export function CardsPage({ siteContent, cardsConfig, playerSection = "", player
{section === "home" && <CardsHomePanel {...panelProps} content={content.home} guildContent={content.guild} onOpenPacks={openPacks} />}
{section === "guild" && <GuildPanel catalog={catalog} state={state} content={content.guild} />}
{section === "daily" && <DailyPanel {...panelProps} content={content.daily} />}
{section === "expeditions" && <ExpeditionsPanel {...panelProps} content={content.expeditions} joinId={decodeURIComponent(playerSubsection)} />}
{section === "expeditions" && <ExpeditionsPanel {...panelProps} content={{ ...content.expeditions, cardSheet: content.cardSheet }} joinId={decodeURIComponent(playerSubsection)} />}
{section === "packs" && <PackPanel {...panelProps} content={content.packs} reserveContent={content.home} />}
{section === "collection" && <CollectionPanel {...panelProps} headingContent={content.collection} recyclingContent={content.recycling} onStartTransfer={startTransfer} />}
{section === "shop" && <ShopPanel {...panelProps} content={content.shop} onOpenPacks={openPacks} />}

View file

@ -16,7 +16,7 @@ import { formatStardust } from "./stardustFormat.js";
const OWNERSHIP_OPTIONS = [{ value: "owned", label: "Possédées" }, { value: "missing", label: "Manquantes" }, { value: "duplicates", label: "Doublons" }];
const countDuplicates = (count) => `${count} doublon${count > 1 ? "s" : ""}`;
export function CollectionPanel({ catalog, state, runMutation, busy, headingContent, recyclingContent: content, onStartTransfer }) {
export function CollectionPanel({ catalog, state, runMutation, busy, headingContent, recyclingContent: content, cardSheetContent, onStartTransfer }) {
const [search, setSearch] = useState("");
const [collectionIds, setCollectionIds] = useState([]);
const [rarities, setRarities] = useState([]);
@ -126,6 +126,6 @@ export function CollectionPanel({ catalog, state, runMutation, busy, headingCont
>
<ul className="nebula-shop-rates" aria-label={content.ratesLabel}>{catalog.rarities.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} runMutation={runMutation} busy={busy} onClose={() => setSelected(null)} onStartTransfer={onStartTransfer} />}
{selected && <CardDetailModal catalog={catalog} state={state} entry={selected} content={cardSheetContent} runMutation={runMutation} busy={busy} onClose={() => setSelected(null)} onStartTransfer={onStartTransfer} />}
</>;
}

View file

@ -5,7 +5,7 @@ import { useState } from "react";
import { Modal } from "../../components/Modal.jsx";
import { fillTemplate } from "./dailyShare.js";
import { MaskIcon } from "./ExpeditionLabels.jsx";
import { editionEntry, POWER_TEXT, powerDetails } from "./expeditionFormat.js";
import { editionEntry, powerDetails, powerText } from "./expeditionFormat.js";
import { NebulaCard } from "./NebulaCard.jsx";
const RECIPE_SIZE = 3;
@ -20,8 +20,8 @@ function CraftedCard({ catalog, entry, content, powerValues }) {
{entry.card.description && <p className="nebula-atelier-description">{entry.card.description}</p>}
{power && <section className="nebula-atelier-power" aria-label={content.atelierPower}>
<h4><MaskIcon name="power" />{content.powers[power] || power}</h4>
<p>{POWER_TEXT[power]}</p>
{powerDetails(power, powerValues).length > 0 && <ul>{powerDetails(power, powerValues).map((line) => <li key={line}>{line}</li>)}</ul>}
<p>{powerText(power, content)}</p>
{powerDetails(power, powerValues, content).length > 0 && <ul>{powerDetails(power, powerValues, content).map((line) => <li key={line}>{line}</li>)}</ul>}
</section>}
</div>
</div>;

View file

@ -7,7 +7,7 @@ import { Modal } from "../../components/Modal.jsx";
import { Tooltip } from "../../components/Tooltip.jsx";
import { equipCard } from "./cardsApi.js";
import { fillTemplate } from "./dailyShare.js";
import { editionEntry, POWER_TEXT, powerDetails, STAT_IDS, tagColor, tagLabel } from "./expeditionFormat.js";
import { editionEntry, powerDetails, powerText, STAT_IDS, tagColor, tagLabel } from "./expeditionFormat.js";
import { MaskIcon, StatValue } from "./ExpeditionLabels.jsx";
import { NebulaCard } from "./NebulaCard.jsx";
@ -28,18 +28,18 @@ const PLACEHOLDER_SLOTS = [0, 1, 2];
// stat (icône de fiole et nom en or, effet au survol), pour ne pas ressembler aux pastilles d'étiquette. Posée en synergie,
// le bonus de synergie suit la stat qu'il renforce, dans la couleur de l'étiquette partagée : « +8 (+2) ».
// Infobulle d'un pouvoir : sa description, puis ses effets chiffrés.
export function PowerTooltipContent({ power, values }) {
export function PowerTooltipContent({ power, values, content }) {
return <span className="nebula-tooltip-lines">
<span>{POWER_TEXT[power]}</span>
{powerDetails(power, values).map((line) => <span key={line} className="nebula-power-detail">{line}</span>)}
<span>{powerText(power, content)}</span>
{powerDetails(power, values, content).map((line) => <span key={line} className="nebula-power-detail">{line}</span>)}
</span>;
}
export function EquipmentStats({ item, content, color, powerValues }) {
// Une commune de pouvoir n'a pas de stats ; posée en synergie, son bonus va à la première stat, et s'affiche sous le pouvoir.
if (item.power) return <span className="nebula-equipment-stats">
<Tooltip className="nebula-equipment-power" tooltipClassName="nebula-power-tooltip" content={<PowerTooltipContent power={item.power} values={powerValues} />}
aria-label={[`${content.powers[item.power]} : ${POWER_TEXT[item.power]}`, ...powerDetails(item.power, powerValues)].join(" ; ")} tabIndex={-1}>
<Tooltip className="nebula-equipment-power" tooltipClassName="nebula-power-tooltip" content={<PowerTooltipContent power={item.power} values={powerValues} content={content} />}
aria-label={[`${content.powers[item.power]} : ${powerText(item.power, content)}`, ...powerDetails(item.power, powerValues, content)].join(" ; ")} tabIndex={-1}>
<MaskIcon name="power" /><span aria-hidden="true">{content.powers[item.power]}</span>
</Tooltip>
{item.synergyStat && item.synergyBonus > 0 && <Tooltip className="nebula-stat-value" content={content.stats[item.synergyStat]} aria-label={`${content.stats[item.synergyStat]} : +${item.synergyBonus}`} tabIndex={-1}>

View file

@ -204,17 +204,18 @@ export function EngraveModal({ catalog, state, view, content, busy, runMutation,
</Modal>;
}
export function CardSheet({ catalog, state, editionId, focus = null, busy, runMutation, onClose }) {
// `content` : textes cards.cardSheet.
export function CardSheet({ catalog, state, editionId, content, focus = null, busy, runMutation, onClose }) {
const entry = editionEntry(catalog, editionId);
if (!entry) return null;
return <CardDetailModal catalog={catalog} state={state} entry={entry} focus={focus} initialTab="improve" runMutation={runMutation} busy={busy} onClose={onClose} />;
return <CardDetailModal catalog={catalog} state={state} entry={entry} content={content} focus={focus} initialTab="improve" runMutation={runMutation} busy={busy} onClose={onClose} />;
}
export function ImproveCardPicker({ catalog, state, view, item, content, busy, runMutation, onClose }) {
const [chosen, setChosen] = useState(null);
const filters = useCardFilters();
const cards = applyCardFilters([...view.cards].sort((a, b) => b.power - a.power), filters, { entryOf: (card) => editionEntry(catalog, card.editionId), statOf: (card, stat) => card.stats[stat], mode: "sort" });
if (chosen) return <CardSheet catalog={catalog} state={state} editionId={chosen} focus="plan" busy={busy} runMutation={runMutation} onClose={onClose} />;
if (chosen) return <CardSheet catalog={catalog} state={state} editionId={chosen} content={content.cardSheet} focus="plan" busy={busy} runMutation={runMutation} onClose={onClose} />;
return <Modal dialogClassName="confirm-modal nds-modal nebula-expedition-picker" labelledBy="nebula-improve-picker-title" onRequestClose={onClose}>
<h2 id="nebula-improve-picker-title">{content.items[item]}</h2>
<p className="nebula-form-help">{content.improvePickerHelp[item]}</p>

View file

@ -10,7 +10,7 @@ import { fillTemplate } from "./dailyShare.js";
import { ExpeditionCardTile } from "./ExpeditionCardTile.jsx";
import { EquipmentPicker, EquipmentSlots, PowerTooltipContent } from "./ExpeditionEquipmentSlots.jsx";
import { CardSheet, EngraveModal } from "./ExpeditionImprove.jsx";
import { editionEntry, formatDecimal, helpScore, POWER_TEXT, powerDetails, STAT_IDS, tagColor, tagLabel } from "./expeditionFormat.js";
import { editionEntry, formatDecimal, helpScore, powerDetails, powerText, STAT_IDS, tagColor, tagLabel } from "./expeditionFormat.js";
import { MaskIcon } from "./ExpeditionLabels.jsx";
import { NebulaCard } from "./NebulaCard.jsx";
@ -99,16 +99,16 @@ export function ExpeditionLoadout({ catalog, state, view, destination, card, onC
</li>;
})}</ul>
{card.powers?.length > 0 && <ul className="nebula-expedition-chosen-powers" aria-label={content.chosenPowers}>{card.powers.map((power) => <li key={power}>
<Tooltip className="nebula-equipment-power" tooltipClassName="nebula-power-tooltip" content={<PowerTooltipContent power={power} values={view.powers} />}
aria-label={[`${content.powers[power]} : ${POWER_TEXT[power]}`, ...powerDetails(power, view.powers)].join(" ; ")} tabIndex={0}>
<Tooltip className="nebula-equipment-power" tooltipClassName="nebula-power-tooltip" content={<PowerTooltipContent power={power} values={view.powers} content={content} />}
aria-label={[`${content.powers[power]} : ${powerText(power, content)}`, ...powerDetails(power, view.powers, content)].join(" ; ")} tabIndex={0}>
<MaskIcon name="power" /><span aria-hidden="true">{content.powers[power]}</span>
</Tooltip> {POWER_TEXT[power]}
</Tooltip> {powerText(power, content)}
</li>)}</ul>}
</section>}
</div>
</div>
{picker?.engrave && progress && <EngraveModal catalog={catalog} state={state} view={view} equipmentId={picker.engrave} characterId={progress.editionId} content={content} busy={busy} runMutation={runMutation} onClose={() => setPicker(null)} />}
{picker === "sheet" && card && <CardSheet catalog={catalog} state={state} editionId={card.editionId} busy={busy} runMutation={runMutation} onClose={() => setPicker(null)} />}
{picker === "sheet" && card && <CardSheet catalog={catalog} state={state} editionId={card.editionId} content={content.cardSheet} busy={busy} runMutation={runMutation} onClose={() => setPicker(null)} />}
{picker === "card" && <CardPicker catalog={catalog} view={view} destination={destination} selectedId={card?.editionId} content={content} onChoose={onChooseCard} onClose={() => setPicker(null)} />}
{typeof picker === "number" && progress && <EquipmentPicker catalog={catalog} state={state} progress={progress} cardName={entry?.card.name || ""} slot={picker} content={content}
busy={busy} runMutation={runMutation} onClose={() => setPicker(null)} powerValues={view.powers} />}

View file

@ -2,7 +2,7 @@
// le palier et le score, l'effet du palier sur le butin, le butin attendu et les pouvoirs de l'équipe.
import { Tooltip } from "../../components/Tooltip.jsx";
import { fillTemplate } from "./dailyShare.js";
import { formatEclats, POWER_TEXT, TIER_VARIANTS } from "./expeditionFormat.js";
import { formatEclats, powerText, TIER_VARIANTS } from "./expeditionFormat.js";
import { MaskIcon } from "./ExpeditionLabels.jsx";
// Effet du palier prévu sur le butin, en une phrase ; le pourcentage en rouge (réduit) ou en vert (augmenté).
@ -16,7 +16,7 @@ export function TierLoot({ pct, content }) {
// Nom d'un pouvoir de l'équipe (icône de fiole), sa description au survol.
export function PowerName({ power, content }) {
return <Tooltip className="nebula-equipment-power" content={POWER_TEXT[power]} aria-label={`${content.powers[power]} : ${POWER_TEXT[power]}`} tabIndex={0}>
return <Tooltip className="nebula-equipment-power" content={powerText(power, content)} aria-label={`${content.powers[power]} : ${powerText(power, content)}`} tabIndex={0}>
<MaskIcon name="power" /><span aria-hidden="true">{content.powers[power]}</span>
</Tooltip>;
}

View file

@ -47,6 +47,17 @@ function LootEffects({ specialty, settings, content }) {
})}</span>;
}
// Légende du butin des destinations, une fois en tête de l'étape : chaque icône avec son nom, et le sens des flèches.
function LootLegend({ content }) {
return <p className="nebula-loot-legend" aria-label={content.lootLegendLabel}>
<span className="nebula-loot-legend-kinds">{LOOT_KINDS.map((kind) => <span key={kind}><MaskIcon name={kind} />{content.loot[kind]}</span>)}</span>
<span className="nebula-loot-legend-trends">
<span data-trend="up"><svg className="nebula-loot-arrow" viewBox="0 0 10 10" aria-hidden="true"><path d={ARROW_PATHS.up} /></svg>{content.lootLegendUp}</span>
<span data-trend="down"><svg className="nebula-loot-arrow" viewBox="0 0 10 10" aria-hidden="true"><path d={ARROW_PATHS.down} /></svg>{content.lootLegendDown}</span>
</span>
</p>;
}
// Illustration d'une destination : son paysage dans la forme du coup de pinceau, sinon l'image de sa carte de couverture.
// Toujours un bandeau de même forme, pour que les cartes voisines restent alignées.
function DestinationCover({ catalog, destination }) {
@ -203,6 +214,7 @@ export function ExpeditionPlanner({ catalog, state, view, content, busy, onStart
</button>}
</div>
{view.unlocked && view.unlocked.count < view.unlocked.total && <p className="nebula-form-help">{fillTemplate(content.unlockedDestinations, view.unlocked)}</p>}
<LootLegend content={content} />
<p className="nebula-form-help">{card ? fillTemplate(content.requirementsHelpCard, { card: editionEntry(catalog, card.editionId)?.card.name || "" }) : content.requirementsHelp}</p>
<div className="nebula-expedition-destinations">{destinations.map((item) => <DestinationOption key={item.id} catalog={catalog} item={item} selected={item.id === destination.id} card={card}
view={view} content={content} onSelect={() => setDestinationId(item.id)} />)}</div>

View file

@ -48,8 +48,28 @@ function ItemArt({ id, count }) {
</span>;
}
// Sac replié ou déplié : une préférence de ce navigateur seulement, gardée d'une visite à l'autre.
const BAG_OPEN_KEY = "sokko-tcg-bag-open";
const readBagOpen = () => {
try {
return globalThis.localStorage?.getItem(BAG_OPEN_KEY) !== "false";
} catch {
return true;
}
};
function ItemBag({ catalog, state, view, content, busy, onBonus, onCraft, onAtelierClosed, runMutation }) {
const [crafting, setCrafting] = useState(false);
// Replié, le Sac n'est qu'une rangée d'objets et leur quantité : la préparation de l'expédition remonte.
const [open, setOpen] = useState(readBagOpen);
const toggle = () => {
setOpen(!open);
try {
globalThis.localStorage?.setItem(BAG_OPEN_KEY, String(!open));
} catch {
// Sans stockage, le choix vaut pour cette visite.
}
};
// Burin ou Parchemin : la fenêtre des cartes ouverte pour cet objet, puis la fiche de la carte choisie.
const [improving, setImproving] = useState(null);
const { items } = view;
@ -61,9 +81,17 @@ function ItemBag({ catalog, state, view, content, busy, onBonus, onCraft, onAtel
.sort(([a], [b]) => BAG_ORDER.indexOf(a) - BAG_ORDER.indexOf(b));
// Sans objet, pas de Sac du Veilleur.
if (!owned.length) return null;
return <section className="nds-panel nebula-expedition-bag" aria-labelledby="nebula-expedition-bag-title">
<h3 id="nebula-expedition-bag-title">{content.bagTitle}</h3>
<ul>{owned.map(([id, count]) => {
return <section className="nds-panel nebula-expedition-bag" aria-labelledby="nebula-expedition-bag-title" data-open={open || undefined}>
<div className="nebula-expedition-bag-heading">
<h3 id="nebula-expedition-bag-title">{content.bagTitle}</h3>
{!open && <ul className="nebula-bag-strip" aria-label={content.bagTitle}>{owned.map(([id, count]) => <li key={id} title={content.items[id]}>
<ItemArt id={id} count={count} /><span className="sr-only">{`${content.items[id]} ×${count}`}</span>
</li>)}</ul>}
<button className="nds-button" data-size="sm" data-variant="secondary" type="button" aria-expanded={open} aria-controls="nebula-expedition-bag-items" onClick={toggle}>
{open ? content.bagHide : content.bagShow}
</button>
</div>
{open && <ul id="nebula-expedition-bag-items">{owned.map(([id, count]) => {
const action = actions[id];
return <li key={id} className="nds-card nebula-bag-item">
<ItemArt id={id} count={count} />
@ -74,7 +102,7 @@ function ItemBag({ catalog, state, view, content, busy, onBonus, onCraft, onAtel
aria-label={fillTemplate(content.useItemLabel, { item: content.items[id] })} onClick={() => setImproving(id)}>{content.useItem}</button>}
{id === "plan" && view.atelierAvailable && <button className="nds-button" data-size="sm" data-variant="secondary" type="button" disabled={busy} onClick={() => setCrafting(true)}>{content.atelierOpen}</button>}
</li>;
})}</ul>
})}</ul>}
{improving === "engraving" && <EngraveModal catalog={catalog} state={state} view={view} content={content} busy={busy} runMutation={runMutation} onClose={() => setImproving(null)} />}
{improving === "oblivion" && <ImproveCardPicker catalog={catalog} state={state} view={view} item={improving} content={content} busy={busy} runMutation={runMutation} onClose={() => setImproving(null)} />}
{crafting && <ExpeditionAtelier catalog={catalog} state={state} content={content} busy={busy} powerValues={view.powers} onCraft={onCraft} onClose={() => { setCrafting(false); onAtelierClosed(); }} />}

View file

@ -5,37 +5,15 @@ export const STAT_IDS = ["bravoure", "endurance", "fortune", "orientation"];
// Variante de badge de chaque palier.
export const TIER_VARIANTS = { struggle: "neutral", success: "success", triumph: "gold" };
// Pouvoirs des communes des Carnets : un avantage, une contrepartie (les valeurs se règlent dans l'administration).
export const POWER_TEXT = {
longsight: "Plus de chance de rapporter une carte, mais un trajet plus long.",
rations: "Un trajet plus court, mais moins de butin.",
treasureMap: "Rapporte toujours un objet rare en plus, mais le score baisse un peu.",
talisman: "Toujours une Réussite : jamais de Retour difficile, mais jamais de Triomphe.",
madCompass: "Bien plus de butin, mais des exigences incertaines : elles peuvent être plus basses ou plus hautes qu’affiché, et ne sont révélées qu’au retour.",
starNet: "Une chance de rapporter en plus une carte des Carnets des Veilleurs, mais un peu moins de Fortune.",
stormLantern: "Les dangers non parés font moins baisser les stats, mais le trajet est plus long.",
fogBell: "En groupe, le score de l’équipe augmente ; seul, vous rapportez moins de butin."
};
// Pouvoirs des communes des Carnets : un avantage, une contrepartie (textes cards.expeditions.powerText ; les valeurs se règlent
// dans l'administration).
export const powerText = (power, content) => content.powerText?.[power] || "";
const STAT_NAMES = { bravoure: "Bravoure", endurance: "Endurance", fortune: "Fortune", orientation: "Orientation" };
// Effet d'un équipement : son pouvoir, ou les stats qu'il ajoute (« +3 Bravoure · +3 Fortune »).
export const equipmentEffect = (item) => (item.power ? POWER_TEXT[item.power]
: Object.entries(item.stats || {}).map(([stat, value]) => `${value > 0 ? "+" : "−"}${Math.abs(value)} ${STAT_NAMES[stat]}`).join(" · "));
// Effets chiffrés d'un pouvoir, avec les valeurs réglées dans l'administration (`values` : réglages `powers`), une ligne par effet.
export function powerDetails(power, values) {
// Effets chiffrés d'un pouvoir, une ligne par effet : les modèles cards.expeditions.powerDetails, remplis avec les valeurs réglées
// dans l'administration (`values` : réglages `powers`).
export function powerDetails(power, values, content) {
if (!values) return [];
const pct = (value) => `${value}\u00a0%`;
return {
longsight: [`Chance de carte : +${pct(values.longsightPackPct)}`, `Trajet : +${values.longsightExtraHours} h`],
rations: [`Trajet : −${pct(values.rationsTimePct)}`, `Butin : −${pct(values.rationsLootPct)}`],
treasureMap: ["Objet rare en plus : fragment, burin ou plan", `Score : −${pct(values.treasureMapScorePct)}`],
talisman: ["Palier : toujours Réussite (butin ×1)", "Ni Retour difficile, ni Triomphe"],
madCompass: [`Butin : +${pct(values.madCompassLootPct)}`, `Exigences réelles : ${pct(values.madCompassMinPct)} à ${pct(values.madCompassMaxPct)}`, "Révélées au retour"],
starNet: [`Carte des Carnets en plus : ${pct(values.starNetCardPct)}`, `Fortune de l’équipe : −${values.starNetFortune}`],
stormLantern: [`Malus d’un danger subi : −${pct(values.stormLanternDangerPct)}`, `Trajet : +${values.stormLanternExtraHours} h`],
fogBell: [`Score en groupe : +${pct(values.fogBellSynergyPct)}`, `Butin seul : −${pct(values.fogBellSoloLootPct)}`]
}[power] || [];
return (content.powerDetails?.[power] || []).map((line) => fillTemplate(line, values));
}
export const formatEclats = (value) => Number(value).toLocaleString("fr-FR", { maximumFractionDigits: 1 });

View file

@ -93,3 +93,13 @@
.nebula-expedition-step-heading h3 { margin: 0; }
.nds-button.nebula-wind-rose-button { display: inline-flex; align-items: center; gap: var(--space-2); width: auto; }
.nebula-wind-rose-button img { width: 30px; height: 25px; margin: -4px 0; object-fit: contain; }
// Légende du butin en tête de l'étape des destinations : les quatre butins avec leur nom, puis le sens des flèches.
.nebula-loot-legend { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2) var(--space-5); margin: 0; padding: var(--space-2) var(--space-3); border: 1px solid var(--color-border); border-radius: var(--radius-sm); background: rgba(0, 0, 0, 0.18); color: var(--color-text-secondary); font-size: var(--font-size-xs); }
.nebula-loot-legend-kinds, .nebula-loot-legend-trends { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-4); }
.nebula-loot-legend span { display: inline-flex; align-items: center; gap: 0.4em; color: inherit; }
.nebula-loot-legend-kinds .nebula-mask-icon { width: 1.2em; height: 1.2em; color: var(--color-text-primary); }
.nebula-loot-legend .nebula-loot-arrow { width: 1em; height: 1em; }
.nebula-loot-legend [data-trend="up"] .nebula-loot-arrow { fill: var(--color-success); }
.nebula-loot-legend [data-trend="down"] .nebula-loot-arrow { fill: var(--color-danger); }

View file

@ -74,3 +74,23 @@
.nebula-return-cards li { display: grid; gap: var(--space-1); justify-items: center; width: 118px; color: var(--color-text-primary); font-size: var(--font-size-xs); text-align: center; }
// Téléphone : deux cartes par ligne.
@media (max-width: 480px) { .nebula-return-cards li { width: 100px; } }
// Mythiques dans les Expéditions : un halo prismatique qui tourne lentement autour de la carte (carte envoyée, choix de la carte,
// voyage). Purement visuel : une mythique a les stats de sa légendaire. Sans animation, le halo reste fixe.
@property --nebula-mythic-angle { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
:is(.nebula-loadout-card, .nebula-expedition-cards, .nebula-expedition-caravan, .nebula-group-team) .nebula-card[data-rarity="mythic"] {
box-shadow: 0 0 18px rgba(196, 160, 255, 0.45);
}
:is(.nebula-loadout-card, .nebula-expedition-cards, .nebula-expedition-caravan, .nebula-group-team) .nebula-card[data-rarity="mythic"]::after {
// Un anneau seulement (le centre est découpé au masque) : il passe au-dessus du bord de la carte sans couvrir son illustration.
content: ""; position: absolute; inset: -4px; z-index: 6; padding: 3px; border-radius: 19px; pointer-events: none;
background: conic-gradient(from var(--nebula-mythic-angle), #f6c453, #ff8fd8, #8fd6ff, #b9a9f0, #9df2c4, #f6c453);
mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
filter: drop-shadow(0 0 6px rgba(196, 160, 255, 0.7));
animation: nebula-mythic-halo 6s linear infinite;
}
@keyframes nebula-mythic-halo { to { --nebula-mythic-angle: 360deg; } }
@media (prefers-reduced-motion: reduce) {
:is(.nebula-loadout-card, .nebula-expedition-cards, .nebula-expedition-caravan, .nebula-group-team) .nebula-card[data-rarity="mythic"]::after { animation: none; }
}

View file

@ -259,6 +259,13 @@
// Sac du Veilleur et gravure d'un équipement.
.nds-panel.nebula-expedition-bag { display: grid; gap: var(--space-2); padding: var(--space-4); }
// En-tête du Sac : le titre, replié la rangée des objets (illustration et quantité), puis le bouton qui l'ouvre ou le replie.
.nebula-expedition-bag-heading { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-4); }
.nebula-expedition-bag-heading h3 { margin: 0; }
.nebula-expedition-bag-heading > .nds-button { width: auto; margin-left: auto; }
.nebula-expedition-bag ul.nebula-bag-strip { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.nebula-bag-strip .nebula-bag-art { width: 56px; height: 46px; }
.nebula-bag-strip .nebula-bag-count { right: -4px; bottom: -4px; padding: 0 5px; }
// Une carte par objet, en colonnes : l'illustration, le nom et l'aide, l'action en bas.
.nebula-expedition-bag ul { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: var(--space-3); margin: 0; padding: 0; list-style: none; }
.nds-card.nebula-bag-item { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-3); }