Rebuild Share and Delete Account from the privacy designs.

Share asks the person who holds the pen to confirm their community agreed before a link turns on, and deleting an account lists each owned Rule with PDF and RULE.md export. Case-study Share copies the page link instead of opening the privacy modal, and the sign-in banner stays below the header so Share remains clickable.
This commit is contained in:
adilallo committed 2026-11-09 19:54:09 -07:00
1 parent 5cbda35e32
commit b6795c1f18
28 files changed
+1467 -377

No files matched your search

@@ -0,0 +1,60 @@
"use client";
/**
* Figma: Overlay / Modal / Delete Account (24985:1959)
* https://www.figma.com/design/agv0VBLiBlcnSAaiAORgPR/Community-Rule-System?node-id=24985-1959
*/
import { memo, useEffect, useId, useRef, useState } from "react";
import { useMessages } from "../../../contexts/MessagesContext";
import { useCreateModalA11y } from "../Create/useCreateModalA11y";
import { DeleteAccountView } from "./DeleteAccount.view";
import type { DeleteAccountProps } from "./DeleteAccount.types";
const DeleteAccountContainer = memo<DeleteAccountProps>((props) => {
const {
isOpen,
onClose,
onConfirm,
busy = false,
rules,
onExportPdf,
onExportMarkdown,
className = "",
backdropVariant = "blurredYellow",
} = props;
const dialogRef = useRef<HTMLDivElement>(null);
const overlayRef = useRef<HTMLDivElement>(null);
const titleId = useId();
const copy = useMessages().modals.deleteAccount;
const [understood, setUnderstood] = useState(false);
useCreateModalA11y(isOpen, busy ? () => undefined : onClose, dialogRef);
useEffect(() => {
if (!isOpen) setUnderstood(false);
}, [isOpen]);
return (
<DeleteAccountView
isOpen={isOpen}
onClose={onClose}
onConfirm={onConfirm}
busy={busy}
rules={rules}
onExportPdf={onExportPdf}
onExportMarkdown={onExportMarkdown}
className={className}
backdropVariant={backdropVariant}
dialogRef={dialogRef}
overlayRef={overlayRef}
titleId={titleId}
copy={copy}
understood={understood}
onUnderstoodChange={setUnderstood}
/>
);
});
DeleteAccountContainer.displayName = "DeleteAccount";
export default DeleteAccountContainer;
@@ -0,0 +1,50 @@
import type { RefObject } from "react";
import type { CreateModalBackdropVariant } from "../Create/CreateModalFrame.view";
export type DeleteAccountRule = {
id: string;
title: string;
};
export type DeleteAccountProps = {
isOpen: boolean;
onClose: () => void;
onConfirm: () => void;
busy?: boolean;
rules: DeleteAccountRule[];
onExportPdf: (_id: string) => void;
onExportMarkdown: (_id: string) => void;
className?: string;
backdropVariant?: CreateModalBackdropVariant;
};
export type DeleteAccountCopy = {
title: string;
description: string;
yourRules: string;
exportPdf: string;
exportMarkdown: string;
confirmLabel: string;
confirmHint: string;
cancel: string;
confirm: string;
closeDialogAriaLabel: string;
};
export type DeleteAccountViewProps = {
isOpen: boolean;
onClose: () => void;
onConfirm: () => void;
busy: boolean;
rules: DeleteAccountRule[];
onExportPdf: (_id: string) => void;
onExportMarkdown: (_id: string) => void;
className: string;
backdropVariant: CreateModalBackdropVariant;
dialogRef: RefObject<HTMLDivElement | null>;
overlayRef: RefObject<HTMLDivElement | null>;
titleId: string;
copy: DeleteAccountCopy;
understood: boolean;
onUnderstoodChange: (_checked: boolean) => void;
};
@@ -0,0 +1,139 @@
"use client";
import { memo } from "react";
import Avatar from "../../asset/Avatar";
import Icon from "../../asset/icon";
import Button from "../../buttons/Button";
import Checkbox from "../../controls/Checkbox";
import { CreateModalFrameView } from "../Create/CreateModalFrame.view";
import ModalHeader from "../ModalHeader";
import ContentLockup from "../../type/ContentLockup";
import { communityInviteInitials } from "../../../../lib/create/ruleInviteCardMeta";
import type { DeleteAccountViewProps } from "./DeleteAccount.types";
export const DeleteAccountView = memo(function DeleteAccountView({
isOpen,
onClose,
onConfirm,
busy,
rules,
onExportPdf,
onExportMarkdown,
className,
backdropVariant,
dialogRef,
overlayRef,
titleId,
copy,
understood,
onUnderstoodChange,
}: DeleteAccountViewProps) {
return (
<CreateModalFrameView
isOpen={isOpen}
onOverlayClick={busy ? () => undefined : onClose}
backdropVariant={backdropVariant}
presentation="sheet"
className={className}
ariaLabel={copy.title}
ariaLabelledBy={titleId}
overlayRef={overlayRef}
dialogRef={dialogRef}
>
<ModalHeader
onClose={busy ? undefined : onClose}
showMoreOptionsButton={false}
closeButtonAriaLabel={copy.closeDialogAriaLabel}
/>
<div className="shrink-0 bg-[var(--color-surface-default-primary)] px-6">
<ContentLockup
title={copy.title}
description={copy.description}
variant="modal"
alignment="left"
titleId={titleId}
/>
</div>
<div className="flex min-h-0 flex-1 flex-col gap-3 overflow-x-clip overflow-y-auto px-6 pb-6 pt-6">
<p className="w-full text-small-label text-[var(--color-content-default-secondary)]">
{copy.yourRules}
</p>
{rules.map((rule) => (
<div
key={rule.id}
className="flex w-full items-center gap-3 overflow-hidden rounded-[12px] bg-[var(--color-surface-default-secondary)] p-3"
>
<Avatar
alt=""
initials={communityInviteInitials(rule.title)}
size="large"
shape="circle"
variant="filled"
/>
<p className="min-w-0 flex-1 truncate text-small-label text-[var(--color-content-default-primary)]">
{rule.title}
</p>
<div className="flex shrink-0 items-start gap-2">
<Button
type="button"
buttonType="outline"
palette="default"
size="small"
disabled={busy}
onClick={() => onExportPdf(rule.id)}
>
<Icon name="picture_as_pdf" size={14} />
{copy.exportPdf}
</Button>
<Button
type="button"
buttonType="outline"
palette="default"
size="small"
disabled={busy}
onClick={() => onExportMarkdown(rule.id)}
>
<Icon name="markdown_copy" size={14} />
{copy.exportMarkdown}
</Button>
</div>
</div>
))}
<Checkbox
checked={understood}
disabled={busy}
label={copy.confirmLabel}
onChange={(data) => onUnderstoodChange(data.checked)}
/>
</div>
<div className="flex shrink-0 items-center justify-end gap-2 border-t border-solid border-[var(--color-border-default-secondary)] bg-[var(--color-surface-default-primary)] px-6 py-4">
<Button
type="button"
buttonType="outline"
palette="default"
size="small"
disabled={busy}
onClick={onClose}
>
{copy.cancel}
</Button>
<Button
type="button"
buttonType="outline"
palette="default"
size="small"
danger
disabled={busy || !understood}
onClick={onConfirm}
>
{copy.confirm}
</Button>
</div>
</CreateModalFrameView>
);
});
DeleteAccountView.displayName = "DeleteAccountView";
@@ -0,0 +1,5 @@
export { default } from "./DeleteAccount.container";
export type {
DeleteAccountProps,
DeleteAccountRule,
} from "./DeleteAccount.types";