fix(labs): pin add-entry action bars to the sheet footer; tighten header

The lab and biomarker forms portal their Cancel/Save row into the
ResponsiveSheet sticky footer (footerSlot pattern) so Save stays reachable
on mobile instead of scrolling away. The Labs header folds Manage
biomarkers into an overflow kebab beside the primary Add, mirroring the
medication header. The biomarker detail gains a self-edit Pencil opening
the pre-filled form. Add buttons on the labs detail and measurements page
meet the min-h-11 sm:min-h-9 tap floor.
This commit is contained in:
Marc-André Bombeck committed 2026-06-16 23:12:04 +02:00
1 parent 6df0c64d85
commit 9c8c7051aa
6 files changed
+202 -58

No files matched your search

+34 -12
View File
@@ -3,12 +3,18 @@
import { useCallback, useEffect, useState } from "react";
import { useRouter } from "next/navigation";
import { useQueryClient } from "@tanstack/react-query";
import { FlaskConical, Loader2, Plus } from "lucide-react";
import { FlaskConical, Loader2, MoreVertical, Plus } from "lucide-react";
import { BiomarkerManager } from "@/components/labs/biomarker-manager";
import { LabForm } from "@/components/labs/lab-form";
import { LabList } from "@/components/labs/lab-list";
import { Button } from "@/components/ui/button";
import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu";
import { PullToRefreshIndicator } from "@/components/ui/pull-to-refresh-indicator";
import { ResponsiveSheet } from "@/components/ui/responsive-sheet";
import { useAuth } from "@/hooks/use-auth";
@@ -25,6 +31,9 @@ export default function LabsPage() {
const { t } = useTranslations();
const [dialogOpen, setDialogOpen] = useState(false);
const [manageOpen, setManageOpen] = useState(false);
// Sticky-footer slot element for the add-result sheet (filled by the
// ResponsiveSheet `footer` ref so the form portals its action row there).
const [addFooterEl, setAddFooterEl] = useState<HTMLDivElement | null>(null);
const refreshVisible = useCallback(
() => queryClient.invalidateQueries({ type: "active" }),
@@ -61,17 +70,7 @@ export default function LabsPage() {
{t("labs.subtitle")}
</p>
</div>
<div className="flex shrink-0 gap-2">
<Button
variant="outline"
onClick={() => setManageOpen(true)}
className="min-h-11 sm:min-h-9"
>
<FlaskConical className="h-4 w-4" />
<span className="hidden sm:inline">
{t("labs.biomarker.manage")}
</span>
</Button>
<div className="flex shrink-0 items-center gap-2">
<Button
onClick={() => setDialogOpen(true)}
className="min-h-11 sm:min-h-9"
@@ -79,6 +78,27 @@ export default function LabsPage() {
<Plus className="h-4 w-4" />
{t("labs.addResult")}
</Button>
{/* Secondary actions fold into one overflow kebab beside the primary
Add, mirroring the medication-card header (one cluster, not a
two-button row). */}
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button
variant="ghost"
size="icon"
className="min-h-11 min-w-11 sm:min-h-9 sm:min-w-9"
aria-label={t("common.moreOptions")}
>
<MoreVertical className="h-4 w-4" />
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent align="end" className="w-56">
<DropdownMenuItem onClick={() => setManageOpen(true)}>
<FlaskConical className="mr-2 h-4 w-4" />
{t("labs.biomarker.manage")}
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
</div>
</div>
@@ -87,8 +107,10 @@ export default function LabsPage() {
onOpenChange={setDialogOpen}
title={t("labs.addResult")}
description={t("labs.addDescription")}
footer={<div ref={setAddFooterEl} className="flex w-full justify-end gap-2" />}
>
<LabForm
footerSlot={addFooterEl}
onSuccess={() => {
setDialogOpen(false);
queryClient.invalidateQueries({
+4 -1
View File
@@ -120,7 +120,10 @@ export default function MeasurementsPage() {
{t("measurements.subtitle")}
</p>
</div>
<Button className="shrink-0" onClick={() => setDialogOpen(true)}>
<Button
className="min-h-11 shrink-0 sm:min-h-9"
onClick={() => setDialogOpen(true)}
>
<Plus className="h-4 w-4" />
{t("measurements.addMeasurement")}
</Button>