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>
45 lines
3.1 KiB
JavaScript
45 lines
3.1 KiB
JavaScript
/**
|
|
* @file Une carte jouable dans la préparation d'une expédition ou l'inscription à une expédition ouverte : la
|
|
* carte, sa Puissance en haut à droite, ses stats en icônes (nom au survol) et ses étiquettes : celles
|
|
* utiles à la destination en pastilles (condition, dangers parés, Affinité), toutes au survol de
|
|
* l'icône d'étiquette.
|
|
*/
|
|
|
|
import { Tooltip } from "../../components/Tooltip.jsx";
|
|
import { fillTemplate } from "./dailyShare.js";
|
|
import { cardHelps, editionEntry, formatDecimal, STAT_BY_PLAN, STAT_IDS, tagLabel } from "./expeditionFormat.js";
|
|
import { MaskIcon } from "./ExpeditionLabels.jsx";
|
|
import { NebulaCard } from "./NebulaCard.jsx";
|
|
|
|
export function ExpeditionCardTile({ catalog, card, destination, content, selected, sortKey = null, onSelect }) {
|
|
const entry = editionEntry(catalog, card.editionId);
|
|
if (!entry) return null;
|
|
const vocation = STAT_BY_PLAN[card.plan];
|
|
const helps = cardHelps(card, destination);
|
|
const tags = (card.tags || []).map((tag) => tagLabel(catalog, tag));
|
|
const powerLabel = vocation ? fillTemplate(content.powerVocation, { power: card.power, stat: content.stats[vocation] }) : fillTemplate(content.power, { power: card.power });
|
|
return <li data-busy={card.busy || undefined} data-selected={selected || undefined}>
|
|
<div className="nebula-expedition-card-frame">
|
|
<NebulaCard catalog={catalog} entry={entry} size="sm" selected={selected} disabled={card.busy} onSelect={card.busy ? undefined : onSelect}
|
|
selectLabel={fillTemplate(content.chooseCard, { card: entry.card.name })} />
|
|
<Tooltip className="nebula-expedition-card-power" content={powerLabel} aria-label={powerLabel} tabIndex={-1}>
|
|
{vocation && <MaskIcon name={vocation} />}<span aria-hidden="true">{card.power}</span>
|
|
</Tooltip>
|
|
{card.busy && <span className="nebula-expedition-card-busy">{content.busy}</span>}
|
|
</div>
|
|
<span className="nebula-expedition-stats" role="list" aria-label={content.chosenStats}>{STAT_IDS.map((stat) => {
|
|
const label = `${content.stats[stat]} : ${formatDecimal(card.stats[stat])}`;
|
|
return <Tooltip key={stat} className="nebula-expedition-stat" content={content.stats[stat]} role="listitem" aria-label={label} tabIndex={-1} data-sorted={stat === sortKey || undefined}>
|
|
<MaskIcon name={stat} /><span aria-hidden="true">{formatDecimal(card.stats[stat])}</span>
|
|
</Tooltip>;
|
|
})}</span>
|
|
<span className="nebula-expedition-card-tags">
|
|
{helps.condition && <span className="nds-badge" data-variant="success">{content.tagCondition}</span>}
|
|
{helps.dangers.map((danger) => <span key={danger.id} className="nds-badge" data-variant="success">{fillTemplate(content.tagParry, { label: danger.label })}</span>)}
|
|
{helps.affinity && <span className="nds-badge" data-variant="gold">{content.tagAffinity}</span>}
|
|
<Tooltip className="nebula-expedition-card-taglist" content={tags.length ? tags.join(" · ") : content.tagsNone} aria-label={fillTemplate(content.tagsLabel, { tags: tags.join(", ") || content.tagsNone })} tabIndex={0}>
|
|
<MaskIcon name="tag" /><span aria-hidden="true">{tags.length}</span>
|
|
</Tooltip>
|
|
</span>
|
|
</li>;
|
|
}
|