Rebuild the Expeditions page around one guided journey: one card, no roles, leave alone or open to a group, follow the trip, keep a Journal

An expedition now opens with a single card. Its creator leaves alone right away, or opens it to the Guild board with an invite link and launches it whenever they want; at the end of recruitment it leaves by itself, alone or as a group, and is never dissolved for lack of players. Stars no longer depend on the number of players, a player has one expedition at a time, and roles are gone: each card brings its stats and a team adds them up, so every requirement is its per-slot share times the number of slots.

The page follows the player's path: the offered destination card is revealed once in a modal, then Préparer shows the destinations (stat requirements, condition and dangers coloured for the chosen card, loot effects), a frame with the sent card in large size, its equipment slots and stats, and the duration and departure. Cards and commons are chosen in modals with sorts and highlighted current picks; tags get matching colours on the card and on equipment synergies. Once gone, the trip is shown with a progress bar and moving cards, the loot opens in a modal, and finished expeditions move to a Journal tab with the Grimoire.

Power commons get short power names of their own and show their exact effects on hover, a card holds one power at a time, and Coup de folie now draws the real requirements between 80 % and 130 % of the shown ones, revealed on return.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Shinuwa 2026-11-17 17:10:56 +01:00
parent d70ae51265
commit 3720fd01f7
41 changed files with 1807 additions and 894 deletions

View file

@ -1,53 +1,72 @@
// 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";
// Rôle : présente une expédition en préparation sur le tableau de la Guilde : membres, places libres, résultat attendu si elle partait
// maintenant (seule ou en groupe), et l'inscription d'une carte.
import { useEffect, useRef, useState } from "react";
import { fillTemplate, formatCountdown } from "./dailyShare.js";
import { conditionText, coverEntry, dangerText, editionEntry, formatEclats, synergyLabels } from "./expeditionFormat.js";
import { RoleLabel } from "./ExpeditionLabels.jsx";
import { conditionText, coverEntry, dangerText, editionEntry, formatEclats, helpScore, synergyLabels } from "./expeditionFormat.js";
import { ExpeditionCardTile } from "./ExpeditionCardTile.jsx";
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.
// Inscription : une carte jouable non occupée ; celles utiles à la destination d'abord (condition, dangers), puis les plus puissantes.
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);
const available = [...cards].filter((card) => !card.busy).sort((a, b) => helpScore(b, group) - helpScore(a, group) || 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)}>
<RoleLabel stat={value} content={content} detail />
</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>}
{available.length ? <ul className="nebula-expedition-cards" aria-label={content.cardsLabel}>{available.map((card) => <ExpeditionCardTile key={card.editionId} catalog={catalog} card={card}
destination={group} content={content} selected={card.editionId === editionId} onSelect={() => setEditionId(card.editionId)} />)}</ul>
: <p className="nds-inline-notice" data-variant="info">{content.noCards}</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="primary" type="button" disabled={busy || !editionId} onClick={() => onJoin(group.id, { editionId })}>{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);
// Lien d'invitation : il ouvre la page des Expéditions sur cette expédition, son inscription déjà dépliée.
const inviteUrl = (groupId) => `${window.location.origin}/#/cards/expeditions/${encodeURIComponent(groupId)}`;
function InviteLink({ groupId, content }) {
const [copied, setCopied] = useState(false);
const url = inviteUrl(groupId);
const copy = async () => {
try {
await navigator.clipboard.writeText(url);
setCopied(true);
} catch {
setCopied(false);
}
};
return <div className="nebula-expedition-invite">
<label className="nebula-form-help" htmlFor={`nebula-invite-${groupId}`}>{content.inviteLabel}</label>
<div className="nds-toolbar">
<input id={`nebula-invite-${groupId}`} className="nds-input" type="text" readOnly value={url} onFocus={(event) => event.target.select()} />
<button className="nds-button" data-size="sm" data-variant="secondary" type="button" onClick={copy}>{copied ? content.inviteCopied : content.inviteCopy}</button>
</div>
</div>;
}
// `invited` : le joueur arrive par le lien d'invitation de cette expédition : elle est mise en vue, son inscription dépliée.
export function ExpeditionGroupCard({ catalog, group, cards, content, now, busy, limitReached, onJoin, onLeave, onDepart, invited = false }) {
const [joining, setJoining] = useState(invited && group.canJoin && !limitReached);
const articleRef = useRef(null);
useEffect(() => { if (invited) articleRef.current?.scrollIntoView({ block: "center" }); }, [invited]);
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}`}>
return <article ref={articleRef} className="nds-card nebula-expedition-report nebula-expedition-group" data-invited={invited || undefined} 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>
<p className="nebula-form-help">{fillTemplate(content.groupDeadline, { time: formatCountdown(group.recruitUntil - now) })}</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>;
return <li key={member.position}>{entry && <NebulaCard catalog={catalog} entry={entry} size="sm" />}<span><strong>{member.own ? content.you : member.playerName}</strong></span></li>;
})}
{group.freeRoles.map((role) => <li key={role} className="nebula-expedition-group-free"><span><strong>{content.roles[role]}</strong>{content.groupFreeRole}</span></li>)}
{Array.from({ length: group.freeSlots }, (_, index) => <li key={`free-${index}`} className="nebula-expedition-group-free"><span>{content.groupFreeRole}</span></li>)}
</ul>
{group.freeRoles.length > 0 && <p className="nebula-form-help">{content.groupKeeper}</p>}
{group.freeSlots > 0 && <p className="nebula-form-help">{group.members.length > 1 ? content.groupKeeper : content.soloKeeper}</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>
@ -56,7 +75,7 @@ export function ExpeditionGroupCard({ catalog, group, cards, content, now, busy,
{(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>
{projected.players > 1 && <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>)}
@ -65,7 +84,7 @@ export function ExpeditionGroupCard({ catalog, group, cards, content, now, busy,
{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.isMember && <InviteLink groupId={group.id} content={content} />}
{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>