diff --git a/frontend/src/components/stats/BedtimePlot.tsx b/frontend/src/components/stats/BedtimePlot.tsx index eb280c0..4efa46e 100644 --- a/frontend/src/components/stats/BedtimePlot.tsx +++ b/frontend/src/components/stats/BedtimePlot.tsx @@ -57,20 +57,20 @@ const BedtimePlot: React.FC = ({ from_date, to_date, wakeup_ tickLine={false} axisLine={{ stroke: '#e5e7eb' }} /> - formatMinutesAfter(value, bedtime_ref)} - domain={['dataMin - 30', 'dataMax + 30']} - /> - [ - formatMinutesAfter(value, bedtime_ref), - 'Bedtime', - ]} - labelFormatter={(label) => label} - /> + formatMinutesAfter(Number(value), bedtime_ref)} + domain={['dataMin - 30', 'dataMax + 30']} + /> + [ + formatMinutesAfter(Number(value), bedtime_ref), + 'Bedtime', + ]} + labelFormatter={(label) => label} + /> = ({ from_date, to_date, day_sta margin={{ top: 5, right: 30, left: 60, bottom: 5 }} > - `${Math.round(value)}h`} - tick={{ fontSize: 12 }} - tickLine={false} - /> - + `${Math.round(Number(value))}h`} + tick={{ fontSize: 12 }} + tickLine={false} + /> + [ - formatMinutes(Math.round((value ?? 0) * 60)), + formatter={(value: any, name: any) => [ + formatMinutes(Math.round(Number(value ?? 0) * 60)), name === 'daySleep' ? 'Day' : 'Night', ]} /> diff --git a/frontend/src/components/stats/SessionList.tsx b/frontend/src/components/stats/SessionList.tsx index 3d00460..374e41c 100644 --- a/frontend/src/components/stats/SessionList.tsx +++ b/frontend/src/components/stats/SessionList.tsx @@ -7,21 +7,21 @@ import { formatDateTime, toLocalDatetimeInputValue, getDurationMinutes, formatMi export function SessionList() { const { sessions, isLoading, updateSession, deleteSession, isDeleting } = useSessions(); const [editingId, setEditingId] = useState(null); - const [editStart, setEditStart] = useState(''); - const [editEnd, setEditEnd] = useState(''); + const [editStart, setEditStart] = useState(''); + const [editEnd, setEditEnd] = useState(''); if (isLoading) return
Loading sessions...
; if (!sessions.length) return
No sessions recorded.
; const handleSave = async (id: number) => { try { - await updateSession({ - sessionId: id, - payload: { - start_time: new Date(editStart).toISOString(), - end_time: editEnd ? new Date(editEnd).toISOString() : null, - } - }); + await updateSession({ + sessionId: id, + payload: { + start_time: new Date(editStart).toISOString(), + end_time: editEnd ? new Date(editEnd).toISOString() : undefined, + } + }); setEditingId(null); } catch (err) { console.error(err); diff --git a/frontend/src/components/stats/WakeupPlot.tsx b/frontend/src/components/stats/WakeupPlot.tsx index dfea719..3afbd87 100644 --- a/frontend/src/components/stats/WakeupPlot.tsx +++ b/frontend/src/components/stats/WakeupPlot.tsx @@ -59,20 +59,20 @@ const WakeupPlot: React.FC = ({ from_date, to_date, wakeup_r tickLine={false} axisLine={{ stroke: '#e5e7eb' }} /> - formatMinutesAfter(value, wakeup_ref)} - domain={['dataMin - 30', 'dataMax + 30']} - /> - [ - formatMinutesAfter(value, wakeup_ref), - 'Wakeup', - ]} - labelFormatter={(label) => label} - /> + formatMinutesAfter(Number(value), wakeup_ref)} + domain={['dataMin - 30', 'dataMax + 30']} + /> + [ + formatMinutesAfter(Number(value), wakeup_ref), + 'Wakeup', + ]} + labelFormatter={(label) => label} + />