From 7677fdd73de155550274af8a181919a60070b792 Mon Sep 17 00:00:00 2001 From: Simon Franken Date: Tue, 24 Feb 2026 21:57:21 +0100 Subject: [PATCH] revert --- frontend/src/pages/ClientsPage.tsx | 62 ++++++++---------------------- 1 file changed, 16 insertions(+), 46 deletions(-) diff --git a/frontend/src/pages/ClientsPage.tsx b/frontend/src/pages/ClientsPage.tsx index bf3504e..6dae4a1 100644 --- a/frontend/src/pages/ClientsPage.tsx +++ b/frontend/src/pages/ClientsPage.tsx @@ -61,8 +61,6 @@ function ClientTargetPanel({ const [showCorrectionForm, setShowCorrectionForm] = useState(false); const [corrDate, setCorrDate] = useState(''); const [corrHours, setCorrHours] = useState(''); - const [corrMins, setCorrMins] = useState(''); - const [corrNegative, setCorrNegative] = useState(false); const [corrDesc, setCorrDesc] = useState(''); const [corrError, setCorrError] = useState(null); const [corrSaving, setCorrSaving] = useState(false); @@ -154,25 +152,21 @@ function ClientTargetPanel({ e.preventDefault(); setCorrError(null); if (!target) return; - const h = parseInt(corrHours || '0', 10); - const m = parseInt(corrMins || '0', 10); - if (h === 0 && m === 0) { - setCorrError('Duration must be at least 1 minute'); + const hours = parseFloat(corrHours); + if (isNaN(hours) || hours < -1000 || hours > 1000) { + setCorrError('Hours must be between -1000 and 1000'); return; } if (!corrDate) { setCorrError('Please select a date'); return; } - const totalHours = (h + m / 60) * (corrNegative ? -1 : 1); setCorrSaving(true); try { - const input: CreateCorrectionInput = { date: corrDate, hours: totalHours, description: corrDesc || undefined }; + const input: CreateCorrectionInput = { date: corrDate, hours, description: corrDesc || undefined }; await addCorrection.mutateAsync({ targetId: target.id, input }); setCorrDate(''); setCorrHours(''); - setCorrMins(''); - setCorrNegative(false); setCorrDesc(''); setShowCorrectionForm(false); } catch (err) { @@ -365,7 +359,7 @@ function ClientTargetPanel({
= 0 ? 'text-green-600' : 'text-red-600'}`}> - {c.hours >= 0 ? '+' : '−'}{formatDurationHoursMinutes(Math.abs(c.hours) * 3600)} + {c.hours >= 0 ? '+' : ''}{c.hours}h
-
- -
- - setCorrHours(e.target.value)} - className="input text-xs py-1 w-12 min-w-0 text-center" - placeholder="h" - /> - h - setCorrMins(e.target.value)} - className="input text-xs py-1 w-12 min-w-0 text-center" - placeholder="m" - /> - m -
+
+ + setCorrHours(e.target.value)} + className="input text-xs py-1" + placeholder="+8 / -4" + step="0.5" + required + />