Affinity, each resonance, cohesion, Expertise and the bonus cap now open a tooltip saying what triggered them and how much they add, with the values in force when the result was computed (results store them as bonusPcts; older ones get the explanation without a figure). The departure preview, group cards and return report share the same badges, and cohesion now shows in the report too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
58 lines
5.4 KiB
JavaScript
58 lines
5.4 KiB
JavaScript
// Rôle : présente une expédition du joueur : en route (compte à rebours), revenue (butin à récupérer), terminée ou annulée.
|
|
import { CurrencyAmount } from "./Currency.jsx";
|
|
import { fillTemplate, formatCountdown } from "./dailyShare.js";
|
|
import { editionEntry, formatEclats, synergyBadges } from "./expeditionFormat.js";
|
|
import { BonusBadges } from "./ExpeditionOutcome.jsx";
|
|
import { DestinationArt } from "./ExpeditionLabels.jsx";
|
|
import { NebulaCard } from "./NebulaCard.jsx";
|
|
import { formatStardust } from "./stardustFormat.js";
|
|
|
|
const TIER_VARIANTS = { struggle: "neutral", success: "success", triumph: "gold" };
|
|
|
|
function RewardBadges({ catalog, reward, content }) {
|
|
return <div className="nebula-expedition-rewards">
|
|
<span className="nds-badge" data-variant="gold"><CurrencyAmount kind="eclats">{fillTemplate(content.rewardEclats, { value: formatEclats(reward.eclats) })}</CurrencyAmount></span>
|
|
{reward.stardust > 0 && <span className="nds-badge" data-variant="neutral">{fillTemplate(content.rewardStardust, { value: formatStardust(reward.stardust) })}</span>}
|
|
{reward.packs.length > 0 && <span className="nds-badge" data-variant="success">{fillTemplate(content.rewardPacks, { count: reward.packs.length, s: reward.packs.length > 1 ? "s" : "" })}</span>}
|
|
{(reward.cards || []).map((editionId, index) => <span key={`${editionId}-${index}`} className="nds-badge" data-variant="gold">{fillTemplate(content.rewardCard, { card: editionEntry(catalog, editionId)?.card.name || editionId })}</span>)}
|
|
{(reward.items || []).map((item, index) => <span key={`${item}-${index}`} className="nds-badge" data-variant="success">{content.items[item]}</span>)}
|
|
{reward.recalledPct != null && <span className="nds-badge" data-variant="warning">{fillTemplate(content.recalledShare, { pct: reward.recalledPct })}</span>}
|
|
</div>;
|
|
}
|
|
|
|
export function ExpeditionReport({ catalog, expedition, content, now, busy, onClaim, anchors = 0, onRecall = null }) {
|
|
// Le serveur dit « en route » au chargement ; passé l'heure du retour, la page propose déjà de récupérer le butin.
|
|
// En groupe, un joueur qui a récupéré sa part voit l'expédition terminée, même si les autres n'ont pas encore récupéré la leur.
|
|
const status = expedition.claimedAt ? "completed" : expedition.status === "running" && expedition.returnsAt <= now ? "returned" : expedition.status;
|
|
const stars = "★".repeat(expedition.stars);
|
|
return <article className="nds-card nebula-expedition-report" data-status={status} aria-labelledby={`nebula-expedition-${expedition.id}`}>
|
|
<DestinationArt catalog={catalog} destination={expedition.destination} />
|
|
<div className="nds-card-body nebula-expedition-report-body">
|
|
<p className="eyebrow">{fillTemplate(content.reportMeta, { stars, hours: expedition.hours })}</p>
|
|
<h3 id={`nebula-expedition-${expedition.id}`}>{expedition.destination.name}</h3>
|
|
{status === "running" && <p className="nebula-expedition-report-status">{fillTemplate(content.running, { time: formatCountdown(expedition.returnsAt - now) })}</p>}
|
|
{status === "returned" && <p className="nebula-expedition-report-status">{content.returned}</p>}
|
|
{status === "completed" && <p className="nebula-expedition-report-status">{content.completed}</p>}
|
|
{status === "cancelled" && <p className="nebula-expedition-report-status">{content.cancelled}</p>}
|
|
{expedition.result && <div className="nebula-expedition-rewards">
|
|
<span className="nds-badge" data-variant={TIER_VARIANTS[expedition.result.tier]}>{content.tiers[expedition.result.tier]}</span>
|
|
<span className="nds-badge" data-variant="neutral">{fillTemplate(content.score, { score: formatEclats(expedition.result.scorePct) })}</span>
|
|
<BonusBadges badges={synergyBadges(expedition.result, catalog, content)} />
|
|
{expedition.result.requirementFactorPct != null && <span className="nds-badge" data-variant={expedition.result.requirementFactorPct > 100 ? "warning" : "success"}>{fillTemplate(content.requirementFactor, { pct: expedition.result.requirementFactorPct })}</span>}
|
|
</div>}
|
|
{expedition.reward && <RewardBadges catalog={catalog} reward={expedition.reward} content={content} />}
|
|
{expedition.result?.players > 1 && <p className="nebula-form-help">{fillTemplate(content.reportPlayers, { count: expedition.result.players, loot: formatEclats(expedition.result.lootPct / 100) })}</p>}
|
|
<ul className="nebula-expedition-report-team" aria-label={content.teamTitle}>{expedition.slots.map((slot) => {
|
|
const entry = slot.editionId && editionEntry(catalog, slot.editionId);
|
|
if (!entry) return null;
|
|
return <li key={slot.position}><NebulaCard catalog={catalog} entry={entry} size="sm" />{expedition.mode === "group" && <span>{slot.own ? content.you : slot.playerName}</span>}</li>;
|
|
})}</ul>
|
|
{status === "running" && expedition.mode === "solo" && anchors > 0 && onRecall && <div className="nds-card-actions">
|
|
<button className="nds-button" data-size="sm" data-variant="secondary" type="button" disabled={busy} onClick={() => onRecall(expedition.id)}>{fillTemplate(content.recall, { count: anchors })}</button>
|
|
</div>}
|
|
{status === "returned" && !expedition.claimedAt && <div className="nds-card-actions">
|
|
<button className="nds-button" data-size="sm" data-variant="primary" type="button" disabled={busy} onClick={() => onClaim(expedition.id)}>{content.claim}</button>
|
|
</div>}
|
|
</div>
|
|
</article>;
|
|
}
|