Move the Cards privacy notice out of the login panel
A discreet centered link now sits below the panel and opens the notice in its own panel, which does not exist while collapsed. The link keeps none of the site's button hover styles. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
33eda986e5
commit
d372f0d248
4 changed files with 55 additions and 15 deletions
|
|
@ -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
|
||||
`<details>`, 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`,
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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 <section className="empty nds-empty-state" aria-busy="true"><h1>{content.loadingTitle}</h1><p>{content.loadingText}</p></section>;
|
||||
if (status === "disabled") return <section className="empty nds-empty-state"><h1>{content.disabledTitle}</h1><p>{error || content.disabled}</p></section>;
|
||||
if (status === "error") return <section className="empty nds-empty-state" role="alert"><h1>{content.errorTitle}</h1><p>{error}</p></section>;
|
||||
if (status === "anonymous") return <section className="nebula-login nds-panel">
|
||||
if (status === "anonymous") return <>
|
||||
<section className="nebula-login nds-panel">
|
||||
<div className="nebula-login-art"><img src="/static/img/cards/login.webp" alt="" width="800" height="800" /></div>
|
||||
<div className="nebula-login-content">
|
||||
<p className="eyebrow">{content.eyebrow}</p>
|
||||
|
|
@ -184,12 +192,14 @@ export function CardsPage({ siteContent, cardsConfig, playerSection = "", adminM
|
|||
{authFailure && <p className="nds-inline-notice" data-variant="danger" role="alert">{content.discordErrors[authFailure] || content.discordErrors.failed}</p>}
|
||||
{error && <p className="nds-inline-notice" data-variant="danger" role="alert">{error}</p>}
|
||||
{accountDeleted && <p className="nds-inline-notice" data-variant="success" role="status">{content.account.deleted}</p>}
|
||||
<details className="nebula-privacy-details">
|
||||
<summary>{content.privacy.title}</summary>
|
||||
<PrivacyNotice content={content.privacy} contact={cardsConfig.privacyContact} controller={cardsConfig.privacyController} />
|
||||
</details>
|
||||
</div>
|
||||
</section>;
|
||||
</section>
|
||||
<button className="nebula-privacy-toggle" type="button" aria-expanded={privacyOpen} aria-controls="nebula-login-privacy" onClick={() => setPrivacyOpen((open) => !open)}><span aria-hidden="true">▸</span>{content.privacy.title}</button>
|
||||
{privacyOpen && <section ref={privacyPanelRef} id="nebula-login-privacy" className="nebula-login-privacy nds-panel" aria-labelledby="nebula-login-privacy-title">
|
||||
<h2 id="nebula-login-privacy-title">{content.privacy.title}</h2>
|
||||
<PrivacyNotice content={content.privacy} contact={cardsConfig.privacyContact} controller={cardsConfig.privacyController} />
|
||||
</section>}
|
||||
</>;
|
||||
|
||||
async function deleteAccount() {
|
||||
const result = await runMutation(() => deleteCardsAccount());
|
||||
|
|
|
|||
|
|
@ -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); }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue