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
|
|
@ -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());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue