Files
temetro/frontend/components/notes/note-detail-sheet.tsx
T
Khalid Abdi 49c39bd853 Tasks/notes/prescriptions/appointments/patients UX fixes
- Task dialog: rename Title→Subject, add a "Details" textarea (notes),
  widen to sm:max-w-lg.
- Tasks & Notes: replace split-panes with full-width lists that open a
  right-side Sheet on click (TaskDetailSheet, NoteDetailSheet), mirroring
  the Patients table → detail Sheet pattern.
- Prescriptions: rows are now clickable and open PrescriptionDetailSheet
  with the full Rx details (incl. duration + notes).
- New prescription dialog: Duration is a dropdown of presets with an
  "Other" → custom input, plus a Notes textarea; NewPrescription gains
  notes and threads duration/notes through to the list.
- Appointments: header search filtering by patient/type/provider,
  grouped by date, with an empty state.
- Patients: pressing Enter in the search box opens the top match's record.

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

56 lines
1.5 KiB
TypeScript

"use client";
import { NotesEditor } from "@/components/notes/notes-editor";
import {
Sheet,
SheetHeader,
SheetPopup,
SheetTitle,
} from "@/components/ui/sheet";
import type { Note } from "@/lib/notes";
// Right-side Sheet that holds the rich-text NotesEditor, opened from the Notes
// list (mirrors the Patients table → side Sheet pattern). The save/delete logic
// stays in NotesView and is passed down. `editorKey` remounts the editor when a
// different note (or a fresh draft) is opened.
export function NoteDetailSheet({
note,
editorKey,
open,
onOpenChange,
saving,
onSave,
onDelete,
}: {
note: Note | null;
editorKey: string;
open: boolean;
onOpenChange: (open: boolean) => void;
saving: boolean;
onSave: (data: { title: string; content: string }) => void;
onDelete?: () => void;
}) {
return (
<Sheet onOpenChange={onOpenChange} open={open}>
<SheetPopup className="sm:max-w-2xl" side="right">
<SheetHeader>
<SheetTitle>{note?.id ? "Edit note" : "New note"}</SheetTitle>
</SheetHeader>
{/* Plain flex container (not SheetPanel) so the editor gets a bounded
height and scrolls internally rather than nesting two scroll areas. */}
<div className="flex min-h-0 flex-1 flex-col px-6 pt-1 pb-6">
{note && (
<NotesEditor
key={editorKey}
note={note}
onDelete={onDelete}
onSave={onSave}
saving={saving}
/>
)}
</div>
</SheetPopup>
</Sheet>
);
}