Turn the comments that describe functions into JSDoc so the editor shows them on hover
The 669 // comments sitting right above a function, method or hook become /** */ blocks, unchanged in wording; eslint directives stay right above the line they target. website/AGENTS.md now asks for JSDoc on function comments and // inside function bodies. ExpeditionPlanner.jsx grew past 300 lines and gets its full header, as the header test requires. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
88c7bf8317
commit
166790245f
152 changed files with 1389 additions and 967 deletions
|
|
@ -27,7 +27,7 @@ const plural = (count, singular, pluralForm = `${singular}s`) => `${count.toLoca
|
|||
|
||||
const isExpired = (campaign, now) => campaign.expiresAt != null && campaign.expiresAt <= now;
|
||||
|
||||
// Une campagne est terminée quand son code ne sert plus : révoquée, expirée ou épuisée.
|
||||
/** Une campagne est terminée quand son code ne sert plus : révoquée, expirée ou épuisée. */
|
||||
const isEnded = (campaign, now) => Boolean(campaign.revokedAt) || isExpired(campaign, now) || (campaign.maxClaims != null && campaign.claimedCount >= campaign.maxClaims);
|
||||
const CAMPAIGN_FILTERS = [["all", "Toutes"], ["active", "En cours"], ["ended", "Terminées"]];
|
||||
|
||||
|
|
@ -47,8 +47,10 @@ function editionGroups(catalog, lookup, collectionId) {
|
|||
|
||||
const describeEdition = (lookup, edition) => `${lookup.cards.get(edition.cardId)?.name} — ${lookup.rarityLabel(edition.rarity)}${edition.finishIds[0] !== "standard" ? ` · ${lookup.finishLabel(edition)}` : ""}`;
|
||||
|
||||
// Grille visuelle des cartes d'une collection en format sm, filtrable par rareté et par nom.
|
||||
// Sert au choix d'une carte unique (garantie) comme à la sélection multiple des cartes offertes.
|
||||
/**
|
||||
* Grille visuelle des cartes d'une collection en format sm, filtrable par rareté et par nom.
|
||||
* Sert au choix d'une carte unique (garantie) comme à la sélection multiple des cartes offertes.
|
||||
*/
|
||||
function CardPicker({ catalog, lookup, collectionId, isSelected, onPick, label, status, statusEmpty, verb }) {
|
||||
const [rarity, setRarity] = useState("all");
|
||||
const [search, setSearch] = useState("");
|
||||
|
|
@ -91,7 +93,7 @@ function newPack(catalog) {
|
|||
};
|
||||
}
|
||||
|
||||
// Ce qu'il manque à un paquet pour être offert ; vide quand il est prêt.
|
||||
/** Ce qu'il manque à un paquet pour être offert ; vide quand il est prêt. */
|
||||
function packIssues(pack, index, lookup) {
|
||||
const label = `paquet ${index + 1}`;
|
||||
const issues = [];
|
||||
|
|
@ -118,7 +120,7 @@ function buildPack(pack) {
|
|||
|
||||
const clampQuantity = (value) => Math.min(10, Math.max(1, Number(value) || 1));
|
||||
|
||||
// Cartes offertes : un clic coche ou décoche une carte ; chaque carte cochée est offerte en un exemplaire.
|
||||
/** Cartes offertes : un clic coche ou décoche une carte ; chaque carte cochée est offerte en un exemplaire. */
|
||||
function CardsSection({ catalog, lookup, cards, setCards, onRemove }) {
|
||||
const [collectionId, setCollectionId] = useState(catalog.collections[0]?.id || "");
|
||||
const selectedIds = new Set(cards.map((card) => card.editionId));
|
||||
|
|
@ -226,7 +228,7 @@ function initialDraft() {
|
|||
};
|
||||
}
|
||||
|
||||
// Brouillon d'une copie : même nom, même récompense, même limite et même durée de validité ; le code reste à choisir.
|
||||
/** Brouillon d'une copie : même nom, même récompense, même limite et même durée de validité ; le code reste à choisir. */
|
||||
function duplicateDraft(campaign, catalog) {
|
||||
const items = campaign.reward?.items || [];
|
||||
const cards = items.filter((item) => item.type === "card").map((item) => ({ editionId: item.editionId }));
|
||||
|
|
@ -326,7 +328,7 @@ function CopyCodeButton({ code }) {
|
|||
return <button className="nds-button" data-size="sm" data-variant="secondary" type="button" onClick={async () => { await navigator.clipboard?.writeText(code); setCopied(true); }}>{copied ? "Copié" : "Copier le code"}</button>;
|
||||
}
|
||||
|
||||
// Confirmation compacte après création : le code à annoncer, prêt à copier.
|
||||
/** Confirmation compacte après création : le code à annoncer, prêt à copier. */
|
||||
function CreatedCampaign({ campaign, onClose }) {
|
||||
const panelRef = useRef(null);
|
||||
// Amène la confirmation à l'écran une seule fois, à la création de la campagne.
|
||||
|
|
@ -386,7 +388,7 @@ export function AdminDistributions({ catalog, lookup, dashboard, mutateCampaigns
|
|||
const counts = { all: campaigns.length, ended: campaigns.filter((campaign) => isEnded(campaign, now)).length };
|
||||
counts.active = counts.all - counts.ended;
|
||||
const shown = filter === "all" ? campaigns : campaigns.filter((campaign) => isEnded(campaign, now) === (filter === "ended"));
|
||||
// `creating` vaut false, true (nouvelle campagne) ou la campagne à dupliquer ; la clé recrée le formulaire à chaque copie.
|
||||
/** `creating` vaut false, true (nouvelle campagne) ou la campagne à dupliquer ; la clé recrée le formulaire à chaque copie. */
|
||||
const startCreating = (source) => { setCreating(source || true); setCreated(null); };
|
||||
|
||||
// La liste d'abord ; le formulaire s'ouvre à la demande et se referme après la création.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue