Skip to content

armgit / mso

Public Imported from GitHub
0

Browser-based graphical shell and control plane for a Linux server you own — real terminal, file manager, live metrics and BYOK AI in one mobile-first workspace. Next.js 16 · React 19 · node-pty · Tailwind v4 · shadcn/ui. Public alpha, self-hosted.

1.5 KB
Raw Blame
"use client";

import { Button } from "@/components/ui/button";
import { FormDrawer } from "@/features/appshell";

// Unsaved-changes prompt shown when a dirty window is closed: Save (writes then
// closes) / Don't Save (discards + closes) / Cancel (keeps the window open).
// FormDrawer keeps the behavior shared while the active shell chooses the native
// presentation: content dialog on desktop, Apple/Material drawer on mobile.
export function CloseGuardDialog({
  open,
  onOpenChange,
  fileLabel,
  error,
  onSave,
  onDiscard,
  onCancel,
}: {
  open: boolean;
  onOpenChange: (open: boolean) => void;
  fileLabel: string;
  error?: boolean;
  onSave: () => void;
  onDiscard: () => void;
  onCancel: () => void;
}) {
  return (
    <FormDrawer open={open} onOpenChange={onOpenChange} variant="alert" size="sm">
      <FormDrawer.Header>
        <FormDrawer.Title>Save changes before closing?</FormDrawer.Title>
        <FormDrawer.Description>
          {fileLabel} has unsaved edits. They&apos;ll be lost if you don&apos;t save.
        </FormDrawer.Description>
        {error && <p role="alert">Save failed. Changes remain in this window; retry or cancel.</p>}
      </FormDrawer.Header>
      <FormDrawer.Footer>
        <Button variant="ghost" onClick={onCancel}>Cancel</Button>
        <Button variant="ghost" className="text-destructive" onClick={onDiscard}>Don&apos;t Save</Button>
        <Button onClick={onSave}>Save</Button>
      </FormDrawer.Footer>
    </FormDrawer>
  );
}