From a3a331cc0c5a9acd9c234601356b7a60ad2a92df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20F=C3=B6rtsch?= Date: Thu, 12 Mar 2026 19:44:02 +0100 Subject: [PATCH] update prozess route: pass process status from data queries Co-Authored-By: Claude Opus 4.6 --- src/features/prozess/hooks.ts | 2 +- src/routes/prozess/index.tsx | 27 +++++++++++++++++++++++---- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/src/features/prozess/hooks.ts b/src/features/prozess/hooks.ts index 65bd042..47825a6 100644 --- a/src/features/prozess/hooks.ts +++ b/src/features/prozess/hooks.ts @@ -86,7 +86,7 @@ export function useSitzungen(sprechstundeId: number) { ); } -export function useProcessStatus( +export function deriveProcessStatus( nutzer: NutzerRow | undefined, stats: KontaktStats | undefined, erstgespraeche: ErstgespraechRow[], diff --git a/src/routes/prozess/index.tsx b/src/routes/prozess/index.tsx index 8c355ca..15173fa 100644 --- a/src/routes/prozess/index.tsx +++ b/src/routes/prozess/index.tsx @@ -1,6 +1,11 @@ import { createFileRoute } from "@tanstack/react-router"; import { ProcessStepper } from "@/features/prozess/components/process-stepper"; -import { useKontaktStats, useNutzer } from "@/features/prozess/hooks"; +import { + deriveProcessStatus, + useErstgespraeche, + useKontaktStats, + useNutzer, +} from "@/features/prozess/hooks"; export const Route = createFileRoute("/prozess/")({ component: ProzessPage, @@ -17,20 +22,34 @@ function ProzessPage() { loading: statsLoading, refetch: refetchStats, } = useKontaktStats(); + const { + data: erstgespraeche, + loading: egLoading, + refetch: refetchEg, + } = useErstgespraeche(); - if (nutzerLoading || statsLoading) return

Laden…

; + if (nutzerLoading || statsLoading || egLoading) return

Laden…

; if (!nutzer[0]) return

Bitte zuerst das Onboarding abschließen.

; - const s = stats[0] ?? { gesamt: 0, absagen: 0 }; + const s = stats[0] ?? { + gesamt: 0, + absagen: 0, + warteliste: 0, + keine_antwort: 0, + }; + + const processStatus = deriveProcessStatus(nutzer[0], s, erstgespraeche); return ( { refetchNutzer(); refetchStats(); + refetchEg(); }} /> );