sokko-g/website/src/features/cards/ExpeditionReport.jsx
Shinuwa 9739189f0c
All checks were successful
Validate and deploy Sokko G / validate (push) Successful in 22m49s
Validate and deploy Sokko G / deploy (push) Successful in 16s
Give each pack collection its own power common, fix redundant commons and spell out powers in the interface
The Nebula, the Long Night, the Dream Arcade and the Crimson Procession now each have two power commons: Adaptation and one of their own (Étude, Givre d'étoiles, Trouvaille, Chance de l'aube). Eight other commons change stats and four gain a tag, so that no common is dominated by another with the same effect and Bravoure can be equipped like the other stats. Commons that became power commons are taken off the cards that carried them.

Card sheets, the equipment window, placed commons and the departure preview show every power's gains and costs with their figures, and the preview says when a power has no effect.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 13:18:38 +01:00

59 lines
5.6 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, PowerName } 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, powerValues, 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.powers || []).map((power) => <PowerName key={power} power={power} values={powerValues} content={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>;
}