Show a New badge when a pack reveals an unowned card edition
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
c95f767b63
commit
1adccb4e04
7 changed files with 19 additions and 5 deletions
|
|
@ -1422,6 +1422,8 @@ Sous `prefers-reduced-motion: reduce`, le tilt, le mouvement du prisme, le flip
|
||||||
animé, les particules et les transitions non essentielles sont supprimés ; la
|
animé, les particules et les transitions non essentielles sont supprimés ; la
|
||||||
finition holographique reste visible sous une forme statique (le Reflet diffractif
|
finition holographique reste visible sous une forme statique (le Reflet diffractif
|
||||||
aussi sur écran tactile, faute de tilt) et la révélation se
|
aussi sur écran tactile, faute de tilt) et la révélation se
|
||||||
termine immédiatement. Les pages
|
termine immédiatement. Une fois sa révélation terminée, une carte dont le joueur ne
|
||||||
|
possédait pas l'édition affiche le badge « New » (`nebula-card-new-badge`), or plein
|
||||||
|
à cheval sur le coin haut droit ; son nom accessible se termine par « nouvelle carte ». Les pages
|
||||||
Paquets, Collection, Échanges, Historique et Administration partagent les panels,
|
Paquets, Collection, Échanges, Historique et Administration partagent les panels,
|
||||||
chips et focus du NDS et sont validées sans débordement à partir de 768 px.
|
chips et focus du NDS et sont validées sans débordement à partir de 768 px.
|
||||||
|
|
|
||||||
|
|
@ -292,6 +292,10 @@ test("player opens and reveals a three-card pack", async ({ page }) => {
|
||||||
await expect(page.locator(".nebula-home-rarest-card")).toHaveCount(0);
|
await expect(page.locator(".nebula-home-rarest-card")).toHaveCount(0);
|
||||||
await page.getByRole("button", { name: "Reprendre l’ouverture", exact: true }).click();
|
await page.getByRole("button", { name: "Reprendre l’ouverture", exact: true }).click();
|
||||||
await expect(page.getByRole("button", { name: "Révéler la carte" })).toHaveCount(3);
|
await expect(page.getByRole("button", { name: "Révéler la carte" })).toHaveCount(3);
|
||||||
|
// Le badge « New » suit l'édition non possédée et n'apparaît qu'une fois la carte révélée : la première carte du tout premier paquet est forcément nouvelle.
|
||||||
|
const newEditions = await page.evaluate(async () => (await globalThis.fetch("/api/cards/state")).json().then((state) => state.pendingOpening.cards.map((card) => card.isNewEdition)));
|
||||||
|
expect(newEditions[0]).toBe(true);
|
||||||
|
await expect(page.locator(".nebula-card-new-badge")).toHaveCount(0);
|
||||||
await page.getByRole("button", { name: "Tout révéler" }).click();
|
await page.getByRole("button", { name: "Tout révéler" }).click();
|
||||||
const openingStage = page.locator(".nebula-opening-stage");
|
const openingStage = page.locator(".nebula-opening-stage");
|
||||||
const revealedCards = page.locator('.nebula-opening-cards .nebula-card[data-card-size="lg"]');
|
const revealedCards = page.locator('.nebula-opening-cards .nebula-card[data-card-size="lg"]');
|
||||||
|
|
@ -306,7 +310,9 @@ test("player opens and reveals a three-card pack", async ({ page }) => {
|
||||||
await expect(revealedCards.first().locator(".nebula-card-rarity-symbol")).toHaveCSS("color", "rgb(103, 232, 249)");
|
await expect(revealedCards.first().locator(".nebula-card-rarity-symbol")).toHaveCSS("color", "rgb(103, 232, 249)");
|
||||||
await expect(revealedCards.first().locator(".nebula-card-particles i").first()).toHaveCSS("color", "rgb(255, 59, 48)");
|
await expect(revealedCards.first().locator(".nebula-card-particles i").first()).toHaveCSS("color", "rgb(255, 59, 48)");
|
||||||
await expect(page.getByRole("button", { name: "Retour", exact: true })).toBeVisible();
|
await expect(page.getByRole("button", { name: "Retour", exact: true })).toBeVisible();
|
||||||
const revealedNames = await revealedCards.evaluateAll((cards) => cards.map((card) => card.getAttribute("aria-label").replace(/ révélée$/, "")));
|
expect(await revealedCards.evaluateAll((cards) => cards.map((card) => card.querySelector(".nebula-card-new-badge")?.textContent === "New"))).toEqual(newEditions);
|
||||||
|
expect(await revealedCards.evaluateAll((cards) => cards.map((card) => card.getAttribute("aria-label").endsWith(", nouvelle carte")))).toEqual(newEditions);
|
||||||
|
const revealedNames = await revealedCards.evaluateAll((cards) => cards.map((card) => card.getAttribute("aria-label").replace(/ révélée(, nouvelle carte)?$/, "")));
|
||||||
await expect.poll(() => page.evaluate(async () => (await globalThis.fetch("/api/cards/state")).json().then((state) => state.pendingOpening))).toBeNull();
|
await expect.poll(() => page.evaluate(async () => (await globalThis.fetch("/api/cards/state")).json().then((state) => state.pendingOpening))).toBeNull();
|
||||||
expect((await openingStage.boundingBox()).width).toBeLessThanOrEqual(1000);
|
expect((await openingStage.boundingBox()).width).toBeLessThanOrEqual(1000);
|
||||||
await expect(page.locator(".nebula-opening-summary")).toHaveCount(0);
|
await expect(page.locator(".nebula-opening-summary")).toHaveCount(0);
|
||||||
|
|
|
||||||
|
|
@ -217,6 +217,7 @@ export function validateSiteContent(site) {
|
||||||
"cards.packs.open",
|
"cards.packs.open",
|
||||||
"cards.packs.probabilities",
|
"cards.packs.probabilities",
|
||||||
"cards.packs.back",
|
"cards.packs.back",
|
||||||
|
"cards.packs.newBadge",
|
||||||
"cards.packs.shopShare",
|
"cards.packs.shopShare",
|
||||||
"cards.shop.packDescription",
|
"cards.shop.packDescription",
|
||||||
"cards.shop.packAction",
|
"cards.shop.packAction",
|
||||||
|
|
|
||||||
|
|
@ -200,6 +200,7 @@
|
||||||
"open": "Ouvrir ce paquet",
|
"open": "Ouvrir ce paquet",
|
||||||
"probabilities": "Probabilités",
|
"probabilities": "Probabilités",
|
||||||
"back": "Retour",
|
"back": "Retour",
|
||||||
|
"newBadge": "New",
|
||||||
"shopShare": "des légendaires et mythiques tirées viennent de",
|
"shopShare": "des légendaires et mythiques tirées viennent de",
|
||||||
"purchasedLabel": "Ouvertures achetées",
|
"purchasedLabel": "Ouvertures achetées",
|
||||||
"purchasedHelp": "Utilisées automatiquement quand votre réserve est vide.",
|
"purchasedHelp": "Utilisées automatiquement quand votre réserve est vide.",
|
||||||
|
|
|
||||||
|
|
@ -213,7 +213,7 @@ function CardFace({ entry, quantity, visual, size }) {
|
||||||
</div>;
|
</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 }) {
|
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 }) {
|
||||||
const cardSize = ["sm", "md", "lg"].includes(size) ? size : "lg";
|
const cardSize = ["sm", "md", "lg"].includes(size) ? size : "lg";
|
||||||
const rarity = entry.edition?.rarity || "common";
|
const rarity = entry.edition?.rarity || "common";
|
||||||
const finish = entry.edition?.finishIds?.join(" ") || "standard";
|
const finish = entry.edition?.finishIds?.join(" ") || "standard";
|
||||||
|
|
@ -309,7 +309,7 @@ export function NebulaCard({ catalog, entry, quantity = 0, size = "lg", faceUp =
|
||||||
const faceVisible = ["revealing", "revealed"].includes(revealPhase);
|
const faceVisible = ["revealing", "revealed"].includes(revealPhase);
|
||||||
const particlesVisible = faceVisible && rarity !== "common" && openingVisual.particlePreset;
|
const particlesVisible = faceVisible && rarity !== "common" && openingVisual.particlePreset;
|
||||||
const ariaLabel = revealPhase === "revealed"
|
const ariaLabel = revealPhase === "revealed"
|
||||||
? (replayable ? `Remettre ${revealLabel} face cachée` : `${entry.card.name} révélée`)
|
? (replayable ? `Remettre ${revealLabel} face cachée` : `${entry.card.name} révélée${newBadge ? ", nouvelle carte" : ""}`)
|
||||||
: `Révéler ${revealLabel}`;
|
: `Révéler ${revealLabel}`;
|
||||||
return <button
|
return <button
|
||||||
ref={cardRef}
|
ref={cardRef}
|
||||||
|
|
@ -342,6 +342,7 @@ export function NebulaCard({ catalog, entry, quantity = 0, size = "lg", faceUp =
|
||||||
><CollectionCardBack collection={backCollection} /></span>
|
><CollectionCardBack collection={backCollection} /></span>
|
||||||
<CardFace entry={entry} quantity={quantity} visual={visual} size={cardSize} />
|
<CardFace entry={entry} quantity={quantity} visual={visual} size={cardSize} />
|
||||||
</span>
|
</span>
|
||||||
|
{newBadge && revealPhase === "revealed" && <span className="nds-badge nebula-card-new-badge" aria-hidden="true">{newBadge}</span>}
|
||||||
</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></>}
|
{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></>}
|
||||||
{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>}
|
{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>}
|
||||||
|
|
|
||||||
|
|
@ -143,7 +143,7 @@ function OpeningStage({ catalog, opening, onComplete, onDismiss, busy, content,
|
||||||
{allRevealed && <button className="nds-button" data-size="sm" data-variant="secondary" type="button" disabled={busy} onClick={finish}>{content.back}</button>}
|
{allRevealed && <button className="nds-button" data-size="sm" data-variant="secondary" type="button" disabled={busy} onClick={finish}>{content.back}</button>}
|
||||||
</div>
|
</div>
|
||||||
<div className="nebula-opening-cards">
|
<div className="nebula-opening-cards">
|
||||||
{opening.cards.map((card) => <NebulaCard key={card.id} catalog={catalog} entry={card} size="lg" faceUp={false} backCollection={collection} revealed={revealed.has(card.id)} onReveal={() => setRevealed((current) => new Set([...current, card.id]))} onRevealComplete={() => setFinishedReveals((current) => new Set([...current, card.id]))} />)}
|
{opening.cards.map((card) => <NebulaCard key={card.id} catalog={catalog} entry={card} size="lg" faceUp={false} backCollection={collection} newBadge={card.isNewEdition ? content.newBadge : null} revealed={revealed.has(card.id)} onReveal={() => setRevealed((current) => new Set([...current, card.id]))} onRevealComplete={() => setFinishedReveals((current) => new Set([...current, card.id]))} />)}
|
||||||
</div>
|
</div>
|
||||||
<OpeningOdds catalog={catalog} opening={opening} collection={collection} content={content} shopShare={shopShare} />
|
<OpeningOdds catalog={catalog} opening={opening} collection={collection} content={content} shopShare={shopShare} />
|
||||||
</section>;
|
</section>;
|
||||||
|
|
|
||||||
|
|
@ -201,6 +201,8 @@ button.nebula-card { cursor: pointer; }
|
||||||
.nebula-card[data-card-size="md"] .nebula-card-rarity-symbol { right: 6px; bottom: 5px; width: 13px; height: 13px; filter: drop-shadow(0 1px 2px rgba(5, 7, 17, 0.8)); }
|
.nebula-card[data-card-size="md"] .nebula-card-rarity-symbol { right: 6px; bottom: 5px; width: 13px; height: 13px; filter: drop-shadow(0 1px 2px rgba(5, 7, 17, 0.8)); }
|
||||||
.nebula-card-rarity-symbol svg { width: 100%; height: 100%; overflow: visible; fill: currentColor; stroke: currentColor; stroke-width: 1.4; }
|
.nebula-card-rarity-symbol svg { width: 100%; height: 100%; overflow: visible; fill: currentColor; stroke: currentColor; stroke-width: 1.4; }
|
||||||
.nebula-card-rarity-symbol[data-rarity="legendary"] svg > circle, .nebula-card-rarity-symbol[data-rarity="mythic"] svg > ellipse { fill: none; }
|
.nebula-card-rarity-symbol[data-rarity="legendary"] svg > circle, .nebula-card-rarity-symbol[data-rarity="mythic"] svg > ellipse { fill: none; }
|
||||||
|
.nebula-card-reveal .nds-badge.nebula-card-new-badge { position: absolute; top: -8px; right: -8px; z-index: 3; border-color: transparent; background: var(--color-accent-gold); color: var(--color-text-inverse); transform: translateZ(1px); box-shadow: var(--shadow-md); animation: nebula-card-new-badge 260ms var(--ease-standard) both; }
|
||||||
|
@keyframes nebula-card-new-badge { from { opacity: 0; transform: translateZ(1px) scale(0.6); } to { opacity: 1; transform: translateZ(1px) scale(1); } }
|
||||||
.nebula-card-quantity { position: absolute; left: 10px; bottom: 10px; z-index: 5; min-width: 28px; padding: 3px 7px; border-radius: var(--radius-pill); background: rgba(5, 7, 17, 0.82); color: white; font-size: var(--font-size-xs); font-weight: 800; text-align: center; }
|
.nebula-card-quantity { position: absolute; left: 10px; bottom: 10px; z-index: 5; min-width: 28px; padding: 3px 7px; border-radius: var(--radius-pill); background: rgba(5, 7, 17, 0.82); color: white; font-size: var(--font-size-xs); font-weight: 800; text-align: center; }
|
||||||
.nebula-card[data-card-size="md"] .nebula-card-quantity { top: 10px; bottom: auto; }
|
.nebula-card[data-card-size="md"] .nebula-card-quantity { top: 10px; bottom: auto; }
|
||||||
.nebula-card-glare, .nebula-card-holo-layer { position: absolute; inset: 0; pointer-events: none; border-radius: inherit; transition: opacity 220ms var(--ease-standard); }
|
.nebula-card-glare, .nebula-card-holo-layer { position: absolute; inset: 0; pointer-events: none; border-radius: inherit; transition: opacity 220ms var(--ease-standard); }
|
||||||
|
|
@ -767,6 +769,7 @@ main:has(.nebula-dashboard) { overflow-x: clip; }
|
||||||
.nebula-card { --card-lift: 0px; }
|
.nebula-card { --card-lift: 0px; }
|
||||||
.nebula-card-tilt-surface { transform: none; transition: none; }
|
.nebula-card-tilt-surface { transform: none; transition: none; }
|
||||||
.nebula-card-inner { transition: none; }
|
.nebula-card-inner { transition: none; }
|
||||||
|
.nebula-card-reveal .nds-badge.nebula-card-new-badge { animation: none; }
|
||||||
.nebula-card-particles, .nebula-card-glare, .nebula-card-reveal::after, .nebula-card-opening-aura-palette, .nebula-card-opening-crown-palette, .nebula-card-opening-glow-palette, .nebula-card-glow-palette { display: none !important; }
|
.nebula-card-particles, .nebula-card-glare, .nebula-card-reveal::after, .nebula-card-opening-aura-palette, .nebula-card-opening-crown-palette, .nebula-card-opening-glow-palette, .nebula-card-glow-palette { display: none !important; }
|
||||||
.nebula-card-reveal .nebula-card-tilt-surface { filter: none !important; animation: none !important; }
|
.nebula-card-reveal .nebula-card-tilt-surface { filter: none !important; animation: none !important; }
|
||||||
.nebula-card-holo-layer { transition: none; }
|
.nebula-card-holo-layer { transition: none; }
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue