diff --git a/DESIGN_SYSTEM.md b/DESIGN_SYSTEM.md index 83e3ab9..a2a334a 100644 --- a/DESIGN_SYSTEM.md +++ b/DESIGN_SYSTEM.md @@ -1041,8 +1041,9 @@ Les chips `nds-chip[data-size="sm"]` utilisent une hauteur minimale de 30 px, un La section Compte réunit `nds-panel` pour le récapitulatif, la notice et la zone de suppression, un bouton `data-variant="danger"` et `ConfirmModal` en mode `danger`. -La notice `PrivacyNotice` est la même sur cette section et, repliée dans un -`
`, sur l'écran de connexion. +La notice `PrivacyNotice` est la même sur cette section et sur l'écran de connexion. +Sur ce dernier, un lien centré hors du panneau de connexion, juste sous lui, l'ouvre +dans un `nds-panel` séparé ; replié, ce second panneau n'existe pas. Les cartes collectionnables utilisent un ratio vertical `5 / 7`. Le gabarit `standard` applique un fond de nuages diffus teintes selon la rarete. En `lg`, diff --git a/e2e/nebula-cards.spec.js b/e2e/nebula-cards.spec.js index f46614a..80cfaa9 100644 --- a/e2e/nebula-cards.spec.js +++ b/e2e/nebula-cards.spec.js @@ -1499,10 +1499,33 @@ test("a player reads the privacy notice and deletes the account for good", async })); const login = page.getByRole("button", { name: "Version développement", exact: true }); await page.goto("/#/cards"); - await page.locator(".nebula-privacy-details summary").click(); - await expect(page.locator(".nebula-privacy-details").getByRole("link", { name: "privacy@example.invalid" })).toHaveAttribute("href", "mailto:privacy@example.invalid"); - await expect(page.locator(".nebula-privacy-details")).toContainText("Exploitant E2E"); - await expect(page.locator(".nebula-privacy-details")).toContainText("24 mois"); + // Le lien est hors du panneau de connexion, centré sous lui ; déplié, la notice a son propre panneau en dessous. + const privacyToggle = page.getByRole("button", { name: "Confidentialité de Sokko TCG", exact: true }); + await expect(page.locator(".nebula-login .nebula-privacy-toggle")).toHaveCount(0); + const loginBox = await page.locator(".nebula-login").boundingBox(); + const toggleBox = await privacyToggle.boundingBox(); + expect(toggleBox.y).toBeGreaterThanOrEqual(loginBox.y + loginBox.height); + expect(toggleBox.x + toggleBox.width / 2).toBeCloseTo(loginBox.x + loginBox.width / 2, 0); + const privacyPanel = page.locator(".nebula-login-privacy"); + await expect(privacyToggle).toHaveAttribute("aria-expanded", "false"); + await expect(privacyPanel).toHaveCount(0); + // Au survol, seul le texte s'éclaircit : il ne reprend pas le fond des boutons du site. + await privacyToggle.hover(); + await expect(privacyToggle).toHaveCSS("background-image", "none"); + await expect(privacyToggle).toHaveCSS("box-shadow", "none"); + await privacyToggle.click(); + await expect(privacyToggle).toHaveAttribute("aria-expanded", "true"); + await expect(page.locator(".nebula-login .nebula-privacy-notice")).toHaveCount(0); + await expect(privacyPanel.getByRole("link", { name: "privacy@example.invalid" })).toHaveAttribute("href", "mailto:privacy@example.invalid"); + await expect(privacyPanel).toContainText("Exploitant E2E"); + await expect(privacyPanel).toContainText("24 mois"); + // Le panneau suit le lien et ne passe pas sous la barre du haut quand la page défile jusqu'à lui. + const panelBox = await privacyPanel.boundingBox(); + const openToggleBox = await privacyToggle.boundingBox(); + expect(panelBox.y).toBeGreaterThan(openToggleBox.y); + expect(panelBox.y).toBeGreaterThanOrEqual((await page.locator(".topbar").boundingBox()).height); + await privacyToggle.click(); + await expect(privacyPanel).toHaveCount(0); await login.click(); await page.getByRole("navigation", { name: "Sections de Sokko TCG" }).getByRole("link", { name: "Compte", exact: true }).click(); await expect(page.getByRole("heading", { name: "Compte", exact: true })).toBeVisible(); diff --git a/website/src/features/cards/CardsPage.jsx b/website/src/features/cards/CardsPage.jsx index b3ef058..2b1ba3d 100644 --- a/website/src/features/cards/CardsPage.jsx +++ b/website/src/features/cards/CardsPage.jsx @@ -45,6 +45,8 @@ export function CardsPage({ siteContent, cardsConfig, playerSection = "", adminM const [authFailure] = useState(readDiscordAuthFailure); const [busy, setBusy] = useState(false); const [accountDeleted, setAccountDeleted] = useState(false); + const [privacyOpen, setPrivacyOpen] = useState(false); + const privacyPanelRef = useRef(null); const resolvedSection = PLAYER_SECTION_ALIASES[playerSection] || playerSection; const section = PLAYER_SECTIONS.has(resolvedSection) ? resolvedSection : "home"; const [transferDraft, setTransferDraft] = useState(null); @@ -97,6 +99,11 @@ export function CardsPage({ siteContent, cardsConfig, playerSection = "", adminM if (status !== "loading") clearDiscordAuthFailure(); }, [status]); + // Le panneau s'ouvre sous le login, parfois hors de l'écran. + useEffect(() => { + if (privacyOpen) privacyPanelRef.current?.scrollIntoView({ block: "nearest" }); + }, [privacyOpen]); + useEffect(() => { const nextOpeningAt = state?.recharge?.nextOpeningAt; if (status !== "ready" || offline || !nextOpeningAt) return undefined; @@ -170,7 +177,8 @@ export function CardsPage({ siteContent, cardsConfig, playerSection = "", adminM if (cardsConfig.loading || status === "loading") return

{content.loadingTitle}

{content.loadingText}

; if (status === "disabled") return

{content.disabledTitle}

{error || content.disabled}

; if (status === "error") return

{content.errorTitle}

{error}

; - if (status === "anonymous") return
+ if (status === "anonymous") return <> +

{content.eyebrow}

@@ -184,12 +192,14 @@ export function CardsPage({ siteContent, cardsConfig, playerSection = "", adminM {authFailure &&

{content.discordErrors[authFailure] || content.discordErrors.failed}

} {error &&

{error}

} {accountDeleted &&

{content.account.deleted}

} -
- {content.privacy.title} - -
-
; +
+ + {privacyOpen &&
+

{content.privacy.title}

+ +
} + ; async function deleteAccount() { const result = await runMutation(() => deleteCardsAccount()); diff --git a/website/src/styles/_nebula-cards.scss b/website/src/styles/_nebula-cards.scss index 95282b8..1002523 100644 --- a/website/src/styles/_nebula-cards.scss +++ b/website/src/styles/_nebula-cards.scss @@ -863,9 +863,15 @@ main:has(.nebula-dashboard) { overflow-x: clip; } .nebula-account-summary dt { color: var(--color-text-muted); font-size: var(--font-size-xs); } .nebula-account-summary dd { margin: 0; overflow-wrap: anywhere; } .nebula-account-delete > .nds-button { justify-self: start; } -.nebula-privacy-details { margin-top: var(--space-3); color: var(--color-text-muted); font-size: var(--font-size-xs); } -.nebula-privacy-details summary { width: fit-content; cursor: pointer; } -.nebula-privacy-details summary:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; } +.nebula-privacy-toggle { display: flex; align-items: center; gap: var(--space-2); margin: calc(var(--space-4) - var(--space-8)) auto var(--space-4); padding: 0; border: 0; background: none; color: var(--color-text-muted); font-size: var(--font-size-xs); cursor: pointer; } +.nebula-privacy-toggle > span { display: inline-block; transition: transform 150ms ease; } +.nebula-privacy-toggle[aria-expanded="true"] > span { transform: rotate(90deg); } +// Un lien discret : aucun état ne doit reprendre le fond, l'ombre ou le déplacement des boutons du site. +button.nebula-privacy-toggle, button.nebula-privacy-toggle:hover:not(:disabled), button.nebula-privacy-toggle:active { min-height: 0; border: 0; border-radius: 0; background: none; box-shadow: none; transform: none; } +button.nebula-privacy-toggle:hover:not(:disabled) { color: var(--color-text-primary); } +.nebula-privacy-toggle:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; } +.nebula-login-privacy { display: grid; gap: var(--space-3); max-width: 960px; margin: 0 auto var(--space-8); padding: var(--space-6); scroll-margin-top: calc(var(--space-8) * 3); } +.nebula-login-privacy h2 { margin: 0; font-size: var(--font-size-lg); } .nebula-privacy-notice { display: grid; gap: var(--space-2); margin-top: var(--space-2); } .nebula-privacy-notice p { margin: 0; } .nebula-privacy-notice h4 { margin: 0 0 var(--space-1); }