diff --git a/messages/de.json b/messages/de.json index 1965004ee..4a9d5d696 100644 --- a/messages/de.json +++ b/messages/de.json @@ -6485,6 +6485,8 @@ "label": "Reihenfolge der Werte", "recentDesc": "Neueste Messung zuerst", "recentAsc": "Älteste Messung zuerst", + "alphaAsc": "Name (A–Z)", + "alphaDesc": "Name (Z–A)", "manual": "Manuell sortieren", "hint": "Bei manueller Sortierung kannst du die Biomarker unten in deine eigene Reihenfolge bringen." }, diff --git a/messages/en.json b/messages/en.json index f17baab6d..a94e198e1 100644 --- a/messages/en.json +++ b/messages/en.json @@ -6485,6 +6485,8 @@ "label": "Order of values", "recentDesc": "Most recent reading first", "recentAsc": "Oldest reading first", + "alphaAsc": "Name (A–Z)", + "alphaDesc": "Name (Z–A)", "manual": "Sort manually", "hint": "With manual sorting you can drag the biomarkers below into your own order." }, diff --git a/messages/es.json b/messages/es.json index 98d005164..1ec056c87 100644 --- a/messages/es.json +++ b/messages/es.json @@ -6485,6 +6485,8 @@ "label": "Orden de los valores", "recentDesc": "Medición más reciente primero", "recentAsc": "Medición más antigua primero", + "alphaAsc": "Nombre (A–Z)", + "alphaDesc": "Nombre (Z–A)", "manual": "Ordenar manualmente", "hint": "Con el orden manual puedes arrastrar los biomarcadores de abajo en tu propio orden." }, diff --git a/messages/fr.json b/messages/fr.json index 24eb16649..e26eb1143 100644 --- a/messages/fr.json +++ b/messages/fr.json @@ -6485,6 +6485,8 @@ "label": "Ordre des valeurs", "recentDesc": "Mesure la plus récente d'abord", "recentAsc": "Mesure la plus ancienne d'abord", + "alphaAsc": "Nom (A–Z)", + "alphaDesc": "Nom (Z–A)", "manual": "Trier manuellement", "hint": "En tri manuel, vous pouvez glisser les biomarqueurs ci-dessous dans votre propre ordre." }, diff --git a/messages/it.json b/messages/it.json index d00f64d89..27a4477e7 100644 --- a/messages/it.json +++ b/messages/it.json @@ -6485,6 +6485,8 @@ "label": "Ordine dei valori", "recentDesc": "Misurazione più recente prima", "recentAsc": "Misurazione più vecchia prima", + "alphaAsc": "Nome (A–Z)", + "alphaDesc": "Nome (Z–A)", "manual": "Ordina manualmente", "hint": "Con l'ordinamento manuale puoi trascinare i biomarcatori qui sotto nel tuo ordine." }, diff --git a/messages/pl.json b/messages/pl.json index a6b1c28c5..85ef84be3 100644 --- a/messages/pl.json +++ b/messages/pl.json @@ -6485,6 +6485,8 @@ "label": "Kolejność wartości", "recentDesc": "Najnowszy pomiar najpierw", "recentAsc": "Najstarszy pomiar najpierw", + "alphaAsc": "Nazwa (A–Z)", + "alphaDesc": "Nazwa (Z–A)", "manual": "Sortuj ręcznie", "hint": "Przy sortowaniu ręcznym możesz przeciągnąć biomarkery poniżej we własnej kolejności." }, diff --git a/src/components/labs/lab-biomarker-detail.tsx b/src/components/labs/lab-biomarker-detail.tsx index 436ec36d3..2b07f364a 100644 --- a/src/components/labs/lab-biomarker-detail.tsx +++ b/src/components/labs/lab-biomarker-detail.tsx @@ -1,15 +1,18 @@ "use client"; import { useState } from "react"; -import { useQuery, useQueryClient } from "@tanstack/react-query"; +import { useRouter } from "next/navigation"; +import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query"; import { FlaskConical, Pencil, Plus } from "lucide-react"; +import { toast } from "sonner"; +import { DeleteButton } from "@/components/data-list"; import { Button } from "@/components/ui/button"; import { Card, CardContent } from "@/components/ui/card"; import { EmptyState } from "@/components/ui/empty-state"; import { ResponsiveSheet } from "@/components/ui/responsive-sheet"; import { Skeleton } from "@/components/ui/skeleton"; -import { apiGet } from "@/lib/api/api-fetch"; +import { apiDelete, apiGet } from "@/lib/api/api-fetch"; import { classifyReferenceRange } from "@/lib/labs/reference-range"; import { formatLabValue } from "@/lib/labs/format-value"; import { useTranslations } from "@/lib/i18n/context"; @@ -34,6 +37,7 @@ import type { */ export function LabBiomarkerDetail({ biomarkerId }: { biomarkerId: string }) { const { t } = useTranslations(); + const router = useRouter(); const queryClient = useQueryClient(); const [addOpen, setAddOpen] = useState(false); // Sticky-footer slot for the add-value sheet (the form portals here). @@ -93,6 +97,21 @@ export function LabBiomarkerDetail({ biomarkerId }: { biomarkerId: string }) { queryClient.invalidateQueries({ queryKey: queryKeys.labResults() }); } + // v1.18.9 (#41/#3) — delete the biomarker directly from its detail page so + // a stray marker is removable without a Settings detour. `onDelete: SetNull` + // keeps the readings and unlinks them. On success, invalidate the catalog + + // result list and return to the labs surface. + const deleteMarker = useMutation({ + mutationFn: () => apiDelete(`/api/biomarkers/${biomarkerId}`), + onSuccess: () => { + toast.success(t("labs.biomarker.deletedToast")); + queryClient.invalidateQueries({ queryKey: queryKeys.biomarkers() }); + queryClient.invalidateQueries({ queryKey: queryKeys.labResults() }); + router.push("/labs"); + }, + onError: () => toast.error(t("labs.biomarker.deleteError")), + }); + if (markerError || listError) { return (

@@ -136,6 +155,14 @@ export function LabBiomarkerDetail({ biomarkerId }: { biomarkerId: string }) { > + deleteMarker.mutate()} + title={t("labs.biomarker.deleteConfirmTitle")} + description={t("labs.biomarker.deleteConfirmDescription")} + confirmLabel={t("labs.biomarker.delete")} + className="min-h-11 min-w-11 sm:min-h-9 sm:min-w-9" + iconClassName="h-4 w-4" + />