refactor(medications): mount the entry surfaces via ResponsiveSheet

Swaps the medication create/edit, intake create/edit, side-effect
log, and inventory add-pen mounts from the centred `<Dialog>` to
the shared `<ResponsiveSheet>` primitive so the same surfaces flip
to a bottom-anchored sheet on narrow viewports. The "log this
thing" mental model — measurement, mood, medication, intake,
side-effect, inventory — now lands on a consistent mobile shape.
Configuration surfaces (IntakeImport, ApiEndpoint, PhaseConfig)
stay centred per Decision G; the dialog primitive's new
`max-h-[calc(100dvh-2rem)]` default keeps them inside the viewport
on short / soft-keyboard screens without the previous per-callsite
`max-h-[90vh]` ceiling.
This commit is contained in:
Marc-André Bombeck committed 2026-05-15 18:30:15 +02:00
1 parent b25683404e
commit 04cce8d9c2
4 files changed
+46 -69

No files matched your search

+13 -12
View File
@@ -18,6 +18,7 @@ import {
DialogHeader,
DialogTitle,
} from "@/components/ui/dialog";
import { ResponsiveSheet } from "@/components/ui/responsive-sheet";
import {
DropdownMenu,
DropdownMenuContent,
@@ -256,16 +257,17 @@ export default function MedicationsPage() {
onClose={() => setImportMedId(null)}
/>
{/* Create/Edit Dialog */}
<Dialog open={dialogOpen} onOpenChange={setDialogOpen}>
<DialogContent className="max-h-[90vh] overflow-y-auto sm:max-w-lg">
<DialogHeader>
<DialogTitle>
{editingMed
? t("medications.editMedication")
: t("medications.newMedication")}
</DialogTitle>
</DialogHeader>
{/* Create/Edit Sheet — bottom-sheet on `<md`, centred Dialog on `md+`. */}
<ResponsiveSheet
open={dialogOpen}
onOpenChange={setDialogOpen}
title={
editingMed
? t("medications.editMedication")
: t("medications.newMedication")
}
className="sm:max-w-lg"
>
<MedicationForm
initial={
editingMed
@@ -307,8 +309,7 @@ export default function MedicationsPage() {
onSuccess={closeDialog}
onCancel={closeDialog}
/>
</DialogContent>
</Dialog>
</ResponsiveSheet>
</div>
);
}