From 04cce8d9c291ae6e600b8c4f140d7c8a07237930 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Bombeck?= Date: Fri, 15 May 2026 18:30:15 +0200 Subject: [PATCH] refactor(medications): mount the entry surfaces via ResponsiveSheet MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Swaps the medication create/edit, intake create/edit, side-effect log, and inventory add-pen mounts from the centred `` to the shared `` 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. --- src/app/medications/page.tsx | 25 +++++++------ .../medications/SideEffectsSection.tsx | 26 +++++-------- .../medications/intake-history-list.tsx | 37 ++++++++----------- .../medications/inventory-section.tsx | 27 +++++--------- 4 files changed, 46 insertions(+), 69 deletions(-) diff --git a/src/app/medications/page.tsx b/src/app/medications/page.tsx index 373721e66..cf32e9197 100644 --- a/src/app/medications/page.tsx +++ b/src/app/medications/page.tsx @@ -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 */} - - - - - {editingMed - ? t("medications.editMedication") - : t("medications.newMedication")} - - + {/* Create/Edit Sheet — bottom-sheet on ` - - + ); } diff --git a/src/components/medications/SideEffectsSection.tsx b/src/components/medications/SideEffectsSection.tsx index c78dd6568..02905f965 100644 --- a/src/components/medications/SideEffectsSection.tsx +++ b/src/components/medications/SideEffectsSection.tsx @@ -5,13 +5,7 @@ import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query"; import { Loader2, Plus, Trash2 } from "lucide-react"; import { Button } from "@/components/ui/button"; -import { - Dialog, - DialogContent, - DialogFooter, - DialogHeader, - DialogTitle, -} from "@/components/ui/dialog"; +import { ResponsiveSheet } from "@/components/ui/responsive-sheet"; import { Label } from "@/components/ui/label"; import { Badge } from "@/components/ui/badge"; import { @@ -330,12 +324,11 @@ export function SideEffectsSection({ medicationId }: SideEffectsSectionProps) { )} - - - - {t("medications.sideEffects.sheetTitle")} - - +
)} - +
-
-
+ ); } diff --git a/src/components/medications/intake-history-list.tsx b/src/components/medications/intake-history-list.tsx index c40cf9105..b237a31bf 100644 --- a/src/components/medications/intake-history-list.tsx +++ b/src/components/medications/intake-history-list.tsx @@ -16,12 +16,7 @@ import { AlertDialogTitle, AlertDialogTrigger, } from "@/components/ui/alert-dialog"; -import { - Dialog, - DialogContent, - DialogHeader, - DialogTitle, -} from "@/components/ui/dialog"; +import { ResponsiveSheet } from "@/components/ui/responsive-sheet"; import { DropdownMenu, DropdownMenuContent, @@ -530,12 +525,12 @@ export function IntakeHistoryList({ )} - {/* Edit Dialog */} - !open && closeEdit()}> - - - {t("medications.editIntake")} - + {/* Edit Sheet */} + !open && closeEdit()} + title={t("medications.editIntake")} + > {editing && (
@@ -670,15 +665,14 @@ export function IntakeHistoryList({ )} - -
+ - {/* Create Dialog */} - !open && closeCreate()}> - - - {t("medications.newIntake")} - + {/* Create Sheet */} + !open && closeCreate()} + title={t("medications.newIntake")} + >
-
-
+ ); } diff --git a/src/components/medications/inventory-section.tsx b/src/components/medications/inventory-section.tsx index d73614402..1f9a13130 100644 --- a/src/components/medications/inventory-section.tsx +++ b/src/components/medications/inventory-section.tsx @@ -5,13 +5,7 @@ import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query"; import { ChevronDown, Loader2, Plus, Trash2 } from "lucide-react"; import { Button } from "@/components/ui/button"; -import { - Dialog, - DialogContent, - DialogFooter, - DialogHeader, - DialogTitle, -} from "@/components/ui/dialog"; +import { ResponsiveSheet } from "@/components/ui/responsive-sheet"; import { Input } from "@/components/ui/input"; import { Label } from "@/components/ui/label"; import { Badge } from "@/components/ui/badge"; @@ -430,13 +424,11 @@ export function InventorySection({ - - - - - {t("medications.inventory.addPenTitle")} - - +
+ ); }