sokko-g/website/src/features/cards/ExpeditionGroupCard.jsx
Shinuwa 21827a252b Add the Carnets des Veilleurs, the expedition-only Sokko TCG collection with power commons
- A new watchers-logbooks collection of category expedition never comes from packs, the shop or codes, and administrators cannot open it as a pack.
- Its six commons carry powers instead of stats (Longue-vue, Provisions, Carte au trésor, Talisman, Boussole folle, Filet à étoiles filantes); a card holds one power and each counts once per team.
- Powers change travel time, loot, score or tier, hide requirements, or catch a logbook card; each destination lists the logbook cards it can bring back.
- A workshop turns a plan and three duplicate commons into a power common.
- The fifteen cards ship without images with ready ChatGPT prompts; a card only drops or gets crafted once illustrated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 17:40:51 +01:00

72 lines
6.7 KiB
JavaScript

// Rôle : présente un groupe en formation sur le tableau de la Guilde : membres, rôles libres, résultat attendu, et l'inscription d'une carte.
import { useState } from "react";
import { fillTemplate, formatCountdown } from "./dailyShare.js";
import { conditionText, coverEntry, dangerText, editionEntry, formatEclats, synergyLabels } from "./expeditionFormat.js";
import { NebulaCard } from "./NebulaCard.jsx";
const TIER_VARIANTS = { struggle: "neutral", success: "success", triumph: "gold" };
// Inscription : un rôle libre et une carte jouable non occupée.
function JoinForm({ catalog, group, cards, content, busy, onJoin, onCancel }) {
const [role, setRole] = useState(group.freeRoles[0]);
const [editionId, setEditionId] = useState(null);
const available = [...cards].filter((card) => !card.busy).sort((a, b) => (b.stats[role] ?? 0) - (a.stats[role] ?? 0) || b.power - a.power);
return <div className="nebula-expedition-join">
<div role="group" aria-label={content.joinRole} className="nds-toolbar">{group.freeRoles.map((value) => <button key={value} type="button" className="nds-button" data-size="sm" data-variant={value === role ? "primary" : "secondary"} aria-pressed={value === role} onClick={() => setRole(value)}>
{fillTemplate(content.roleBadge, { role: content.roles[value], stat: content.stats[value] })}
</button>)}</div>
{available.length ? <ul className="nebula-expedition-cards" aria-label={content.cardsLabel}>{available.map((card) => {
const entry = editionEntry(catalog, card.editionId);
return entry && <li key={card.editionId}>
<NebulaCard catalog={catalog} entry={entry} size="sm" selected={card.editionId === editionId} onSelect={() => setEditionId(card.editionId)} selectLabel={fillTemplate(content.chooseCard, { card: entry.card.name, role: content.roles[role] })} />
<span className="nebula-expedition-card-power">{fillTemplate(content.power, { power: card.power })}</span>
</li>;
})}</ul> : <p className="nds-inline-notice" data-variant="info">{fillTemplate(content.noCards, { count: 1 })}</p>}
<div className="nds-toolbar">
<button className="nds-button" data-size="sm" data-variant="primary" type="button" disabled={busy || !editionId} onClick={() => onJoin(group.id, { editionId, role })}>{content.joinConfirm}</button>
<button className="nds-button" data-size="sm" data-variant="secondary" type="button" onClick={onCancel}>{content.cancel}</button>
</div>
</div>;
}
export function ExpeditionGroupCard({ catalog, group, cards, content, now, busy, limitReached, minPlayers, onJoin, onLeave, onDepart }) {
const [joining, setJoining] = useState(false);
const cover = group.destination.coverCardId && coverEntry(catalog, group.destination.coverCardId);
const projected = group.projected;
return <article className="nds-card nebula-expedition-report nebula-expedition-group" aria-labelledby={`nebula-group-${group.id}`}>
{cover && <div className="nds-card-cover nebula-expedition-report-cover" aria-hidden="true"><img src={cover.card.image} alt="" /></div>}
<div className="nds-card-body nebula-expedition-report-body">
<p className="eyebrow">{fillTemplate(content.groupMeta, { stars: "★".repeat(group.stars), hours: group.hours, creator: group.isCreator ? content.you : group.creatorName })}</p>
<h4 id={`nebula-group-${group.id}`}>{group.destination.name}</h4>
<p className="nebula-form-help">{fillTemplate(content.groupDeadline, { time: formatCountdown(group.recruitUntil - now), min: minPlayers })}</p>
<ul className="nebula-expedition-group-members" aria-label={content.groupMembers}>
{group.members.map((member) => {
const entry = editionEntry(catalog, member.editionId);
return <li key={member.role}>{entry && <NebulaCard catalog={catalog} entry={entry} size="sm" />}<span><strong>{content.roles[member.role]}</strong>{member.own ? content.you : member.playerName}</span></li>;
})}
{group.freeRoles.map((role) => <li key={role} className="nebula-expedition-group-free"><span><strong>{content.roles[role]}</strong>{content.groupFreeRole}</span></li>)}
</ul>
{group.freeRoles.length > 0 && <p className="nebula-form-help">{content.groupKeeper}</p>}
<div className="nebula-expedition-rewards" aria-label={content.groupProjected}>
{projected.hiddenRequirements ? <span className="nds-badge" data-variant="warning">{content.hiddenResult}</span> : <>
<span className="nds-badge" data-variant={TIER_VARIANTS[projected.tier]}>{content.tiers[projected.tier]}</span>
<span className="nds-badge" data-variant="neutral">{fillTemplate(content.score, { score: formatEclats(projected.scorePct) })}</span>
</>}
{(projected.powers || []).map((power) => <span key={power} className="nds-badge" data-variant="gold">{content.powers[power]}</span>)}
{synergyLabels(projected, catalog, content).map((label) => <span key={label} className="nds-badge" data-variant="success">{label}</span>)}
{projected.cohesionPct > 0 && <span className="nds-badge" data-variant="success">{fillTemplate(content.cohesion, { value: projected.cohesionPct })}</span>}
<span className="nds-badge" data-variant="gold">{fillTemplate(content.lootBonus, { value: formatEclats(projected.lootPct / 100) })}</span>
</div>
{group.condition && <p className="nebula-form-help">{conditionText(group.condition, catalog, content)}</p>}
{group.dangers.map((danger) => <p key={danger.id} className="nebula-form-help">{dangerText(danger, catalog, content)}</p>)}
<div className="nds-card-actions nebula-expedition-group-actions">
{group.canJoin && !joining && <button className="nds-button" data-size="sm" data-variant="primary" type="button" disabled={busy || limitReached} onClick={() => setJoining(true)}>{content.join}</button>}
{group.isCreator && <button className="nds-button" data-size="sm" data-variant="primary" type="button" disabled={busy || !group.canDepart} onClick={() => onDepart(group.id)}>{content.depart}</button>}
{group.isMember && <button className="nds-button" data-size="sm" data-variant="secondary" type="button" disabled={busy} onClick={() => onLeave(group.id)}>{group.isCreator ? content.dissolve : content.leave}</button>}
</div>
{group.isCreator && !group.canDepart && <p className="nebula-form-help">{fillTemplate(content.departWait, { min: minPlayers })}</p>}
{group.canJoin && limitReached && <p className="nebula-form-help">{content.groupLimit}</p>}
{joining && <JoinForm catalog={catalog} group={group} cards={cards} content={content} busy={busy} onJoin={async (...args) => { if (await onJoin(...args)) setJoining(false); }} onCancel={() => setJoining(false)} />}
</div>
</article>;
}