From 687325ad0dbdf1c488b209553255298055e0e695 Mon Sep 17 00:00:00 2001 From: DeeCee03 Date: Thu, 11 Jun 2026 19:22:33 +0200 Subject: [PATCH] =?UTF-8?q?Anwesenheitszeit=20(Lock-in=20bis=20Feierabend)?= =?UTF-8?q?=20als=20reine=20Anzeige=20erg=C3=A4nzen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Neben der getrackten Task-Zeit zeigt der "Zeit heute"-Header jetzt "Getrackt · Anwesend"; der Check-In/Out-Balken zeigt die Anwesenheit live ("anwesend seit …") und nach Check-Out die finale Dauer. Kein Eingriff ins Task-Tracking — Wert wird nur aus checkedInAt/checkedOutAt berechnet. Co-Authored-By: Claude Fable 5 --- .../src/components/time/TimelineSection.tsx | 13 ++++++- apps/web/src/lib/use-presence-seconds.ts | 22 +++++++++++ apps/web/src/routes/heute.tsx | 38 ++++++++++--------- 3 files changed, 54 insertions(+), 19 deletions(-) create mode 100644 apps/web/src/lib/use-presence-seconds.ts diff --git a/apps/web/src/components/time/TimelineSection.tsx b/apps/web/src/components/time/TimelineSection.tsx index 7fc81a9..a791800 100644 --- a/apps/web/src/components/time/TimelineSection.tsx +++ b/apps/web/src/components/time/TimelineSection.tsx @@ -7,6 +7,7 @@ import { Card } from '../ui/Card'; import { Button } from '../ui/Button'; import { Modal } from '../ui/Modal'; import { formatDuration, formatDurationCompact } from '../../lib/format-duration'; +import { usePresenceSeconds } from '../../lib/use-presence-seconds'; import { TIME_CATEGORIES, type TimeCategory } from '../../lib/time-categories'; const CATEGORY_LABEL: Record = Object.fromEntries( @@ -30,6 +31,10 @@ export function TimelineSection() { const todayQuery = trpc.dayEntry.today.useQuery(); const [manualOpen, setManualOpen] = useState(false); const [editing, setEditing] = useState(null); + const presenceSeconds = usePresenceSeconds( + todayQuery.data?.entry?.checkedInAt, + todayQuery.data?.entry?.checkedOutAt, + ); if (listQuery.isPending) return null; // Aufsteigend sortieren: Vormittag oben, Abend unten. @@ -45,7 +50,13 @@ export function TimelineSection() {

Zeit heute

- Gesamt: {formatDurationCompact(totalSeconds)} + Getrackt: {formatDurationCompact(totalSeconds)} + {presenceSeconds !== null && ( + <> + {' · '}Anwesend:{' '} + {formatDurationCompact(presenceSeconds)} + + )}

+ <> + {presenceSeconds !== null && ( + + · anwesend seit{' '} + {formatDurationCompact(presenceSeconds)} + + )} + + )}