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:
1 parent
5cbda35e32
commit
b6795c1f18
28 files changed
+1467
-377
No files matched your search
@@ -7,26 +7,26 @@ import {
|
||||
shareIconPath,
|
||||
type ShareIconName,
|
||||
} from "../../../../lib/assetUtils";
|
||||
import ContentLockup from "../../type/ContentLockup";
|
||||
import Avatar from "../../asset/Avatar";
|
||||
import Button from "../../buttons/Button";
|
||||
import ModalHeader from "../ModalHeader";
|
||||
import ModalFooter from "../ModalFooter";
|
||||
import Checkbox from "../../controls/Checkbox";
|
||||
import SelectInput from "../../controls/SelectInput";
|
||||
import TextInput from "../../controls/TextInput";
|
||||
import Alert from "../Alert";
|
||||
import { CreateModalFrameView } from "../Create/CreateModalFrame.view";
|
||||
import type { ShareChannelTileProps, ShareViewProps } from "./Share.types";
|
||||
import ModalHeader from "../ModalHeader";
|
||||
import ContentLockup from "../../type/ContentLockup";
|
||||
import type { SharePerson } from "../../../../lib/ruleShareTypes";
|
||||
import type { ShareViewProps } from "./Share.types";
|
||||
|
||||
/** Decorative glyphs in `public/assets/share/` — sizes match prior inline SVGs within the 60×60 circles. */
|
||||
function ShareAssetIcon(props: {
|
||||
name: ShareIconName;
|
||||
width: number;
|
||||
height: number;
|
||||
}) {
|
||||
const { name, width, height } = props;
|
||||
function ShareGlyph(props: { name: ShareIconName; size?: number }) {
|
||||
const size = props.size ?? 24;
|
||||
return (
|
||||
<Image
|
||||
src={getAssetPath(shareIconPath(name))}
|
||||
src={getAssetPath(shareIconPath(props.name))}
|
||||
alt=""
|
||||
width={width}
|
||||
height={height}
|
||||
width={size}
|
||||
height={size}
|
||||
className="shrink-0"
|
||||
unoptimized
|
||||
aria-hidden
|
||||
@@ -34,161 +34,298 @@ function ShareAssetIcon(props: {
|
||||
);
|
||||
}
|
||||
|
||||
function ShareChannelTile({
|
||||
label,
|
||||
onClick,
|
||||
circleClassName,
|
||||
icon,
|
||||
copied = false,
|
||||
}: ShareChannelTileProps) {
|
||||
function PersonRow(props: {
|
||||
initials: string;
|
||||
title: string;
|
||||
subtitle?: string;
|
||||
roleLabel: string;
|
||||
}) {
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => void onClick()}
|
||||
aria-pressed={copied || undefined}
|
||||
className="group flex w-16 shrink-0 flex-col items-center gap-2 rounded-md focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-border-invert-primary)] focus-visible:ring-offset-2 focus-visible:ring-offset-[var(--color-surface-default-primary)]"
|
||||
>
|
||||
<div
|
||||
className={`flex h-[60px] w-[60px] items-center justify-center rounded-full border border-solid transition-[transform,background-color,border-color,filter] duration-150 ease-out group-active:scale-90 ${circleClassName}`}
|
||||
>
|
||||
{icon}
|
||||
<div className="flex w-full items-center gap-3 overflow-hidden">
|
||||
<Avatar
|
||||
alt=""
|
||||
initials={props.initials}
|
||||
size="xlarge"
|
||||
shape="circle"
|
||||
variant="filled"
|
||||
/>
|
||||
<div className="flex min-w-0 flex-1 flex-col gap-0.5 overflow-hidden">
|
||||
<p className="truncate text-small-label text-[var(--color-content-default-primary)]">
|
||||
{props.title}
|
||||
</p>
|
||||
{props.subtitle ? (
|
||||
<p className="truncate text-x-small-paragraph text-[var(--color-content-default-tertiary)]">
|
||||
{props.subtitle}
|
||||
</p>
|
||||
) : null}
|
||||
</div>
|
||||
<span
|
||||
className={`max-w-[4.5rem] text-center text-x-small-label ${
|
||||
copied
|
||||
? "text-[var(--color-border-default-positive-primary)]"
|
||||
: "text-[var(--color-content-default-tertiary)]"
|
||||
}`}
|
||||
>
|
||||
{label}
|
||||
</span>
|
||||
</button>
|
||||
<p className="shrink-0 text-x-small-paragraph text-[var(--color-content-default-tertiary)]">
|
||||
{props.roleLabel}
|
||||
</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function ReaderRow({ reader, roleLabel }: { reader: SharePerson; roleLabel: string }) {
|
||||
return (
|
||||
<PersonRow
|
||||
initials={reader.initials}
|
||||
title={reader.email}
|
||||
roleLabel={roleLabel}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
export const ShareView = memo(function ShareView({
|
||||
isOpen,
|
||||
onClose,
|
||||
onEmailShare,
|
||||
onSignalShare,
|
||||
onSlackShare,
|
||||
onDiscordShare,
|
||||
className = "",
|
||||
backdropVariant = "blurredYellow",
|
||||
className,
|
||||
backdropVariant,
|
||||
dialogRef,
|
||||
overlayRef,
|
||||
titleId,
|
||||
title,
|
||||
description,
|
||||
copyLinkLabel,
|
||||
copiedLabel,
|
||||
copiedLive,
|
||||
copy,
|
||||
communityName,
|
||||
inviteValue,
|
||||
onInviteValueChange,
|
||||
onInvite,
|
||||
inviteBusy,
|
||||
inviteError,
|
||||
ownerEmail,
|
||||
ownerInitials,
|
||||
shownReaders,
|
||||
overflowLabel,
|
||||
selectValue,
|
||||
onSelectValue,
|
||||
showLinkField,
|
||||
shareUrlDisplay,
|
||||
onTurnOffLink,
|
||||
showConfirm,
|
||||
communityAgreed,
|
||||
onCommunityAgreedChange,
|
||||
onTurnOnLink,
|
||||
turnOnDisabled,
|
||||
turnOnBusy,
|
||||
showError,
|
||||
copyEnabled,
|
||||
linkCopied,
|
||||
onCopyLinkClick,
|
||||
signalLabel,
|
||||
slackLabel,
|
||||
discordLabel,
|
||||
emailLabel,
|
||||
doneLabel,
|
||||
closeDialogAriaLabel,
|
||||
moreOptionsAriaLabel,
|
||||
onCopyLink,
|
||||
}: ShareViewProps) {
|
||||
const linkOn = selectValue === "shared_by_link";
|
||||
|
||||
return (
|
||||
<CreateModalFrameView
|
||||
isOpen={isOpen}
|
||||
onOverlayClick={onClose}
|
||||
backdropVariant={backdropVariant}
|
||||
className={`max-h-[90vh] w-[min(546px,calc(100vw-32px))] max-w-[546px] min-h-0 ${className}`}
|
||||
ariaLabel={title}
|
||||
presentation="sheet"
|
||||
className={className}
|
||||
ariaLabel={copy.title}
|
||||
ariaLabelledBy={titleId}
|
||||
overlayRef={overlayRef}
|
||||
dialogRef={dialogRef}
|
||||
>
|
||||
<ModalHeader
|
||||
onClose={onClose}
|
||||
onMoreOptions={onClose}
|
||||
closeButtonAriaLabel={closeDialogAriaLabel}
|
||||
moreOptionsAriaLabel={moreOptionsAriaLabel}
|
||||
showMoreOptionsButton={false}
|
||||
closeButtonAriaLabel={copy.closeDialogAriaLabel}
|
||||
/>
|
||||
|
||||
<div className="shrink-0 bg-[var(--color-surface-default-primary)] px-[24px] py-[12px]">
|
||||
<div className="shrink-0 bg-[var(--color-surface-default-primary)] px-6">
|
||||
<ContentLockup
|
||||
title={title}
|
||||
description={description}
|
||||
title={copy.title}
|
||||
description={communityName}
|
||||
variant="modal"
|
||||
alignment="left"
|
||||
titleId={titleId}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="scrollbar-design flex min-h-0 flex-1 flex-col overflow-x-clip overflow-y-auto px-[24px] pb-6 pt-0">
|
||||
{/* Channel circle hexes are third-party brand colors (copy/link, Signal, Slack, Discord), not DS tokens. */}
|
||||
<div className="flex flex-wrap gap-4">
|
||||
<ShareChannelTile
|
||||
label={linkCopied ? copiedLabel : copyLinkLabel}
|
||||
onClick={onCopyLinkClick}
|
||||
copied={linkCopied}
|
||||
circleClassName={
|
||||
linkCopied
|
||||
? "border-2 border-[var(--color-gray-600)] bg-[var(--color-gray-700)]"
|
||||
: "border-[var(--color-gray-600)] bg-[var(--color-gray-700)] group-hover:border-2 group-hover:border-[var(--color-border-default-positive-primary)] group-hover:bg-[var(--color-gray-600)]"
|
||||
}
|
||||
icon={
|
||||
<ShareAssetIcon
|
||||
name={linkCopied ? "check" : "link"}
|
||||
width={24}
|
||||
height={24}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
<ShareChannelTile
|
||||
label={signalLabel}
|
||||
onClick={onSignalShare}
|
||||
circleClassName="border-[#3a76f0] bg-[#3a76f0] group-hover:brightness-110"
|
||||
icon={<ShareAssetIcon name="signal" width={26} height={26} />}
|
||||
/>
|
||||
<ShareChannelTile
|
||||
label={slackLabel}
|
||||
onClick={onSlackShare}
|
||||
circleClassName="border-[#4a154b] bg-[#4a154b] group-hover:brightness-110"
|
||||
icon={<ShareAssetIcon name="slack" width={26} height={26} />}
|
||||
/>
|
||||
<ShareChannelTile
|
||||
label={discordLabel}
|
||||
onClick={onDiscordShare}
|
||||
circleClassName="border-[#5865f2] bg-[#5865f2] group-hover:brightness-110"
|
||||
icon={<ShareAssetIcon name="discord" width={30} height={30} />}
|
||||
/>
|
||||
<ShareChannelTile
|
||||
label={emailLabel}
|
||||
onClick={onEmailShare}
|
||||
circleClassName="border-[var(--color-surface-invert-brand-kiwi)] bg-[var(--color-surface-invert-brand-kiwi)] group-hover:brightness-110"
|
||||
icon={<ShareAssetIcon name="mail" width={24} height={24} />}
|
||||
/>
|
||||
<div className="flex min-h-0 flex-1 flex-col gap-5 overflow-x-clip overflow-y-auto px-6 pb-6 pt-6">
|
||||
<div className="flex w-full items-center gap-2">
|
||||
<div className="min-w-0 flex-1">
|
||||
<TextInput
|
||||
type="email"
|
||||
inputSize="medium"
|
||||
formHeader={false}
|
||||
showHelpIcon={false}
|
||||
label={copy.addPeoplePlaceholder}
|
||||
placeholder={copy.addPeoplePlaceholder}
|
||||
value={inviteValue}
|
||||
error={Boolean(inviteError)}
|
||||
disabled={inviteBusy}
|
||||
autoComplete="email"
|
||||
onChange={(e) => onInviteValueChange(e.target.value)}
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === "Enter") {
|
||||
e.preventDefault();
|
||||
onInvite();
|
||||
}
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
<Button
|
||||
type="button"
|
||||
buttonType="outline"
|
||||
palette="default"
|
||||
size="small"
|
||||
disabled={inviteBusy || inviteValue.trim().length === 0}
|
||||
onClick={onInvite}
|
||||
>
|
||||
{copy.invite}
|
||||
</Button>
|
||||
</div>
|
||||
<p className="sr-only" aria-live="polite">
|
||||
{linkCopied ? copiedLive : ""}
|
||||
</p>
|
||||
</div>
|
||||
{inviteError ? (
|
||||
<p className="-mt-3 text-x-small-paragraph text-[var(--color-content-default-negative-primary)]">
|
||||
{inviteError}
|
||||
</p>
|
||||
) : null}
|
||||
|
||||
<ModalFooter
|
||||
showBackButton={false}
|
||||
showNextButton={false}
|
||||
stepper={false}
|
||||
footerContent={
|
||||
<div className="absolute right-[16px] top-[12px] flex max-w-[calc(100%-32px)] flex-wrap items-center justify-end gap-3">
|
||||
<div className="flex w-full flex-col items-start gap-3 overflow-hidden">
|
||||
<p className="w-full text-small-label text-[var(--color-content-default-secondary)]">
|
||||
{copy.peopleWithAccess}
|
||||
</p>
|
||||
<PersonRow
|
||||
initials={ownerInitials}
|
||||
title={copy.you}
|
||||
subtitle={ownerEmail}
|
||||
roleLabel={copy.holdsThePen}
|
||||
/>
|
||||
{shownReaders.map((reader) => (
|
||||
<ReaderRow
|
||||
key={reader.email}
|
||||
reader={reader}
|
||||
roleLabel={copy.canRead}
|
||||
/>
|
||||
))}
|
||||
{overflowLabel ? (
|
||||
<p className="w-full text-x-small-paragraph text-[var(--color-content-default-tertiary)]">
|
||||
{overflowLabel}
|
||||
</p>
|
||||
) : null}
|
||||
</div>
|
||||
|
||||
<div className="flex w-full flex-col items-start gap-2 overflow-hidden">
|
||||
<p className="w-full text-small-label text-[var(--color-content-default-secondary)]">
|
||||
{copy.whoCanRead}
|
||||
</p>
|
||||
<div className="flex w-full items-center gap-3">
|
||||
<ShareGlyph name={linkOn ? "language" : "lock"} />
|
||||
<div className="min-w-0 flex-1">
|
||||
<SelectInput
|
||||
showLabel={false}
|
||||
iconHelp={false}
|
||||
value={selectValue}
|
||||
onChange={(data) => onSelectValue(data.target.value)}
|
||||
options={[
|
||||
{ value: "private", label: copy.inviteOnly },
|
||||
{ value: "shared_by_link", label: copy.anyoneWithLink },
|
||||
]}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
{!showConfirm && !showError ? (
|
||||
<p className="w-full text-small-paragraph text-[var(--color-content-default-tertiary)]">
|
||||
{linkOn ? copy.anyoneWithLinkHint : copy.inviteOnlyHint}
|
||||
</p>
|
||||
) : null}
|
||||
</div>
|
||||
|
||||
{showLinkField ? (
|
||||
<div className="flex w-full flex-col items-start gap-3">
|
||||
<TextInput
|
||||
formHeader={false}
|
||||
showHelpIcon={false}
|
||||
label={copy.anyoneWithLink}
|
||||
value={shareUrlDisplay}
|
||||
disabled
|
||||
textHint={copy.linkHint}
|
||||
/>
|
||||
<Button
|
||||
buttonType="filled"
|
||||
palette="default"
|
||||
size="medium"
|
||||
type="button"
|
||||
onClick={onClose}
|
||||
buttonType="ghost"
|
||||
palette="default"
|
||||
size="small"
|
||||
onClick={onTurnOffLink}
|
||||
>
|
||||
{doneLabel}
|
||||
{copy.turnOffLink}
|
||||
</Button>
|
||||
</div>
|
||||
}
|
||||
/>
|
||||
) : null}
|
||||
|
||||
{showConfirm || showError ? (
|
||||
<div className="flex w-full flex-col items-start gap-4 overflow-hidden rounded-[8px] bg-[var(--color-surface-default-secondary)] p-4">
|
||||
{showError ? (
|
||||
<Alert
|
||||
type="banner"
|
||||
status="danger"
|
||||
size="s"
|
||||
title={copy.errorTitle}
|
||||
description={copy.errorDescription}
|
||||
hasLeadingIcon
|
||||
hasBodyText
|
||||
hasTrailingIcon={false}
|
||||
className="w-full"
|
||||
/>
|
||||
) : null}
|
||||
<p className="w-full text-small-paragraph text-[var(--color-content-default-primary)]">
|
||||
{copy.confirmBody}
|
||||
</p>
|
||||
<Checkbox
|
||||
checked={communityAgreed}
|
||||
label={copy.communityAgreed}
|
||||
onChange={(data) => onCommunityAgreedChange(data.checked)}
|
||||
/>
|
||||
<Button
|
||||
type="button"
|
||||
buttonType="filled"
|
||||
palette="default"
|
||||
size="small"
|
||||
disabled={turnOnDisabled || turnOnBusy}
|
||||
onClick={onTurnOnLink}
|
||||
>
|
||||
{copy.turnOnLink}
|
||||
</Button>
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
{linkCopied ? (
|
||||
<Alert
|
||||
type="toast"
|
||||
status="positive"
|
||||
size="s"
|
||||
title={copy.copiedLive}
|
||||
hasLeadingIcon
|
||||
hasBodyText={false}
|
||||
hasTrailingIcon={false}
|
||||
className="w-full"
|
||||
/>
|
||||
) : null}
|
||||
</div>
|
||||
|
||||
<div className="flex shrink-0 items-center justify-between 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={!copyEnabled}
|
||||
aria-pressed={linkCopied || undefined}
|
||||
onClick={onCopyLink}
|
||||
>
|
||||
<ShareGlyph name={linkCopied ? "check" : "link"} size={14} />
|
||||
{linkCopied ? copy.copied : copy.copyLink}
|
||||
</Button>
|
||||
<Button
|
||||
type="button"
|
||||
buttonType="filled"
|
||||
palette="default"
|
||||
size="small"
|
||||
onClick={onClose}
|
||||
>
|
||||
{copy.done}
|
||||
</Button>
|
||||
</div>
|
||||
</CreateModalFrameView>
|
||||
);
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user