sokko-g/website/src/features/cards/ExpeditionReport.jsx
Shinuwa 30413de036 Rework the expedition screens: in-place return, illustrated bag and workshop, card sheet tabs and an engraving workshop
Expeditions
- The journey keeps the destination landscape still while a sky scenery
  (clouds, floating isles, shards, sparkles) drifts behind the cards.
- A returned expedition shows only what the player receives, in place and
  without a window; claiming it removes the card and confirms with a notice,
  and the page reloads by itself when an expedition comes back.
- The Guild Keeper slots are gone: group requirements scale with the players.
- Local development adds a 20-second test duration, a test player for groups
  and keeps the dev account stocked with every item.
- The Wind Rose has no daily limit and is used from the destinations step.
- The Guide Star opens a destination one level below the player's highest daily
  level, the Sky Chart one at that level; bonus destinations are badged with
  the item that opened them.

Bag and workshop
- The Watcher's bag is a grid of illustrated item cards, ordered from the
  destination items, with a short "Utiliser" button; the six missing item
  illustrations are added.
- The workshop opens in a window with illustrated commons, spare counts on the
  cards, cancel without spending anything, and shows the crafted card with its
  description and power.
- The engraving workshop picks a common first, then a tag from a chosen
  character card (in its tag colours) or from every tag, filtered by name and
  family; card lists filter by name, collection and stat.

Card sheet
- Two tabs: the card and its lore (default from the collection), and its
  improvement (default from the expeditions) with a summary of power, level,
  experience and stats.
- "Répartition des statistiques" offers Par défaut, Personnalisé and profiles,
  previews the change in the summary, and a Parchemin d'oubli resets it to
  Personnalisé so the next choice is free again.

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

57 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, synergyLabels } from "./expeditionFormat.js";
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>
{synergyLabels(expedition.result, catalog, content).map((label) => <span key={label} className="nds-badge" data-variant="success">{label}</span>)}
{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>;
}