// Create-project dialog for the rail. The API still calls these channels; // the rail presents the user-facing organizational concept. // creation feels like every other lightweight naming flow. import { Loader2Icon } from "lucide-react"; import { Button } from "../../../ui/button"; import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, } from "../../../ui/dialog"; import { Field } from "../../../ui/field"; import { Input } from "../../../ui/input"; import { Label } from "../../../ui/label"; import { SegmentedControl } from "../../../ui/segmented-control"; export const CHANNEL_NAME_MAX_LENGTH = 80; export type ProjectAudience = "workspace" | "private"; const AUDIENCE_OPTIONS = [ { value: "workspace", label: "Workspace" }, { value: "private", label: "Only me" }, ] as const satisfies readonly { value: ProjectAudience; label: string }[]; export function ChannelCreateDialog(props: { open: boolean; name: string; busy: boolean; /** * Who can see the new project, offered only where this person may make * Only me things (never in a Personal workspace, where everything is theirs). */ audience?: { value: ProjectAudience; onChange: (value: ProjectAudience) => void } | undefined; onNameChange: (name: string) => void; onOpenChange: (open: boolean) => void; onSubmit: () => void; }) { const audience = props.audience; return ( { if (!props.busy) props.onOpenChange(open); }} >
{ event.preventDefault(); if (!props.busy && props.name.trim()) props.onSubmit(); }} > New project {audience ? "Projects keep related sessions together." : "Projects keep related sessions together for everyone in this workspace."}
props.onNameChange(event.target.value)} />
{audience ? ( ) : null}
); }