Add the daily team administration, recruitment retouches, the Watchers' balm and a new Guild layout

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Shinuwa 2026-11-26 13:35:38 +01:00
parent 7ed63fff49
commit b179a40a04
36 changed files with 799 additions and 298 deletions

View file

@ -39,7 +39,7 @@ const expeditionCall = (call) => async () => {
// Sac du Veilleur en grille de cartes : l'illustration de chaque objet (sans illustration, l'icône générique des objets) et sa
// quantité, son nom, son aide, puis son action. La Rose des vents s'utilise depuis les destinations du jour ; le plan ouvre
// l'atelier en fenêtre.
const BAG_ORDER = ["guideStar", "skyChart", "fragment", "windRose", "anchor", "engraving", "plan", "oblivion"];
const BAG_ORDER = ["guideStar", "skyChart", "fragment", "windRose", "anchor", "engraving", "plan", "balm", "oblivion"];
function ItemArt({ id, count }) {
return <span className="nebula-bag-art">

View file

@ -1,5 +1,6 @@
// Rôle : présente la Guilde des Veilleurs et la tuile de chacune de ses quêtes, avec leur état.
import { useEffect, useState } from "react";
// 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";
import { dailyQuestStatus, fillTemplate, formatStreak } from "./dailyShare.js";
import { expeditionQuestStatus } from "./expeditionFormat.js";
import { guildQuests } from "./guildQuests.js";
@ -96,6 +97,19 @@ function RaceQuest({ summary: team, pending, content }) {
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 }) {
// 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());
@ -107,14 +121,37 @@ export function GuildPanel({ catalog, state, content }) {
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 tile = ({ id, summary, pending }) => {
const Tile = QUEST_TILES[id];
return <Tile catalog={catalog} summary={summary} pending={pending} content={content} now={now} />;
};
return <section className="nebula-quests" aria-labelledby="nebula-guild-title">
<div className="nds-section-heading nebula-section-heading">
<div><p className="eyebrow">{content.eyebrow}</p><h2 id="nebula-guild-title">{content.title}</h2><p className="nebula-guild-intro">{content.intro}</p></div>
</div>
{quests.length ? <div className="nebula-quests-grid">{quests.map(({ id, summary, pending }) => {
const Tile = QUEST_TILES[id];
return <Tile key={id} catalog={catalog} summary={summary} pending={pending} content={content} now={now} />;
})}</div>
: <div className="nds-empty-state"><p>{content.empty}</p></div>}
<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>
{!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>;
}

View file

@ -88,8 +88,9 @@ function HistoryDetail({ entry, catalog }) {
if (entry.type === "expedition_dissolved") return <span>{details.destinationName} · {details.reason === "creator_left" ? "dissous par son créateur" : "pas assez de joueurs"} · cartes libérées</span>;
if (entry.type === "card_upgraded") return <span>{[cardReference(entry.entityId, catalog), `niveau ${details.level}`, `Puissance ${details.power}`, upgradeCost(details)].join(" · ")}</span>;
if (entry.type === "item_used") {
const name = { anchor: "Ancre des Veilleurs", guideStar: "Étoile guide", skyChart: "Carte céleste", fragment: "Carte au trésor", engraving: "Burin de graveur", plan: "Plan d’atelier", windRose: "Rose des vents" }[details.item] || details.item;
const name = { anchor: "Ancre des Veilleurs", guideStar: "Étoile guide", skyChart: "Carte céleste", fragment: "Carte au trésor", engraving: "Burin de graveur", plan: "Plan d’atelier", windRose: "Rose des vents", balm: "Baume des Veilleurs" }[details.item] || details.item;
if (details.item === "windRose") return <span>{name} · nouvelles destinations du jour</span>;
if (details.item === "balm") return <span>{[name, catalog.cards.find((card) => card.id === details.cardId)?.name].filter(Boolean).join(" · ")}</span>;
if (details.item === "plan") return <span>{name} · {cardReference(details.editionId, catalog)} fabriquée</span>;
const detail = details.destinationName ? `${details.destinationName}${details.recalledPct != null ? ` · rappel à ${details.recalledPct} %` : ""}` : details.tag ? `${cardReference(details.editionId, catalog)} · étiquette gravée` : "";
return <span>{[name, detail].filter(Boolean).join(" · ")}</span>;

View file

@ -11,13 +11,13 @@ export function SpecialtyBand({ companion, content, statLabels }) {
}
// `onSelect` : toute la carte devient un bouton, avec `actionLabel` en pied. `badge` : mention sur l'illustration.
export function TeamCompanion({ catalog, companion, content, statLabels, badge = "", footer = null, onSelect = null, actionLabel = "", disabled = false, showPower = true }) {
export function TeamCompanion({ catalog, companion, content, statLabels, badge = "", footer = null, onSelect = null, actionLabel = "", disabled = false, showPower = true, size = "md" }) {
const card = catalog.cards.find((item) => item.id === companion.cardId);
const strong = mainStats(companion);
const name = card?.name || content.unknownCard;
const Tag = onSelect ? "button" : "div";
const action = onSelect ? { type: "button", disabled, onClick: onSelect, "aria-label": fillTemplate(content.recruitLabel, { card: name }) } : {};
return <Tag className="nebula-team-companion" style={specialtyStyle(companion)} {...action}>
return <Tag className="nebula-team-companion" data-size={size} style={specialtyStyle(companion)} {...action}>
<span className="nebula-team-art">
{card?.image && <img src={card.image} alt="" loading="lazy" draggable="false" />}
{badge && <span className="nebula-team-tag">{badge}</span>}
@ -26,8 +26,8 @@ export function TeamCompanion({ catalog, companion, content, statLabels, badge =
<SpecialtyBand companion={companion} content={content} statLabels={statLabels} />
<span className="nebula-team-name">{name}</span>
{showPower && <span className="nebula-team-power">{fillTemplate(content.power, { power: companion.power })}</span>}
<span className="nebula-team-strong">{strong.map((stat) => <span key={stat}><MaskIcon name={stat} /><span className="sr-only">{statLabels[stat]} </span>{companion.stats[stat]}</span>)}</span>
<span className="nebula-team-stats">{STAT_IDS.filter((stat) => !strong.includes(stat)).map((stat) => <span key={stat}><MaskIcon name={stat} /><span className="sr-only">{statLabels[stat]} </span>{companion.stats[stat]}</span>)}</span>
<span className="nebula-team-strong">{strong.map((stat) => <span key={stat} style={{ "--specialty": `var(--color-stat-${stat})` }}><MaskIcon name={stat} /><span className="sr-only">{statLabels[stat]} </span>{companion.stats[stat]}</span>)}</span>
{size !== "sm" && <span className="nebula-team-stats">{STAT_IDS.filter((stat) => !strong.includes(stat)).map((stat) => <span key={stat} style={{ "--specialty": `var(--color-stat-${stat})` }}><MaskIcon name={stat} /><span className="sr-only">{statLabels[stat]} </span>{companion.stats[stat]}</span>)}</span>}
{footer}
{onSelect && <span className="nebula-team-action" aria-hidden="true">{actionLabel}</span>}
</Tag>;

View file

@ -0,0 +1,19 @@
// Rôle : fenêtre d'aide de l'Équipe du jour : comment recruter, et ce qui est conseillé.
import { useState } from "react";
import { Modal } from "../../components/Modal.jsx";
import { fillTemplate } from "./dailyShare.js";
export function TeamGuide({ content, maxDays }) {
const [open, setOpen] = useState(false);
return <>
<button className="nds-button" data-size="sm" data-variant="secondary" type="button" onClick={() => setOpen(true)}>{content.guideAction}</button>
{open && <Modal dialogClassName="confirm-modal nds-modal nebula-team-guide" labelledBy="nebula-team-guide-title" onRequestClose={() => setOpen(false)}>
<h2 id="nebula-team-guide-title">{content.guideTitle}</h2>
<h3>{content.guideHowTitle}</h3>
<ol>{content.guideHow.map((text) => <li key={text}>{fillTemplate(text, { max: maxDays })}</li>)}</ol>
<h3>{content.guideTipsTitle}</h3>
<ul>{content.guideTips.map((text) => <li key={text}>{text}</li>)}</ul>
<div className="nds-toolbar"><button className="nds-button" data-variant="primary" type="button" onClick={() => setOpen(false)}>{content.guideClose}</button></div>
</Modal>}
</>;
}

View file

@ -1,9 +1,10 @@
// Rôle : page de l'Équipe du jour : réserve d'étoiles dorées, recrutement, équipe prête et choix de la garder ou d'en recruter une autre.
import { useEffect, useRef, useState } from "react";
import { chooseTeamCharacter, keepTeamCompanion, loadTeam, recruitTeam, revealTeamStar } from "./cardsApi.js";
import { chooseTeamCharacter, healTeamCompanion, keepTeamCompanion, loadTeam, recruitTeam, rerollTeamOffer, resetTeam, revealTeamStar } from "./cardsApi.js";
import { fillTemplate } from "./dailyShare.js";
import { TeamCompanion } from "./TeamCompanion.jsx";
import { TeamBest, TeamCourse, TeamRecruitment } from "./TeamRecruitment.jsx";
import { TeamGuide } from "./TeamGuide.jsx";
import { TeamBest, TeamRecruitment } from "./TeamRecruitment.jsx";
import { TeamSky } from "./TeamSky.jsx";
import { averagePower, countText, fateOf } from "./teamFormat.js";
@ -87,12 +88,12 @@ export function TeamPanel({ catalog, state, runMutation, busy, content, statLabe
return <section className="nebula-team" aria-labelledby="nebula-team-title" aria-busy={busy || undefined}>
<div className="nds-section-heading nebula-section-heading">
<div><p className="eyebrow">{content.eyebrow}</p><h2 id="nebula-team-title">{content.title}</h2></div>
<div className="nebula-team-heading-actions"><GoldReserve team={team} content={content} /><a className="nds-button" data-size="sm" data-variant="secondary" href="#/cards/guild">{content.back}</a></div>
<div className="nebula-team-heading-actions"><GoldReserve team={team} content={content} /><TeamGuide content={content} maxDays={team.maxDays} />{team.devReset && <button className="nds-button" data-size="sm" data-variant="danger" type="button" disabled={busy} onClick={() => { setFinishedPowers(null); play(() => resetTeam()); }}>{content.devReset}</button>}<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>}
{!team.enabled && !recruiting && <p className="nds-inline-notice" role="status">{content.closed}</p>}
{recruiting && <TeamRecruitment catalog={catalog} team={team} content={content} statLabels={statLabels} busy={busy}
onChoose={(cardId) => play(() => chooseTeamCharacter(cardId))} onReveal={(index) => play(() => revealTeamStar(index))} onKeep={() => play(() => keepTeamCompanion(team.recruitment.current.cardId))} />}
onChoose={(cardId) => play(() => chooseTeamCharacter(cardId))} onReroll={(offer) => play(() => rerollTeamOffer(offer))} onReveal={(index) => play(() => revealTeamStar(index))} onHeal={() => play(() => healTeamCompanion(team.recruitment.current.cardId))} onKeep={() => play(() => keepTeamCompanion(team.recruitment.current.cardId))} />}
{!recruiting && finishedPowers && team.status === "ready" && <section className="nebula-team-ready" aria-labelledby="nebula-team-ready-title">
<h3 id="nebula-team-ready-title" ref={readyTitleRef} tabIndex={-1}>{content.readyTitle}</h3>
<p>{fillTemplate(content.readyText, { power: averagePower(team.companions) })}{team.lastDust > 0 && ` ${fillTemplate(content.readyDust, { count: team.lastDust })}`}</p>
@ -114,7 +115,6 @@ export function TeamPanel({ catalog, state, runMutation, busy, content, statLabe
</section>}
{team.canRecruit && dailyToPlay && team.goldStars < team.maxGoldStars && <p className="nds-inline-notice" role="status">{content.dailyFirst} <a href="#/cards/daily">{content.dailyLink}</a></p>}
{team.canRecruit && <RecruitAction key={team.status} team={team} content={content} busy={busy} onRecruit={recruit} />}
<TeamCourse zones={team.zones} content={content} statLabels={statLabels} />
</>}
</section>;
}

View file

@ -1,11 +1,12 @@
// Rôle : recrutement de l'Équipe du jour : choix d'un personnage, puis amélioration en révélant des étoiles.
import { Fragment, useEffect, useRef } from "react";
import { useEffect, useRef } from "react";
import { CurrencyIcon } from "./Currency.jsx";
import { fillTemplate } from "./dailyShare.js";
import { STAT_IDS } from "./expeditionFormat.js";
import { ITEM_ART, STAT_IDS } from "./expeditionFormat.js";
import { MaskIcon } from "./ExpeditionLabels.jsx";
import { TeamCompanion } from "./TeamCompanion.jsx";
import { TeamSky } from "./TeamSky.jsx";
import { countText, fateOf, isMissing, mainStats, riskPct, teamBest } from "./teamFormat.js";
import { countText, fateOf, isMissing, mainStats, riskLevel, riskPct, teamBest } from "./teamFormat.js";
export function TeamBest({ companions, content, statLabels }) {
const best = teamBest(companions);
@ -14,26 +15,40 @@ export function TeamBest({ companions, content, statLabels }) {
</div>)}</dl>;
}
export function TeamCourse({ zones, content, statLabels }) {
return <section className="nebula-team-course" aria-labelledby="nebula-team-course-title">
<h3 id="nebula-team-course-title">{content.courseTitle}</h3>
<ol>{zones.map((stat, index) => <li key={index} style={{ "--specialty": `var(--color-stat-${stat})` }}><MaskIcon name={stat} />{statLabels[stat]}</li>)}</ol>
// Étoiles encore cachées : un nombre par sorte, avec son effet en quelques mots.
function StarsLeft({ recruitment, content }) {
const { hidden, dustValue, fallPower } = recruitment;
const rows = [
["gold", "★", content.starGold],
["black", "✖", fillTemplate(content.starBlack, { power: fallPower })],
["dust", <CurrencyIcon key="dust" kind="stardust" />, fillTemplate(content.starDust, { value: dustValue })]
];
return <section className="nebula-team-stars-left" aria-labelledby="nebula-team-stars-left-title">
<h3 id="nebula-team-stars-left-title">{content.starsLeft}</h3>
<ul>{rows.map(([kind, icon, effect]) => <li key={kind} data-kind={kind} data-empty={!hidden[kind] || undefined}>
<i aria-hidden="true">{icon}</i><strong>{hidden[kind]}</strong><span><span className="sr-only">{content.stars[kind]} : </span>{effect}</span>
</li>)}</ul>
</section>;
}
function TeamSoFar({ catalog, team, recruitment, content, statLabels }) {
return <section className="nebula-team-so-far" aria-labelledby="nebula-team-so-far-title">
<h3 id="nebula-team-so-far-title">{content.yourTeam}</h3>
{team.length > 0 && <TeamBest companions={team} content={content} statLabels={statLabels} />}
<ul className="nebula-team-list">{Array.from({ length: recruitment.size }, (_, index) => {
const companion = team[index];
if (!companion) return <li key={index}><span className="nebula-team-empty">{fillTemplate(content.emptySlot, { number: index + 1 })}</span></li>;
const fate = fateOf(companion, recruitment.powers, content);
return <li key={index}><TeamCompanion catalog={catalog} companion={companion} content={content} statLabels={statLabels} footer={<span className="nebula-team-fate" data-fate={fate.kind}>{fate.text}</span>} /></li>;
})}</ul>
// Équipe en construction : sa meilleure valeur par stat, à côté du choix.
function TeamSummary({ team, content, statLabels }) {
return <section className="nebula-team-summary" aria-labelledby="nebula-team-summary-title">
<h3 id="nebula-team-summary-title">{content.yourTeam}</h3>
<TeamBest companions={team} content={content} statLabels={statLabels} />
</section>;
}
// Ses compagnons, en petit, sous le choix.
function TeamMembers({ catalog, team, recruitment, content, statLabels }) {
return <ol className="nebula-team-members" aria-label={content.recruitedTitle}>{Array.from({ length: recruitment.size }, (_, index) => {
const companion = team[index];
if (!companion) return <li key={index}><span className="nebula-team-slot">{fillTemplate(content.emptySlot, { number: index + 1 })}</span></li>;
const fate = fateOf(companion, recruitment.powers, content);
return <li key={index}><TeamCompanion catalog={catalog} companion={companion} content={content} statLabels={statLabels} size="sm" footer={<span className="nebula-team-fate" data-fate={fate.kind}>{fate.text}</span>} /></li>;
})}</ol>;
}
function Steps({ count, size, step, content }) {
return <ol className="nebula-team-steps">
<li data-current="true">{fillTemplate(content.stepCount, { count, max: size })}</li>
@ -42,18 +57,7 @@ function Steps({ count, size, step, content }) {
</ol>;
}
function StarsRule({ hidden, recruitment, content }) {
const total = hidden.gold + hidden.black + hidden.dust;
if (!total) return <p>{content.noStars}</p>;
const kinds = ["gold", "black", "dust"].filter((kind) => hidden[kind] > 0);
const texts = { gold: content.hiddenGold, black: content.hiddenBlack, dust: content.hiddenDust };
const separator = (index) => (index === 0 ? " " : index === kinds.length - 1 ? content.listLast : content.listSeparator);
return <p>{fillTemplate(content.hiddenStars, { count: total })}{kinds.map((kind, index) => <Fragment key={kind}>
{separator(index)}<strong data-kind={kind}>{countText(texts[kind].name, hidden[kind])}</strong>{countText(texts[kind].effect, hidden[kind], { value: recruitment.dustValue })}
</Fragment>)}. {hidden.black > 0 ? fillTemplate(content.blackRule, { power: recruitment.fallPower }) : content.safeRule}</p>;
}
function Improve({ catalog, recruitment, last, content, statLabels, busy, titleRef, onReveal, onKeep }) {
function Improve({ catalog, recruitment, last, content, statLabels, busy, titleRef, onReveal, onHeal, onKeep }) {
const { current, powers, hidden, sky } = recruitment;
const top = current.step === powers.length - 1;
const total = hidden.gold + hidden.black + hidden.dust;
@ -64,33 +68,31 @@ function Improve({ catalog, recruitment, last, content, statLabels, busy, titleR
// Fin des essais : le bouton qui continue reçoit le focus, l'étoile cliquée ne réagit plus.
useEffect(() => { if (over) keepRef.current?.focus({ preventScroll: true }); }, [over]);
return <div className="nebula-team-improve">
<div className="nebula-team-rule">
<h3 ref={titleRef} tabIndex={-1}>{content.improveTitle}</h3>
<StarsRule hidden={hidden} recruitment={recruitment} content={content} />
</div>
<h3 ref={titleRef} tabIndex={-1}>{content.improveTitle}</h3>
<TeamCompanion catalog={catalog} companion={current} content={content} statLabels={statLabels} />
<div className="nds-panel nebula-team-stars-panel">
<ol className="nebula-team-ladder" data-fallen={current.fallen || undefined}>{powers.map((power, index) => <li key={power} data-state={index <= current.step ? "reached" : index === current.step + 1 && !over ? "next" : undefined}>
<ol className="nebula-team-ladder" data-fallen={(current.fallen && !current.healed) || undefined}>{powers.map((power, index) => <li key={power} data-state={index <= (current.healed ? 0 : current.step) ? "reached" : index === current.step + 1 && !over ? "next" : undefined}>
<small>{index ? countText(content.ladderStep, index) : content.ladderStart}</small>
<strong>{power}</strong>
<small>{strong.map((stat) => `${statLabels[stat]} ${recruitment.ladder[index][stat]}`).join(" · ")}</small>
</li>)}</ol>
<TeamSky sky={sky} content={content} canReveal={!over && !busy} onReveal={onReveal} />
<p className="nebula-team-risk" role="status">
{current.fallen ? fillTemplate(content.fallen, { power: recruitment.fallPower }) : top ? content.top : !total ? content.noStars
: hidden.black > 0 ? fillTemplate(content.risk, { risk }) : content.noRisk}
{current.healed ? <strong data-risk="low">{fillTemplate(content.healed, { power: current.power })}</strong> : current.fallen ? fillTemplate(content.fallen, { power: recruitment.fallPower }) : top ? content.top : !total ? content.noStars
: hidden.black > 0 ? <>{content.risk} <strong data-risk={riskLevel(risk)}>{fillTemplate(content.riskValue, { risk })}</strong></> : <strong data-risk="low">{content.noRisk}</strong>}
</p>
<div className="nds-toolbar nebula-team-actions">
<button ref={keepRef} className="nds-button" data-variant={over ? "primary" : "secondary"} type="button" disabled={busy} onClick={onKeep}>{over ? (last ? content.seeTeam : content.nextCompanion) : fillTemplate(content.keepAt, { power: current.power })}</button>
{!over && <span>{content.orClickStar}</span>}
{current.fallen && !current.healed && recruitment.balms > 0 && <button className="nds-button nebula-team-heal" data-variant="secondary" type="button" disabled={busy} onClick={onHeal}><img src={ITEM_ART.balm} alt="" />{fillTemplate(content.heal, { power: powers[0], count: recruitment.balms })}</button>}
</div>
<p className="nebula-team-note">{content.starsShared}</p>
</div>
</div>;
}
export function TeamRecruitment({ catalog, team, content, statLabels, busy, onChoose, onReveal, onKeep }) {
const { recruitment, companions, zones } = team;
export function TeamRecruitment({ catalog, team, content, statLabels, busy, onChoose, onReroll, onReveal, onHeal, onKeep }) {
const { recruitment, companions } = team;
const count = companions.length + 1;
const titleRef = useRef(null);
const step = `${count}-${recruitment.current ? "improve" : "offer"}`;
@ -103,15 +105,21 @@ export function TeamRecruitment({ catalog, team, content, statLabels, busy, onCh
}, [step]);
return <>
<Steps count={count} size={recruitment.size} step={recruitment.current ? 2 : 1} content={content} />
{recruitment.current
? <Improve key={recruitment.current.cardId} catalog={catalog} recruitment={recruitment} last={count === recruitment.size} content={content} statLabels={statLabels} busy={busy} titleRef={titleRef} onReveal={onReveal} onKeep={onKeep} />
: <section aria-labelledby="nebula-team-offer-title" className="nebula-team-offer">
<h3 id="nebula-team-offer-title" ref={titleRef} tabIndex={-1}>{content.offerTitle}</h3>
<p>{fillTemplate(content.offerText, { power: recruitment.powers[0] })}{companions.length === 0 && recruitment.extraGold > 0 && <> <strong>{countText(content.reserveUsed, recruitment.extraGold)}</strong></>}</p>
<div className="nebula-team-offer-cards">{recruitment.offer.map((companion) => <TeamCompanion key={companion.cardId} catalog={catalog} companion={companion} content={content} statLabels={statLabels} showPower={false} disabled={busy}
badge={isMissing(companion, companions, zones) ? content.missing : ""} actionLabel={content.recruitAction} onSelect={() => onChoose(companion.cardId)} />)}</div>
</section>}
<TeamSoFar catalog={catalog} team={companions} recruitment={recruitment} content={content} statLabels={statLabels} />
<TeamCourse zones={zones} content={content} statLabels={statLabels} />
<div className="nebula-team-recruiting">
<div className="nebula-team-main">
{recruitment.current
? <Improve key={recruitment.current.cardId} catalog={catalog} recruitment={recruitment} last={count === recruitment.size} content={content} statLabels={statLabels} busy={busy} titleRef={titleRef} onReveal={onReveal} onHeal={onHeal} onKeep={onKeep} />
: <section aria-labelledby="nebula-team-offer-title" className="nebula-team-offer">
<h3 id="nebula-team-offer-title" ref={titleRef} tabIndex={-1}>{content.offerTitle}</h3>
<p>{fillTemplate(content.offerText, { power: recruitment.powers[0] })}{companions.length === 0 && recruitment.extraGold > 0 && <> <strong>{countText(content.reserveUsed, recruitment.extraGold)}</strong></>}</p>
<div className="nebula-team-offer-cards">{recruitment.offer.map((companion) => <TeamCompanion key={companion.cardId} catalog={catalog} companion={companion} content={content} statLabels={statLabels} showPower={false} disabled={busy}
badge={isMissing(companion, companions) ? content.missing : ""} actionLabel={content.recruitAction} onSelect={() => onChoose(companion.cardId)} />)}</div>
<div className="nds-toolbar nebula-team-actions"><button className="nds-button" data-size="sm" data-variant="secondary" type="button" disabled={busy || !recruitment.rerolls} onClick={() => onReroll(recruitment.offer.map((companion) => companion.cardId))}>{content.reroll}</button><span>{recruitment.rerolls ? countText(content.rerollsLeft, recruitment.rerolls) : content.rerollsNone}</span></div>
</section>}
</div>
<StarsLeft recruitment={recruitment} content={content} />
<TeamSummary team={companions} content={content} statLabels={statLabels} />
<TeamMembers catalog={catalog} team={companions} recruitment={recruitment} content={content} statLabels={statLabels} />
</div>
</>;
}

View file

@ -1,9 +1,10 @@
// Rôle : règle les quêtes de la Guilde des Veilleurs, une par onglet (Carte du jour, Expéditions), chacun avec son adresse.
// Rôle : règle les quêtes de la Guilde des Veilleurs, une par onglet (Carte du jour, Équipe du jour, Expéditions), chacun avec son adresse.
import { useState } from "react";
import { Tabs } from "../../../components/Tabs.jsx";
import { ApplyActions } from "./adminSettingForm.jsx";
import { inRange, MAX_VALUE, parse, shopSettingSaver } from "./adminSettings.js";
import { ExpeditionSettings } from "./ExpeditionSettings.jsx";
import { TeamSettings } from "./TeamSettings.jsx";
// Carte du jour : la partie du jour (joueurs et gagnants), puis la récompense d'une victoire.
function DailyQuestSettings({ setting, daily, busy, save }) {
@ -29,7 +30,7 @@ function DailyQuestSettings({ setting, daily, busy, save }) {
}
// Onglets de la Guilde : l'adresse #/cards/admin/guild/<onglet> garde l'onglet ouvert ; sans onglet, la Carte du jour.
const GUILD_TABS = [{ id: "daily", label: "Carte du jour" }, { id: "expeditions", label: "Expéditions" }];
const GUILD_TABS = [{ id: "daily", label: "Carte du jour" }, { id: "team", label: "Équipe du jour" }, { id: "expeditions", label: "Expéditions" }];
export function AdminGuild({ dashboard, busy, runMutation, refreshDashboard, tab = "" }) {
const setting = dashboard?.shopSetting;
@ -40,6 +41,7 @@ export function AdminGuild({ dashboard, busy, runMutation, refreshDashboard, tab
{setting
? <>
{activeTab === "daily" && <DailyQuestSettings key={setting.dailyReward} setting={setting} daily={dashboard.daily} busy={busy} save={save} />}
{activeTab === "team" && dashboard.teamSettings && <TeamSettings dashboard={dashboard} busy={busy} runMutation={runMutation} refreshDashboard={refreshDashboard} />}
{activeTab === "expeditions" && dashboard.expeditionSettings && <ExpeditionSettings dashboard={dashboard} busy={busy} runMutation={runMutation} refreshDashboard={refreshDashboard} />}
</>
: <div className="nds-empty-state" aria-busy="true"><p>Chargement des quêtes…</p></div>}

View file

@ -4,6 +4,8 @@ import { loadAdminHistory } from "../cardsApi.js";
import { summarizeReward } from "../rewardText.js";
import { DATE_FORMATTER, formatDuration } from "./adminFormat.js";
import { expeditionSettingLabel, formatSettingValue } from "./expeditionSettingFields.js";
import { readPath } from "./settingsDraft.js";
import { formatTeamSetting, TEAM_SETTING_PATHS, teamSettingLabel } from "./teamSettingFields.js";
const EVENT_LABELS = {
recharge_updated: "Recharge modifiée",
@ -21,7 +23,8 @@ const EVENT_LABELS = {
campaign_extended: "Campagne prolongée",
account_deleted: "Compte joueur supprimé",
expedition_settings_updated: "Expéditions modifiées",
expedition_cancelled: "Expédition annulée"
expedition_cancelled: "Expédition annulée",
team_settings_updated: "Équipe du jour modifiée"
};
const collectionName = (entry, catalog) => catalog.collections.find((item) => item.id === entry.entityId)?.name || entry.entityId;
@ -97,6 +100,7 @@ function eventDetail(entry, catalog) {
case "campaign_extended": return `${campaignName || entry.entityId} · ${details.expiresAt == null ? "sans expiration" : `jusqu’au ${DATE_FORMATTER.format(details.expiresAt)}`}`;
case "campaign_revoked": return campaignName || entry.entityId;
case "expedition_settings_updated": return (details.changes || []).map((item) => change(expeditionSettingLabel(item.path), formatSettingValue(item.previous), formatSettingValue(item.next))).filter(Boolean).join(" · ");
case "team_settings_updated": return TEAM_SETTING_PATHS.map((path) => change(teamSettingLabel(path), formatTeamSetting(readPath(details.previous, path)), formatTeamSetting(readPath(details.next, path)))).filter(Boolean).join(" · ");
case "expedition_cancelled": return details.destinationId;
default: return "";
}

View file

@ -5,25 +5,12 @@ import { Tabs } from "../../../components/Tabs.jsx";
import { ConfirmModal } from "../../../components/ToolboxModals.jsx";
import { cancelExpedition, updateExpeditionSettings } from "../cardsApi.js";
import { DATE_FORMATTER } from "./adminFormat.js";
import { inRange, parse } from "./adminSettings.js";
import { EXPEDITION_OPEN_PATH, EXPEDITION_SETTING_GROUPS, EXPEDITION_SETTING_THEMES, expeditionSettingLabel, formatSettingValue } from "./expeditionSettingFields.js";
import { ApplyBar, DefaultHint, NumberInput, SettingsGroup } from "./SettingFields.jsx";
import { readPath, same, toDraft, useSettingsDraft, writePath } from "./settingsDraft.js";
const DESTINATION_WEIGHT = { min: 0, max: 100 };
const readPath = (source, path) => path.split(".").reduce((value, key) => value?.[key], source);
function writePath(target, path, value) {
const keys = path.split(".");
keys.slice(0, -1).reduce((node, key) => node[key], target)[keys.at(-1)] = value;
}
const same = (left, right) => JSON.stringify(left) === JSON.stringify(right);
const toDraft = (value) => (typeof value === "boolean" ? value : Array.isArray(value) ? value.map(String) : String(value));
const fromDraft = (value) => (typeof value === "boolean" ? value : Array.isArray(value) ? value.map(parse) : parse(value));
const validValue = (field, value) => (field.kind === "bool" ? typeof value === "boolean" : (Array.isArray(value) ? value : [value]).every((item) => inRange(item, field.min, field.max)));
const withUnit = (value, unit) => (unit ? `${value} ${unit}` : String(value));
const formatDefault = (value, unit) => (typeof value === "boolean" ? (value ? "oui" : "non") : Array.isArray(value) ? value.map((item) => withUnit(item, unit)).join(" / ") : withUnit(value, unit));
// Tous les réglages modifiables ici : ceux des groupes rangés dans un onglet (bornes du schéma) et ceux de chaque destination.
// L'ouverture (bandeau d'état) et le prix d'un Éclat (Boutique) se règlent ailleurs.
function editableFields(schema, destinations) {
@ -38,70 +25,6 @@ function editableFields(schema, destinations) {
const PANEL_THEME = new Map(EXPEDITION_SETTING_THEMES.flatMap((theme) => theme.panels.map((panel) => [panel, theme.id])));
// Brouillon commun à tous les onglets : seules les valeurs touchées y figurent, le reste se lit dans les réglages enregistrés.
function useSettingsDraft(settings, fields) {
const [draft, setDraft] = useState({});
const value = (path) => (path in draft ? fromDraft(draft[path]) : readPath(settings, path));
const raw = (path) => (path in draft ? draft[path] : toDraft(readPath(settings, path)));
const touched = fields.filter((field) => field.path in draft);
const invalid = touched.filter((field) => !validValue(field, value(field.path)));
const changes = touched.filter((field) => validValue(field, value(field.path)) && !same(value(field.path), readPath(settings, field.path)));
const set = (path, next) => setDraft((current) => ({ ...current, [path]: next }));
const reset = () => setDraft({});
return { value, raw, invalid, changes, set, reset };
}
function DefaultHint({ field, value, defaults, busy, onReset }) {
const fallback = readPath(defaults, field.path);
if (fallback === undefined || same(value, fallback)) return null;
return <button className="nebula-admin-setting-default" type="button" disabled={busy} title="Rétablir la valeur par défaut" onClick={onReset}>
Défaut : {formatDefault(fallback, field.unit)} <span aria-hidden="true">↺</span>
</button>;
}
function NumberInput({ field, value, label, busy, onChange }) {
return <span className="nebula-admin-setting-input" data-unit={field.unit || undefined}>
<input className="nds-input" type="number" inputMode="numeric" min={field.min} max={field.max} step="1" value={value} disabled={busy} aria-label={label} aria-invalid={!inRange(parse(value), field.min, field.max) || undefined} onChange={(event) => onChange(event.target.value)} />
{field.unit && <span aria-hidden="true">{field.unit}</span>}
</span>;
}
// Un réglage : interrupteur, nombre ou suite de nombres, avec son état (modifié, invalide) et la valeur par défaut s'il s'en écarte.
function SettingField({ field, draft, settings, defaults, busy }) {
const value = draft.value(field.path);
const raw = draft.raw(field.path);
const changed = !same(value, readPath(settings, field.path));
const invalid = !validValue(field, value);
const label = field.unit ? `${field.label} (${field.unit})` : field.label;
const state = { "data-changed": changed || undefined, "data-invalid": invalid || undefined };
const hint = <DefaultHint field={field} value={value} defaults={defaults} busy={busy} onReset={() => draft.set(field.path, toDraft(readPath(defaults, field.path)))} />;
const error = invalid && <small role="alert">Entier de {field.min.toLocaleString("fr-FR")} à {field.max.toLocaleString("fr-FR")}</small>;
if (field.kind === "bool") return <div className="nebula-admin-expedition-field" {...state}>
<span className="nebula-admin-setting-label">{field.label}</span>
<button className="nds-button" data-size="sm" data-variant={raw ? "primary" : "secondary"} type="button" aria-pressed={raw} aria-label={field.label} disabled={busy} onClick={() => draft.set(field.path, !raw)}>{raw ? "Oui" : "Non"}</button>
{hint}
</div>;
if (Array.isArray(raw)) return <fieldset className="nebula-admin-expedition-field" {...state}>
<legend>{field.label}</legend>
<div className="nebula-admin-expedition-items">{raw.map((item, index) => <label key={index}><span>{field.items?.[index] ?? index + 1}</span>
<NumberInput field={field} value={item} label={`${label} · ${field.items?.[index] ?? index + 1}`} busy={busy} onChange={(next) => draft.set(field.path, raw.map((current, position) => (position === index ? next : current)))} />
</label>)}</div>
{error}{hint}
</fieldset>;
return <label className="nebula-admin-expedition-field" {...state}><span className="nebula-admin-setting-label">{field.label}</span>
<NumberInput field={field} value={raw} label={label} busy={busy} onChange={(next) => draft.set(field.path, next)} />
{error}{hint}
</label>;
}
function SettingsGroup({ group, fields, ...props }) {
return <section className="nds-panel nebula-admin-shop nebula-admin-expedition-group" aria-labelledby={`nebula-admin-expedition-${group.id}`}>
<div className="nds-section-heading nebula-admin-panel-heading"><h3 id={`nebula-admin-expedition-${group.id}`}>{group.title}</h3></div>
<p className="nebula-form-help">{group.help}</p>
<div className="nebula-admin-expedition-fields">{fields.map((field) => <SettingField key={field.path} field={field} {...props} />)}</div>
</section>;
}
// Destinations : proposées ou non, et poids dans le tirage du jour. Leurs textes vivent dans le fichier du serveur.
function DestinationSettings({ destinations, draft, settings, defaults, busy }) {
return <section className="nds-panel nebula-admin-shop nebula-admin-expedition-group" aria-labelledby="nebula-admin-expedition-destinations">
@ -164,34 +87,6 @@ function ExpeditionsStatus({ enabled, today, destinations, busy, onToggle, onCan
</section>;
}
// Barre commune : nombre de réglages modifiés ou invalides, puis confirmation avec la liste des changements.
function ApplyBar({ draft, settings, destinations, busy, onApply }) {
const [confirming, setConfirming] = useState(false);
const { changes, invalid } = draft;
if (!changes.length && !invalid.length) return null;
const count = (total, word) => `${total} réglage${total > 1 ? "s" : ""} ${word}${total > 1 ? "s" : ""}`;
return <div className="nds-panel nebula-admin-apply-bar" role="region" aria-label="Modifications en attente">
<p role="status">{[changes.length && count(changes.length, "modifié"), invalid.length && count(invalid.length, "invalide")].filter(Boolean).join(" · ")}</p>
<div className="nds-toolbar">
<button className="nds-button" data-size="sm" data-variant="secondary" type="button" disabled={busy} aria-label="Annuler les modifications" onClick={draft.reset}>Annuler</button>
<button className="nds-button" data-size="sm" data-variant="primary" type="button" disabled={busy || !changes.length || invalid.length > 0} onClick={() => setConfirming(true)}>Appliquer</button>
</div>
{confirming && <ConfirmModal
title={`Appliquer ${count(changes.length, "modifié")} ?`}
message="Les nouveaux réglages s’appliquent aux prochains départs. Les expéditions en route gardent ceux de leur départ."
confirmLabel="Appliquer"
onClose={async (confirmed) => {
setConfirming(false);
if (confirmed) await onApply();
}}
>
<ul className="nebula-admin-apply-changes">{changes.map((field) => <li key={field.path}>
<span>{expeditionSettingLabel(field.path, destinations)}</span> : {formatSettingValue(readPath(settings, field.path))} → <strong>{formatSettingValue(draft.value(field.path))}</strong>
</li>)}</ul>
</ConfirmModal>}
</div>;
}
export function ExpeditionSettings({ dashboard, busy, runMutation, refreshDashboard }) {
const { settings, defaults, schema, destinations } = dashboard.expeditionSettings;
const [themeId, setThemeId] = useState(EXPEDITION_SETTING_THEMES[0].id);
@ -227,6 +122,6 @@ export function ExpeditionSettings({ dashboard, busy, runMutation, refreshDashbo
{theme.panels.map((panel) => (panel === "destinations"
? <DestinationSettings key={panel} destinations={destinations} {...props} />
: <SettingsGroup key={panel} group={EXPEDITION_SETTING_GROUPS.find((group) => group.id === panel)} fields={fields.filter((field) => field.panel === panel)} {...props} />))}
<ApplyBar draft={draft} settings={settings} destinations={destinations} busy={busy} onApply={apply} />
<ApplyBar draft={draft} settings={settings} busy={busy} onApply={apply} message="Les nouveaux réglages s’appliquent aux prochains départs. Les expéditions en route gardent ceux de leur départ." labelOf={(path) => expeditionSettingLabel(path, destinations)} formatValue={formatSettingValue} />
</div>;
}

View file

@ -0,0 +1,85 @@
// Rôle : champs et barre d'application des formulaires de réglages de l'administration (Expéditions, Équipe du jour).
import { useState } from "react";
import { ConfirmModal } from "../../../components/ToolboxModals.jsx";
import { inRange, parse } from "./adminSettings.js";
import { formatDefault, readPath, same, toDraft, validValue } from "./settingsDraft.js";
export function DefaultHint({ field, value, defaults, busy, onReset }) {
const fallback = readPath(defaults, field.path);
if (fallback === undefined || same(value, fallback)) return null;
return <button className="nebula-admin-setting-default" type="button" disabled={busy} title="Rétablir la valeur par défaut" onClick={onReset}>
Défaut : {formatDefault(fallback, field.unit)} <span aria-hidden="true">↺</span>
</button>;
}
export function NumberInput({ field, value, label, busy, onChange }) {
return <span className="nebula-admin-setting-input" data-unit={field.unit || undefined}>
<input className="nds-input" type="number" inputMode="numeric" min={field.min} max={field.max} step="1" value={value} disabled={busy} aria-label={label} aria-invalid={!inRange(parse(value), field.min, field.max) || undefined} onChange={(event) => onChange(event.target.value)} />
{field.unit && <span aria-hidden="true">{field.unit}</span>}
</span>;
}
// Un réglage : interrupteur, nombre ou suite de nombres, avec son état (modifié, invalide) et la valeur par défaut s'il s'en écarte.
function SettingField({ field, draft, settings, defaults, busy }) {
const value = draft.value(field.path);
const raw = draft.raw(field.path);
const changed = !same(value, readPath(settings, field.path));
const invalid = !validValue(field, value);
const label = field.unit ? `${field.label} (${field.unit})` : field.label;
const state = { "data-changed": changed || undefined, "data-invalid": invalid || undefined };
const hint = <DefaultHint field={field} value={value} defaults={defaults} busy={busy} onReset={() => draft.set(field.path, toDraft(readPath(defaults, field.path)))} />;
const error = invalid && <small role="alert">Entier de {field.min.toLocaleString("fr-FR")} à {field.max.toLocaleString("fr-FR")}</small>;
if (field.kind === "bool") return <div className="nebula-admin-expedition-field" {...state}>
<span className="nebula-admin-setting-label">{field.label}</span>
<button className="nds-button" data-size="sm" data-variant={raw ? "primary" : "secondary"} type="button" aria-pressed={raw} aria-label={field.label} disabled={busy} onClick={() => draft.set(field.path, !raw)}>{raw ? "Oui" : "Non"}</button>
{hint}
</div>;
if (Array.isArray(raw)) return <fieldset className="nebula-admin-expedition-field" {...state}>
<legend>{field.label}</legend>
<div className="nebula-admin-expedition-items">{raw.map((item, index) => <label key={index}><span>{field.items?.[index] ?? index + 1}</span>
<NumberInput field={field} value={item} label={`${label} · ${field.items?.[index] ?? index + 1}`} busy={busy} onChange={(next) => draft.set(field.path, raw.map((current, position) => (position === index ? next : current)))} />
</label>)}</div>
{error}{hint}
</fieldset>;
return <label className="nebula-admin-expedition-field" {...state}><span className="nebula-admin-setting-label">{field.label}</span>
<NumberInput field={field} value={raw} label={label} busy={busy} onChange={(next) => draft.set(field.path, next)} />
{error}{hint}
</label>;
}
export function SettingsGroup({ group, fields, ...props }) {
return <section className="nds-panel nebula-admin-shop nebula-admin-expedition-group" aria-labelledby={`nebula-admin-expedition-${group.id}`}>
<div className="nds-section-heading nebula-admin-panel-heading"><h3 id={`nebula-admin-expedition-${group.id}`}>{group.title}</h3></div>
<p className="nebula-form-help">{group.help}</p>
<div className="nebula-admin-expedition-fields">{fields.map((field) => <SettingField key={field.path} field={field} {...props} />)}</div>
</section>;
}
// Barre commune : nombre de réglages modifiés ou invalides, puis confirmation avec la liste des changements.
// `labelOf` et `formatValue` nomment un réglage et sa valeur ; `blocked` : ce qui empêche d'appliquer des valeurs valides une à une.
export function ApplyBar({ draft, settings, busy, message, labelOf, formatValue, blocked = "", onApply }) {
const [confirming, setConfirming] = useState(false);
const { changes, invalid } = draft;
if (!changes.length && !invalid.length) return null;
const count = (total, word) => `${total} réglage${total > 1 ? "s" : ""} ${word}${total > 1 ? "s" : ""}`;
return <div className="nds-panel nebula-admin-apply-bar" role="region" aria-label="Modifications en attente">
<p role="status">{[changes.length && count(changes.length, "modifié"), invalid.length && count(invalid.length, "invalide"), blocked].filter(Boolean).join(" · ")}</p>
<div className="nds-toolbar">
<button className="nds-button" data-size="sm" data-variant="secondary" type="button" disabled={busy} aria-label="Annuler les modifications" onClick={draft.reset}>Annuler</button>
<button className="nds-button" data-size="sm" data-variant="primary" type="button" disabled={busy || !changes.length || invalid.length > 0 || Boolean(blocked)} onClick={() => setConfirming(true)}>Appliquer</button>
</div>
{confirming && <ConfirmModal
title={`Appliquer ${count(changes.length, "modifié")} ?`}
message={message}
confirmLabel="Appliquer"
onClose={async (confirmed) => {
setConfirming(false);
if (confirmed) await onApply();
}}
>
<ul className="nebula-admin-apply-changes">{changes.map((field) => <li key={field.path}>
<span>{labelOf(field.path)}</span> : {formatValue(readPath(settings, field.path))} → <strong>{formatValue(draft.value(field.path))}</strong>
</li>)}</ul>
</ConfirmModal>}
</div>;
}

View file

@ -0,0 +1,60 @@
// Rôle : règle l'Équipe du jour depuis Administration › Guilde : ouverture et suivi du jour, étoiles, Puissance et récompenses.
import { useState } from "react";
import { ConfirmModal } from "../../../components/ToolboxModals.jsx";
import { updateTeamSettings } from "../cardsApi.js";
import { ApplyBar, SettingsGroup } from "./SettingFields.jsx";
import { readPath, useSettingsDraft, writePath } from "./settingsDraft.js";
import { formatTeamSetting, TEAM_SETTING_GROUPS, teamSettingLabel, teamSettingsConflict } from "./teamSettingFields.js";
const FIELDS = TEAM_SETTING_GROUPS.flatMap((group) => group.fields);
const plural = (count, word) => `${word}${count > 1 ? "s" : ""}`;
// Ouverture, appliquée tout de suite sans toucher au brouillon, et activité du jour.
function TeamStatus({ enabled, today, busy, onToggle }) {
const [confirming, setConfirming] = useState(false);
return <section className="nds-panel nebula-admin-shop nebula-admin-expedition-status" data-open={enabled} aria-labelledby="nebula-admin-team-status-title">
<div className="nebula-admin-expedition-status-head">
<div>
<h3 id="nebula-admin-team-status-title">Équipe du jour <span className="nds-badge" data-variant={enabled ? "success" : "neutral"}>{enabled ? "Ouverte aux joueurs" : "Fermée aux joueurs"}</span></h3>
<p className="nebula-admin-guild-today">Aujourd’hui : <strong>{today.teams}</strong> {plural(today.teams, "équipe")} utilisable{today.teams > 1 ? "s" : ""} · <strong>{today.races}</strong> {plural(today.races, "course")} · <strong>{today.stars}</strong> {plural(today.stars, "étoile")} {plural(today.stars, "dorée")} {plural(today.stars, "choisie")}.</p>
</div>
<button className="nds-button" data-size="sm" data-variant={enabled ? "secondary" : "primary"} type="button" disabled={busy} onClick={() => setConfirming(true)}>{enabled ? "Fermer l’Équipe du jour" : "Ouvrir l’Équipe du jour"}</button>
</div>
{confirming && <ConfirmModal
title={enabled ? "Fermer l’Équipe du jour ?" : "Ouvrir l’Équipe du jour ?"}
message={enabled
? "Plus aucun recrutement ni départ de course. Un recrutement ou une course déjà commencés se terminent, et la Carte du jour redonne sa poussière aussitôt."
: "Les tuiles de l’Équipe du jour et de la Course apparaissent dans la Guilde, et la Carte du jour propose une étoile dorée."}
confirmLabel={enabled ? "Fermer" : "Ouvrir"}
onClose={async (confirmed) => {
setConfirming(false);
if (confirmed) await onToggle(!enabled);
}}
/>}
</section>;
}
export function TeamSettings({ dashboard, busy, runMutation, refreshDashboard }) {
const { settings, defaults, today } = dashboard.teamSettings;
const draft = useSettingsDraft(settings, FIELDS);
const save = async (apply) => {
const next = structuredClone(settings);
apply(next);
const saved = await runMutation(() => updateTeamSettings(next));
if (saved) await refreshDashboard();
return saved;
};
const apply = async () => {
if (await save((next) => draft.changes.forEach((field) => writePath(next, field.path, draft.value(field.path))))) draft.reset();
};
const value = (path) => draft.value(path) ?? readPath(settings, path);
const starStardust = value("starStardust");
const dailyReward = dashboard.shopSetting.dailyReward;
return <div className="nebula-admin-expeditions">
<TeamStatus enabled={settings.enabled} today={today} busy={busy} onToggle={(enabled) => save((next) => { next.enabled = enabled; })} />
{starStardust >= dailyReward && <p className="nds-inline-notice" data-variant="warning" role="status">L’étoile dorée vient avec {starStardust.toLocaleString("fr-FR")} de poussière, autant ou plus que la Carte du jour sans étoile ({dailyReward.toLocaleString("fr-FR")}) : les joueurs n’auraient aucune raison de choisir la poussière seule.</p>}
{TEAM_SETTING_GROUPS.map((group) => <SettingsGroup key={group.id} group={group} fields={group.fields} draft={draft} settings={settings} defaults={defaults} busy={busy} />)}
<ApplyBar draft={draft} settings={settings} busy={busy} onApply={apply} message="Les nouveaux réglages valent pour les prochains recrutements, courses et victoires à la Carte du jour." labelOf={teamSettingLabel} formatValue={formatTeamSetting}
blocked={teamSettingsConflict({ powers: value("recruitment.powers"), fallPower: value("recruitment.fallPower") })} />
</div>;
}

View file

@ -161,6 +161,7 @@ export const EXPEDITION_SETTING_GROUPS = [
{ path: "items.weights.guideStar", label: "Poids : étoile guide (destination bonus)" },
{ path: "items.weights.skyChart", label: "Poids : carte céleste (destination bonus au butin plus riche)" },
{ path: "items.weights.windRose", label: "Poids : rose des vents (nouvelles destinations du jour)" },
{ path: "items.weights.balm", label: "Poids : baume des Veilleurs (soigne un compagnon, si l’Équipe du jour est ouverte)" },
{ path: "items.weights.oblivion", label: "Poids : parchemin d’oubli (changer le plan d’une carte)" }
]
},

View file

@ -0,0 +1,30 @@
// Rôle : brouillon des formulaires de réglages de l'administration (Expéditions, Équipe du jour) : lecture, saisie, validation.
import { useState } from "react";
import { inRange, parse } from "./adminSettings.js";
export const readPath = (source, path) => path.split(".").reduce((value, key) => value?.[key], source);
export function writePath(target, path, value) {
const keys = path.split(".");
keys.slice(0, -1).reduce((node, key) => node[key], target)[keys.at(-1)] = value;
}
export const same = (left, right) => JSON.stringify(left) === JSON.stringify(right);
export const toDraft = (value) => (typeof value === "boolean" ? value : Array.isArray(value) ? value.map(String) : String(value));
export const fromDraft = (value) => (typeof value === "boolean" ? value : Array.isArray(value) ? value.map(parse) : parse(value));
export const validValue = (field, value) => (field.kind === "bool" ? typeof value === "boolean" : (Array.isArray(value) ? value : [value]).every((item) => inRange(item, field.min, field.max)));
const withUnit = (value, unit) => (unit ? `${value} ${unit}` : String(value));
export const formatDefault = (value, unit) => (typeof value === "boolean" ? (value ? "oui" : "non") : Array.isArray(value) ? value.map((item) => withUnit(item, unit)).join(" / ") : withUnit(value, unit));
// Brouillon commun : seules les valeurs touchées y figurent, le reste se lit dans les réglages enregistrés.
export function useSettingsDraft(settings, fields) {
const [draft, setDraft] = useState({});
const value = (path) => (path in draft ? fromDraft(draft[path]) : readPath(settings, path));
const raw = (path) => (path in draft ? draft[path] : toDraft(readPath(settings, path)));
const touched = fields.filter((field) => field.path in draft);
const invalid = touched.filter((field) => !validValue(field, value(field.path)));
const changes = touched.filter((field) => validValue(field, value(field.path)) && !same(value(field.path), readPath(settings, field.path)));
const set = (path, next) => setDraft((current) => ({ ...current, [path]: next }));
const reset = () => setDraft({});
return { value, raw, invalid, changes, set, reset };
}

View file

@ -0,0 +1,42 @@
// Rôle : décrit les réglages de l'Équipe du jour dans l'administration : libellés, bornes et règles entre plusieurs valeurs.
export const TEAM_SETTING_GROUPS = [
{
id: "team-stars", title: "Recrutement", help: "Étoiles cachées au début d’un recrutement. Les étoiles dorées en réserve s’y ajoutent. Nouvelles propositions : fois où un joueur peut redemander trois personnages. Un recrutement commencé garde les réglages de son début.",
fields: [
{ path: "recruitment.goldStars", label: "Étoiles dorées", min: 1, max: 30 },
{ path: "recruitment.blackStars", label: "Étoiles noires", min: 0, max: 15 },
{ path: "recruitment.dustStars", label: "Étoiles de poussière", min: 0, max: 10 },
{ path: "recruitment.dustValue", label: "Poussière par étoile", min: 0, max: 1_000 },
{ path: "recruitment.rerolls", label: "Nouvelles propositions", min: 0, max: 10 }
]
},
{
id: "team-powers", title: "Puissance des compagnons", help: "Puissance à l’arrivée, puis après chaque étoile dorée. La Puissance après une étoile noire doit rester sous celle du départ : sinon, le premier essai ne coûte rien.",
fields: [
{ path: "recruitment.powers", label: "Paliers", min: 1, max: 100, items: ["Départ", "1 dorée", "2 dorées", "3 dorées"] },
{ path: "recruitment.fallPower", label: "Après une étoile noire", min: 1, max: 100 }
]
},
{
id: "team-rewards", title: "Récompenses", help: "En poussière d’étoiles. Les récompenses d’une course sont celles de son départ.",
fields: [
{ path: "raceRewards", label: "Course, selon la place", min: 0, max: 100_000, items: ["1re", "2e", "3e", "4e"] },
{ path: "starStardust", label: "Avec une étoile dorée (Carte du jour)", min: 0, max: 100_000 }
]
}
];
const FIELDS = TEAM_SETTING_GROUPS.flatMap((group) => group.fields);
const LABELS = new Map([...FIELDS.map((field) => [field.path, field.label]), ["enabled", "Ouverte aux joueurs"]]);
export const teamSettingLabel = (path) => LABELS.get(path) || path;
export const formatTeamSetting = (value) => (typeof value === "boolean" ? (value ? "oui" : "non") : Array.isArray(value) ? value.join(" / ") : String(value));
export const TEAM_SETTING_PATHS = ["enabled", ...FIELDS.map((field) => field.path)];
// Règles entre valeurs, que le serveur vérifie aussi.
export function teamSettingsConflict({ powers, fallPower }) {
if (powers.some((power, index) => index > 0 && power <= powers[index - 1])) return "Chaque palier doit dépasser le précédent.";
if (fallPower >= powers[0]) return "La Puissance après une étoile noire doit être inférieure à celle du départ.";
return "";
}

View file

@ -104,6 +104,15 @@ export function recruitTeam(day) {
return request("/team/recruit", { method: "POST", body: JSON.stringify({ day }) });
}
// Serveur de développement seulement.
export function resetTeam() {
return request("/team/reset", { method: "POST" });
}
export function rerollTeamOffer(offer) {
return request("/team/reroll", { method: "POST", body: JSON.stringify({ offer }) });
}
export function chooseTeamCharacter(cardId) {
return request("/team/choose", { method: "POST", body: JSON.stringify({ cardId }) });
}
@ -112,6 +121,10 @@ export function revealTeamStar(index) {
return request("/team/stars", { method: "POST", body: JSON.stringify({ index }) });
}
export function healTeamCompanion(cardId) {
return request("/team/heal", { method: "POST", body: JSON.stringify({ cardId }) });
}
export function keepTeamCompanion(cardId) {
return request("/team/keep", { method: "POST", body: JSON.stringify({ cardId }) });
}
@ -250,6 +263,10 @@ export function claimExpedition(expeditionId) {
return request(`/expeditions/${encodeURIComponent(expeditionId)}/claim`, { method: "POST" });
}
export function updateTeamSettings(settings) {
return request("/admin/team/settings", { method: "PUT", body: JSON.stringify({ settings }) });
}
export function updateExpeditionSettings(settings) {
return request("/admin/expeditions/settings", { method: "PUT", body: JSON.stringify({ settings }) });
}

View file

@ -143,6 +143,7 @@ export const ITEM_ART = Object.freeze({
anchor: "/static/img/expeditions/items/anchor.webp",
guideStar: "/static/img/expeditions/items/guide-star.webp",
skyChart: "/static/img/expeditions/items/sky-chart.webp",
balm: "/static/img/expeditions/items/balm.webp",
oblivion: "/static/img/cards/shop/oblivion.webp",
windRose: "/static/img/cards/shop/wind-rose.webp"
});

View file

@ -16,10 +16,10 @@ export const teamBest = (companions) => Object.fromEntries(STAT_IDS.map((stat) =
export const averagePower = (companions) => Math.round(companions.reduce((sum, companion) => sum + companion.power, 0) / companions.length);
// Un candidat « manque à l'équipe » s'il a une spécialité du parcours que personne n'a encore.
export function isMissing(companion, team, zones) {
// Un candidat « manque à l'équipe » s'il a une spécialité que personne n'a encore.
export function isMissing(companion, team) {
const covered = new Set(team.flatMap((member) => member.specialties));
return team.length > 0 && companion.specialties.some((stat) => zones.includes(stat) && !covered.has(stat));
return team.length > 0 && companion.specialties.some((stat) => !covered.has(stat));
}
// Texte au singulier ou au pluriel : `{ one, many }`, avec `{count}`.
@ -30,6 +30,10 @@ export const riskPct = ({ gold, black, dust }) => {
return total ? Math.round((black / total) * 100) : 0;
};
// Couleur du risque : vers 30 % (26 à 33 selon le palier et les poussières restantes, réglages par défaut), une étoile de plus fait perdre de la
// Puissance en moyenne.
export const riskLevel = (pct) => (pct > 30 ? "high" : pct > 20 ? "medium" : "low");
// Couleurs d'une spécialité, ou des deux : lues par la bordure et le bandeau.
export function specialtyStyle(companion) {
const band = bandOf(companion);
@ -37,7 +41,8 @@ export function specialtyStyle(companion) {
}
// Ce que les étoiles ont fait d'un compagnon.
export function fateOf({ fallen, step }, powers, content) {
export function fateOf({ fallen, healed, step }, powers, content) {
if (healed) return { kind: "healed", text: content.fateHealed };
if (fallen) return { kind: "fallen", text: content.fateFallen };
if (step === powers.length - 1) return { kind: "top", text: content.fateTop };
return step ? { kind: "improved", text: countText(content.fateImproved, step) } : { kind: "none", text: content.fateNone };

View file

@ -125,29 +125,67 @@
}
.nebula-guild-intro { margin: var(--space-1) 0 0; color: var(--color-text-secondary); font-size: var(--font-size-sm); }
.nebula-quests { display: grid; gap: var(--space-4); }
.nebula-quests .nds-section-heading.nebula-section-heading { margin-bottom: 0; }
/* Deux colonnes dès le demi-écran, trois en plein écran (une quête seule garde la largeur d'une colonne). */
.nebula-quests-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-4); }
@container nebula-dashboard (min-width: 600px) {
.nebula-quests-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.nebula-quests { display: grid; gap: var(--space-6); }
.nebula-quests :is(h2, h3, p, ol) { margin: 0; }
/* En-tête : le dragon des Veilleurs, la présentation et l'avancement des quêtes du jour. */
.nds-panel.nebula-guild-hero { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: var(--space-5); align-items: center; padding: var(--space-4) var(--space-6); }
.nebula-guild-hero > img { width: 150px; height: auto; margin-block: calc(var(--space-2) * -1); filter: drop-shadow(0 8px 18px rgba(5, 7, 17, 0.6)); }
.nebula-guild-hero > div { display: grid; gap: var(--space-2); justify-items: start; min-width: 0; }
.nebula-guild-hero h2 { font-size: var(--font-size-2xl); }
.nebula-guild-progress { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); margin-top: var(--space-1); color: var(--color-text-primary); font-size: var(--font-size-sm); font-weight: 700; }
.nebula-guild-progress ol { display: flex; gap: 6px; padding: 0; list-style: none; }
.nebula-guild-progress li { width: 28px; height: 8px; border-radius: var(--radius-pill); background: var(--color-bg-hover); }
.nebula-guild-progress li[data-done] { background: var(--color-success); }
.nebula-guild-section { display: grid; gap: var(--space-3); }
.nebula-guild-section-heading { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-1) var(--space-3); }
.nebula-guild-section-heading h3 { font-size: var(--font-size-lg); }
.nebula-guild-section-heading p { color: var(--color-text-muted); font-size: var(--font-size-sm); }
/* Parcours du jour : les quêtes côte à côte, reliées par ce qui passe de l'une à la suivante ; en colonne en demi-écran étroit. */
.nebula-guild-path { display: grid; grid-auto-flow: row; gap: var(--space-2); padding: 0; list-style: none; }
.nebula-guild-step { display: grid; min-width: 0; }
.nebula-guild-link { display: grid; place-items: center; color: var(--color-text-muted); font-size: var(--font-size-xs); font-weight: 700; text-align: center; }
.nebula-guild-link span::before { content: "↓"; display: block; color: var(--color-accent-gold); font-size: var(--font-size-lg); }
@container nebula-dashboard (min-width: 760px) {
.nebula-guild-path { grid-auto-columns: minmax(0, 1fr) auto; grid-auto-flow: column; align-items: stretch; }
.nebula-guild-path[data-count="1"] { grid-template-columns: minmax(0, 420px); }
.nebula-guild-link { width: 84px; }
.nebula-guild-link span::before { content: "→"; }
}
@container nebula-dashboard (min-width: 1400px) {
.nebula-quests-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@container nebula-dashboard (max-width: 759px) {
.nebula-guild-step .nds-card-cover.nebula-quest-cover { aspect-ratio: 16 / 5; }
}
.nds-card.nebula-quest { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--space-4); align-items: center; padding: var(--space-4); }
.nds-card-cover.nebula-quest-cover { position: relative; width: 96px; display: grid; place-items: center; overflow: hidden; aspect-ratio: 5 / 7; border-radius: var(--radius-md); }
.nebula-quest-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.nebula-quest-cover span { position: relative; color: var(--color-accent-gold); font-size: 3rem; font-weight: 800; text-shadow: 0 2px 12px rgba(5, 7, 17, 0.9); }
/* Texte aligné à gauche à côté de la couverture ; seul le bouton est centré dans la colonne. */
.nds-card-body.nebula-quest-body { display: grid; gap: var(--space-2); justify-items: start; min-width: 0; padding: 0; }
.nebula-quest-body :is(h3, p) { margin: 0; }
.nebula-quest-body p:not(.eyebrow) { color: var(--color-text-secondary); font-size: var(--font-size-sm); text-wrap: pretty; }
/* Sous la couverture (96 px), la série en pastille entière, centrée : une longue série élargit la colonne au lieu de déborder. */
/* Tuile d'une quête du parcours : illustration en bandeau, texte, puis le bouton en bas. */
.nebula-guild-step .nds-card.nebula-quest { display: flex; flex-direction: column; gap: 0; height: 100%; padding: 0; overflow: hidden; }
.nebula-guild-step[data-done] .nds-card.nebula-quest { border-color: color-mix(in srgb, var(--color-success) 45%, transparent); }
.nebula-guild-step .nebula-quest-media { position: relative; display: block; }
.nebula-guild-step .nds-card-cover.nebula-quest-cover { width: 100%; aspect-ratio: 16 / 7; border-radius: 0; }
/* Le dos de carte de la Carte du jour est en portrait : agrandi, ses bords ne se voient pas dans le bandeau. */
.nebula-guild-step [data-status] .nebula-quest-cover img[src*="empty-back"] { transform: scale(1.2); }
.nebula-guild-step .nebula-quest-media .nds-badge { position: absolute; right: var(--space-2); bottom: var(--space-2); }
.nebula-guild-step .nds-card-body.nebula-quest-body { flex: 1; align-content: start; padding: var(--space-4); }
.nebula-guild-step .nebula-quest-body .nds-card-actions { align-self: end; justify-content: flex-start; margin-top: auto; padding-top: var(--space-2); }
/* Longues missions : une tuile large, l'illustration à gauche. */
.nebula-guild-long { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 520px), 1fr)); gap: var(--space-4); }
.nebula-guild-long .nds-card.nebula-quest { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: var(--space-5); align-items: stretch; padding: 0; overflow: hidden; }
.nebula-guild-long .nds-card-cover.nebula-quest-cover { width: 100%; height: 100%; min-height: 170px; aspect-ratio: auto; border-radius: 0; }
.nebula-guild-long .nebula-quest-media { display: block; }
.nebula-guild-long .nds-card-body.nebula-quest-body { align-content: center; padding: var(--space-4) var(--space-5) var(--space-4) 0; }
.nebula-guild-long .nebula-quest-body .nds-card-actions { justify-content: flex-start; }
.nebula-quest-media { display: grid; gap: var(--space-2); justify-items: center; }
.nebula-quest-media .nds-badge { padding-inline: 7px; white-space: nowrap; }
.nds-card-cover.nebula-quest-cover { position: relative; display: grid; place-items: center; overflow: hidden; }
.nebula-quest-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.nebula-quest-cover span { position: relative; color: var(--color-accent-gold); font-size: 3rem; font-weight: 800; text-shadow: 0 2px 12px rgba(5, 7, 17, 0.9); }
.nds-card-body.nebula-quest-body { display: grid; gap: var(--space-2); justify-items: start; min-width: 0; }
.nebula-quest-body p:not(.eyebrow) { color: var(--color-text-secondary); font-size: var(--font-size-sm); text-wrap: pretty; }
.nebula-quest-body .nebula-quest-status { color: var(--color-text-primary); font-weight: 700; }
.nebula-quest-body .nds-card-actions { display: flex; justify-self: stretch; justify-content: center; margin-top: var(--space-2); padding: 0; }
.nebula-quest-body .nds-card-actions { display: flex; padding: 0; }
@container nebula-dashboard (max-width: 560px) {
.nds-panel.nebula-guild-hero { grid-template-columns: 90px minmax(0, 1fr); padding: var(--space-4); }
.nebula-guild-hero > img { width: 90px; }
.nebula-guild-long .nds-card.nebula-quest { grid-template-columns: 120px minmax(0, 1fr); }
}
.nebula-pack-page { display: grid; gap: var(--space-6); }
.nds-section-heading.nebula-pack-page-heading { align-items: stretch; }

View file

@ -1,7 +1,8 @@
// Rôle : met en page l'Équipe du jour de Sokko TCG (compagnons et couleurs de spécialité, étoiles, recrutement, équipe).
.nebula-team { display: grid; gap: var(--space-5); min-width: 0; container: nebula-team / inline-size; }
.nebula-team .nds-section-heading.nebula-section-heading { margin-bottom: 0; }
.nebula-team .nds-section-heading.nebula-section-heading { flex-wrap: wrap; margin-bottom: 0; }
.nebula-team .nebula-section-heading > div:first-child { white-space: nowrap; }
.nebula-team :is(h3, p, ul, ol, dl, dd) { margin: 0; }
.nebula-team :is(ul, ol) { padding: 0; list-style: none; }
.nebula-team h3 { font-size: var(--font-size-lg); scroll-margin-top: 80px; }
@ -39,27 +40,55 @@ button.nebula-team-companion:disabled { cursor: default; opacity: 0.7; }
:is(.nebula-team-star, .nebula-team-band > span, .nebula-team-companion .nebula-team-strong, .nebula-team-companion .nebula-team-stats) span { color: inherit; }
.nebula-team-companion .nebula-team-band > span { color: var(--color-text-inverse); }
.nebula-team-companion .nebula-team-strong { color: var(--color-text-primary); }
.nebula-team-companion :is(.nebula-team-strong, .nebula-team-stats) .nebula-mask-icon { color: var(--specialty); }
.nebula-team-strong > span, .nebula-team-stats > span { display: inline-flex; align-items: center; gap: 3px; }
.nebula-team-fate { padding: 0 var(--space-2) var(--space-2); color: var(--color-text-muted); font-size: var(--font-size-xs); font-weight: 700; }
.nebula-team-fate[data-fate="top"] { color: var(--color-accent-gold); }
.nebula-team-fate[data-fate="improved"] { color: var(--color-success); }
.nebula-team-fate[data-fate="healed"] { color: var(--color-info); }
.nebula-team-fate[data-fate="fallen"] { color: var(--color-danger); }
.nebula-team-action { margin: auto var(--space-2) var(--space-2); padding: 6px; border-radius: var(--radius-sm); background: var(--color-primary-active); color: var(--color-text-primary); font-weight: 700; text-align: center; }
button.nebula-team-companion:hover:not(:disabled) .nebula-team-action { background: var(--color-primary); }
.nebula-team-list { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--space-3); }
.nebula-team-list > li { display: grid; min-width: 0; }
.nebula-team-empty { display: grid; min-height: 160px; border: 2px dashed var(--color-border-hover); border-radius: var(--radius-md); color: var(--color-text-muted); font-size: var(--font-size-sm); place-items: center; }
.nebula-team-so-far, .nebula-team-ready, .nebula-team-offer, .nebula-team-course { display: grid; gap: var(--space-3); min-width: 0; }
.nebula-team-so-far, .nebula-team-ready, .nebula-team-offer { display: grid; gap: var(--space-3); min-width: 0; }
.nebula-team :is(.nebula-team-offer, .nebula-team-ready) > p { max-width: 70ch; color: var(--color-text-secondary); }
.nebula-team-offer-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 230px)); gap: var(--space-4); }
.nebula-team-best { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.nebula-team-best > div { display: flex; align-items: center; gap: var(--space-2); padding: 3px var(--space-3); border: 1px solid var(--color-border); border-radius: var(--radius-sm); font-size: var(--font-size-sm); }
.nebula-team-best .nebula-mask-icon { color: var(--specialty); }
.nebula-team-best dt { display: inline-flex; align-items: center; gap: var(--space-1); color: var(--specialty); font-weight: 600; }
.nebula-team-best dd { font-variant-numeric: tabular-nums; font-weight: 800; }
.nebula-team-course ol { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.nebula-team-course li { display: inline-flex; align-items: center; gap: var(--space-1); padding: 3px var(--space-3); border: 1px solid color-mix(in srgb, var(--specialty) 45%, transparent); border-radius: var(--radius-sm); color: var(--specialty); font-size: var(--font-size-sm); font-weight: 600; }
.nebula-team-guide { display: grid; gap: var(--space-3); max-width: 620px; }
.nebula-team-guide :is(h2, h3, ol, ul) { margin: 0; }
.nebula-team-guide h3 { font-size: var(--font-size-base); }
.nebula-team-guide :is(ol, ul) { display: grid; gap: var(--space-2); padding-left: var(--space-5); color: var(--color-text-secondary); }
// Recrutement : le choix en cours, puis les étoiles restantes et l'équipe, à droite dès qu'il y a la place.
.nebula-team-recruiting { display: grid; grid-template-areas: "stars" "main" "team" "members"; grid-template-columns: minmax(0, 1fr); gap: var(--space-5); align-items: start; }
.nebula-team-main { grid-area: main; min-width: 0; }
.nebula-team-stars-left { grid-area: stars; display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-4); }
.nebula-team-stars-left ul { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.nebula-team-stars-left li { display: flex; align-items: center; gap: var(--space-2); padding: 3px var(--space-3) 3px 4px; border: 1px solid var(--color-border); border-radius: var(--radius-pill); color: var(--color-text-secondary); font-size: var(--font-size-sm); }
.nebula-team-stars-left li[data-empty] { opacity: 0.45; }
.nebula-team-stars-left i { display: grid; width: 26px; height: 26px; border: 2px solid var(--color-border-hover); border-radius: 50%; font-size: var(--font-size-sm); font-style: normal; place-items: center; }
.nebula-team-stars-left li[data-kind="gold"] i { border-color: var(--color-accent-gold); background: #241d08; color: var(--color-accent-gold); }
.nebula-team-stars-left li[data-kind="black"] i { border-color: var(--color-text-secondary); background: #000; color: var(--color-text-primary); }
.nebula-team-stars-left li[data-kind="dust"] i { border-color: #c4b5fd; background: #2c1d63; }
.nebula-team-stars-left strong { color: var(--color-text-primary); font-size: var(--font-size-lg); font-variant-numeric: tabular-nums; }
.nebula-team-summary { grid-area: team; display: grid; gap: var(--space-2); }
.nebula-team-members { grid-area: members; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--space-2); }
.nebula-team-members > li { display: grid; min-width: 0; }
.nebula-team-slot { display: grid; min-height: 150px; border: 2px dashed var(--color-border-hover); border-radius: var(--radius-md); color: var(--color-text-muted); font-size: var(--font-size-xs); place-items: center; }
// Petit compagnon : l'illustration moins haute, sans les stats secondaires.
.nebula-team-companion[data-size="sm"] .nebula-team-art { aspect-ratio: 4 / 3; }
.nebula-team-companion[data-size="sm"] .nebula-team-band > span { padding-block: 1px; font-size: var(--font-size-xs); }
.nebula-team-companion[data-size="sm"] .nebula-team-name { padding: var(--space-1) var(--space-2) 0; font-size: var(--font-size-xs); }
.nebula-team-companion[data-size="sm"] .nebula-team-power { font-size: var(--font-size-xs); }
.nebula-team-companion[data-size="sm"] .nebula-team-strong { font-size: var(--font-size-base); }
.nebula-team-companion[data-size="sm"] .nebula-team-fate { padding-top: 2px; }
.nebula-team-steps { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.nebula-team-steps li { padding: 2px var(--space-3); border: 1px solid var(--color-border); border-radius: var(--radius-pill); color: var(--color-text-muted); font-size: var(--font-size-sm); font-weight: 600; }
@ -67,11 +96,7 @@ button.nebula-team-companion:hover:not(:disabled) .nebula-team-action { backgrou
// Amélioration : le compagnon à gauche, les étoiles à droite.
.nebula-team-improve { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: var(--space-4); align-items: start; }
.nebula-team-rule { display: grid; grid-column: 1 / -1; gap: var(--space-2); }
.nebula-team-rule p { max-width: 80ch; }
.nebula-team-rule strong[data-kind="gold"] { color: var(--color-accent-gold); }
.nebula-team-rule strong[data-kind="black"] { padding: 0 var(--space-2); border: 1px solid var(--color-text-secondary); border-radius: var(--radius-pill); background: #000; color: var(--color-text-primary); }
.nebula-team-rule strong[data-kind="dust"] { color: #c4b5fd; }
.nebula-team-improve > h3 { grid-column: 1 / -1; }
.nds-panel.nebula-team-stars-panel { display: grid; gap: var(--space-3); min-width: 0; padding: var(--space-4) var(--space-5); }
.nebula-team-ladder { display: grid; grid-auto-columns: minmax(0, 1fr); grid-auto-flow: column; gap: var(--space-2); }
.nebula-team-ladder li { display: grid; padding: var(--space-2) var(--space-1); border: 1px solid var(--color-border); border-radius: var(--radius-sm); color: var(--color-text-muted); text-align: center; }
@ -87,24 +112,44 @@ button.nebula-team-companion:hover:not(:disabled) .nebula-team-action { backgrou
.nebula-team-star:hover:not([aria-disabled]) { border-color: var(--color-text-primary); box-shadow: var(--shadow-primary); }
.nebula-team-star:focus-visible { outline: 2px solid var(--color-text-primary); outline-offset: 2px; }
.nebula-team-star[aria-disabled] { cursor: default; }
.nebula-team-star > span { display: grid; place-items: center; }
.nebula-team-star > span { display: grid; width: 100%; height: 100%; place-items: center; }
// L'icône de poussière est faite pour s'aligner sur du texte : dans un rond, elle se centre sans décalage.
:is(.nebula-team-star, .nebula-team-stars-left i) .nebula-currency-icon { width: 72%; height: 72%; margin: 0; vertical-align: 0; }
.nebula-team-star[data-kind="gold"], .nebula-team-star[data-kind="gold"]:hover { border-color: var(--color-accent-gold); background: #241d08; color: var(--color-accent-gold); }
.nebula-team-star[data-kind="black"], .nebula-team-star[data-kind="black"]:hover { border-color: var(--color-text-secondary); background: #000; }
.nebula-team-star[data-kind="dust"], .nebula-team-star[data-kind="dust"]:hover { border-color: #c4b5fd; background: radial-gradient(circle at 35% 30%, #6d52c9, #2c1d63); }
.nebula-team-star[data-missed] { opacity: 0.45; }
.nebula-team-risk { font-weight: 700; }
.nebula-team-risk strong { font-size: var(--font-size-lg); }
.nebula-team-risk strong[data-risk="low"] { color: var(--color-success); }
.nebula-team-risk strong[data-risk="medium"] { color: var(--color-warning); }
.nebula-team-risk strong[data-risk="high"] { color: var(--color-danger); }
.nebula-team-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); }
.nds-button.nebula-team-heal { display: inline-flex; align-items: center; gap: var(--space-2); }
.nebula-team-heal img { flex: none; width: 46px; height: 38px; margin-block: -10px; object-fit: contain; }
.nebula-team-actions > span, .nebula-team-note, .nebula-team-recruit p { color: var(--color-text-muted); font-size: var(--font-size-sm); }
.nebula-team-recruit { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-4); }
.nebula-team-confirm { display: grid; gap: var(--space-3); margin: 0; }
.nebula-team > .nds-inline-notice { margin: 0; }
@container nebula-team (min-width: 1040px) {
.nebula-team-recruiting { grid-template-areas: "main stars" "team ." "members ."; grid-template-columns: minmax(0, 1fr) 300px; }
.nebula-team-stars-left { display: grid; gap: var(--space-2); }
.nebula-team-stars-left ul { display: grid; }
.nebula-team-stars-left li { border-radius: var(--radius-md); padding: var(--space-2) var(--space-3) var(--space-2) var(--space-2); }
.nebula-team-offer-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: 840px; }
}
@container nebula-team (max-width: 760px) {
.nebula-team-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.nebula-team-improve { grid-template-columns: 170px minmax(0, 1fr); }
.nebula-team-offer-cards { gap: var(--space-3); }
}
@container nebula-team (max-width: 620px) {
.nebula-team-members { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@container nebula-team (max-width: 520px) {
.nebula-team-improve { grid-template-columns: minmax(0, 1fr); }
.nebula-team-improve > .nebula-team-companion { max-width: 200px; }