Let players use Sokko TCG from a phone through a mobile fallback mode
#/mobile/cards shows the game without the site shell: a title, a footer with the account and a discreet "Version complète" link, and a tab bar fixed at the bottom. Phones opening #/cards are sent to the same section in mobile mode unless the player chose the full version. Account, History and Administration point to the computer. The panels are the computer ones, adapted under .nebula-mobile (and body.nebula-mobile-body for dialogs) for a 393×852 reference phone: small cards with names under them when opening packs, a revealed card shown large on tap, tap-to-pick team recruitment with a single Recruit button and large stars, row lists for explorers and commons in the expedition pickers, a race track and circuit that read at phone size, and full-width actions throughout. Firefox no longer shows a mirrored back on a flipped card. Phone Playwright journeys check that every section fits the screen with no button wrapping, then open a pack, run an expedition and recruit a team by touch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
0262f596c9
commit
c3e494b8a6
53 changed files with 1830 additions and 123 deletions
|
|
@ -362,7 +362,21 @@ function CardFace({ entry, quantity, visual, size, flare = null }) {
|
|||
</div>;
|
||||
}
|
||||
|
||||
export function NebulaCard({ catalog, entry, quantity = 0, size = "lg", faceUp = true, onReveal, onRevealComplete, onConceal, onSelect, selectLabel, selected, revealed = false, replayable = false, revealLabel = "la carte", disabled = false, concealed = false, backCollection = null, newBadge = null }) {
|
||||
/**
|
||||
* Carte collectionnable : face visible (`article`, ou bouton avec `onSelect`), face cachée à révéler (`faceUp` faux)
|
||||
* ou dos seul (`concealed`).
|
||||
* @param {object} props
|
||||
* @param {object} props.catalog Catalogue (finitions, effets d'ouverture, palettes).
|
||||
* @param {object} props.entry Carte et édition (`{ card, edition }`).
|
||||
* @param {"sm"|"md"|"lg"} [props.size] Format : `sm` sans nom, `md` avec le nom, `lg` avec la description.
|
||||
* @param {boolean} [props.faceUp] Faux pour une carte à révéler : `revealed`, `onReveal` et `onRevealComplete` la pilotent.
|
||||
* @param {Function} [props.onRevealComplete] Appelé quand la révélation est terminée, effets compris.
|
||||
* @param {Function} [props.onOpen] Rend une carte révélée touchable (sauf si `replayable`) : l'ouvre en grand.
|
||||
* @param {string} [props.openLabel] Nom accessible de la carte révélée quand `onOpen` est donné.
|
||||
* @param {boolean} [props.quietReveal] Révélation sobre : retournement et lueur seulement, sans halo, couronne ni
|
||||
* particules ; la révélation se termine avec le retournement au lieu d'attendre la fin des particules.
|
||||
*/
|
||||
export function NebulaCard({ catalog, entry, quantity = 0, size = "lg", faceUp = true, onReveal, onRevealComplete, onConceal, onSelect, selectLabel, selected, revealed = false, replayable = false, revealLabel = "la carte", disabled = false, concealed = false, backCollection = null, newBadge = null, quietReveal = false, onOpen = null, openLabel = "" }) {
|
||||
const cardSize = ["sm", "md", "lg"].includes(size) ? size : "lg";
|
||||
const rarity = entry.edition?.rarity || "common";
|
||||
const finish = entry.edition?.finishIds?.join(" ") || "standard";
|
||||
|
|
@ -442,7 +456,8 @@ export function NebulaCard({ catalog, entry, quantity = 0, size = "lg", faceUp =
|
|||
}
|
||||
|
||||
const auraDuration = openingVisual.auraDurationMs;
|
||||
const revealDuration = Math.max(600, openingVisual.particleDurationMs);
|
||||
// 600 ms : la durée du retournement (`.nebula-card-inner`). Sans particules, rien ne reste à attendre après lui.
|
||||
const revealDuration = quietReveal ? 600 : Math.max(600, openingVisual.particleDurationMs);
|
||||
queueMicrotask(() => setRevealPhase(auraDuration ? "aura" : "revealing"));
|
||||
if (auraDuration) timers.push(window.setTimeout(() => setRevealPhase("revealing"), auraDuration));
|
||||
timers.push(window.setTimeout(() => {
|
||||
|
|
@ -450,7 +465,7 @@ export function NebulaCard({ catalog, entry, quantity = 0, size = "lg", faceUp =
|
|||
onRevealCompleteRef.current?.();
|
||||
}, auraDuration + revealDuration));
|
||||
return () => timers.forEach((timer) => window.clearTimeout(timer));
|
||||
}, [revealed, openingVisual.auraDurationMs, openingVisual.particleDurationMs]);
|
||||
}, [revealed, quietReveal, openingVisual.auraDurationMs, openingVisual.particleDurationMs]);
|
||||
|
||||
if (concealed) {
|
||||
return <article ref={cardRef} className="nebula-card nebula-card-concealed" data-card-size={cardSize} aria-label={`Carte inconnue — ${backCollection?.name || "collection inconnue"}`}>
|
||||
|
|
@ -459,11 +474,13 @@ export function NebulaCard({ catalog, entry, quantity = 0, size = "lg", faceUp =
|
|||
}
|
||||
if (!faceUp) {
|
||||
const hasAuraPalette = openingVisual.auraColors.length > 1;
|
||||
const outerAura = hasAuraPalette && !quietReveal;
|
||||
const locked = ["aura", "revealing", "concealing"].includes(revealPhase);
|
||||
const faceVisible = ["revealing", "revealed"].includes(revealPhase);
|
||||
const particlesVisible = faceVisible && rarity !== "common" && openingVisual.particlePreset;
|
||||
const particlesVisible = faceVisible && !quietReveal && rarity !== "common" && openingVisual.particlePreset;
|
||||
const openable = revealPhase === "revealed" && !replayable && Boolean(onOpen);
|
||||
const ariaLabel = revealPhase === "revealed"
|
||||
? (replayable ? `Remettre ${revealLabel} face cachée` : `${entry.card.name} révélée${newBadge ? ", nouvelle carte" : ""}`)
|
||||
? (replayable ? `Remettre ${revealLabel} face cachée` : openable ? openLabel : `${entry.card.name} révélée${newBadge ? ", nouvelle carte" : ""}`)
|
||||
: `Révéler ${revealLabel}`;
|
||||
return <button
|
||||
ref={cardRef}
|
||||
|
|
@ -476,13 +493,13 @@ export function NebulaCard({ catalog, entry, quantity = 0, size = "lg", faceUp =
|
|||
data-aura-palette={hasAuraPalette || undefined}
|
||||
{...visualAttributes}
|
||||
type="button"
|
||||
disabled={disabled || (revealPhase === "revealed" && !replayable)}
|
||||
aria-disabled={disabled || locked || (revealPhase === "revealed" && !replayable) || undefined}
|
||||
disabled={disabled || (revealPhase === "revealed" && !replayable && !openable)}
|
||||
aria-disabled={disabled || locked || (revealPhase === "revealed" && !replayable && !openable) || undefined}
|
||||
data-reveal-locked={locked || undefined}
|
||||
aria-label={ariaLabel}
|
||||
onClick={() => {
|
||||
if (locked || disabled) return;
|
||||
if (revealPhase === "revealed") onConceal?.();
|
||||
if (revealPhase === "revealed") (openable ? onOpen : onConceal)?.();
|
||||
else onReveal?.();
|
||||
}}
|
||||
>
|
||||
|
|
@ -498,7 +515,7 @@ export function NebulaCard({ catalog, entry, quantity = 0, size = "lg", faceUp =
|
|||
</span>
|
||||
{newBadge && revealPhase === "revealed" && <span className="nds-badge nebula-card-new-badge" aria-hidden="true">{newBadge}</span>}
|
||||
</span>
|
||||
{hasAuraPalette && <><span className="nebula-card-opening-aura-palette" aria-hidden="true" /><span className="nebula-card-opening-crown-palette" aria-hidden="true" /><span className="nebula-card-opening-glow-palette" aria-hidden="true"><span /></span></>}
|
||||
{outerAura && <><span className="nebula-card-opening-aura-palette" aria-hidden="true" /><span className="nebula-card-opening-crown-palette" aria-hidden="true" /><span className="nebula-card-opening-glow-palette" aria-hidden="true"><span /></span></>}
|
||||
{particlesVisible && <span className="nebula-card-particles" aria-hidden="true">{rarity === "mythic" && <><span className="nebula-card-particle-ring-glow" data-glow="outer"><span><span /></span></span><span className="nebula-card-particle-ring-glow" data-glow="inner"><span><span /></span></span></>}{Array.from({ length: openingVisual.particlePreset.count }, (_, index) => <i key={index} style={particlePosition(index, openingVisual.particlePreset.count, rarity === "legendary" || rarity === "mythic", openingVisual.particlePalette?.colors[index % openingVisual.particlePalette.colors.length])} />)}</span>}
|
||||
</button>;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue