Show what each destination looks for and what it yields in two small panels, and keep specialties off collection destinations

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Shinuwa 2026-11-16 23:00:51 +01:00
parent 7d331d1a3f
commit d85d6d8ffa
9 changed files with 76 additions and 36 deletions

View file

@ -1,6 +1,7 @@
// Rôle : prépare une expédition solo ou de groupe : destination du jour (sa difficulté est tirée avec elle), durée, équipe par rôle
// et aperçu exact avant le départ.
import { useEffect, useMemo, useState } from "react";
import { Tooltip } from "../../components/Tooltip.jsx";
import { previewExpedition } from "./cardsApi.js";
import { fillTemplate } from "./dailyShare.js";
import { conditionText, coverEntry, dangerText, editionEntry, formatDecimal, formatEclats, STAT_IDS, synergyLabels } from "./expeditionFormat.js";
@ -14,16 +15,32 @@ const LOOT_KINDS = ["eclats", "stardust", "cards", "items"];
// Vocation d'une carte (son plan de progression) : icône de la stat de son rôle à côté de sa Puissance.
const STAT_BY_PLAN = { leader: "bravoure", guardian: "endurance", seeker: "fortune", navigator: "orientation" };
// Effet de la spécialité sur le butin : flèche verte sur ce qui augmente, rouge sur ce qui baisse.
// Effet de la spécialité sur le butin, regroupé par sens : une flèche verte (ce qui augmente) ou rouge (ce qui baisse) suivie
// des icônes des butins concernés ; le pourcentage s'affiche dans l'infobulle de la flèche.
function LootIcon({ kind }) {
return <span className="nebula-loot-icon">{kind === "eclats" || kind === "stardust" ? <CurrencyIcon kind={kind} /> : <MaskIcon name={kind} />}</span>;
}
const ARROW_PATHS = { up: "M5 1 9 5.4H6.4V9H3.6V5.4H1Z", down: "M5 9 1 4.6H3.6V1H6.4V4.6H9Z" };
// Flèche avec son infobulle (Tooltip du NDS). Elle est dans le bouton de la destination : pas d'arrêt au clavier en plus,
// le libellé complet est porté par la ligne (aria-label).
function TrendArrow({ trend, label }) {
return <Tooltip className="nebula-loot-arrow-anchor" content={label} tabIndex={-1}>
<svg className="nebula-loot-arrow" viewBox="0 0 10 10" aria-hidden="true"><path d={ARROW_PATHS[trend]} /></svg>
</Tooltip>;
}
function LootEffects({ specialty, pct, content }) {
if (!specialty || !pct) return null;
return <span className="nebula-loot-effects" role="list" aria-label={content.specialties[specialty]} title={content.specialties[specialty]}>{LOOT_KINDS.map((kind) => {
const up = kind === specialty;
const delta = (up ? pct.boostPct : pct.otherPct) - 100;
const label = fillTemplate(content.lootEffect, { loot: content.loot[kind], value: `${delta > 0 ? "+" : "−"}${Math.abs(delta)} %` });
return <span key={kind} role="listitem" className="nebula-loot-effect" data-trend={up ? "up" : "down"} title={label} aria-label={label}>
{kind === "eclats" || kind === "stardust" ? <CurrencyIcon kind={kind} /> : <MaskIcon name={kind} />}
<svg className="nebula-loot-arrow" viewBox="0 0 10 10" aria-hidden="true"><path d={up ? "M5 1 9 5.4H6.4V9H3.6V5.4H1Z" : "M5 9 1 4.6H3.6V1H6.4V4.6H9Z"} /></svg>
const rows = [
{ trend: "up", delta: pct.boostPct - 100, kinds: LOOT_KINDS.filter((kind) => kind === specialty) },
{ trend: "down", delta: pct.otherPct - 100, kinds: LOOT_KINDS.filter((kind) => kind !== specialty) }
].filter((row) => row.delta && row.kinds.length);
return <span className="nebula-loot-effects" role="list" aria-label={content.specialties[specialty]}>{rows.map(({ trend, delta, kinds }) => {
const label = fillTemplate(content.lootEffect, { loot: kinds.map((kind) => content.loot[kind]).join(", "), value: `${delta > 0 ? "+" : "−"}${Math.abs(delta)} %` });
return <span key={trend} role="listitem" className="nebula-loot-effect" data-trend={trend} aria-label={label}>
<TrendArrow trend={trend} label={label} />
<span className="nebula-loot-icons" aria-hidden="true">{kinds.map((kind) => <LootIcon key={kind} kind={kind} />)}</span>
</span>;
})}</span>;
}
@ -146,10 +163,18 @@ export function ExpeditionPlanner({ catalog, view, mode = "solo", content, busy,
<strong>{item.name}<StarsBadge stars={group ? item.groupStar : item.soloStar} content={content} />{item.bonusSlot && <span className="nds-badge" data-variant="gold">{content.bonusSlots[item.bonusSlot]}</span>}</strong>
<span>{item.description}</span>
<span className="nebula-expedition-destination-facts">
<span className="nebula-expedition-destination-roles" aria-label={content.rolesLabel}>{(group ? item.groupRoles : item.roles).map((stat) => <RoleLabel key={stat} stat={stat} content={content} />)}</span>
<LootEffects specialty={item.specialty} pct={view.specialty} content={content} />
<span className="nebula-destination-fact">
<span className="nebula-destination-fact-title">{content.profileTitle}</span>
<span className="nebula-expedition-destination-roles">{(group ? item.groupRoles : item.roles).map((stat) => <RoleLabel key={stat} stat={stat} content={content} />)}</span>
</span>
{(item.specialty || collection) && <span className="nebula-destination-fact">
<span className="nebula-destination-fact-title">{content.lootTitle}</span>
<LootEffects specialty={item.specialty} pct={view.specialty} content={content} />
{collection && <span className="nebula-loot-effect" data-trend="up" data-kind="collection" aria-label={fillTemplate(content.rewardCollection, { collection })}>
<TrendArrow trend="up" label={fillTemplate(content.rewardCollection, { collection })} /><span aria-hidden="true"><MaskIcon name="cards" />{collection}</span>
</span>}
</span>}
</span>
{collection && <span className="nebula-expedition-destination-collection" title={fillTemplate(content.rewardCollection, { collection })}><MaskIcon name="cards" />{collection}</span>}
</span>
</button>;
})}</div>