import { Check, WifiOff, X } from "lucide-react" import { motion } from "motion/react" import type { ReactNode } from "react" import { Button } from "@/components/ui/button" import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, } from "@/components/ui/dialog" import { FluksioLoader } from "@/components/ui/fluksio-loader" import { Separator } from "@/components/ui/separator" import { Tooltip, TooltipContent, TooltipTrigger, } from "@/components/ui/tooltip" import { slideUp, transitions } from "@/lib/motion" import { cn } from "@/lib/utils" /** * The action bar at the bottom of an editor canvas, flow or dashboard. * * A phone has no room to float: there it is a bar across the full width, flush * with the bottom edge, with the buttons packed to fit one row. From `md` it is * a pill floating over the canvas, capped and wrapping, since the canvas shell * clips and an uncapped row would put the buttons at its ends out of reach. * The caller places it, with the same split. See DESIGN-GUIDELINES.md → * Responsive. */ export function Dock({ className, children, }: { className?: string children: ReactNode }) { return ( {children} ) } /** Groups the dock's buttons; a phone wraps instead. */ export function DockSeparator() { return ( ) } /** * Saved state and publish are one control: the glyph never moves, it simply * stops being something you can press once there is nothing left to put live. * A button that appears and disappears moved everything beside it just as the * work was finished. */ export function PublishButton({ label, testId, hasDraft, saving, publishing, offline = false, draftHint, onPublish, }: { label: string testId: string hasDraft: boolean saving: boolean publishing: boolean /** The engine is out of reach, so there is nothing to publish to. */ offline?: boolean /** What the tooltip says while there is a saved draft waiting. */ draftHint: string onPublish: () => void }) { return ( {offline ? "Reconnecting to the engine" : publishing ? "Publishing" : saving ? "Saving" : hasDraft ? draftHint : "All changes saved"} ) } /** Sits next to publish, and only while there is something to throw away. */ export function DiscardButton({ testId, onClick, }: { testId: string onClick: () => void }) { return ( Discard the unpublished changes ) } /** The confirmation behind `DiscardButton`; `children` says what goes back. */ export function DiscardDraftDialog({ open, onOpenChange, pending, testId, onConfirm, children, }: { open: boolean onOpenChange: (open: boolean) => void pending: boolean testId: string onConfirm: () => void children: ReactNode }) { return ( Discard the unpublished changes? {children} ) }