Simplify joining a Sokko TCG group and let a test player open one locally
Some checks failed
Validate and deploy Sokko G / deploy (push) Blocked by required conditions
Validate and deploy Sokko G / validate (push) Has been cancelled

- On the local dev server, a test player can open a group on one of its destinations, with the 20 s test trip; it departs by itself after 5 minutes, since only the creator may launch it.
- While a player chooses their card to join, the expedition planner is hidden; Cancel brings it back.
- Joining and readying are one button, "Valider et se mettre en prêt", at the bottom right of the loadout frame, also after "Modifier ma préparation", which now sits next to "Quitter l'expédition".
- The redundant "you are ready" block is gone: the member list already shows the Ready badge.
- The card a player sends is called their explorer in the texts about that role.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Shinuwa 2026-11-30 11:22:35 +01:00
parent 82cebd0fd1
commit 8eb7f2e53e
12 changed files with 196 additions and 88 deletions

View file

@ -44,13 +44,14 @@ function useJoinPreview(group, card) {
// Carte du joueur pour ce groupe, dans le même cadre que la préparation : emplacement de la carte (la liste des cartes jouables
// s'ouvre d'un clic), stats et équipements, « Améliorer la carte ». La carte seule n'est pas comparée aux exigences de toute l'équipe :
// `needs` les rappelle à côté face à l'apport du groupe, `pickerNeeds` dans le choix de la carte.
function MemberLoadout({ catalog, state, view, group, card, help, needs, pickerNeeds = needs, content, busy, runMutation, onChooseCard, children }) {
// `children` : les boutons, en bas à droite du cadre ; `notice` : un avis sous le cadre.
function MemberLoadout({ catalog, state, view, group, card, help, needs, pickerNeeds = needs, content, busy, runMutation, onChooseCard, notice = null, children }) {
const destination = { ...group.destination, requirements: [], condition: group.condition, dangers: group.dangers };
return <section className="nebula-expedition-join" aria-labelledby={`nebula-group-loadout-${group.id}`}>
<h5 id={`nebula-group-loadout-${group.id}`}>{content.ownLoadoutTitle}</h5>
<p className="nebula-form-help">{help}</p>
<ExpeditionLoadout catalog={catalog} state={state} view={view} destination={destination} card={card} onChooseCard={onChooseCard} content={content} busy={busy} runMutation={runMutation} needs={needs} pickerNeeds={pickerNeeds} />
<div className="nds-toolbar">{children}</div>
<ExpeditionLoadout catalog={catalog} state={state} view={view} destination={destination} card={card} onChooseCard={onChooseCard} content={content} busy={busy} runMutation={runMutation} needs={needs} pickerNeeds={pickerNeeds} actions={children} />
{notice}
</section>;
}
@ -60,10 +61,10 @@ function JoinForm({ catalog, state, view, group, card, outlook, content, busy, r
const players = group.members.length + 1;
const without = { title: fillTemplate(content.needsWithout, { players }), rows: requirementRows(group.joinRequirements || group.requirements, group.projected), missing: true };
const needs = outlook.preview ? { title: fillTemplate(content.needsWith, { players }), rows: outlook.rows, stale: outlook.stale } : without;
return <MemberLoadout catalog={catalog} state={state} view={view} group={group} card={card} help={content.joinHelp} needs={needs} pickerNeeds={without} content={content} busy={busy} runMutation={runMutation} onChooseCard={onChooseCard}>
{outlook.error && <p className="nds-inline-notice" data-variant="warning" role="status">{outlook.error}</p>}
<button className="nds-button" data-size="sm" data-variant="primary" type="button" disabled={busy || !card} onClick={() => onJoin(group.id, { editionId: card.editionId })}>{content.joinConfirm}</button>
<button className="nds-button" data-size="sm" data-variant="secondary" type="button" onClick={onCancel}>{content.cancel}</button>
return <MemberLoadout catalog={catalog} state={state} view={view} group={group} card={card} help={content.joinHelp} needs={needs} pickerNeeds={without} content={content} busy={busy} runMutation={runMutation} onChooseCard={onChooseCard}
notice={outlook.error && <p className="nds-inline-notice" data-variant="warning" role="status">{outlook.error}</p>}>
<button className="nds-button" data-variant="secondary" type="button" onClick={onCancel}>{content.cancel}</button>
<button className="nds-button" data-variant="primary" type="button" disabled={busy || !card} onClick={() => onJoin(group.id, { editionId: card.editionId, ready: true })}>{content.joinConfirm}</button>
</MemberLoadout>;
}
@ -72,20 +73,12 @@ function JoinForm({ catalog, state, view, group, card, outlook, content, busy, r
function OwnSlot({ catalog, state, view, group, content, busy, runMutation, onMember }) {
const { editionId, ready } = group.ownSlot;
const card = view.cards.find((item) => item.editionId === editionId) || null;
if (ready) {
const entry = editionEntry(catalog, editionId);
return <section className="nebula-expedition-join nebula-expedition-ready" aria-labelledby={`nebula-group-loadout-${group.id}`}>
<h5 id={`nebula-group-loadout-${group.id}`}>{content.ownLoadoutTitle}</h5>
<p className="nds-inline-notice" data-variant="success">{fillTemplate(content.readyText, { card: entry?.card.name || "" })}</p>
<div className="nds-toolbar">
<button className="nds-button" data-size="sm" data-variant="secondary" type="button" disabled={busy} onClick={() => onMember(group.id, { ready: false }, content.unreadyNotice)}>{content.unready}</button>
</div>
</section>;
}
// Prêt : la liste des membres le montre déjà ; « Modifier ma préparation » est dans les actions du groupe.
if (ready) return null;
return <MemberLoadout catalog={catalog} state={state} view={view} group={group} card={card} help={content.ownLoadoutHelp}
needs={{ title: fillTemplate(content.needsWith, { players: group.members.length }), rows: requirementRows(group.requirements, group.projected) }} content={content} busy={busy} runMutation={runMutation}
onChooseCard={(id) => onMember(group.id, { editionId: id }, null)}>
<button className="nds-button" data-size="sm" data-variant="primary" type="button" disabled={busy || !card} onClick={() => onMember(group.id, { ready: true }, content.readyNotice)}>{content.ready}</button>
<button className="nds-button" data-variant="primary" type="button" disabled={busy || !card} onClick={() => onMember(group.id, { ready: true }, content.readyNotice)}>{content.ready}</button>
</MemberLoadout>;
}
@ -160,13 +153,19 @@ function InviteLink({ groupId, content }) {
}
// `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, state, view, group, content, now, busy, limitReached, runMutation, onJoin, onMember, onLeave, onDepart, onTestPlayer = null, invited = false }) {
// `onJoiningChange(groupId, open)` : prévient le panneau quand l'inscription se déplie ou se replie.
export function ExpeditionGroupCard({ catalog, state, view, group, content, now, busy, limitReached, runMutation, onJoin, onMember, onLeave, onDepart, onTestPlayer = null, onJoiningChange = null, invited = false }) {
const [joining, setJoining] = useState(invited && group.canJoin && !limitReached);
const articleRef = useRef(null);
useEffect(() => { if (invited) articleRef.current?.scrollIntoView({ block: "center" }); }, [invited]);
// Inscription : la carte choisie compte déjà dans le résultat prévu et les exigences.
const [editionId, setEditionId] = useState(null);
const open = joining && !group.isMember;
useEffect(() => {
if (!open || !onJoiningChange) return undefined;
onJoiningChange(group.id, true);
return () => onJoiningChange(group.id, false);
}, [open, group.id, onJoiningChange]);
const card = (open && view.cards.find((item) => item.editionId === editionId && !item.busy)) || null;
const { value: preview, error: previewError, stale } = useJoinPreview(group, card);
const projected = preview?.projected || group.projected;
@ -195,7 +194,8 @@ export function ExpeditionGroupCard({ catalog, state, view, group, content, now,
</section>
<div className="nds-toolbar 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.canDepart && <button className="nds-button" data-size="sm" data-variant="primary" type="button" disabled={busy} onClick={() => onDepart(group.id)}>{content.depart}</button>}
{group.ownSlot?.ready && <button className="nds-button" data-size="sm" data-variant="secondary" type="button" disabled={busy} onClick={() => onMember(group.id, { ready: false }, content.unreadyNotice)}>{content.unready}</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>}
{onTestPlayer && group.isMember && group.freeSlots > 0 && <button className="nds-button" data-size="sm" data-variant="ghost" type="button" disabled={busy} onClick={() => onTestPlayer(group.id)}>{content.testPlayer}</button>}
</div>