"use client"; import Image from "next/image"; import { memo } from "react"; import { getAssetPath, shareIconPath, type ShareIconName, } from "../../../../lib/assetUtils"; import Avatar from "../../asset/Avatar"; import Button from "../../buttons/Button"; 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 ModalHeader from "../ModalHeader"; import ContentLockup from "../../type/ContentLockup"; import type { SharePerson } from "../../../../lib/ruleShareTypes"; import type { ShareViewProps } from "./Share.types"; function ShareGlyph(props: { name: ShareIconName; size?: number }) { const size = props.size ?? 24; return ( ); } function PersonRow(props: { initials: string; title: string; subtitle?: string; roleLabel: string; }) { return (

{props.title}

{props.subtitle ? (

{props.subtitle}

) : null}

{props.roleLabel}

); } function ReaderRow({ reader, roleLabel }: { reader: SharePerson; roleLabel: string }) { return ( ); } export const ShareView = memo(function ShareView({ isOpen, onClose, className, backdropVariant, dialogRef, overlayRef, titleId, 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, onCopyLink, }: ShareViewProps) { const linkOn = selectValue === "shared_by_link"; return (
onInviteValueChange(e.target.value)} onKeyDown={(e) => { if (e.key === "Enter") { e.preventDefault(); onInvite(); } }} />
{inviteError ? (

{inviteError}

) : null}

{copy.peopleWithAccess}

{shownReaders.map((reader) => ( ))} {overflowLabel ? (

{overflowLabel}

) : null}

{copy.whoCanRead}

onSelectValue(data.target.value)} options={[ { value: "private", label: copy.inviteOnly }, { value: "shared_by_link", label: copy.anyoneWithLink }, ]} />
{!showConfirm && !showError ? (

{linkOn ? copy.anyoneWithLinkHint : copy.inviteOnlyHint}

) : null}
{showLinkField ? (
) : null} {showConfirm || showError ? (
{showError ? ( ) : null}

{copy.confirmBody}

onCommunityAgreedChange(data.checked)} />
) : null} {linkCopied ? ( ) : null}
); }); ShareView.displayName = "ShareView";