"use client"; import { useNavigation } from "../navigation"; import { DragStrip } from "../platform"; import { ArrowLeft } from "lucide-react"; import { Button } from "@multica/ui/components/ui/button"; import { Dialog, DialogContent, DialogTitle, DialogDescription, } from "@multica/ui/components/ui/dialog"; import { paths } from "@multica/core/paths"; import { useConfigStore } from "@multica/core/config"; import { CreateWorkspaceForm } from "../workspace/create-workspace-form"; import { useT } from "../i18n"; export function CreateWorkspaceModal({ onClose }: { onClose: () => void }) { const { t } = useT("modals"); const tWorkspace = useT("workspace").t; const router = useNavigation(); const workspaceCreationDisabled = useConfigStore((s) => s.workspaceCreationDisabled); return ( { if (!v) onClose(); }} > {/* DragStrip as flex child — macOS traffic lights stay visible and the top 48px is draggable. Back button sits just below the strip (top-16 = 64px), clear of both traffic lights (y<=27) and the strip (y<=48). `no-drag` is a belt-and-braces guard in case the button's layout ever creeps up into the strip zone. */}
{workspaceCreationDisabled ? (
{tWorkspace(($) => $.creation_disabled.title)} {tWorkspace(($) => $.creation_disabled.description)}
) : ( <>
{t(($) => $.create_workspace.title)} {t(($) => $.create_workspace.description)}
{ onClose(); // Navigate INTO the new workspace. The mutation's own onSuccess // (in core/workspace/mutations.ts) runs before this callback and // has already seeded the workspace list cache, so the destination // [workspaceSlug]/layout will resolve newWs.slug → workspace // synchronously without a loading flash. router.push(paths.workspace(newWs.slug).issues()); }} /> )}
); }