sokko-g/website/src/features/cards/TeamWelcome.jsx
Shinuwa 22b397ebfa Document Sokko G's architecture and folders, and move JavaScript file headers to JSDoc @file blocks
Add ARCHITECTURE.md (layers, flows, folder map, glossary), CONTRIBUTING.md
(setup and step-by-step recipes) and a README in each main folder, with an
index of docs/. Convert the 511 JavaScript headers from "// Rôle :" lines to
JSDoc @file blocks, define a three-level header template in website/AGENTS.md
and check the header in tests/file-headers.test.mjs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 09:42:13 +01:00

51 lines
2.9 KiB
JavaScript

/**
* @file Accueil de l'Équipe du jour quand le joueur n'a pas d'équipe (ou qu'elle s'est reposée) : un appel à
* recruter, cinq places à pourvoir, puis les trois étapes (recruter, améliorer, partir en quête),
* chacune avec un visuel. L'équipe n'est liée à aucun jeu.
*/
import { CurrencyIcon } from "./Currency.jsx";
import { fillTemplate } from "./dailyShare.js";
const TABLE_ART = "/static/img/cards/guild/tavern.webp";
// Trois personnages du catalogue, pris loin les uns des autres, pour montrer une proposition de recrutement.
function sampleCards(catalog) {
const cards = catalog.cards.filter((card) => card.image && card.expedition?.profile);
const pool = cards.length >= 3 ? cards : catalog.cards.filter((card) => card.image);
return pool.length ? [0, Math.floor(pool.length / 2), pool.length - 1].map((index) => pool[index]) : [];
}
const STEP_VISUALS = {
recruit: ({ catalog }) => <span className="nebula-team-welcome-fan">{sampleCards(catalog).map((card) => <img key={card.id} src={card.image} alt="" loading="lazy" />)}</span>,
improve: () => <span className="nebula-team-welcome-stars">
<i data-kind="gold">★</i><i data-kind="gold">★</i><i data-kind="hidden">?</i><i data-kind="black">✖</i><i data-kind="dust"><CurrencyIcon kind="stardust" /></i>
</span>,
quest: ({ maxDays }) => <span className="nebula-team-welcome-days">{Array.from({ length: maxDays }, (_, index) => <i key={index}>{index + 1}</i>)}</span>
};
export function TeamWelcome({ catalog, team, content, action }) {
const expired = team.status === "expired";
return <>
<section className="nds-panel nebula-team-welcome" aria-labelledby="nebula-team-none-title">
<img className="nebula-team-welcome-bg" src={TABLE_ART} alt="" />
<div className="nebula-team-welcome-copy">
<h3 id="nebula-team-none-title">{expired ? content.expiredTitle : content.noneTitle}</h3>
<p>{fillTemplate(expired ? content.expiredText : content.noneText, { max: team.maxDays })}</p>
<ol className="nebula-team-welcome-slots" aria-hidden="true">{Array.from({ length: 5 }, (_, index) => <li key={index}>{index + 1}</li>)}</ol>
{action}
</div>
</section>
<ol className="nebula-team-welcome-steps" aria-label={content.welcomeStepsLabel}>{content.welcomeSteps.map((step, index) => {
const Visual = STEP_VISUALS[step.id];
return <li key={step.id} className="nds-card">
<div className="nebula-team-welcome-visual" aria-hidden="true"><span className="nebula-team-welcome-number">{index + 1}</span>{Visual && <Visual catalog={catalog} maxDays={team.maxDays} />}</div>
<div className="nds-card-body">
<h4>{step.title}</h4>
<p>{fillTemplate(step.text, { max: team.maxDays })}</p>
{step.tip && <p className="nebula-team-welcome-tip">{step.tip}</p>}
</div>
</li>;
})}</ol>
</>;
}