Turn the Guild page into a guild hall and put the race circuit forward
The Guild page becomes a guild hall: a counter with the Watchers' dragon and the day's quest progress, the Expeditions highlighted as the main mission, the player's team with golden stars and balms, and a quest board whose illustrations are clickable. The race page now opens on the day's circuit, explained for newcomers, and the team and race pages drop their links to each other. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
b179a40a04
commit
327337075b
18 changed files with 331 additions and 212 deletions
|
|
@ -307,7 +307,7 @@ export function CardsPage({ siteContent, cardsConfig, playerSection = "", player
|
|||
switchLink={state.player.isAdmin ? { href: "#/cards/admin", label: "Administration" } : null}
|
||||
>
|
||||
{section === "home" && <CardsHomePanel {...panelProps} content={content.home} guildContent={content.guild} tipsContent={content.tips} onOpenPacks={openPacks} />}
|
||||
{section === "guild" && <GuildPanel catalog={catalog} state={state} content={content.guild} />}
|
||||
{section === "guild" && <GuildPanel catalog={catalog} state={state} content={content.guild} teamContent={content.team} statLabels={content.expeditions.stats} />}
|
||||
{section === "daily" && <DailyPanel {...panelProps} content={content.daily} />}
|
||||
{section === "team" && <TeamPanel {...panelProps} content={content.team} statLabels={content.expeditions.stats} />}
|
||||
{section === "race" && <RacePanel {...panelProps} content={content.race} teamContent={content.team} statLabels={content.expeditions.stats} />}
|
||||
|
|
|
|||
|
|
@ -1,116 +1,112 @@
|
|||
// Rôle : présente la Guilde des Veilleurs : avancement du jour, quêtes quotidiennes en parcours (chacune nourrit la suivante), puis
|
||||
// les longues missions. Chaque quête a sa tuile, avec son état.
|
||||
import { Fragment, useEffect, useState } from "react";
|
||||
// Rôle : présente la Guilde des Veilleurs comme un hall de guilde : le comptoir (accueil et avancée des quêtes du jour), les grandes
|
||||
// missions (les Expéditions, mises en avant), l'équipe du joueur, puis le tableau des quêtes du jour. Chaque quête a sa tuile, avec son état.
|
||||
import { useEffect, useState } from "react";
|
||||
import { dailyQuestStatus, fillTemplate, formatStreak } from "./dailyShare.js";
|
||||
import { expeditionQuestStatus } from "./expeditionFormat.js";
|
||||
import { guildQuests } from "./guildQuests.js";
|
||||
import { expeditionQuestStatus, ITEM_ART } from "./expeditionFormat.js";
|
||||
import { guildGreeting, guildQuests, questDone } from "./guildQuests.js";
|
||||
import { TeamCompanion } from "./TeamCompanion.jsx";
|
||||
|
||||
// Carte du jour : un dos vierge, propre à aucune collection et marqué d'un « ? », figure la carte cachée à retrouver.
|
||||
const DAILY_COVER = "/static/img/cards/empty-back.webp";
|
||||
const ART = {
|
||||
hall: "/static/img/cards/guild/hall.webp",
|
||||
table: "/static/img/cards/guild/tavern.webp",
|
||||
clerk: "/static/img/cards/guild-veilleurs.webp",
|
||||
daily: "/static/img/cards/guild/quest-daily.webp",
|
||||
race: "/static/img/cards/guild/quest-race.webp",
|
||||
expeditions: "/static/img/cards/guild/quest-expeditions.webp"
|
||||
};
|
||||
|
||||
function DailyQuest({ summary: daily, content }) {
|
||||
const finished = daily.status !== "playing";
|
||||
return <article className="nds-card nebula-quest" data-status={daily.status} aria-labelledby="nebula-quest-daily-title">
|
||||
{/* La série en cours se range sous la couverture. */}
|
||||
// Tuile d'une quête : son illustration, son type, son état et le bouton qui y mène. `badge` se pose sur l'illustration.
|
||||
function QuestTile({ id, art, kind, title, description, status, action, href, primary, badge = null, locked = false, done = false }) {
|
||||
return <article className="nds-card nebula-quest" data-quest={id} data-done={done || undefined} data-locked={locked || undefined} aria-labelledby={`nebula-quest-${id}-title`}>
|
||||
<div className="nebula-quest-media">
|
||||
<div className="nds-card-cover nebula-quest-cover" aria-hidden="true">
|
||||
<img src={DAILY_COVER} alt="" />
|
||||
<span>?</span>
|
||||
</div>
|
||||
{daily.streak > 0 && <span className="nds-badge" data-variant="gold">{fillTemplate(content.dailyStreak, { streak: formatStreak(daily.streak) })}</span>}
|
||||
{/* L'illustration mène aussi à la quête, comme les couvertures des Toolboxes ; le bouton reste le lien annoncé. */}
|
||||
<a className="nds-card-cover nebula-quest-cover" href={href} tabIndex={-1} aria-hidden="true"><img src={art} alt="" loading="lazy" /></a>
|
||||
{badge}
|
||||
</div>
|
||||
<div className="nds-card-body nebula-quest-body">
|
||||
<p className="eyebrow">{content.dailyKind}</p>
|
||||
<h3 id="nebula-quest-daily-title">{content.dailyTitle}</h3>
|
||||
<p>{content.dailyDescription}</p>
|
||||
<p className="nebula-quest-status">{dailyQuestStatus(daily, content)}</p>
|
||||
<div className="nds-card-actions">
|
||||
<a className="nds-button" data-size="sm" data-variant={finished ? "secondary" : "primary"} href="#/cards/daily">{finished ? content.dailyResult : content.dailyAction}</a>
|
||||
</div>
|
||||
<p className="eyebrow">{kind}</p>
|
||||
<h3 id={`nebula-quest-${id}-title`}>{title}</h3>
|
||||
<p>{description}</p>
|
||||
<p className="nebula-quest-status">{status}</p>
|
||||
<div className="nds-card-actions"><a className="nds-button" data-size="sm" data-variant={primary ? "primary" : "secondary"} href={href}>{action}</a></div>
|
||||
</div>
|
||||
</article>;
|
||||
}
|
||||
|
||||
// Expéditions : la couverture montre le Grand Vide et son bateau à la lanterne. Le bouton dit ce qui attend le joueur : le butin
|
||||
// d'une expédition revenue, une expédition encore en route, sinon la préparation (ou « Voir » quand les Expéditions sont fermées).
|
||||
const EXPEDITIONS_COVER = "/static/img/cards/watchers-logbooks/rare/great_void.webp";
|
||||
function DailyQuest({ summary: daily, pending, content }) {
|
||||
const finished = daily.status !== "playing" && !daily.rewardPending;
|
||||
return <QuestTile id="daily" art={ART.daily} kind={content.dailyKind} title={content.dailyTitle} description={content.dailyDescription} status={dailyQuestStatus(daily, content)}
|
||||
action={finished ? content.dailyResult : daily.rewardPending ? content.dailyChoose : content.dailyAction} href="#/cards/daily" primary={pending} done={finished}
|
||||
badge={daily.streak > 0 && <span className="nds-badge" data-variant="gold">{fillTemplate(content.dailyStreak, { streak: formatStreak(daily.streak) })}</span>} />;
|
||||
}
|
||||
|
||||
// La Course attend une équipe : sans elle, sa tuile renvoie au recrutement.
|
||||
function RaceQuest({ summary: team, pending, content }) {
|
||||
const locked = team.status !== "ready" && team.race === "none";
|
||||
const status = locked ? content.raceLocked : { running: content.raceRunning, finished: content.raceFinished }[team.race] || content.raceToRun;
|
||||
return <QuestTile id="race" art={ART.race} kind={content.raceKind} title={content.raceTitle} description={content.raceDescription} status={status}
|
||||
action={locked ? content.raceToTeam : team.race === "finished" ? content.raceResult : content.raceAction} href={locked ? "#/cards/team" : "#/cards/race"}
|
||||
primary={pending && !locked} locked={locked} done={team.race === "finished"} />;
|
||||
}
|
||||
|
||||
function ExpeditionsQuest({ summary, pending, content, now }) {
|
||||
const returned = summary.returned > 0 || (summary.nextReturnAt != null && summary.nextReturnAt <= now);
|
||||
return <article className="nds-card nebula-quest" data-status={returned ? "returned" : summary.running ? "running" : "idle"} aria-labelledby="nebula-quest-expeditions-title">
|
||||
<div className="nebula-quest-media">
|
||||
<div className="nds-card-cover nebula-quest-cover" aria-hidden="true"><img src={EXPEDITIONS_COVER} alt="" /></div>
|
||||
</div>
|
||||
<div className="nds-card-body nebula-quest-body">
|
||||
<p className="eyebrow">{content.expeditionsKind}</p>
|
||||
<h3 id="nebula-quest-expeditions-title">{content.expeditionsTitle}</h3>
|
||||
<p>{content.expeditionsDescription}</p>
|
||||
<p className="nebula-quest-status">{expeditionQuestStatus(summary, content, now)}</p>
|
||||
<div className="nds-card-actions">
|
||||
<a className="nds-button" data-size="sm" data-variant={pending ? "primary" : "secondary"} href="#/cards/expeditions">{returned ? content.expeditionsClaim : summary.running ? content.expeditionsInProgress : summary.enabled ? content.expeditionsAction : content.expeditionsOpen}</a>
|
||||
</div>
|
||||
</div>
|
||||
</article>;
|
||||
return <QuestTile id="expeditions" art={ART.expeditions} kind={content.expeditionsKind} title={content.expeditionsTitle} description={content.expeditionsDescription}
|
||||
status={expeditionQuestStatus(summary, content, now)} href="#/cards/expeditions" primary={pending}
|
||||
action={returned ? content.expeditionsClaim : summary.running ? content.expeditionsInProgress : summary.enabled ? content.expeditionsAction : content.expeditionsOpen} />;
|
||||
}
|
||||
|
||||
// Tuile de chaque type de quête, choisie par l'identifiant donné dans guildQuests.
|
||||
const TEAM_COVER = "/static/img/cards/watchers-logbooks/legendary/watchers_guide_magpie.webp";
|
||||
const RACE_COVER = "/static/img/cards/watchers-logbooks/rare/light_currents.webp";
|
||||
const QUEST_TILES = { daily: DailyQuest, race: RaceQuest, expeditions: ExpeditionsQuest };
|
||||
const BOARD = ["daily", "race"];
|
||||
|
||||
// Équipe du jour : recruter, reprendre un recrutement, ou revoir son équipe.
|
||||
function TeamQuest({ summary: team, pending, content }) {
|
||||
const status = { recruiting: content.teamRecruiting, ready: fillTemplate(content.teamReady, { day: team.teamDay, max: team.maxDays }) }[team.status] || content.teamToRecruit;
|
||||
return <article className="nds-card nebula-quest" data-status={team.status} aria-labelledby="nebula-quest-team-title">
|
||||
<div className="nebula-quest-media">
|
||||
<div className="nds-card-cover nebula-quest-cover" aria-hidden="true"><img src={TEAM_COVER} alt="" /></div>
|
||||
{team.goldStars > 0 && <span className="nds-badge" data-variant="gold">{fillTemplate(content.teamStars, { count: team.goldStars, max: team.maxGoldStars })}</span>}
|
||||
// Le comptoir : le dragon des Veilleurs, ce qu'il conseille de faire, et à droite l'avancée des quêtes du jour.
|
||||
function GuildCounter({ state, quests, content, now }) {
|
||||
const daily = quests.filter((quest) => BOARD.includes(quest.id));
|
||||
const done = daily.filter(questDone).length;
|
||||
const greeting = content.greetings[guildGreeting(state, now)];
|
||||
return <header className="nds-panel nebula-guild-hall">
|
||||
<img className="nebula-guild-hall-bg" src={ART.hall} alt="" />
|
||||
<img className="nebula-guild-clerk" src={ART.clerk} alt="" />
|
||||
<div className="nebula-guild-welcome">
|
||||
<p className="eyebrow">{content.eyebrow}</p>
|
||||
<h2 id="nebula-guild-title">{content.title}</h2>
|
||||
<div className="nebula-guild-speech" role="status"><strong>{greeting.title}</strong><span>{greeting.text}</span></div>
|
||||
</div>
|
||||
<div className="nds-card-body nebula-quest-body">
|
||||
<p className="eyebrow">{content.teamKind}</p>
|
||||
<h3 id="nebula-quest-team-title">{content.teamTitle}</h3>
|
||||
<p>{content.teamDescription}</p>
|
||||
<p className="nebula-quest-status">{status}</p>
|
||||
<div className="nds-card-actions">
|
||||
<a className="nds-button" data-size="sm" data-variant={pending ? "primary" : "secondary"} href="#/cards/team">{team.status === "ready" ? content.teamOpen : team.status === "recruiting" ? content.teamResume : content.teamRecruit}</a>
|
||||
</div>
|
||||
</div>
|
||||
</article>;
|
||||
{daily.length > 0 && <p className="nebula-guild-progress" data-done={done === daily.length || undefined}>
|
||||
<span>{content.dailyDone}</span>
|
||||
<strong>{fillTemplate(content.dailyCount, { done, total: daily.length })}</strong>
|
||||
<span className="nebula-guild-pips" aria-hidden="true">{daily.map((quest) => <i key={quest.id} data-done={questDone(quest) || undefined} />)}</span>
|
||||
</p>}
|
||||
</header>;
|
||||
}
|
||||
|
||||
// Course des courants : une par jour, avec l'équipe du joueur.
|
||||
function RaceQuest({ summary: team, pending, content }) {
|
||||
return <article className="nds-card nebula-quest" data-status={team.race} aria-labelledby="nebula-quest-race-title">
|
||||
<div className="nebula-quest-media">
|
||||
<div className="nds-card-cover nebula-quest-cover" aria-hidden="true"><img src={RACE_COVER} alt="" /></div>
|
||||
// Votre équipe : les cinq compagnons (ou leurs places à pourvoir), et à côté ce qui sert à la former ou la soigner.
|
||||
function GuildTeam({ catalog, state, team, content, teamContent, statLabels }) {
|
||||
const ready = team.status === "ready";
|
||||
const recruiting = team.status === "recruiting";
|
||||
const text = ready ? fillTemplate(content.teamReady, { day: team.teamDay, max: team.maxDays }) : recruiting ? content.teamRecruiting : content.teamEmpty;
|
||||
const slots = Array.from({ length: 5 }, (_, index) => team.companions[index] || null);
|
||||
return <section className="nds-panel nebula-guild-team" aria-labelledby="nebula-guild-team-title">
|
||||
<img className="nebula-guild-team-bg" src={ART.table} alt="" />
|
||||
<div className="nebula-guild-team-head">
|
||||
<h3 id="nebula-guild-team-title">{content.teamTitle}</h3>
|
||||
<p>{text}{ready && <span className="nebula-guild-days" aria-hidden="true">{Array.from({ length: team.maxDays }, (_, index) => <i key={index} data-on={index < team.teamDay || undefined} />)}</span>}</p>
|
||||
</div>
|
||||
<div className="nds-card-body nebula-quest-body">
|
||||
<p className="eyebrow">{content.raceKind}</p>
|
||||
<h3 id="nebula-quest-race-title">{content.raceTitle}</h3>
|
||||
<p>{content.raceDescription}</p>
|
||||
<p className="nebula-quest-status">{{ running: content.raceRunning, finished: content.raceFinished }[team.race] || content.raceToRun}</p>
|
||||
<div className="nds-card-actions">
|
||||
<a className="nds-button" data-size="sm" data-variant={pending ? "primary" : "secondary"} href="#/cards/race">{team.race === "finished" ? content.raceResult : content.raceAction}</a>
|
||||
</div>
|
||||
</div>
|
||||
</article>;
|
||||
<ol className="nebula-guild-team-list">{slots.map((companion, index) => <li key={companion?.cardId ?? `slot-${index}`}>
|
||||
{companion ? <TeamCompanion catalog={catalog} companion={companion} content={teamContent} statLabels={statLabels} size="sm" /> : <span className="nebula-guild-team-slot">{content.teamSeat}</span>}
|
||||
</li>)}</ol>
|
||||
<aside className="nebula-guild-team-side">
|
||||
<dl>
|
||||
<div><dt>{content.goldStars}</dt><dd className="nebula-guild-stars" aria-label={fillTemplate(content.goldStarsLabel, { count: team.goldStars, max: team.maxGoldStars })}>{"★".repeat(team.goldStars)}<i>{"★".repeat(team.maxGoldStars - team.goldStars)}</i></dd></div>
|
||||
<div><dt><img src={ITEM_ART.balm} alt="" />{content.balms}</dt><dd>{state.items?.balm ?? 0}</dd></div>
|
||||
</dl>
|
||||
{!ready && team.goldStars > 0 && <p>{fillTemplate(team.goldStars > 1 ? content.teamStars : content.teamStar, { count: team.goldStars })}</p>}
|
||||
<a className="nds-button" data-size="sm" data-variant={ready ? "secondary" : "primary"} href="#/cards/team">{ready ? content.teamOpen : recruiting ? content.teamResume : content.teamRecruit}</a>
|
||||
</aside>
|
||||
</section>;
|
||||
}
|
||||
|
||||
const QUEST_TILES = { daily: DailyQuest, team: TeamQuest, race: RaceQuest, expeditions: ExpeditionsQuest };
|
||||
|
||||
const GUILD_ILLUSTRATION = "/static/img/cards/guild-veilleurs.webp";
|
||||
// Quêtes du jour, dans l'ordre du parcours ; ce qui passe de l'une à la suivante est dit entre les deux.
|
||||
const DAILY_PATH = ["daily", "team", "race"];
|
||||
const PATH_LINKS = { team: "linkStar", race: "linkTeam" };
|
||||
|
||||
// Quête quotidienne terminée aujourd'hui.
|
||||
function questDone({ id, summary }) {
|
||||
if (id === "daily") return summary.status !== "playing" && !summary.rewardPending;
|
||||
if (id === "team") return summary.status === "ready";
|
||||
if (id === "race") return summary.race === "finished";
|
||||
return false;
|
||||
}
|
||||
|
||||
export function GuildPanel({ catalog, state, content }) {
|
||||
export function GuildPanel({ catalog, state, content, teamContent, statLabels }) {
|
||||
// Heure d'affichage de la page, remise à jour au prochain retour d'expédition : la tuile passe alors d'elle-même au butin.
|
||||
const [now, setNow] = useState(() => Date.now());
|
||||
const nextReturnAt = state.expeditions?.nextReturnAt ?? null;
|
||||
|
|
@ -120,38 +116,27 @@ export function GuildPanel({ catalog, state, content }) {
|
|||
const timer = setTimeout(() => setNow(Date.now()), Math.min(nextReturnAt - now + 500, 2 ** 31 - 1));
|
||||
return () => clearTimeout(timer);
|
||||
}, [nextReturnAt, now]);
|
||||
const quests = guildQuests(state, now).filter((quest) => QUEST_TILES[quest.id]);
|
||||
const daily = DAILY_PATH.map((id) => quests.find((quest) => quest.id === id)).filter(Boolean);
|
||||
const long = quests.filter((quest) => !DAILY_PATH.includes(quest.id));
|
||||
const done = daily.filter(questDone).length;
|
||||
const listed = guildQuests(state, now);
|
||||
const team = state.team;
|
||||
// La Course figure au tableau dès que l'Équipe du jour est ouverte, verrouillée tant qu'il n'y a pas d'équipe.
|
||||
const quests = team?.enabled && !listed.some((quest) => quest.id === "race") ? [...listed, { id: "race", pending: false, summary: team }] : listed;
|
||||
const tile = ({ id, summary, pending }) => {
|
||||
const Tile = QUEST_TILES[id];
|
||||
return <Tile catalog={catalog} summary={summary} pending={pending} content={content} now={now} />;
|
||||
return Tile ? <Tile key={id} catalog={catalog} summary={summary} pending={pending} content={content} now={now} /> : null;
|
||||
};
|
||||
const board = BOARD.flatMap((id) => quests.filter((quest) => quest.id === id));
|
||||
const missions = quests.filter((quest) => quest.id === "expeditions");
|
||||
return <section className="nebula-quests" aria-labelledby="nebula-guild-title">
|
||||
<header className="nds-panel nebula-guild-hero">
|
||||
<img src={GUILD_ILLUSTRATION} alt="" />
|
||||
<div>
|
||||
<p className="eyebrow">{content.eyebrow}</p>
|
||||
<h2 id="nebula-guild-title">{content.title}</h2>
|
||||
<p className="nebula-guild-intro">{content.intro}</p>
|
||||
{daily.length > 0 && <div className="nebula-guild-progress">
|
||||
<span>{fillTemplate(done === daily.length ? content.progressDone : content.progress, { done, total: daily.length })}</span>
|
||||
<ol aria-hidden="true">{daily.map((quest) => <li key={quest.id} data-done={questDone(quest) || undefined} />)}</ol>
|
||||
</div>}
|
||||
</div>
|
||||
</header>
|
||||
<GuildCounter state={state} quests={quests} content={content} now={now} />
|
||||
{missions.length > 0 && <section className="nebula-guild-missions" aria-labelledby="nebula-guild-missions-title">
|
||||
<h3 id="nebula-guild-missions-title">{content.missionsTitle}</h3>
|
||||
{missions.map(tile)}
|
||||
</section>}
|
||||
{team && (team.enabled || team.status === "recruiting") && <GuildTeam catalog={catalog} state={state} team={team} content={content} teamContent={teamContent} statLabels={statLabels} />}
|
||||
{board.length > 0 && <section className="nebula-guild-board" aria-labelledby="nebula-guild-board-title">
|
||||
<h3 id="nebula-guild-board-title">{content.boardTitle}</h3>
|
||||
<div className="nebula-guild-notices">{board.map(tile)}</div>
|
||||
</section>}
|
||||
{!quests.length && <div className="nds-empty-state"><p>{content.empty}</p></div>}
|
||||
{daily.length > 0 && <section className="nebula-guild-section" aria-labelledby="nebula-guild-daily-title">
|
||||
<div className="nebula-guild-section-heading"><h3 id="nebula-guild-daily-title">{content.dailySection}</h3><p>{daily.length > 1 ? content.dailySectionHelp : content.dailySectionOne}</p></div>
|
||||
<ol className="nebula-guild-path" data-count={daily.length}>{daily.map((quest, index) => <Fragment key={quest.id}>
|
||||
{index > 0 && <li className="nebula-guild-link" aria-hidden="true"><span>{content[PATH_LINKS[quest.id]]}</span></li>}
|
||||
<li className="nebula-guild-step" data-done={questDone(quest) || undefined}>{tile(quest)}</li>
|
||||
</Fragment>)}</ol>
|
||||
</section>}
|
||||
{long.length > 0 && <section className="nebula-guild-section" aria-labelledby="nebula-guild-long-title">
|
||||
<div className="nebula-guild-section-heading"><h3 id="nebula-guild-long-title">{content.longSection}</h3><p>{content.longSectionHelp}</p></div>
|
||||
<div className="nebula-guild-long">{long.map((quest) => <Fragment key={quest.id}>{tile(quest)}</Fragment>)}</div>
|
||||
</section>}
|
||||
</section>;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import { finishRace, loadTeam, recordRaceBoosts, startRace } from "./cardsApi.js
|
|||
import { fillTemplate, formatCountdown } from "./dailyShare.js";
|
||||
import { RaceLive } from "./RaceLive.jsx";
|
||||
import { imageOf, nameOf, racerName, raceRanking } from "./raceRun.js";
|
||||
import { RaceZones } from "./RaceTrack.jsx";
|
||||
import { RaceCircuit } from "./RaceTrack.jsx";
|
||||
import { formatStardust } from "./stardustFormat.js";
|
||||
import { TeamCompanion } from "./TeamCompanion.jsx";
|
||||
|
||||
|
|
@ -105,7 +105,7 @@ export function RacePanel({ catalog, runMutation, busy, content, teamContent, st
|
|||
return <section className="nebula-race" aria-labelledby="nebula-race-title">
|
||||
<div className="nds-section-heading nebula-section-heading">
|
||||
<div><p className="eyebrow">{content.eyebrow}</p><h2 id="nebula-race-title">{content.title}</h2></div>
|
||||
<div className="nebula-team-heading-actions"><a className="nds-button" data-size="sm" data-variant="secondary" href="#/cards/team">{content.toTeam}</a><a className="nds-button" data-size="sm" data-variant="secondary" href="#/cards/guild">{content.back}</a></div>
|
||||
<div className="nebula-team-heading-actions"><a className="nds-button" data-size="sm" data-variant="secondary" href="#/cards/guild">{content.back}</a></div>
|
||||
</div>
|
||||
{notice && <p className="nds-inline-notice" data-variant="warning" role="status">{notice}</p>}
|
||||
{live && <RaceLive key={live.day} catalog={catalog} race={live} companions={team.companions} content={content} teamContent={teamContent} statLabels={statLabels}
|
||||
|
|
@ -114,10 +114,10 @@ export function RacePanel({ catalog, runMutation, busy, content, teamContent, st
|
|||
{showResult && <RaceResult catalog={catalog} race={race} nextAt={team.nextAt} content={content} teamContent={teamContent} titleRef={titleRef} />}
|
||||
{!live && !race && !choosing && <div className="nds-empty-state"><p>{team.enabled ? content.needTeam : teamContent.closed}</p>{team.enabled && <a className="nds-button" data-variant="primary" href="#/cards/team">{content.recruitFirst}</a>}</div>}
|
||||
{choosing && <>
|
||||
<p className="nebula-race-intro">{content.intro}</p>
|
||||
<RaceZones zones={team.zones} statLabels={statLabels} />
|
||||
<RaceCircuit zones={team.zones} content={content} statLabels={statLabels} />
|
||||
<section className="nebula-race-choice" aria-labelledby="nebula-race-choice-title">
|
||||
<h3 id="nebula-race-choice-title">{content.chooseTitle}</h3>
|
||||
<p className="nebula-race-intro">{content.intro}</p>
|
||||
<ul className="nebula-team-list">{team.companions.map((companion) => <li key={companion.cardId}><TeamCompanion catalog={catalog} companion={companion} content={{ ...teamContent, recruitLabel: content.chooseLabel }} statLabels={statLabels} disabled={busy} actionLabel={content.chooseAction} onSelect={() => start(companion.cardId)} /></li>)}</ul>
|
||||
</section>
|
||||
</>}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
// Rôle : dessine le parcours d'une course et les coureurs sur leurs couloirs.
|
||||
import { MaskIcon } from "./ExpeditionLabels.jsx";
|
||||
import { fillTemplate } from "./dailyShare.js";
|
||||
import { imageOf } from "./raceRun.js";
|
||||
import { countText } from "./teamFormat.js";
|
||||
|
||||
export function RaceZones({ zones, current = -1, statLabels }) {
|
||||
return <ol className="nebula-race-zones">{zones.map((stat, index) => <li key={index} style={{ "--specialty": `var(--color-stat-${stat})` }} data-current={index === current || undefined} aria-current={index === current ? "step" : undefined}>
|
||||
|
|
@ -8,6 +10,26 @@ export function RaceZones({ zones, current = -1, statLabels }) {
|
|||
</li>)}</ol>;
|
||||
}
|
||||
|
||||
// Circuit du jour, avant le départ : les zones numérotées du départ à l'arrivée, ce que veut dire leur couleur, et combien
|
||||
// de zones compte chaque stat, pour choisir son coureur.
|
||||
export function RaceCircuit({ zones, content, statLabels }) {
|
||||
const counts = [...new Set(zones)].map((stat) => ({ stat, count: zones.filter((zone) => zone === stat).length })).sort((left, right) => right.count - left.count);
|
||||
return <section className="nds-panel nebula-race-circuit" aria-labelledby="nebula-race-circuit-title">
|
||||
<div className="nebula-race-circuit-head">
|
||||
<h3 id="nebula-race-circuit-title">{content.circuitTitle}</h3>
|
||||
<ul className="nebula-race-circuit-counts">{counts.map(({ stat, count }) => <li key={stat} style={{ "--specialty": `var(--color-stat-${stat})` }}><MaskIcon name={stat} />{countText(content.circuitCount, count, { stat: statLabels[stat] })}</li>)}</ul>
|
||||
</div>
|
||||
<p>{content.circuitText}</p>
|
||||
<div className="nebula-race-circuit-road">
|
||||
<span className="nebula-race-circuit-end">{content.circuitStart}</span>
|
||||
<ol className="nebula-race-zones">{zones.map((stat, index) => <li key={index} style={{ "--specialty": `var(--color-stat-${stat})` }}>
|
||||
<small>{fillTemplate(content.circuitZone, { number: index + 1 })}</small><MaskIcon name={stat} /><span>{statLabels[stat]}</span>
|
||||
</li>)}</ol>
|
||||
<span className="nebula-race-circuit-end" data-end="finish">{content.circuitFinish}</span>
|
||||
</div>
|
||||
</section>;
|
||||
}
|
||||
|
||||
// `lanes` : [{ name, player, cardId, helperId }] ; `laneRef(index)` reçoit l'élément du coureur, dont la page règle l'avancée.
|
||||
export function RaceTrack({ catalog, zones, current, lanes, laneRef, statLabels }) {
|
||||
return <div className="nebula-race-track">
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ export function TeamPanel({ catalog, state, runMutation, busy, content, statLabe
|
|||
<TeamMembers catalog={catalog} companions={team.companions} powers={finishedPowers} content={content} statLabels={statLabels} />
|
||||
<TeamBest companions={team.companions} content={content} statLabels={statLabels} />
|
||||
<div className="nds-panel nebula-team-stars-panel"><p>{content.skyRevealed}</p><TeamSky sky={team.lastSky} content={content} /></div>
|
||||
<div className="nds-toolbar nebula-team-actions">{team.race?.status !== "finished" && <a className="nds-button" data-variant="primary" href="#/cards/race">{content.toRace}</a>}<button className="nds-button" data-variant="secondary" type="button" onClick={() => setFinishedPowers(null)}>{content.readyAction}</button></div>
|
||||
<div className="nds-toolbar nebula-team-actions"><button className="nds-button" data-variant="primary" type="button" onClick={() => setFinishedPowers(null)}>{content.readyAction}</button></div>
|
||||
</section>}
|
||||
{!recruiting && !(finishedPowers && team.status === "ready") && <>
|
||||
{team.status === "ready" ? <section className="nebula-team-ready" aria-labelledby="nebula-team-current-title">
|
||||
|
|
@ -108,7 +108,6 @@ export function TeamPanel({ catalog, state, runMutation, busy, content, statLabe
|
|||
<p>{team.teamDay === team.maxDays ? content.lastDay : team.canRecruit ? content.keepOrRecruit : content.teamText}</p>
|
||||
<TeamMembers catalog={catalog} companions={team.companions} content={content} statLabels={statLabels} />
|
||||
<TeamBest companions={team.companions} content={content} statLabels={statLabels} />
|
||||
{team.enabled && <div className="nds-toolbar nebula-team-actions"><a className="nds-button" data-variant={team.race?.status === "finished" ? "secondary" : "primary"} href="#/cards/race">{team.race?.status === "finished" ? content.raceResult : content.toRace}</a></div>}
|
||||
</section> : <section className="nebula-team-ready" aria-labelledby="nebula-team-none-title">
|
||||
<h3 id="nebula-team-none-title">{team.status === "expired" ? content.expiredTitle : content.noneTitle}</h3>
|
||||
<p>{fillTemplate(team.status === "expired" ? content.expiredText : content.noneText, { max: team.maxDays })}</p>
|
||||
|
|
|
|||
|
|
@ -26,3 +26,23 @@ export function guildQuests(state, now = Date.now()) {
|
|||
}
|
||||
|
||||
export const pendingQuestCount = (state) => guildQuests(state).filter((quest) => quest.pending).length;
|
||||
|
||||
// Quête quotidienne terminée aujourd'hui.
|
||||
export function questDone({ id, summary }) {
|
||||
if (id === "daily") return summary.status !== "playing" && !summary.rewardPending;
|
||||
if (id === "race") return summary.race === "finished";
|
||||
return false;
|
||||
}
|
||||
|
||||
// Ce que dit la Guilde au comptoir : la prochaine chose à faire, dans l'ordre du jour, puis le butin d'une expédition revenue.
|
||||
export function guildGreeting(state, now = Date.now()) {
|
||||
const { daily, team, expeditions } = state;
|
||||
const teamOpen = Boolean(team?.enabled);
|
||||
if (daily?.rewardPending) return "reward";
|
||||
if (daily?.status === "playing") return teamOpen && team.status !== "ready" ? "dailyFirst" : "daily";
|
||||
if (teamOpen && team.status === "recruiting") return "recruiting";
|
||||
if (teamOpen && team.status !== "ready") return "recruit";
|
||||
if (teamOpen && team.race !== "finished") return "race";
|
||||
if (expeditions && (expeditions.returned > 0 || (expeditions.nextReturnAt != null && expeditions.nextReturnAt <= now))) return "loot";
|
||||
return "done";
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue