Files
temetro/frontend/components/ui/confirm-dialog.tsx
T
Khalid Abdi 0f10aafa43 Add Calendar dialog, Prescriptions & Messages pages, note delete confirm
- Appointments: a Calendar button next to Add opens a month-grid dialog
  (reuses the Calendar primitive + shared ScheduleList); the schedule day is
  marked and selecting it lists that day's appointments.
- Patients sub-nav: new Prescriptions page (mock list + KPIs) with a compact
  "New prescription" dialog reusing the patient quick-search pattern.
- Notes: deleting a note now goes through a reusable ConfirmDialog instead of
  deleting immediately.
- New top-level Messages page: two-pane email-style inbox (list + reading pane
  with mock reply composer), mirroring the Notes layout.
- Sidebar logo bumped from size-9 to size-10.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-06 17:37:17 +03:00

64 lines
1.6 KiB
TypeScript

"use client";
import type { ReactNode } from "react";
import { Button } from "@/components/ui/button";
import {
Dialog,
DialogClose,
DialogDescription,
DialogFooter,
DialogHeader,
DialogPopup,
DialogTitle,
} from "@/components/ui/dialog";
// A small controlled confirmation dialog built on Dialog (there is no AlertDialog
// primitive). Use for destructive actions: the confirm button is `destructive`
// by default. onConfirm fires, then the dialog closes.
export function ConfirmDialog({
open,
onOpenChange,
onConfirm,
title,
description,
confirmLabel = "Delete",
cancelLabel = "Cancel",
variant = "destructive",
}: {
open: boolean;
onOpenChange: (open: boolean) => void;
onConfirm: () => void;
title: string;
description?: ReactNode;
confirmLabel?: string;
cancelLabel?: string;
variant?: "destructive" | "default";
}) {
return (
<Dialog onOpenChange={onOpenChange} open={open}>
<DialogPopup className="sm:max-w-sm">
<DialogHeader>
<DialogTitle>{title}</DialogTitle>
{description && <DialogDescription>{description}</DialogDescription>}
</DialogHeader>
<DialogFooter variant="bare">
<DialogClose render={<Button type="button" variant="outline" />}>
{cancelLabel}
</DialogClose>
<Button
onClick={() => {
onConfirm();
onOpenChange(false);
}}
type="button"
variant={variant}
>
{confirmLabel}
</Button>
</DialogFooter>
</DialogPopup>
</Dialog>
);
}