Let Cards players delete their account and read a privacy notice

Add a Compte section with a privacy notice and a confirmed deletion that
anonymises the player row, erases their possessions and cancels open trades.
The public contact comes from CARDS_PRIVACY_CONTACT, which production now
requires before enabling the game. The admin E2E no longer relies on a pull
from the previous test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Shinuwa 2026-11-05 18:05:41 +01:00
parent 155187d01f
commit e60fbd4e9b
16 changed files with 319 additions and 10 deletions

View file

@ -0,0 +1,39 @@
// Rôle : présente au joueur les données liées à son compte, la notice de confidentialité et la suppression du compte.
import { useState } from "react";
import { ConfirmModal } from "../../components/ToolboxModals.jsx";
import { PrivacyNotice } from "./PrivacyNotice.jsx";
export function AccountPanel({ state, busy, content, privacy, privacyContact, onDelete }) {
const [confirming, setConfirming] = useState(false);
const cards = state.collection.reduce((total, entry) => total + entry.quantity, 0);
return <div className="nebula-account">
<div className="nds-section-heading nebula-section-heading"><div><p className="eyebrow">{content.eyebrow}</p><h2>{content.title}</h2><p>{content.description}</p></div></div>
<section className="nds-panel nebula-account-summary" aria-labelledby="nebula-account-summary-title">
<h3 id="nebula-account-summary-title">{content.summaryTitle}</h3>
<dl>
<div><dt>{content.summaryName}</dt><dd>{state.player.displayName}</dd></div>
<div><dt>{content.summaryCards}</dt><dd>{cards.toLocaleString("fr-FR")}</dd></div>
<div><dt>{content.summaryOpenings}</dt><dd>{state.stats.openingsCount.toLocaleString("fr-FR")}</dd></div>
</dl>
</section>
<section className="nds-panel" aria-labelledby="nebula-account-privacy-title">
<h3 id="nebula-account-privacy-title">{privacy.title}</h3>
<PrivacyNotice content={privacy} contact={privacyContact} />
</section>
<section className="nds-panel nebula-account-delete" aria-labelledby="nebula-account-delete-title">
<h3 id="nebula-account-delete-title">{content.deleteTitle}</h3>
<p>{content.deleteText}</p>
<button className="nds-button" data-size="sm" data-variant="danger" type="button" disabled={busy} onClick={() => setConfirming(true)}>{content.deleteButton}</button>
</section>
{confirming && <ConfirmModal
title={content.confirmTitle}
message={content.confirmMessage}
confirmLabel={content.confirmLabel}
danger
onClose={(confirmed) => {
setConfirming(false);
if (confirmed) void onDelete();
}}
/>}
</div>;
}