// Rôle : indices facultatifs de la Carte du jour : cinq cadres de taille fixe, un à dévoiler par essai raté, dans l'ordre choisi par le joueur. import { DailyIcon } from "./DailyIcon.jsx"; import { fillTemplate } from "./dailyShare.js"; // Texte dont certains mots manquent : le serveur ne les envoie pas. function MaskedText({ parts, content }) { return parts.map((part, index) => (part.hidden ? {content.hintHiddenWord} : {part.text})); } function HintValue({ catalog, hint, content }) { if (hint.id === "album") return {hint.value ? content.hintAlbumYes : content.hintAlbumNo}; if (hint.id === "theme") return {hint.value}; if (hint.id === "collection") return {catalog.collections.find((item) => item.id === hint.value)?.name}; if (hint.id === "page") return ; return ; } function helpText(daily, content) { if (daily.hintCredits > 1) return content.hintsMany; if (daily.hintCredits === 1) return content.hintsOne; if (!daily.guesses.length) return content.hintsRule; return daily.guesses.length === daily.maxGuesses - 1 || daily.hintChoices.every((choice) => choice.known || daily.hints.some((hint) => hint.id === choice.id)) ? content.hintsSpent : content.hintsNext; } // Réserve d'indices : une loupe par indice à dévoiler. function HintPurse({ credits, content }) { return 0 || undefined} role="status"> {Array.from({ length: Math.max(1, credits) }, (_, index) => )} {credits ? fillTemplate(credits > 1 ? content.hintCreditsMany : content.hintCreditsOne, { count: credits }) : content.hintCreditsNone} ; } export function DailyHints({ catalog, daily, busy, content, onUse }) { const opened = new Map(daily.hints.map((hint) => [hint.id, hint])); const guessedTheme = daily.guesses.find((guess) => guess.theme?.same)?.theme.label; return {content.hintsTitle} {helpText(daily, content)} {daily.hintChoices.map(({ id, known, available }) => { const { title, text } = content.hints[id]; // Un thème trouvé par un essai s'affiche ouvert, sans coûter d'indice. const found = known && id === "theme" && guessedTheme ? { id, value: guessedTheme } : null; const hint = opened.get(id) || found; const icon = ; if (hint) return {icon}{opened.has(id) ? title : fillTemplate(content.hintKnown, { title })}; return onUse(id)}>{icon}{title}{text} ; })} ; }
{helpText(daily, content)}