Add the Guilde des Veilleurs and its daily guess-the-card quest to Sokko TCG
- La Carte du jour: one zoomed card shared by all players each Paris day, six guesses with collection and rarity hints, a fixed stardust reward and an emoji result to share. - The Guilde des Veilleurs lists the quests, with a menu entry, a home banner and an admin section for quest settings. - The section menu folds into a dropdown below 960 px; the home pairs the guild with the best pull and moves the opening reserve under the menu. - The shop pack share moves to the shop collection admin page, which recalls where the pack draws its cards. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
ecc2040352
commit
0ef213cf4f
37 changed files with 1532 additions and 127 deletions
|
|
@ -1,6 +1,11 @@
|
|||
// Rôle : fournit un champ NDS d'autocomplete libre pour les catégories.
|
||||
import { forwardRef, useId, useMemo, useRef, useState } from "react";
|
||||
|
||||
// Recherche sans casse ni accents : « neant » trouve « Néant ».
|
||||
function searchKey(value) {
|
||||
return value.normalize("NFD").replace(/\p{Diacritic}/gu, "").toLowerCase();
|
||||
}
|
||||
|
||||
function normalizeOptions(options) {
|
||||
const seen = new Set();
|
||||
return (options || [])
|
||||
|
|
@ -35,9 +40,9 @@ export const CategoryAutocompleteInput = forwardRef(function CategoryAutocomplet
|
|||
const cleanOptions = useMemo(() => normalizeOptions(options), [options]);
|
||||
const cleanValue = String(value || "");
|
||||
const filteredOptions = useMemo(() => {
|
||||
const query = cleanValue.trim().toLowerCase();
|
||||
const query = searchKey(cleanValue.trim());
|
||||
const matches = query
|
||||
? cleanOptions.filter((option) => option.toLowerCase().includes(query))
|
||||
? cleanOptions.filter((option) => searchKey(option).includes(query))
|
||||
: cleanOptions;
|
||||
return matches.slice(0, maxOptions);
|
||||
}, [cleanOptions, cleanValue, maxOptions]);
|
||||
|
|
|
|||
|
|
@ -1,19 +1,53 @@
|
|||
// Rôle : fournit le cadre commun des tableaux de bord joueur et administration (menu de sections et encart associé, compte, chiffres clés).
|
||||
import { createContext, useContext, useState } from "react";
|
||||
import { createContext, useContext, useEffect, useId, useRef, useState } from "react";
|
||||
import { createPortal } from "react-dom";
|
||||
|
||||
const AsideSlotContext = createContext(null);
|
||||
|
||||
// Menu de sections : colonne toujours ouverte dans le tableau de bord large ; en demi-écran, un bouton
|
||||
// qui affiche la section courante ouvre la liste, refermée au choix d'une entrée, par Échap ou par un clic ailleurs.
|
||||
function DashboardMenu({ label, groups, active, hrefFor }) {
|
||||
const [open, setOpen] = useState(false);
|
||||
const menuRef = useRef(null);
|
||||
const toggleRef = useRef(null);
|
||||
const navId = useId();
|
||||
const items = groups.flat();
|
||||
const activeLabel = items.find(([id]) => id === active)?.[1] ?? label;
|
||||
const pending = items.reduce((total, [, , count]) => total + (count || 0), 0);
|
||||
|
||||
useEffect(() => {
|
||||
if (!open) return undefined;
|
||||
const closeOutside = (event) => { if (!menuRef.current?.contains(event.target)) setOpen(false); };
|
||||
document.addEventListener("pointerdown", closeOutside);
|
||||
return () => document.removeEventListener("pointerdown", closeOutside);
|
||||
}, [open]);
|
||||
|
||||
const closeOnEscape = (event) => {
|
||||
if (event.key !== "Escape" || !open) return;
|
||||
setOpen(false);
|
||||
toggleRef.current?.focus();
|
||||
};
|
||||
|
||||
return <div ref={menuRef} className="nebula-dashboard-menu" onKeyDown={closeOnEscape}>
|
||||
<button ref={toggleRef} className="nebula-dashboard-menu-toggle" type="button" aria-expanded={open} aria-controls={navId} onClick={() => setOpen((value) => !value)}>
|
||||
<span className="nebula-dashboard-menu-icon" aria-hidden="true" />
|
||||
<span className="nebula-dashboard-menu-current"><span className="sr-only">{label} : </span>{activeLabel}</span>
|
||||
{pending > 0 && !open && <span className="nds-badge" data-variant="gold">{pending}</span>}
|
||||
</button>
|
||||
<nav id={navId} className="nebula-dashboard-nav" aria-label={label} data-open={open || undefined} onClick={(event) => { if (event.target.closest("a")) setOpen(false); }}>
|
||||
{groups.map((group) => <div key={group[0][0]} className="nebula-dashboard-nav-group">
|
||||
{group.map(([id, itemLabel, count]) => <a key={id} className="nebula-dashboard-nav-item" href={hrefFor(id)} aria-current={active === id ? "page" : undefined}>{itemLabel}{count > 0 && <span className="nds-badge" data-variant="gold">{count}</span>}</a>)}
|
||||
</div>)}
|
||||
</nav>
|
||||
</div>;
|
||||
}
|
||||
|
||||
export function CardsDashboardLayout({ label, groups, active, hrefFor, switchLink = null, busy = false, children }) {
|
||||
const [asideSlot, setAsideSlot] = useState(null);
|
||||
return <div className="nebula-dashboard-shell">
|
||||
<div className="nebula-dashboard-aside">
|
||||
{switchLink && <a className="nds-button" data-size="sm" data-variant="secondary" href={switchLink.href}>{switchLink.label}</a>}
|
||||
<nav className="nebula-dashboard-nav" aria-label={label}>
|
||||
{groups.map((items) => <div key={items[0][0]} className="nebula-dashboard-nav-group">
|
||||
{items.map(([id, itemLabel, count]) => <a key={id} className="nebula-dashboard-nav-item" href={hrefFor(id)} aria-current={active === id ? "page" : undefined}>{itemLabel}{count > 0 && <span className="nds-badge" data-variant="gold">{count}</span>}</a>)}
|
||||
</div>)}
|
||||
</nav>
|
||||
<DashboardMenu label={label} groups={groups} active={active} hrefFor={hrefFor} />
|
||||
<div ref={setAsideSlot} className="nebula-dashboard-aside-slot" />
|
||||
</div>
|
||||
<div className="nebula-dashboard-section" data-section={active} aria-busy={busy || undefined}>
|
||||
|
|
|
|||
|
|
@ -1,13 +1,33 @@
|
|||
// Rôle : compose le tableau de bord d'accueil compact de Sokko TCG.
|
||||
import { useState } from "react";
|
||||
import { CardDetailModal } from "./CardDetailModal.jsx";
|
||||
import { DashboardStat } from "./CardsDashboard.jsx";
|
||||
import { DashboardAside, DashboardStat } from "./CardsDashboard.jsx";
|
||||
import { readCollection } from "./collectionState.js";
|
||||
import { NebulaCard } from "./NebulaCard.jsx";
|
||||
import { OpeningReserve } from "./OpeningReserve.jsx";
|
||||
import { fillTemplate } from "./dailyShare.js";
|
||||
import { pendingQuestCount } from "./guildQuests.js";
|
||||
import { StardustBalance } from "./ShopPanel.jsx";
|
||||
|
||||
export function CardsHomePanel({ catalog, state, runMutation, busy, content, onOpenPacks }) {
|
||||
// Le dragon des Veilleurs, parchemin de quête en main : l'emblème de la Guilde, propre à elle et non à l'une de ses quêtes.
|
||||
const GUILD_ILLUSTRATION = "/static/img/cards/guild-veilleurs.webp";
|
||||
|
||||
// Encart de la Guilde des Veilleurs, à côté du meilleur tirage : une entrée vers la Guilde, qui annonce combien de quêtes attendent sans les détailler.
|
||||
function GuildBanner({ state, content, guildContent }) {
|
||||
const pending = pendingQuestCount(state);
|
||||
const status = pending ? fillTemplate(content.guildPending, { count: pending, s: pending > 1 ? "s" : "", ent: pending > 1 ? "ent" : "" }) : content.guildIdle;
|
||||
return <section className="nds-panel nebula-guild-banner" data-pending={pending > 0 || undefined} aria-labelledby="nebula-guild-banner-title">
|
||||
<span className="nebula-guild-banner-art" aria-hidden="true"><img src={GUILD_ILLUSTRATION} alt="" /></span>
|
||||
<div className="nebula-guild-banner-copy">
|
||||
<h3 id="nebula-guild-banner-title">{guildContent.title}</h3>
|
||||
<p>{content.guildTagline}</p>
|
||||
<p className="nebula-guild-banner-status">{status}</p>
|
||||
<a className="nds-button" data-size="sm" data-variant={pending ? "primary" : "secondary"} href="#/cards/guild">{content.guildAction}</a>
|
||||
</div>
|
||||
</section>;
|
||||
}
|
||||
|
||||
export function CardsHomePanel({ catalog, state, runMutation, busy, content, guildContent, onOpenPacks }) {
|
||||
const [detailOpen, setDetailOpen] = useState(false);
|
||||
const collectibleCards = catalog.cards.filter((card) => catalog.editions.some((edition) => edition.cardId === card.id && !edition.promotional));
|
||||
const collectibleEditions = catalog.editions.filter((edition) => !edition.promotional);
|
||||
|
|
@ -22,10 +42,15 @@ export function CardsHomePanel({ catalog, state, runMutation, busy, content, onO
|
|||
<div><p className="eyebrow">{content.eyebrow}</p><h2 id="nebula-home-title">{content.title}</h2></div>
|
||||
</div>
|
||||
{state.pendingOpening && <div className="nds-inline-notice nebula-home-resume" data-variant="warning"><span>{content.resume}</span><button className="nds-button" data-size="sm" data-variant="primary" type="button" onClick={onOpenPacks}>{content.resumeAction}</button></div>}
|
||||
<div className="nebula-home-grid">
|
||||
<OpeningReserve recharge={state.recharge} content={content}>
|
||||
{/* Comme sur Paquets, la réserve d'ouvertures se range sous le menu, avec un accès direct aux paquets. */}
|
||||
<DashboardAside>
|
||||
<OpeningReserve recharge={state.recharge} content={content} compact>
|
||||
<button className="nds-button" data-size="sm" data-variant="primary" type="button" onClick={onOpenPacks}>{content.browsePacks}</button>
|
||||
</OpeningReserve>
|
||||
</DashboardAside>
|
||||
{/* La Guilde et le meilleur tirage se partagent une rangée à parts égales, les chiffres clés suivent. */}
|
||||
<div className="nebula-home-highlights">
|
||||
<GuildBanner state={state} content={content} guildContent={guildContent} />
|
||||
<section className="nds-panel nebula-home-rarest" aria-labelledby="nebula-home-rarest-title">
|
||||
<div className="nebula-home-rarest-copy">
|
||||
<p className="eyebrow">{content.rarestEyebrow}</p>
|
||||
|
|
|
|||
|
|
@ -8,16 +8,21 @@ import { deleteCardsAccount, devLogin, loadCardsSession, loadCardsState, logoutC
|
|||
import { CardsAccount, CardsDashboardLayout } from "./CardsDashboard.jsx";
|
||||
import { CardsHomePanel } from "./CardsHomePanel.jsx";
|
||||
import { CollectionPanel } from "./CollectionPanel.jsx";
|
||||
import { DailyPanel } from "./DailyPanel.jsx";
|
||||
import { HistoryPanel } from "./HistoryPanel.jsx";
|
||||
import { PackPanel } from "./PackPanel.jsx";
|
||||
import { publishCardsReserve } from "./cardsReserve.js";
|
||||
import { PrivacyNotice } from "./PrivacyNotice.jsx";
|
||||
import { GuildPanel } from "./GuildPanel.jsx";
|
||||
import { pendingQuestCount } from "./guildQuests.js";
|
||||
import { ShopPanel } from "./ShopPanel.jsx";
|
||||
import { TransfersPanel } from "./TransfersPanel.jsx";
|
||||
|
||||
// Le jeu, puis l'économie et les échanges, puis le journal : mêmes groupes séparés par un filet que l'administration.
|
||||
const PLAYER_NAVIGATION = [["home", "packs", "collection"], ["shop", "transfers"], ["history", "account"]];
|
||||
const PLAYER_SECTIONS = new Set(PLAYER_NAVIGATION.flat());
|
||||
const PLAYER_NAVIGATION = [["home", "guild", "packs", "collection"], ["shop", "transfers"], ["history", "account"]];
|
||||
// Sections sans entrée de menu, ouvertes depuis une autre : le menu y désigne cette section parente.
|
||||
const SUBSECTION_PARENTS = { daily: "guild" };
|
||||
const PLAYER_SECTIONS = new Set([...PLAYER_NAVIGATION.flat(), ...Object.keys(SUBSECTION_PARENTS)]);
|
||||
// Ancienne adresse conservée pour les favoris : le recyclage vit désormais dans la Collection.
|
||||
const PLAYER_SECTION_ALIASES = { recycling: "collection" };
|
||||
|
||||
|
|
@ -237,7 +242,10 @@ export function CardsPage({ siteContent, cardsConfig, playerSection = "", adminM
|
|||
</div>;
|
||||
|
||||
const openPacks = () => navigate("/cards/packs");
|
||||
const pendingTransfers = state.transfers.filter((transfer) => transfer.status === "open" && transfer.direction === "received").length;
|
||||
const navigationCounts = {
|
||||
guild: pendingQuestCount(state),
|
||||
transfers: state.transfers.filter((transfer) => transfer.status === "open" && transfer.direction === "received").length
|
||||
};
|
||||
const startTransfer = (type, editionId) => {
|
||||
setTransferDraft({ type, editionId });
|
||||
navigate("/cards/transfers");
|
||||
|
|
@ -258,12 +266,14 @@ export function CardsPage({ siteContent, cardsConfig, playerSection = "", adminM
|
|||
{notices}
|
||||
<CardsDashboardLayout
|
||||
label={`Sections de ${content.title}`}
|
||||
groups={PLAYER_NAVIGATION.map((ids) => ids.map((id) => [id, content.navigation[id], id === "transfers" ? pendingTransfers : 0]))}
|
||||
active={section}
|
||||
groups={PLAYER_NAVIGATION.map((ids) => ids.map((id) => [id, content.navigation[id], navigationCounts[id] || 0]))}
|
||||
active={SUBSECTION_PARENTS[section] || section}
|
||||
hrefFor={(id) => id === "home" ? "#/cards" : `#/cards/${id}`}
|
||||
switchLink={state.player.isAdmin ? { href: "#/cards/admin", label: "Administration" } : null}
|
||||
>
|
||||
{section === "home" && <CardsHomePanel {...panelProps} content={content.home} onOpenPacks={openPacks} />}
|
||||
{section === "home" && <CardsHomePanel {...panelProps} content={content.home} guildContent={content.guild} onOpenPacks={openPacks} />}
|
||||
{section === "guild" && <GuildPanel catalog={catalog} state={state} content={content.guild} />}
|
||||
{section === "daily" && <DailyPanel {...panelProps} content={content.daily} />}
|
||||
{section === "packs" && <PackPanel {...panelProps} content={content.packs} reserveContent={content.home} />}
|
||||
{section === "collection" && <CollectionPanel {...panelProps} headingContent={content.collection} recyclingContent={content.recycling} onStartTransfer={startTransfer} />}
|
||||
{section === "shop" && <ShopPanel {...panelProps} content={content.shop} onOpenPacks={openPacks} />}
|
||||
|
|
|
|||
189
website/src/features/cards/DailyPanel.jsx
Normal file
189
website/src/features/cards/DailyPanel.jsx
Normal file
|
|
@ -0,0 +1,189 @@
|
|||
// Rôle : présente la Carte du jour : illustration zoomée, propositions avec indices, révélation et résultat à partager.
|
||||
import { useEffect, useMemo, useState } from "react";
|
||||
import { CategoryAutocompleteInput } from "../../components/CategoryAutocompleteInput.jsx";
|
||||
import { guessDaily, loadDaily, loadDailyImage } from "./cardsApi.js";
|
||||
import { readCollection } from "./collectionState.js";
|
||||
import { dailyShareText, fillTemplate, findCardByName, formatCountdown, formatStreak } from "./dailyShare.js";
|
||||
import { NebulaCard } from "./NebulaCard.jsx";
|
||||
import { formatStardust } from "./stardustFormat.js";
|
||||
|
||||
const COUNTDOWN_TICK_MS = 30_000;
|
||||
|
||||
// Édition de référence d'une carte, pour l'afficher : la standard, jamais une variation mythique.
|
||||
function referenceEntry(catalog, cardId) {
|
||||
const card = catalog.cards.find((item) => item.id === cardId);
|
||||
const editions = catalog.editions.filter((edition) => edition.cardId === cardId && edition.rarity !== "mythic");
|
||||
const edition = editions.find((item) => !item.promotional) || editions[0];
|
||||
return card && edition ? { editionId: edition.id, edition, card } : null;
|
||||
}
|
||||
|
||||
function GuessRow({ catalog, guess, content }) {
|
||||
const entry = referenceEntry(catalog, guess.cardId);
|
||||
const collection = catalog.collections.find((item) => item.id === entry?.card.collectionId)?.name || "";
|
||||
const rarity = catalog.rarities.find((item) => item.id === entry?.edition.rarity)?.label || "";
|
||||
const rarityText = { equal: content.rarityEqual, higher: content.rarityHigher, lower: content.rarityLower }[guess.rarity];
|
||||
const rarityArrow = { equal: "=", higher: "↑", lower: "↓" }[guess.rarity];
|
||||
return <li className="nds-list-row nebula-daily-guess" data-correct={guess.correct || undefined}>
|
||||
<strong>{entry?.card.name || guess.cardId}</strong>
|
||||
{guess.correct ? <span className="nds-badge" data-variant="success">{content.found}</span> : <span className="nebula-daily-hints">
|
||||
<span className="nds-badge" data-variant={guess.sameCollection ? "success" : "neutral"}><span aria-hidden="true">{guess.sameCollection ? "✓" : "✗"}</span>{fillTemplate(guess.sameCollection ? content.sameCollection : content.otherCollection, { collection })}</span>
|
||||
<span className="nds-badge" data-variant={guess.rarity === "equal" ? "success" : "neutral"}><span aria-hidden="true">{rarityArrow}</span>{fillTemplate(rarityText, { rarity })}</span>
|
||||
</span>}
|
||||
</li>;
|
||||
}
|
||||
|
||||
function DailyResult({ catalog, state, daily, content, now }) {
|
||||
const [copied, setCopied] = useState(false);
|
||||
const answer = referenceEntry(catalog, daily.answerCardId);
|
||||
const owned = readCollection(state).ownedCardIds.has(daily.answerCardId);
|
||||
const won = daily.status === "won";
|
||||
async function share() {
|
||||
const text = dailyShareText(daily, { title: content.shareTitle, url: `${window.location.origin}/#/cards/daily` });
|
||||
try {
|
||||
await navigator.clipboard.writeText(text);
|
||||
setCopied(true);
|
||||
} catch {
|
||||
setCopied(false);
|
||||
}
|
||||
}
|
||||
return <section className="nds-panel nebula-daily-result" aria-labelledby="nebula-daily-result-title" data-status={daily.status}>
|
||||
<div className="nebula-daily-result-copy">
|
||||
<h3 id="nebula-daily-result-title">{won ? fillTemplate(content.wonTitle, { count: daily.guesses.length, max: daily.maxGuesses }) : content.lostTitle}</h3>
|
||||
{!won && <p>{content.lostText}</p>}
|
||||
{answer && <p className="nebula-daily-answer"><strong>{answer.card.name}</strong>{answer.card.description && <span>{answer.card.description}</span>}</p>}
|
||||
<div className="nebula-daily-result-badges">
|
||||
{won && daily.earned > 0 && <span className="nds-badge" data-variant="gold">{fillTemplate(content.earned, { reward: formatStardust(daily.earned) })}</span>}
|
||||
<span className="nds-badge" data-variant={owned ? "success" : "neutral"}>{owned ? content.owned : content.notOwned}</span>
|
||||
{daily.streak > 0 && <span className="nds-badge" data-variant="neutral">{fillTemplate(content.streak, { streak: formatStreak(daily.streak) })}</span>}
|
||||
</div>
|
||||
<div className="nds-toolbar nebula-daily-result-actions">
|
||||
<button className="nds-button" data-size="sm" data-variant="primary" type="button" onClick={share}>{copied ? content.shared : content.share}</button>
|
||||
<span className="nebula-daily-next">{fillTemplate(content.next, { time: formatCountdown(daily.nextAt - now) })}</span>
|
||||
</div>
|
||||
</div>
|
||||
{answer && <div className="nebula-daily-result-card"><NebulaCard catalog={catalog} entry={answer} size="md" /></div>}
|
||||
</section>;
|
||||
}
|
||||
|
||||
export function DailyPanel({ catalog, state, runMutation, busy, content }) {
|
||||
const [daily, setDaily] = useState(null);
|
||||
const [loadError, setLoadError] = useState("");
|
||||
const [reloadKey, setReloadKey] = useState(0);
|
||||
const [image, setImage] = useState({ day: "", url: "", failed: false });
|
||||
const [guess, setGuess] = useState("");
|
||||
const [notice, setNotice] = useState("");
|
||||
const [now, setNow] = useState(() => Date.now());
|
||||
const day = daily?.day || "";
|
||||
|
||||
useEffect(() => {
|
||||
let active = true;
|
||||
loadDaily()
|
||||
.then((result) => { if (active) { setDaily(result); setLoadError(""); } })
|
||||
.catch((error) => { if (active) setLoadError(error.code === "DAILY_UNAVAILABLE" ? content.unavailable : error.message); });
|
||||
return () => { active = false; };
|
||||
}, [content.unavailable, reloadKey]);
|
||||
|
||||
// Une seule illustration par jour : elle reste en mémoire pendant la partie, le zoom ne fait que changer d'échelle.
|
||||
useEffect(() => {
|
||||
if (!day) return undefined;
|
||||
let active = true;
|
||||
let url = "";
|
||||
loadDailyImage()
|
||||
.then((objectUrl) => {
|
||||
url = objectUrl;
|
||||
if (active) setImage({ day, url: objectUrl, failed: false });
|
||||
else URL.revokeObjectURL(objectUrl);
|
||||
})
|
||||
.catch(() => { if (active) setImage({ day, url: "", failed: true }); });
|
||||
return () => {
|
||||
active = false;
|
||||
if (url) URL.revokeObjectURL(url);
|
||||
};
|
||||
}, [day]);
|
||||
|
||||
useEffect(() => {
|
||||
const timer = setInterval(() => setNow(Date.now()), COUNTDOWN_TICK_MS);
|
||||
return () => clearInterval(timer);
|
||||
}, []);
|
||||
|
||||
const guessable = useMemo(() => {
|
||||
if (!daily) return [];
|
||||
const collections = new Set(daily.collectionIds);
|
||||
const guessed = new Set(daily.guesses.map((item) => item.cardId));
|
||||
return catalog.cards.filter((card) => collections.has(card.collectionId) && !guessed.has(card.id)).sort((left, right) => left.name.localeCompare(right.name, "fr"));
|
||||
}, [catalog.cards, daily]);
|
||||
const options = useMemo(() => guessable.map((card) => card.name), [guessable]);
|
||||
|
||||
if (loadError) return <section className="nds-empty-state" role="alert"><h2>{content.title}</h2><p>{loadError}</p></section>;
|
||||
if (!daily) return <section className="nds-empty-state" aria-busy="true"><h2>{content.title}</h2></section>;
|
||||
|
||||
const expired = now >= daily.nextAt;
|
||||
const finished = daily.status !== "playing";
|
||||
const imageUrl = image.day === daily.day ? image.url : "";
|
||||
const imageFailed = image.day === daily.day && image.failed;
|
||||
|
||||
async function submit(event) {
|
||||
event.preventDefault();
|
||||
setNotice("");
|
||||
const card = findCardByName(catalog.cards.filter((item) => daily.collectionIds.includes(item.collectionId)), guess);
|
||||
if (!card) return setNotice(content.guessUnknown);
|
||||
if (daily.guesses.some((item) => item.cardId === card.id)) return setNotice(content.guessRepeated);
|
||||
// Les refus propres à la partie restent dans ce panneau ; runMutation garde le reste (erreurs réseau, solde après une victoire).
|
||||
const result = await runMutation(async () => {
|
||||
try {
|
||||
return await guessDaily(daily.day, card.id);
|
||||
} catch (error) {
|
||||
if (String(error.code || "").startsWith("DAILY_")) return { dailyError: error };
|
||||
throw error;
|
||||
}
|
||||
});
|
||||
if (result?.daily) {
|
||||
setDaily(result.daily);
|
||||
setGuess("");
|
||||
} else if (result?.dailyError?.code === "DAILY_EXPIRED") {
|
||||
setNow(daily.nextAt);
|
||||
} else if (result?.dailyError) {
|
||||
setNotice(result.dailyError.message);
|
||||
}
|
||||
}
|
||||
|
||||
return <section className="nebula-daily" aria-labelledby="nebula-daily-title">
|
||||
<div className="nds-section-heading nebula-section-heading">
|
||||
<div><p className="eyebrow">{fillTemplate(content.number, { number: daily.number })}</p><h2 id="nebula-daily-title">{content.title}</h2></div>
|
||||
<div className="nebula-daily-heading-actions">
|
||||
<span className="nds-badge" data-variant="gold">{fillTemplate(content.reward, { reward: formatStardust(daily.reward) })}</span>
|
||||
<a className="nds-button" data-size="sm" data-variant="secondary" href="#/cards/guild">{content.back}</a>
|
||||
</div>
|
||||
</div>
|
||||
{expired && <div className="nds-inline-notice nebula-daily-expired" data-variant="warning" role="status"><span>{content.expired}</span><button className="nds-button" data-size="sm" data-variant="primary" type="button" onClick={() => { setNow(Date.now()); setReloadKey((key) => key + 1); }}>{content.reload}</button></div>}
|
||||
<div className="nebula-daily-layout">
|
||||
<div className="nds-panel nebula-daily-stage">
|
||||
<div className="nebula-daily-frame" data-finished={finished || undefined}>
|
||||
{imageUrl ? <img src={imageUrl} alt={content.imageAlt} draggable="false" style={{ transform: `scale(${daily.zoom})`, transformOrigin: `${daily.focus.x}% ${daily.focus.y}%` }} /> : <span className="nebula-daily-frame-status" role={imageFailed ? "alert" : "status"}>{imageFailed ? content.imageError : content.imageLoading}</span>}
|
||||
</div>
|
||||
<ol className="nebula-daily-steps" aria-label={fillTemplate(content.attempts, { count: Math.min(daily.guesses.length + (finished ? 0 : 1), daily.maxGuesses), max: daily.maxGuesses })}>
|
||||
{Array.from({ length: daily.maxGuesses }, (_, index) => {
|
||||
const item = daily.guesses[index];
|
||||
const result = item ? (item.correct ? "correct" : item.sameCollection ? "close" : "miss") : "empty";
|
||||
return <li key={index} data-result={result} />;
|
||||
})}
|
||||
</ol>
|
||||
</div>
|
||||
<div className="nebula-daily-play">
|
||||
{finished ? <DailyResult catalog={catalog} state={state} daily={daily} content={content} now={now} /> : <form className="nds-panel nebula-daily-form" onSubmit={submit}>
|
||||
<p>{content.intro}</p>
|
||||
<label htmlFor="nebula-daily-guess">{content.guessLabel} · {fillTemplate(content.attempts, { count: daily.guesses.length + 1, max: daily.maxGuesses })}</label>
|
||||
<div className="nebula-daily-form-row">
|
||||
<CategoryAutocompleteInput id="nebula-daily-guess" name="guess" options={options} value={guess} placeholder={content.guessPlaceholder} maxOptions={8} disabled={busy || expired} onChange={(event) => { setGuess(event.target.value); setNotice(""); }} />
|
||||
<button className="nds-button" data-variant="primary" type="submit" disabled={busy || expired || !guess.trim()}>{content.guessAction}</button>
|
||||
</div>
|
||||
{notice && <p className="nds-inline-notice" data-variant="warning" role="status">{notice}</p>}
|
||||
</form>}
|
||||
<section className="nebula-daily-guesses" aria-labelledby="nebula-daily-guesses-title">
|
||||
<h3 id="nebula-daily-guesses-title">{content.guessesTitle}</h3>
|
||||
{daily.guesses.length ? <ol>{daily.guesses.map((item) => <GuessRow key={item.cardId} catalog={catalog} guess={item} content={content} />)}</ol> : <p className="nebula-daily-empty">{content.noGuess}</p>}
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
</section>;
|
||||
}
|
||||
46
website/src/features/cards/GuildPanel.jsx
Normal file
46
website/src/features/cards/GuildPanel.jsx
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
// Rôle : présente la Guilde des Veilleurs et la tuile de chacune de ses quêtes, avec leur état.
|
||||
import { dailyQuestStatus, fillTemplate, formatStreak } from "./dailyShare.js";
|
||||
import { guildQuests } from "./guildQuests.js";
|
||||
|
||||
// Carte du jour : un dos vierge, propre à aucune collection et marqué d'un « ? », figure la carte cachée à retrouver.
|
||||
const DAILY_COVER = "/static/img/cards/empty-back.webp";
|
||||
|
||||
function DailyQuest({ summary: daily, content }) {
|
||||
const finished = daily.status !== "playing";
|
||||
return <article className="nds-card nebula-quest" data-status={daily.status} aria-labelledby="nebula-quest-daily-title">
|
||||
{/* La série en cours se range sous la couverture. */}
|
||||
<div className="nebula-quest-media">
|
||||
<div className="nds-card-cover nebula-quest-cover" aria-hidden="true">
|
||||
<img src={DAILY_COVER} alt="" />
|
||||
<span>?</span>
|
||||
</div>
|
||||
{daily.streak > 0 && <span className="nds-badge" data-variant="gold">{fillTemplate(content.dailyStreak, { streak: formatStreak(daily.streak) })}</span>}
|
||||
</div>
|
||||
<div className="nds-card-body nebula-quest-body">
|
||||
<p className="eyebrow">{content.dailyKind}</p>
|
||||
<h3 id="nebula-quest-daily-title">{content.dailyTitle}</h3>
|
||||
<p>{content.dailyDescription}</p>
|
||||
<p className="nebula-quest-status">{dailyQuestStatus(daily, content)}</p>
|
||||
<div className="nds-card-actions">
|
||||
<a className="nds-button" data-size="sm" data-variant={finished ? "secondary" : "primary"} href="#/cards/daily">{finished ? content.dailyResult : content.dailyAction}</a>
|
||||
</div>
|
||||
</div>
|
||||
</article>;
|
||||
}
|
||||
|
||||
// Tuile de chaque type de quête, choisie par l'identifiant donné dans guildQuests.
|
||||
const QUEST_TILES = { daily: DailyQuest };
|
||||
|
||||
export function GuildPanel({ catalog, state, content }) {
|
||||
const quests = guildQuests(state).filter((quest) => QUEST_TILES[quest.id]);
|
||||
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 }) => {
|
||||
const Tile = QUEST_TILES[id];
|
||||
return <Tile key={id} catalog={catalog} summary={summary} content={content} />;
|
||||
})}</div>
|
||||
: <div className="nds-empty-state"><p>{content.empty}</p></div>}
|
||||
</section>;
|
||||
}
|
||||
|
|
@ -15,7 +15,8 @@ const EVENT_LABELS = {
|
|||
campaign_claimed: "Code utilisé",
|
||||
gift_pack_opened: "Paquet offert ouvert",
|
||||
cards_recycled: "Doublons recyclés",
|
||||
opening_purchased: "Ouverture achetée"
|
||||
opening_purchased: "Ouverture achetée",
|
||||
daily_won: "Carte du jour trouvée"
|
||||
};
|
||||
|
||||
// Le journal garde la quantité réellement offerte : les comptes plus anciens n'ont reçu qu'une ouverture.
|
||||
|
|
@ -50,6 +51,7 @@ function HistoryDetail({ entry, catalog }) {
|
|||
const { details } = entry;
|
||||
if (details.sent || details.received) return <span>{[details.sent && `Donnée : ${cardReference(details.sent, catalog)}`, details.received && `Reçue : ${cardReference(details.received, catalog)}`].filter(Boolean).join(" · ")}</span>;
|
||||
if (entry.type === "cards_recycled") return <span>{details.count} exemplaire{details.count > 1 ? "s" : ""} · +{formatStardust(details.stardust)} d’étoiles</span>;
|
||||
if (entry.type === "daily_won") return <span>{`Défi n° ${details.number} · ${details.guesses}/6`}{details.stardust > 0 && ` · +${formatStardust(details.stardust)} d’étoiles`}</span>;
|
||||
if (entry.type === "opening_purchased") return <span>−{formatStardust(details.price)} d’étoiles</span>;
|
||||
if (!details.collectionId) return null;
|
||||
const name = catalog.collections.find((item) => item.id === details.collectionId)?.name;
|
||||
|
|
|
|||
|
|
@ -23,7 +23,8 @@ export function OpeningReserve({ recharge, content, children, compact = false })
|
|||
<div className="nebula-opening-reserve-copy">
|
||||
<h2>{content.available}</h2>
|
||||
<div className="nds-progress" role="progressbar" aria-valuemin="0" aria-valuemax="5" aria-valuenow={recharge.openingsBalance}><span style={{ width: `${recharge.openingsBalance / 5 * 100}%` }} /></div>
|
||||
<p>{recharge.nextOpeningAt ? <>{content.next} <strong>{formatRemaining(recharge.nextOpeningAt, now)}</strong></> : content.full}</p>
|
||||
{/* Sous le menu, le libellé court garde le compte à rebours sur la même ligne. */}
|
||||
<p>{recharge.nextOpeningAt ? <>{compact ? content.nextShort : content.next} <strong>{formatRemaining(recharge.nextOpeningAt, now)}</strong></> : content.full}</p>
|
||||
</div>
|
||||
{children && <div className="nds-toolbar nebula-opening-reserve-actions">{children}</div>}
|
||||
</section>;
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ import { openingSettingFor, withoutOpeningSetting } from "./catalogSettings.js";
|
|||
import { MythicEditor } from "./MythicEditor.jsx";
|
||||
import { MythicOpeningFields } from "./MythicOpeningFields.jsx";
|
||||
import { DropRatesEditor, PackAvailability, RechargeSetting } from "./PackSettings.jsx";
|
||||
import { ShopPackContent } from "./ShopPackContent.jsx";
|
||||
|
||||
const CARD_FILTERS = [{ value: "retired", label: "Retirées des tirages" }, { value: "promotional", label: "Promotionnelles" }];
|
||||
const plural = (count, singular, pluralForm = `${singular}s`) => `${count} ${count > 1 ? pluralForm : singular}`;
|
||||
|
|
@ -166,7 +167,7 @@ function CollectionCards({ catalog, lookup, collection, dashboard, onConfigure }
|
|||
</section>;
|
||||
}
|
||||
|
||||
function CollectionPage({ catalog, lookup, collection, dashboard, mutateCatalog, busy }) {
|
||||
function CollectionPage({ catalog, lookup, collection, dashboard, mutateCatalog, runMutation, refreshDashboard, busy }) {
|
||||
const [expandedCardId, setExpandedCardId] = useState(null);
|
||||
const { cards, editions, activeMythics } = collectionStats(catalog, lookup, collection);
|
||||
|
||||
|
|
@ -187,6 +188,8 @@ function CollectionPage({ catalog, lookup, collection, dashboard, mutateCatalog,
|
|||
<dl className="nebula-admin-collection-stats"><div><dt>Cartes</dt><dd>{cards.length}</dd></div><div><dt>Variations</dt><dd>{editions.length}</dd></div><div><dt>Mythiques tirables</dt><dd>{activeMythics}</dd></div></dl>
|
||||
</div>
|
||||
</article>
|
||||
{/* Le paquet de la boutique puise dans les autres collections : rappel de ses sources et part de ses propres cartes. */}
|
||||
{collection.packCategory === "shop" && <ShopPackContent catalog={catalog} collection={collection} dashboard={dashboard} busy={busy} runMutation={runMutation} refreshDashboard={refreshDashboard} />}
|
||||
{/* Taux de tirage et ouverture mythique côte à côte quand la place le permet, empilés sinon. */}
|
||||
<div className="nebula-admin-collection-settings">
|
||||
<section className="nds-panel nebula-admin-drop-rates" aria-labelledby="nebula-admin-drop-rates-title">
|
||||
|
|
@ -206,5 +209,5 @@ export function AdminCollections({ catalog, lookup, dashboard, mutateCatalog, ru
|
|||
const collection = lookup.collections.get(collectionId);
|
||||
if (!collection) return <div className="nds-empty-state"><p>Cette collection n’existe pas.</p><a className="nds-button" data-variant="secondary" href="#/cards/admin/collections">Retour aux collections</a></div>;
|
||||
// La clé remet à zéro filtres et panneaux ouverts quand on change de collection.
|
||||
return <CollectionPage key={collection.id} catalog={catalog} lookup={lookup} collection={collection} dashboard={dashboard} mutateCatalog={mutateCatalog} busy={busy} />;
|
||||
return <CollectionPage key={collection.id} catalog={catalog} lookup={lookup} collection={collection} dashboard={dashboard} mutateCatalog={mutateCatalog} runMutation={runMutation} refreshDashboard={refreshDashboard} busy={busy} />;
|
||||
}
|
||||
|
|
|
|||
37
website/src/features/cards/admin/AdminGuild.jsx
Normal file
37
website/src/features/cards/admin/AdminGuild.jsx
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
// Rôle : règle les quêtes de la Guilde des Veilleurs, chacune dans son panneau ; aujourd'hui la Carte du jour.
|
||||
import { useState } from "react";
|
||||
import { ApplyActions } from "./adminSettingForm.jsx";
|
||||
import { inRange, MAX_VALUE, parse, shopSettingSaver } from "./adminSettings.js";
|
||||
|
||||
// Carte du jour : la partie du jour (joueurs et gagnants), puis la récompense d'une victoire.
|
||||
function DailyQuestSettings({ setting, daily, busy, save }) {
|
||||
const [draft, setDraft] = useState(() => String(setting.dailyReward));
|
||||
const dailyReward = parse(draft);
|
||||
const valid = inRange(dailyReward, 0, MAX_VALUE);
|
||||
const changed = valid && dailyReward !== setting.dailyReward;
|
||||
return <section className="nds-panel nebula-admin-shop" aria-labelledby="nebula-admin-guild-daily-title">
|
||||
<div className="nds-section-heading nebula-admin-panel-heading"><h3 id="nebula-admin-guild-daily-title">Carte du jour</h3></div>
|
||||
{daily && <p className="nebula-admin-guild-today">Partie n° {daily.number} : <strong>{daily.winners.toLocaleString("fr-FR")}</strong> gagnant{daily.winners > 1 ? "s" : ""} sur <strong>{daily.players.toLocaleString("fr-FR")}</strong> joueur{daily.players > 1 ? "s" : ""} aujourd’hui.</p>}
|
||||
<p className="nebula-form-help">Poussière d’étoiles gagnée en trouvant la Carte du jour, une fois par jour. Une partie perdue ne rapporte rien.</p>
|
||||
<label className="nebula-admin-guild-reward-field"><span>Récompense d’une victoire</span><input className="nds-input" type="number" inputMode="numeric" min="0" max={MAX_VALUE} step="1" value={draft} disabled={busy} onChange={(event) => setDraft(event.target.value)} /></label>
|
||||
{valid ? <p className="nebula-form-help" role="status">{dailyReward > 0 && setting.openingPrice > 0 ? `${Math.ceil(setting.openingPrice / dailyReward).toLocaleString("fr-FR")} victoire${Math.ceil(setting.openingPrice / dailyReward) > 1 ? "s" : ""} pour une ouverture achetée.` : "La Carte du jour ne rapporte rien."}</p> : <p className="nebula-form-help" role="alert">Récompense entière de 0 à {MAX_VALUE.toLocaleString("fr-FR")}.</p>}
|
||||
<ApplyActions
|
||||
busy={busy}
|
||||
changed={changed}
|
||||
onCancel={() => setDraft(String(setting.dailyReward))}
|
||||
onApply={() => save({ dailyReward })}
|
||||
confirmTitle="Appliquer la nouvelle récompense ?"
|
||||
confirmMessage="La récompense s’applique aux prochaines victoires. Celles déjà gagnées ne changent pas."
|
||||
/>
|
||||
</section>;
|
||||
}
|
||||
|
||||
export function AdminGuild({ dashboard, busy, runMutation, refreshDashboard }) {
|
||||
const setting = dashboard?.shopSetting;
|
||||
const save = shopSettingSaver(setting, runMutation, refreshDashboard);
|
||||
return <div className="nebula-admin-shop-page">
|
||||
{setting
|
||||
? <DailyQuestSettings key={setting.dailyReward} setting={setting} daily={dashboard.daily} busy={busy} save={save} />
|
||||
: <div className="nds-empty-state" aria-busy="true"><p>Chargement des quêtes…</p></div>}
|
||||
</div>;
|
||||
}
|
||||
|
|
@ -27,6 +27,7 @@ function shopChanges({ previous, ...next }, catalog) {
|
|||
change("Prix d’une ouverture", previous?.openingPrice, next.openingPrice),
|
||||
change("Prix du paquet", previous?.shopPackPrice, next.shopPackPrice),
|
||||
change("Part du paquet", previous?.shopPackShare, next.shopPackShare),
|
||||
change("Récompense de la Carte du jour", previous?.dailyReward, next.dailyReward),
|
||||
...rarityChanges(previous?.stardustValues, next.stardustValues, catalog)
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,6 +27,16 @@ function buildAlerts({ catalog, lookup, dashboard, now }) {
|
|||
return alerts;
|
||||
}
|
||||
|
||||
// La réponse reste repliée : un administrateur qui joue aussi ne la voit qu'en la demandant.
|
||||
function DailyStat({ catalog, daily }) {
|
||||
const name = catalog.cards.find((card) => card.id === daily.cardId)?.name || daily.cardId;
|
||||
return <DashboardStat
|
||||
label={`Carte du jour n° ${daily.number}`}
|
||||
value={<>{daily.winners.toLocaleString("fr-FR")}<small> / {daily.players.toLocaleString("fr-FR")}</small></>}
|
||||
detail={<>gagnants sur les joueurs du jour · <details className="nebula-admin-daily-answer"><summary>Voir la carte</summary><span>{name}</span></details></>}
|
||||
/>;
|
||||
}
|
||||
|
||||
export function AdminOverview(props) {
|
||||
const { catalog, lookup, dashboard, now } = props;
|
||||
const stats = dashboard?.stats;
|
||||
|
|
@ -45,6 +55,7 @@ export function AdminOverview(props) {
|
|||
<DashboardStat label="Joueurs" value={stats?.totalPlayers ?? "—"} detail={stats && `${plural(stats.activePlayers7d, "actif", "actifs")} sur 7 jours`} />
|
||||
<DashboardStat label="Collections actives" value={activeCollections} detail={`sur ${plural(catalog.collections.length, "collection")} au total`} />
|
||||
<DashboardStat label="Cartes différentes" value={editions.length.toLocaleString("fr-FR")} detail={`dont ${plural(mythics, "variante mythique", "variantes mythiques")}`} />
|
||||
{dashboard?.daily && <DailyStat catalog={catalog} daily={dashboard.daily} />}
|
||||
</div>
|
||||
<AdminPlayers {...props} />
|
||||
</>;
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import { CardsAccount, CardsDashboardLayout } from "../CardsDashboard.jsx";
|
|||
import { formatRelative } from "./adminFormat.js";
|
||||
import { AdminCollections } from "./AdminCollections.jsx";
|
||||
import { AdminDistributions } from "./AdminDistributions.jsx";
|
||||
import { AdminGuild } from "./AdminGuild.jsx";
|
||||
import { AdminHistory } from "./AdminHistory.jsx";
|
||||
import { AdminOverview } from "./AdminOverview.jsx";
|
||||
import { AdminShop } from "./AdminShop.jsx";
|
||||
|
|
@ -13,7 +14,7 @@ import { useAdminDashboard } from "./useAdminDashboard.js";
|
|||
|
||||
// Les sections qui agissent sur le jeu, l'Atelier visuel à part (un bac à sable où rien n'est enregistré), puis le journal de ces actions.
|
||||
const ADMIN_NAVIGATION = [
|
||||
[["overview", "Vue d’ensemble"], ["collections", "Collections"], ["codes", "Codes cadeaux"], ["shop", "Boutique"]],
|
||||
[["overview", "Vue d’ensemble"], ["collections", "Collections"], ["codes", "Codes cadeaux"], ["shop", "Boutique"], ["guild", "Guilde"]],
|
||||
[["visual-lab", "Atelier visuel"]],
|
||||
[["history", "Historique"]]
|
||||
];
|
||||
|
|
@ -89,6 +90,7 @@ export function AdminPanel({ catalog, state, runMutation, busy, section, subsect
|
|||
{activeSection === "history" && <AdminHistory catalog={catalog} refreshedAt={dashboard?.generatedAt} />}
|
||||
{activeSection === "codes" && <AdminDistributions {...shared} mutateCampaigns={mutateCampaigns} />}
|
||||
{activeSection === "shop" && <AdminShop {...shared} refreshDashboard={refresh} />}
|
||||
{activeSection === "guild" && <AdminGuild {...shared} refreshDashboard={refresh} />}
|
||||
</CardsDashboardLayout>
|
||||
</section>;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,31 +1,9 @@
|
|||
// Rôle : règle la boutique ; poussière d'étoiles gagnée par doublon recyclé et prix des articles achetables.
|
||||
import { useState } from "react";
|
||||
import { ConfirmModal } from "../../../components/ToolboxModals.jsx";
|
||||
import { updateShopSetting } from "../cardsApi.js";
|
||||
import { ShopOpeningCover, ShopPackCover } from "../ShopPanel.jsx";
|
||||
import { formatStardust } from "../stardustFormat.js";
|
||||
|
||||
const MAX_VALUE = 100_000;
|
||||
const parse = (value) => (/^\d+$/.test(value) ? Number(value) : NaN);
|
||||
const inRange = (value, min, max) => Number.isInteger(value) && value >= min && value <= max;
|
||||
|
||||
// Chaque panneau a son propre brouillon et sa confirmation ; appliquer l'un ne touche pas au brouillon de l'autre.
|
||||
function ApplyActions({ busy, changed, onCancel, onApply, confirmTitle, confirmMessage }) {
|
||||
const [confirming, setConfirming] = useState(false);
|
||||
return <div className="nds-toolbar nebula-admin-shop-actions">
|
||||
<button className="nds-button" data-variant="primary" type="button" disabled={busy || !changed} onClick={() => setConfirming(true)}>Appliquer</button>
|
||||
{changed && <button className="nds-button" data-variant="secondary" type="button" disabled={busy} onClick={onCancel}>Annuler les modifications</button>}
|
||||
{confirming && <ConfirmModal
|
||||
title={confirmTitle}
|
||||
message={confirmMessage}
|
||||
confirmLabel="Appliquer"
|
||||
onClose={async (confirmed) => {
|
||||
setConfirming(false);
|
||||
if (confirmed) await onApply();
|
||||
}}
|
||||
/>}
|
||||
</div>;
|
||||
}
|
||||
import { ApplyActions } from "./adminSettingForm.jsx";
|
||||
import { inRange, MAX_VALUE, parse, shopSettingSaver } from "./adminSettings.js";
|
||||
|
||||
function RecyclingForm({ catalog, setting, busy, save }) {
|
||||
const toDraft = () => Object.fromEntries(Object.entries(setting.stardustValues).map(([id, value]) => [id, String(value)]));
|
||||
|
|
@ -55,13 +33,12 @@ function RecyclingForm({ catalog, setting, busy, save }) {
|
|||
}
|
||||
|
||||
function ArticlesForm({ catalog, setting, busy, save }) {
|
||||
const toDraft = () => ({ openingPrice: String(setting.openingPrice), packPrice: String(setting.shopPackPrice), packShare: String(setting.shopPackShare) });
|
||||
const toDraft = () => ({ openingPrice: String(setting.openingPrice), packPrice: String(setting.shopPackPrice) });
|
||||
const [draft, setDraft] = useState(toDraft);
|
||||
const openingPrice = parse(draft.openingPrice);
|
||||
const shopPackPrice = parse(draft.packPrice);
|
||||
const shopPackShare = parse(draft.packShare);
|
||||
const valid = inRange(openingPrice, 1, MAX_VALUE) && inRange(shopPackPrice, 1, MAX_VALUE) && inRange(shopPackShare, 0, 100);
|
||||
const changed = valid && (openingPrice !== setting.openingPrice || shopPackPrice !== setting.shopPackPrice || shopPackShare !== setting.shopPackShare);
|
||||
const valid = inRange(openingPrice, 1, MAX_VALUE) && inRange(shopPackPrice, 1, MAX_VALUE);
|
||||
const changed = valid && (openingPrice !== setting.openingPrice || shopPackPrice !== setting.shopPackPrice);
|
||||
const shopPack = catalog.collections.find((collection) => collection.packCategory === "shop");
|
||||
// Repère : combien de doublons communs il faut recycler pour une ouverture, selon le barème en vigueur.
|
||||
const commonValue = setting.stardustValues.common;
|
||||
|
|
@ -78,7 +55,7 @@ function ArticlesForm({ catalog, setting, busy, save }) {
|
|||
<h4>{shopPack.name}</h4>
|
||||
{!shopPack.active && <span className="nds-badge" data-variant="neutral">Fermé aux joueurs</span>}
|
||||
<label><span>Prix</span><input className="nds-input" aria-label="Prix du paquet de la boutique" type="number" inputMode="numeric" min="1" max={MAX_VALUE} step="1" {...field("packPrice")} /></label>
|
||||
<label><span>Part de ses cartes parmi les légendaires et mythiques (%)</span><input className="nds-input" type="number" inputMode="numeric" min="0" max="100" step="1" {...field("packShare")} /></label>
|
||||
<p className="nebula-form-help">Contenu et part de ses cartes : <a href={`#/cards/admin/collections/${shopPack.id}`}>page de la collection</a>.</p>
|
||||
</div>
|
||||
</article>}
|
||||
<article className="nds-card nebula-shop-item" data-item="opening">
|
||||
|
|
@ -90,12 +67,12 @@ function ArticlesForm({ catalog, setting, busy, save }) {
|
|||
</div>
|
||||
</article>
|
||||
</div>
|
||||
{!valid && <p className="nebula-form-help" role="alert">Prix entiers de 1 à {MAX_VALUE.toLocaleString("fr-FR")} ; part entière de 0 à 100.</p>}
|
||||
{!valid && <p className="nebula-form-help" role="alert">Prix entiers de 1 à {MAX_VALUE.toLocaleString("fr-FR")}.</p>}
|
||||
<ApplyActions
|
||||
busy={busy}
|
||||
changed={changed}
|
||||
onCancel={() => setDraft(toDraft())}
|
||||
onApply={() => save({ openingPrice, shopPackPrice, shopPackShare })}
|
||||
onApply={() => save({ openingPrice, shopPackPrice })}
|
||||
confirmTitle="Appliquer les nouveaux prix ?"
|
||||
confirmMessage="Les prix s’appliquent immédiatement à tous les joueurs. Les ouvertures déjà achetées ne changent pas."
|
||||
/>
|
||||
|
|
@ -107,11 +84,7 @@ export function AdminShop({ catalog, dashboard, busy, runMutation, refreshDashbo
|
|||
const players = dashboard?.players || [];
|
||||
const stardust = players.reduce((total, player) => total + player.stardust, 0);
|
||||
const purchased = players.reduce((total, player) => total + player.purchasedOpenings, 0);
|
||||
// L'API enregistre tout le réglage : le panneau n'envoie que sa partie, le reste vient de l'état enregistré.
|
||||
async function save(changes) {
|
||||
const next = { ...setting, ...changes };
|
||||
if (await runMutation(() => updateShopSetting(next.stardustValues, next.openingPrice, next.shopPackPrice, next.shopPackShare))) await refreshDashboard();
|
||||
}
|
||||
const save = shopSettingSaver(setting, runMutation, refreshDashboard);
|
||||
return <div className="nebula-admin-shop-page">
|
||||
<div className="nebula-dashboard-stats">
|
||||
<article className="nds-panel nebula-dashboard-stat"><span className="nebula-dashboard-stat-label">Poussière en circulation</span><strong>{stardust.toLocaleString("fr-FR")}</strong><small>{formatStardust(stardust)} d’étoiles chez les joueurs</small></article>
|
||||
|
|
@ -120,7 +93,7 @@ export function AdminShop({ catalog, dashboard, busy, runMutation, refreshDashbo
|
|||
{setting
|
||||
? <>
|
||||
<RecyclingForm key={JSON.stringify(setting.stardustValues)} catalog={catalog} setting={setting} busy={busy} save={save} />
|
||||
<ArticlesForm key={`${setting.openingPrice}-${setting.shopPackPrice}-${setting.shopPackShare}`} catalog={catalog} setting={setting} busy={busy} save={save} />
|
||||
<ArticlesForm key={`${setting.openingPrice}-${setting.shopPackPrice}`} catalog={catalog} setting={setting} busy={busy} save={save} />
|
||||
</>
|
||||
: <div className="nds-empty-state" aria-busy="true"><p>Chargement de la boutique…</p></div>}
|
||||
</div>;
|
||||
|
|
|
|||
51
website/src/features/cards/admin/ShopPackContent.jsx
Normal file
51
website/src/features/cards/admin/ShopPackContent.jsx
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
// Rôle : sur la page du paquet de la boutique, rappelle d'où il tire ses cartes et règle la part de ses propres légendaires et mythiques.
|
||||
import { useState } from "react";
|
||||
import { ApplyActions } from "./adminSettingForm.jsx";
|
||||
import { inRange, parse, shopSettingSaver } from "./adminSettings.js";
|
||||
|
||||
// Mêmes règles que shopPackPools côté serveur : les collections ouvertes hors boutique, puis ses légendaires et mythiques tirables.
|
||||
function shopPackSources(catalog, collection) {
|
||||
const sources = catalog.collections.filter((item) => item.active && item.packCategory !== "shop");
|
||||
const ownCards = new Set(catalog.cards.filter((card) => card.collectionId === collection.id).map((card) => card.id));
|
||||
const own = catalog.editions.filter((edition) => ownCards.has(edition.cardId) && !edition.promotional && !edition.retired);
|
||||
return { sources, legendaries: own.filter((edition) => edition.rarity === "legendary").length, mythics: own.filter((edition) => edition.rarity === "mythic").length };
|
||||
}
|
||||
|
||||
function ShareForm({ setting, busy, save }) {
|
||||
const [draft, setDraft] = useState(() => String(setting.shopPackShare));
|
||||
const shopPackShare = parse(draft);
|
||||
const valid = inRange(shopPackShare, 0, 100);
|
||||
const changed = valid && shopPackShare !== setting.shopPackShare;
|
||||
return <>
|
||||
<label className="nebula-admin-shop-pack-share"><span>Part de ses cartes parmi les légendaires et mythiques (%)</span><input className="nds-input" type="number" inputMode="numeric" min="0" max="100" step="1" value={draft} disabled={busy} onChange={(event) => setDraft(event.target.value)} /></label>
|
||||
{valid
|
||||
? <p className="nebula-form-help" role="status">Quand une légendaire ou une mythique sort, {shopPackShare} % des tirages reviennent à ses propres cartes, quel que soit leur nombre, et {100 - shopPackShare} % aux collections ouvertes.</p>
|
||||
: <p className="nebula-form-help" role="alert">Part entière de 0 à 100.</p>}
|
||||
<ApplyActions
|
||||
busy={busy}
|
||||
changed={changed}
|
||||
onCancel={() => setDraft(String(setting.shopPackShare))}
|
||||
onApply={() => save({ shopPackShare })}
|
||||
confirmTitle="Appliquer la nouvelle part ?"
|
||||
confirmMessage="La part s’applique immédiatement aux prochains paquets achetés. Les cartes déjà obtenues ne changent pas."
|
||||
/>
|
||||
</>;
|
||||
}
|
||||
|
||||
export function ShopPackContent({ catalog, collection, dashboard, busy, runMutation, refreshDashboard }) {
|
||||
const setting = dashboard?.shopSetting;
|
||||
const save = shopSettingSaver(setting, runMutation, refreshDashboard);
|
||||
const { sources, legendaries, mythics } = shopPackSources(catalog, collection);
|
||||
const plural = (count, word) => `${count} ${word}${count > 1 ? "s" : ""}`;
|
||||
return <section className="nds-panel nebula-admin-shop-pack-content" aria-labelledby="nebula-admin-shop-pack-content-title">
|
||||
<h3 id="nebula-admin-shop-pack-content-title">Contenu du paquet</h3>
|
||||
<p className="nebula-form-help">Ce paquet est vendu dans la Boutique. Il tire ses cartes parmi toutes les collections ouvertes en ce moment, plus ses propres légendaires et mythiques.</p>
|
||||
<dl className="nebula-admin-shop-pack-sources">
|
||||
<div><dt>Collections ouvertes</dt><dd>{sources.length ? sources.map((item) => item.name).join(", ") : "Aucune : seules ses propres cartes peuvent sortir."}</dd></div>
|
||||
<div><dt>Ses cartes tirables</dt><dd>{plural(legendaries, "légendaire")} et {plural(mythics, "mythique")}</dd></div>
|
||||
</dl>
|
||||
{setting
|
||||
? <ShareForm key={setting.shopPackShare} setting={setting} busy={busy} save={save} />
|
||||
: <p className="nebula-form-help" aria-busy="true">Chargement du réglage…</p>}
|
||||
</section>;
|
||||
}
|
||||
22
website/src/features/cards/admin/adminSettingForm.jsx
Normal file
22
website/src/features/cards/admin/adminSettingForm.jsx
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
// Rôle : fournit les actions communes des formulaires de réglage de l'administration (Boutique, Guilde) : application après
|
||||
// confirmation et annulation du brouillon.
|
||||
import { useState } from "react";
|
||||
import { ConfirmModal } from "../../../components/ToolboxModals.jsx";
|
||||
|
||||
// Chaque panneau a son propre brouillon et sa confirmation ; appliquer l'un ne touche pas au brouillon de l'autre.
|
||||
export function ApplyActions({ busy, changed, onCancel, onApply, confirmTitle, confirmMessage }) {
|
||||
const [confirming, setConfirming] = useState(false);
|
||||
return <div className="nds-toolbar nebula-admin-shop-actions">
|
||||
<button className="nds-button" data-variant="primary" type="button" disabled={busy || !changed} onClick={() => setConfirming(true)}>Appliquer</button>
|
||||
{changed && <button className="nds-button" data-variant="secondary" type="button" disabled={busy} onClick={onCancel}>Annuler les modifications</button>}
|
||||
{confirming && <ConfirmModal
|
||||
title={confirmTitle}
|
||||
message={confirmMessage}
|
||||
confirmLabel="Appliquer"
|
||||
onClose={async (confirmed) => {
|
||||
setConfirming(false);
|
||||
if (confirmed) await onApply();
|
||||
}}
|
||||
/>}
|
||||
</div>;
|
||||
}
|
||||
15
website/src/features/cards/admin/adminSettings.js
Normal file
15
website/src/features/cards/admin/adminSettings.js
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
// Rôle : bornes des réglages de l'administration (Boutique, Guilde) et enregistrement du réglage qu'ils partagent.
|
||||
import { updateShopSetting } from "../cardsApi.js";
|
||||
|
||||
export const MAX_VALUE = 100_000;
|
||||
export const parse = (value) => (/^\d+$/.test(value) ? Number(value) : NaN);
|
||||
export const inRange = (value, min, max) => Number.isInteger(value) && value >= min && value <= max;
|
||||
|
||||
// Les réglages de la Boutique et de la Guilde forment un seul enregistrement côté serveur : chaque panneau n'envoie que sa
|
||||
// partie, le reste vient de l'état enregistré.
|
||||
export function shopSettingSaver(setting, runMutation, refreshDashboard) {
|
||||
return async (changes) => {
|
||||
const next = { ...setting, ...changes };
|
||||
if (await runMutation(() => updateShopSetting(next.stardustValues, next.openingPrice, next.shopPackPrice, next.shopPackShare, next.dailyReward))) await refreshDashboard();
|
||||
};
|
||||
}
|
||||
|
|
@ -29,8 +29,8 @@ export function loadCardsState() {
|
|||
return request("/state");
|
||||
}
|
||||
|
||||
export function updateShopSetting(stardustValues, openingPrice, shopPackPrice, shopPackShare) {
|
||||
return request("/admin/shop", { method: "PUT", body: JSON.stringify({ stardustValues, openingPrice, shopPackPrice, shopPackShare }) });
|
||||
export function updateShopSetting(stardustValues, openingPrice, shopPackPrice, shopPackShare, dailyReward) {
|
||||
return request("/admin/shop", { method: "PUT", body: JSON.stringify({ stardustValues, openingPrice, shopPackPrice, shopPackShare, dailyReward }) });
|
||||
}
|
||||
|
||||
export function loadAdminDashboard() {
|
||||
|
|
@ -86,6 +86,22 @@ export function completeOpening(openingId) {
|
|||
return request(`/openings/${encodeURIComponent(openingId)}/complete`, { method: "POST" });
|
||||
}
|
||||
|
||||
export function loadDaily() {
|
||||
return request("/daily");
|
||||
}
|
||||
|
||||
// Un essai vaut pour le jour affiché : après minuit, le serveur le refuse et la nouvelle partie doit être chargée.
|
||||
export function guessDaily(day, cardId) {
|
||||
return request("/daily/guesses", { method: "POST", body: JSON.stringify({ day, cardId }) });
|
||||
}
|
||||
|
||||
// L'illustration du jour n'a pas d'adresse publique : elle est chargée en blob, à libérer avec URL.revokeObjectURL.
|
||||
export async function loadDailyImage() {
|
||||
const response = await fetch("/api/cards/daily/image", { credentials: "same-origin" });
|
||||
if (!response.ok) throw Object.assign(new Error("L’illustration du jour est indisponible."), { status: response.status });
|
||||
return URL.createObjectURL(await response.blob());
|
||||
}
|
||||
|
||||
export function setFavorite(editionId, favorite) {
|
||||
return request("/favorites", { method: "PUT", body: JSON.stringify({ editionId, favorite }) });
|
||||
}
|
||||
|
|
|
|||
35
website/src/features/cards/dailyShare.js
Normal file
35
website/src/features/cards/dailyShare.js
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
// Rôle : règles d'affichage de la Carte du jour, quête de la Guilde des Veilleurs (textes, résultat à partager, compte à rebours, recherche de carte par nom).
|
||||
|
||||
export const fillTemplate = (template, values) => Object.entries(values).reduce((text, [key, value]) => text.replaceAll(`{${key}}`, String(value)), template);
|
||||
|
||||
// État du jour de la Carte du jour, pour sa tuile dans la Guilde (textes cards.guild).
|
||||
export function dailyQuestStatus(daily, content) {
|
||||
if (daily.status === "won") return fillTemplate(content.dailyWon, { count: daily.guessCount, max: daily.maxGuesses });
|
||||
if (daily.status === "lost") return content.dailyLost;
|
||||
return daily.guessCount ? fillTemplate(content.dailyPlaying, { count: daily.guessCount, max: daily.maxGuesses }) : content.dailyToPlay;
|
||||
}
|
||||
|
||||
export const formatStreak = (days) => `${days} jour${days > 1 ? "s" : ""}`;
|
||||
|
||||
// Recherche tolérante : sans accents, sans casse et quel que soit l'apostrophe tapée.
|
||||
export function normalizeCardName(value) {
|
||||
return String(value || "").normalize("NFD").replace(/\p{Diacritic}/gu, "").replace(/[’`]/g, "'").replace(/\s+/g, " ").trim().toLowerCase();
|
||||
}
|
||||
|
||||
export function findCardByName(cards, name) {
|
||||
const wanted = normalizeCardName(name);
|
||||
return wanted ? cards.find((card) => normalizeCardName(card.name) === wanted) || null : null;
|
||||
}
|
||||
|
||||
// Carré vert : trouvée ; jaune : bonne collection ; noir : ni l'un ni l'autre. Une défaite se note X, comme dans les jeux du genre.
|
||||
export function dailyShareText(daily, { title, url }) {
|
||||
const score = daily.status === "won" ? `${daily.guesses.length}/${daily.maxGuesses}` : `X/${daily.maxGuesses}`;
|
||||
const squares = daily.guesses.map((guess) => (guess.correct ? "🟩" : guess.sameCollection ? "🟨" : "⬛")).join("");
|
||||
return [`${title} #${daily.number} · ${score}`, squares, url].filter(Boolean).join("\n");
|
||||
}
|
||||
|
||||
export function formatCountdown(milliseconds) {
|
||||
const minutes = Math.max(1, Math.ceil(milliseconds / 60_000));
|
||||
const hours = Math.floor(minutes / 60);
|
||||
return hours ? `${hours} h ${String(minutes % 60).padStart(2, "0")} min` : `${minutes} min`;
|
||||
}
|
||||
11
website/src/features/cards/guildQuests.js
Normal file
11
website/src/features/cards/guildQuests.js
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
// Rôle : recense les quêtes que la Guilde des Veilleurs propose au joueur et celles qui l'attendent.
|
||||
// La Carte du jour est la première ; chaque nouvelle quête (Expéditions…) s'ajoute à cette liste avec sa tuile dans GuildPanel.
|
||||
|
||||
// Une quête : identifiant (qui choisit sa tuile), état du jour fourni par le serveur et `pending` tant qu'elle attend le joueur.
|
||||
export function guildQuests(state) {
|
||||
const quests = [];
|
||||
if (state.daily) quests.push({ id: "daily", pending: state.daily.status === "playing", summary: state.daily });
|
||||
return quests;
|
||||
}
|
||||
|
||||
export const pendingQuestCount = (state) => guildQuests(state).filter((quest) => quest.pending).length;
|
||||
|
|
@ -31,14 +31,11 @@
|
|||
.nebula-login-art { overflow: hidden; aspect-ratio: 1; border-radius: var(--radius-xl); background: var(--gradient-nebula); }
|
||||
.nebula-login-art img { display: block; width: 100%; height: 100%; object-fit: cover; }
|
||||
|
||||
.nebula-home { display: grid; gap: var(--space-4); }
|
||||
/* Espacement resserré : l'en-tête, la rangée Guilde / meilleur tirage et les chiffres clés tiennent dans 1280 × 720. */
|
||||
.nebula-home { display: grid; gap: var(--space-3); }
|
||||
.nds-section-heading:is(.nebula-home-heading, .nebula-pack-page-heading, .nebula-pack-category-heading) { align-items: center; gap: var(--space-4); }
|
||||
.nebula-home-heading :is(h2, p), .nebula-pack-page-heading :is(h2, p), .nebula-pack-category-heading :is(h3, p) { margin: 0; }
|
||||
.nebula-home-resume { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); margin: 0; }
|
||||
.nebula-home-grid { display: grid; grid-template-columns: minmax(230px, 1fr) minmax(0, 2fr); gap: var(--space-4); align-items: stretch; }
|
||||
@container nebula-dashboard (max-width: 560px) {
|
||||
.nebula-home-grid { grid-template-columns: minmax(0, 1fr); }
|
||||
}
|
||||
.nebula-opening-reserve { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--space-4); align-content: center; align-items: center; min-width: 0; padding: var(--space-5); }
|
||||
.nebula-opening-reserve-value { display: flex; align-items: baseline; gap: 4px; color: var(--color-text-muted); }
|
||||
.nebula-opening-reserve-value strong { color: var(--color-accent-gold); font-size: clamp(2.5rem, 4vw, 3.75rem); line-height: 0.9; }
|
||||
|
|
@ -46,12 +43,13 @@
|
|||
.nebula-opening-reserve-copy h2, .nebula-opening-reserve-copy p { margin: 0; }
|
||||
.nebula-opening-reserve-copy h2 { font-size: var(--font-size-lg); }
|
||||
.nebula-opening-reserve-copy p { color: var(--color-text-secondary); font-size: var(--font-size-sm); }
|
||||
.nebula-opening-reserve-copy p strong { color: var(--color-text-primary); font-variant-numeric: tabular-nums; }
|
||||
.nebula-opening-reserve-copy p strong { color: var(--color-text-primary); font-variant-numeric: tabular-nums; white-space: nowrap; }
|
||||
.nebula-opening-reserve-actions { grid-column: 1 / -1; }
|
||||
.nebula-opening-reserve.is-compact { width: min(100%, 390px); padding: var(--space-3) var(--space-4); }
|
||||
.nebula-opening-reserve.is-compact .nebula-opening-reserve-value strong { font-size: var(--font-size-3xl); }
|
||||
.nebula-opening-reserve.is-compact .nebula-opening-reserve-copy h2 { font-size: var(--font-size-sm); }
|
||||
.nebula-home-rarest { display: grid; grid-template-columns: minmax(0, 1fr) 180px; gap: var(--space-4); align-items: center; min-width: 0; padding: var(--space-5); overflow: hidden; }
|
||||
.nebula-home-rarest:not(:has(.nebula-home-rarest-card)) { grid-template-columns: minmax(0, 1fr); }
|
||||
.nebula-home-rarest-copy { display: grid; gap: var(--space-2); min-width: 0; }
|
||||
.nebula-home-rarest-copy :is(h2, p) { margin: 0; }
|
||||
.nebula-home-rarest-copy h2 { font-size: var(--font-size-lg); }
|
||||
|
|
@ -61,14 +59,142 @@
|
|||
.nebula-home-rarity[data-rarity="common"] { color: #9ca3af; }.nebula-home-rarity[data-rarity="rare"] { color: #3b82f6; }.nebula-home-rarity[data-rarity="epic"] { color: #d946ef; }.nebula-home-rarity[data-rarity="legendary"] { color: #f6c453; }.nebula-home-rarity[data-rarity="mythic"] { color: #67e8f9; text-shadow: 0 0 8px rgba(217, 70, 239, 0.72); }
|
||||
.nebula-home-rarest-card { width: 180px; }
|
||||
.nebula-home-rarest-card .nebula-card { max-width: 180px; }
|
||||
/* La Guilde et le meilleur tirage à parts égales, à la même hauteur (fixée par la carte md quand il y en a une) ; les deux s'empilent sous 560 px. Les chiffres clés
|
||||
suivent sur une rangée (trois colonnes en demi-écran). */
|
||||
.nebula-home-highlights { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); align-items: stretch; container: home-highlights / inline-size; }
|
||||
.nebula-home-highlights .nds-panel.nebula-home-rarest { padding: var(--space-4) var(--space-5); }
|
||||
.nebula-home-highlights .nebula-home-rarest-copy { gap: var(--space-1); }
|
||||
.nebula-home-highlights .nebula-home-rarest-copy > strong { font-size: var(--font-size-lg); line-height: 1.25; }
|
||||
/* La carte garde sa taille md (180 px) en plein écran ; en demi-écran, elle passe à 120 px. */
|
||||
@container nebula-dashboard (width < 960px) {
|
||||
.nebula-home-highlights .nds-panel.nebula-home-rarest:has(.nebula-home-rarest-card) { grid-template-columns: minmax(0, 1fr) 120px; }
|
||||
.nebula-home-highlights .nebula-home-rarest-card { width: 120px; }
|
||||
.nebula-home-highlights .nebula-home-rarest-card .nebula-card { max-width: 120px; }
|
||||
}
|
||||
.nebula-dashboard-stats.nebula-home-stats { grid-template-columns: repeat(auto-fit, minmax(108px, 1fr)); gap: var(--space-3); }
|
||||
@container nebula-dashboard (max-width: 720px) {
|
||||
.nebula-dashboard-stats.nebula-home-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
|
||||
}
|
||||
@container nebula-dashboard (max-width: 560px) {
|
||||
.nebula-home-highlights { grid-template-columns: minmax(0, 1fr); }
|
||||
}
|
||||
.nebula-home-stats .nebula-dashboard-stat { grid-template-rows: 1fr auto; padding: var(--space-3); }
|
||||
.nebula-home-stats .nebula-dashboard-stat strong { font-size: var(--font-size-xl); }
|
||||
.nebula-home-stats .nebula-dashboard-stat-label { font-size: var(--font-size-xs); }
|
||||
.nebula-home-stats strong small { color: var(--color-text-muted); font-size: var(--font-size-sm); }
|
||||
/* Encart de la Guilde des Veilleurs : le dragon à gauche sur toute la hauteur, le texte et l'entrée à droite. */
|
||||
.nds-panel.nebula-guild-banner { display: grid; grid-template-columns: 136px minmax(0, 1fr); gap: var(--space-3); align-items: center; min-width: 0; padding: var(--space-4) var(--space-4) var(--space-4) var(--space-2); background: radial-gradient(circle at 18% 55%, rgba(124, 58, 237, 0.38), transparent 50%), linear-gradient(100deg, rgba(49, 46, 129, 0.45), rgba(246, 196, 83, 0.06) 75%, transparent), rgba(16, 20, 38, 0.42); }
|
||||
.nebula-guild-banner[data-pending] { box-shadow: 0 0 28px rgba(246, 196, 83, 0.14); }
|
||||
/* L'illustration occupe toute la hauteur de l'encart, marges comprises, sans le faire grandir. */
|
||||
.nebula-guild-banner-art { position: relative; align-self: stretch; margin-block: calc(-1 * var(--space-4)); }
|
||||
.nebula-guild-banner-art img { position: absolute; inset: var(--space-2) 0 var(--space-1); width: 100%; height: calc(100% - var(--space-3)); object-fit: contain; filter: drop-shadow(0 0 12px rgba(124, 58, 237, 0.5)); }
|
||||
.nebula-guild-banner-copy { display: grid; gap: var(--space-1); justify-items: start; min-width: 0; }
|
||||
.nebula-guild-banner-copy :is(h3, p) { margin: 0; }
|
||||
.nebula-guild-banner-copy h3 { font-size: var(--font-size-lg); line-height: 1.25; }
|
||||
.nebula-guild-banner-copy p { color: var(--color-text-secondary); font-size: var(--font-size-sm); line-height: 1.4; }
|
||||
.nebula-guild-banner-copy .nebula-guild-banner-status { color: var(--color-text-primary); font-weight: 700; }
|
||||
.nebula-guild-banner[data-pending] .nebula-guild-banner-status { color: var(--color-accent-gold); }
|
||||
.nebula-guild-banner-copy .nds-button { margin-top: var(--space-2); white-space: nowrap; }
|
||||
/* En plein écran, le dragon s'agrandit ; en demi-écran, il rapetisse pour laisser au texte et au bouton leur largeur. */
|
||||
@container nebula-dashboard (min-width: 960px) {
|
||||
.nds-panel.nebula-guild-banner { grid-template-columns: 164px minmax(0, 1fr); gap: var(--space-2); padding-inline: var(--space-1) var(--space-3); }
|
||||
}
|
||||
/* Sur grand écran, chaque encart dépasse 540 px : le dragon prend près de la moitié de l'encart, les textes et la carte
|
||||
du meilleur tirage grandissent pour occuper la place ; 250 px de haut au moins, même sans carte tirée. */
|
||||
@container home-highlights (min-width: 1100px) {
|
||||
.nebula-home-highlights > .nds-panel { min-height: 250px; }
|
||||
.nds-panel.nebula-guild-banner { grid-template-columns: minmax(0, 0.85fr) minmax(0, 1fr); gap: var(--space-4); padding-inline: var(--space-2) var(--space-6); }
|
||||
.nebula-guild-banner-copy { gap: var(--space-2); }
|
||||
.nebula-guild-banner-copy h3 { font-size: var(--font-size-2xl); }
|
||||
.nebula-guild-banner-copy p { font-size: var(--font-size-base); }
|
||||
.nebula-home-highlights .nds-panel.nebula-home-rarest { padding: var(--space-5) var(--space-6); }
|
||||
.nebula-home-highlights .nds-panel.nebula-home-rarest:has(.nebula-home-rarest-card) { grid-template-columns: minmax(0, 1fr) 210px; }
|
||||
.nebula-home-highlights .nebula-home-rarest-copy { gap: var(--space-2); }
|
||||
.nebula-home-highlights .nebula-home-rarest-copy h2 { font-size: var(--font-size-xl); }
|
||||
.nebula-home-highlights .nebula-home-rarest-copy > strong { font-size: var(--font-size-2xl); }
|
||||
.nebula-home-highlights .nebula-home-rarity { font-size: var(--font-size-base); }
|
||||
.nebula-home-highlights .nebula-home-rarest-copy time { font-size: var(--font-size-sm); }
|
||||
.nebula-home-highlights .nebula-home-rarest-card { width: 210px; }
|
||||
.nebula-home-highlights .nebula-home-rarest-card .nebula-card { max-width: 210px; }
|
||||
}
|
||||
@container nebula-dashboard (max-width: 720px) {
|
||||
.nds-panel.nebula-guild-banner { grid-template-columns: 96px minmax(0, 1fr); }
|
||||
}
|
||||
.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)); }
|
||||
}
|
||||
@container nebula-dashboard (min-width: 1400px) {
|
||||
.nebula-quests-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
|
||||
}
|
||||
.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. */
|
||||
.nebula-quest-media { display: grid; gap: var(--space-2); justify-items: center; }
|
||||
.nebula-quest-media .nds-badge { padding-inline: 7px; white-space: nowrap; }
|
||||
.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; }
|
||||
|
||||
/* Carte du jour : l'illustration carrée est zoomée par transform, le cadre en masque le reste. */
|
||||
.nebula-daily { display: grid; gap: var(--space-4); min-width: 0; }
|
||||
.nebula-daily .nds-section-heading.nebula-section-heading { margin-bottom: 0; }
|
||||
.nebula-daily-heading-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: var(--space-3); }
|
||||
.nebula-daily-expired { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); margin: 0; }
|
||||
.nebula-daily-layout { display: grid; grid-template-columns: minmax(240px, 360px) minmax(0, 1fr); gap: var(--space-4); align-items: start; }
|
||||
@container nebula-dashboard (max-width: 720px) {
|
||||
.nebula-daily-layout { grid-template-columns: minmax(0, 1fr); }
|
||||
.nebula-daily-stage { justify-self: center; width: min(100%, 360px); }
|
||||
}
|
||||
.nds-panel.nebula-daily-stage { display: grid; gap: var(--space-3); padding: var(--space-3); }
|
||||
.nebula-daily-frame { display: grid; place-items: center; overflow: hidden; aspect-ratio: 1; border-radius: var(--radius-lg); background: var(--color-bg-deep); }
|
||||
.nebula-daily-frame img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform 700ms ease; user-select: none; -webkit-user-drag: none; }
|
||||
.nebula-daily-frame-status { padding: var(--space-4); color: var(--color-text-muted); font-size: var(--font-size-sm); text-align: center; }
|
||||
.nebula-daily-steps { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: var(--space-2); margin: 0; padding: 0; list-style: none; }
|
||||
.nebula-daily-steps li { height: 8px; border-radius: var(--radius-pill); background: var(--color-bg-hover); }
|
||||
.nebula-daily-steps li[data-result="miss"] { background: var(--color-text-disabled); }
|
||||
.nebula-daily-steps li[data-result="close"] { background: var(--color-warning); }
|
||||
.nebula-daily-steps li[data-result="correct"] { background: var(--color-success); }
|
||||
.nebula-daily-play { display: grid; gap: var(--space-4); min-width: 0; }
|
||||
/* La liste de suggestions dépasse du panneau : il ne la coupe pas et passe au-dessus de la liste des essais. */
|
||||
.nds-panel.nebula-daily-form { z-index: 2; display: grid; gap: var(--space-3); padding: var(--space-5); overflow: visible; }
|
||||
.nebula-daily-form p:not(.nds-inline-notice) { margin: 0; color: var(--color-text-secondary); }
|
||||
.nebula-daily-form label { color: var(--color-text-primary); font-weight: 700; }
|
||||
.nebula-daily-form .nds-inline-notice { margin: 0; }
|
||||
.nebula-daily-form-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-2); align-items: start; }
|
||||
.nebula-daily-guesses { display: grid; gap: var(--space-2); }
|
||||
.nebula-daily-guesses h3 { margin: 0; font-size: var(--font-size-base); }
|
||||
.nebula-daily-guesses ol { display: grid; gap: var(--space-2); margin: 0; padding: 0; list-style: none; }
|
||||
.nds-list-row.nebula-daily-guess { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2) var(--space-3); padding: var(--space-3); }
|
||||
.nebula-daily-hints { display: flex; flex-wrap: wrap; gap: var(--space-2); }
|
||||
.nebula-daily-hints .nds-badge { gap: var(--space-1); }
|
||||
.nebula-daily-empty { margin: 0; color: var(--color-text-muted); font-size: var(--font-size-sm); }
|
||||
.nds-panel.nebula-daily-result { display: grid; grid-template-columns: minmax(0, 1fr) 180px; gap: var(--space-4); align-items: center; padding: var(--space-5); }
|
||||
@container nebula-dashboard (max-width: 560px) {
|
||||
.nds-panel.nebula-daily-result { grid-template-columns: minmax(0, 1fr); }
|
||||
.nebula-daily-result-card { justify-self: center; }
|
||||
}
|
||||
.nebula-daily-result-copy { display: grid; gap: var(--space-3); min-width: 0; }
|
||||
.nebula-daily-result-copy :is(h3, p) { margin: 0; }
|
||||
.nebula-daily-result-copy h3 { font-size: var(--font-size-xl); }
|
||||
.nebula-daily-answer { display: grid; gap: var(--space-1); }
|
||||
.nebula-daily-answer strong { color: var(--color-text-primary); font-size: var(--font-size-lg); }
|
||||
.nebula-daily-answer span { color: var(--color-text-secondary); font-size: var(--font-size-sm); }
|
||||
.nebula-daily-result-badges { display: flex; flex-wrap: wrap; gap: var(--space-2); }
|
||||
.nds-toolbar.nebula-daily-result-actions { flex-wrap: wrap; align-items: center; gap: var(--space-3); }
|
||||
.nebula-daily-next { color: var(--color-text-muted); font-size: var(--font-size-sm); }
|
||||
.nebula-daily-result-card { width: 180px; }
|
||||
.nebula-daily-result-card .nebula-card { max-width: 180px; }
|
||||
|
||||
.nebula-pack-page { display: grid; gap: var(--space-6); }
|
||||
.nds-section-heading.nebula-pack-page-heading { align-items: stretch; }
|
||||
|
|
@ -499,21 +625,38 @@ main:has(.nebula-dashboard) { overflow-x: clip; }
|
|||
.nebula-dashboard-aside-slot:empty { display: none; }
|
||||
.nebula-dashboard-aside-slot .nebula-opening-reserve.is-compact { width: 100%; }
|
||||
.nebula-dashboard-section { display: grid; gap: var(--space-6); min-width: 0; }
|
||||
.nebula-dashboard-nav { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1); padding: var(--space-1); border: 1px solid var(--color-border); border-radius: var(--radius-md); background: rgba(5, 7, 17, 0.38); }
|
||||
.nebula-dashboard-nav-group { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; }
|
||||
.nebula-dashboard-nav-group + .nebula-dashboard-nav-group { padding-left: var(--space-1); border-left: 1px solid var(--color-border); }
|
||||
/* Rangée compacte (demi-écran) : six entrées sur une ligne ; la colonne large reprend des marges confortables. */
|
||||
.nebula-dashboard-nav-item { padding: 7px 5px; border-radius: var(--radius-sm); color: var(--color-text-secondary); font-size: 0.8rem; font-weight: 700; text-decoration: none; white-space: nowrap; }
|
||||
/* Menu de sections : une liste groupée, en colonne collante de 200 px dans le tableau de bord large. En demi-écran,
|
||||
un bouton pleine largeur affiche la section courante et ouvre la même liste en panneau par-dessus le contenu. */
|
||||
.nebula-dashboard-menu { position: relative; min-width: 0; }
|
||||
.nebula-dashboard-menu-toggle { display: flex; align-items: center; gap: var(--space-3); width: 100%; min-height: 42px; padding: var(--space-2) var(--space-4); border: 1px solid var(--color-border); border-radius: var(--radius-md); background: rgba(5, 7, 17, 0.38); color: var(--color-text-primary); font: inherit; font-size: var(--font-size-sm); font-weight: 700; text-align: left; cursor: pointer; }
|
||||
.nebula-dashboard-menu-toggle:hover { border-color: var(--color-border-strong); background: var(--color-primary-soft); }
|
||||
.nebula-dashboard-menu-toggle:focus-visible { outline: 2px solid var(--color-accent-gold); outline-offset: 2px; }
|
||||
.nebula-dashboard-menu-toggle[aria-expanded="true"] { border-color: rgba(246, 196, 83, 0.42); }
|
||||
/* Trois traits dessinés en dégradés, puis un chevron qui se retourne à l'ouverture. */
|
||||
.nebula-dashboard-menu-icon { flex: none; width: 16px; height: 12px; background: linear-gradient(currentColor, currentColor) top / 100% 2px no-repeat, linear-gradient(currentColor, currentColor) center / 100% 2px no-repeat, linear-gradient(currentColor, currentColor) bottom / 100% 2px no-repeat; color: var(--color-accent-gold); }
|
||||
.nebula-dashboard-menu-current { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.nebula-dashboard-menu-toggle::after { content: ""; flex: none; width: 7px; height: 7px; margin-top: -4px; border-right: 2px solid var(--color-text-secondary); border-bottom: 2px solid var(--color-text-secondary); transform: rotate(45deg); transition: transform 0.15s ease; }
|
||||
.nebula-dashboard-menu-toggle[aria-expanded="true"]::after { margin-top: 4px; transform: rotate(-135deg); }
|
||||
.nebula-dashboard-nav { display: grid; gap: var(--space-3); padding: var(--space-3); border: 1px solid var(--color-border); border-radius: var(--radius-md); background: rgba(5, 7, 17, 0.38); }
|
||||
.nebula-dashboard-nav-group { display: grid; gap: 2px; }
|
||||
.nebula-dashboard-nav-group + .nebula-dashboard-nav-group { padding-top: var(--space-3); border-top: 1px solid var(--color-border); }
|
||||
/* La pastille d'une entrée (quêtes, échanges reçus) se range au bout de la ligne. */
|
||||
.nebula-dashboard-nav-item { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); padding: 7px 12px; border-radius: var(--radius-sm); color: var(--color-text-secondary); font-size: var(--font-size-sm); font-weight: 700; text-decoration: none; white-space: nowrap; }
|
||||
.nebula-dashboard-nav-item:hover { background: var(--color-primary-soft); color: var(--color-text-primary); }
|
||||
.nebula-dashboard-nav-item:focus-visible { outline: 2px solid var(--color-accent-gold); outline-offset: 2px; }
|
||||
.nebula-dashboard-nav-item[aria-current="page"] { background: rgba(246, 196, 83, 0.14); box-shadow: inset 0 0 0 1px rgba(246, 196, 83, 0.42); color: var(--color-accent-gold); }
|
||||
@container nebula-dashboard (width < 960px) {
|
||||
/* Au-dessus du contenu (cartes transformées comprises), sous la barre du haut collante (z-index 80). */
|
||||
.nebula-dashboard-menu { z-index: 30; }
|
||||
.nebula-dashboard-nav { position: absolute; top: calc(100% + var(--space-1)); left: 0; width: min(100%, 300px); background: var(--color-bg-sidebar); box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5); }
|
||||
.nebula-dashboard-nav:not([data-open]) { display: none; }
|
||||
}
|
||||
@container nebula-dashboard (min-width: 960px) {
|
||||
.nebula-dashboard-shell { grid-template-columns: 200px minmax(0, 1fr); align-items: start; }
|
||||
.nebula-dashboard-aside { position: sticky; top: calc(68px + var(--space-4)); }
|
||||
.nebula-dashboard-nav { display: grid; gap: var(--space-4); padding: var(--space-3); }
|
||||
.nebula-dashboard-nav-group { display: grid; gap: 2px; }
|
||||
.nebula-dashboard-nav-group + .nebula-dashboard-nav-group { padding-left: 0; border-left: 0; }
|
||||
.nebula-dashboard-nav-item { padding: 7px 12px; font-size: var(--font-size-sm); }
|
||||
.nebula-dashboard-menu-toggle { display: none; }
|
||||
.nebula-dashboard-nav-group + .nebula-dashboard-nav-group { padding-top: 0; border-top: 0; }
|
||||
.nebula-dashboard-nav { gap: var(--space-4); }
|
||||
}
|
||||
.nebula-form .nebula-admin-check, .nebula-admin-check { display: inline-flex; align-items: center; gap: var(--space-2); color: var(--color-text-primary); font-weight: 700; cursor: pointer; }
|
||||
.nebula-admin-actions { margin-top: var(--space-3); }
|
||||
|
|
@ -682,9 +825,6 @@ main:has(.nebula-dashboard) { overflow-x: clip; }
|
|||
.nebula-transfer-side > strong { font-size: var(--font-size-sm); }
|
||||
.nebula-transfer-side .nebula-card { width: 96px; }
|
||||
.nebula-transfer-arrow { flex: none; color: var(--color-accent-gold); font-size: var(--font-size-xl); }
|
||||
.nebula-dashboard-nav-item { position: relative; }
|
||||
/* Pastille posée sur le coin : le compteur ne change ni la largeur du menu ni sa rangée en demi-écran. */
|
||||
.nebula-dashboard-nav-item .nds-badge { position: absolute; top: -6px; right: -6px; z-index: 1; }
|
||||
.nebula-trade-composer.nds-modal { box-sizing: border-box; display: grid; gap: var(--space-3); width: min(1040px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow: auto; }
|
||||
.nebula-trade-composer h2 { margin: 0; }
|
||||
.nds-section-heading.nebula-section-heading:has(.nds-radio-button-group) { flex-wrap: wrap; margin-bottom: 0; }
|
||||
|
|
@ -892,6 +1032,11 @@ main:has(.nebula-dashboard) { overflow-x: clip; }
|
|||
.nebula-admin-shop-values label, .nebula-admin-shop-item-fields label { display: grid; gap: 6px; color: var(--color-text-secondary); font-size: var(--font-size-sm); }
|
||||
.nebula-admin-shop-values label > span { padding-left: var(--space-2); border-left: 2px solid var(--card-rarity, var(--color-border-hover)); }
|
||||
.nebula-admin-shop-item-fields .nds-input { width: 100%; }
|
||||
/* Guilde : la partie du jour, puis la récompense d'une victoire. */
|
||||
.nebula-admin-guild-today { margin: 0; color: var(--color-text-secondary); font-size: var(--font-size-sm); }
|
||||
.nebula-admin-guild-today strong { color: var(--color-text-primary); }
|
||||
.nebula-admin-guild-reward-field { display: grid; gap: 6px; max-width: 240px; color: var(--color-text-secondary); font-size: var(--font-size-sm); }
|
||||
.nebula-admin-guild-reward-field .nds-input { width: 100%; }
|
||||
.nebula-admin-shop-item-fields .nds-badge { align-self: flex-start; }
|
||||
.nds-toolbar.nebula-admin-shop-actions { justify-content: flex-start; }
|
||||
|
||||
|
|
@ -901,6 +1046,15 @@ main:has(.nebula-dashboard) { overflow-x: clip; }
|
|||
.nebula-admin-drop-rates.nds-panel { display: grid; gap: var(--space-3); padding: var(--space-4) var(--space-5); }
|
||||
.nebula-admin-drop-rates h3, .nebula-admin-drop-rates .nebula-form-help { margin: 0; }
|
||||
|
||||
/* Paquet de la boutique : ses sources (collections ouvertes, ses légendaires et mythiques) et la part de ses cartes. */
|
||||
.nebula-admin-shop-pack-content.nds-panel { display: grid; gap: var(--space-3); padding: var(--space-4) var(--space-5); }
|
||||
.nebula-admin-shop-pack-content :is(h3, .nebula-form-help) { margin: 0; }
|
||||
.nebula-admin-shop-pack-sources { display: grid; gap: var(--space-2); margin: 0; }
|
||||
.nebula-admin-shop-pack-sources > div { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-3); font-size: var(--font-size-sm); }
|
||||
.nebula-admin-shop-pack-sources dt { min-width: 150px; color: var(--color-text-secondary); font-weight: 700; }
|
||||
.nebula-admin-shop-pack-sources dd { margin: 0; color: var(--color-text-primary); }
|
||||
.nebula-admin-shop-pack-share { display: grid; gap: 6px; max-width: 480px; color: var(--color-text-secondary); font-size: var(--font-size-sm); }
|
||||
.nebula-admin-shop-pack-share .nds-input { width: 100%; max-width: 240px; }
|
||||
.nebula-admin-collection-settings { display: grid; gap: var(--space-4); align-items: start; }
|
||||
.nebula-admin-collection-settings > * { min-width: 0; }
|
||||
.nebula-admin-collection-settings > .nebula-admin-collection-opening-panel.nds-panel { justify-self: stretch; width: auto; }
|
||||
|
|
@ -940,3 +1094,7 @@ button.nebula-privacy-toggle:hover:not(:disabled) { color: var(--color-text-prim
|
|||
.nebula-privacy-notice p { margin: 0; }
|
||||
.nebula-privacy-notice h4 { margin: 0 0 var(--space-1); }
|
||||
.nebula-privacy-contact a { overflow-wrap: anywhere; }
|
||||
.nebula-admin-daily-answer { display: inline; }
|
||||
.nebula-admin-daily-answer summary { display: inline; color: var(--color-text-secondary); cursor: pointer; text-decoration: underline dotted; }
|
||||
.nebula-admin-daily-answer[open] summary { margin-right: var(--space-1); }
|
||||
.nebula-admin-daily-answer span { color: var(--color-text-primary); }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue