Fixed a littlebit. now back to plan.md

This commit is contained in:
2026-05-29 10:03:05 +02:00
parent 929b75dfe3
commit 4a868a3f07
5 changed files with 54 additions and 52 deletions
+14 -14
View File
@@ -57,20 +57,20 @@ const BedtimePlot: React.FC<WakeupBedtimeProps> = ({ from_date, to_date, wakeup_
tickLine={false}
axisLine={{ stroke: '#e5e7eb' }}
/>
<YAxis
tick={{ fontSize: 12 }}
tickLine={false}
axisLine={{ stroke: '#e5e7eb' }}
tickFormatter={(value) => formatMinutesAfter(value, bedtime_ref)}
domain={['dataMin - 30', 'dataMax + 30']}
/>
<Tooltip
formatter={(value: number) => [
formatMinutesAfter(value, bedtime_ref),
'Bedtime',
]}
labelFormatter={(label) => label}
/>
<YAxis
tick={{ fontSize: 12 }}
tickLine={false}
axisLine={{ stroke: '#e5e7eb' }}
tickFormatter={(value) => formatMinutesAfter(Number(value), bedtime_ref)}
domain={['dataMin - 30', 'dataMax + 30']}
/>
<Tooltip
formatter={(value: any) => [
formatMinutesAfter(Number(value), bedtime_ref),
'Bedtime',
]}
labelFormatter={(label) => label}
/>
<Line
type="monotone"
dataKey="minutes"
+15 -15
View File
@@ -86,22 +86,22 @@ const DailySummary: React.FC<DailySummaryProps> = ({ from_date, to_date, day_sta
margin={{ top: 5, right: 30, left: 60, bottom: 5 }}
>
<CartesianGrid strokeDasharray="3 3" stroke="#e5e7eb" />
<XAxis
type="number"
tickFormatter={(value) => `${Math.round(value)}h`}
tick={{ fontSize: 12 }}
tickLine={false}
/>
<YAxis
type="category"
dataKey="date"
tick={{ fontSize: 12 }}
tickLine={false}
width={60}
/>
<XAxis
type="number"
tickFormatter={(value) => `${Math.round(Number(value))}h`}
tick={{ fontSize: 12 }}
tickLine={false}
/>
<YAxis
type="category"
dataKey="date"
tick={{ fontSize: 12 }}
tickLine={false}
width={60}
/>
<Tooltip
formatter={(value: number, name: string) => [
formatMinutes(Math.round((value ?? 0) * 60)),
formatter={(value: any, name: any) => [
formatMinutes(Math.round(Number(value ?? 0) * 60)),
name === 'daySleep' ? 'Day' : 'Night',
]}
/>
@@ -7,21 +7,21 @@ import { formatDateTime, toLocalDatetimeInputValue, getDurationMinutes, formatMi
export function SessionList() {
const { sessions, isLoading, updateSession, deleteSession, isDeleting } = useSessions();
const [editingId, setEditingId] = useState<number | null>(null);
const [editStart, setEditStart] = useState('');
const [editEnd, setEditEnd] = useState('');
const [editStart, setEditStart] = useState<string>('');
const [editEnd, setEditEnd] = useState<string>('');
if (isLoading) return <div className="text-center p-4">Loading sessions...</div>;
if (!sessions.length) return <div className="text-center p-4 text-gray-500">No sessions recorded.</div>;
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);
+14 -14
View File
@@ -59,20 +59,20 @@ const WakeupPlot: React.FC<WakeupBedtimeProps> = ({ from_date, to_date, wakeup_r
tickLine={false}
axisLine={{ stroke: '#e5e7eb' }}
/>
<YAxis
tick={{ fontSize: 12 }}
tickLine={false}
axisLine={{ stroke: '#e5e7eb' }}
tickFormatter={(value) => formatMinutesAfter(value, wakeup_ref)}
domain={['dataMin - 30', 'dataMax + 30']}
/>
<Tooltip
formatter={(value: number) => [
formatMinutesAfter(value, wakeup_ref),
'Wakeup',
]}
labelFormatter={(label) => label}
/>
<YAxis
tick={{ fontSize: 12 }}
tickLine={false}
axisLine={{ stroke: '#e5e7eb' }}
tickFormatter={(value) => formatMinutesAfter(Number(value), wakeup_ref)}
domain={['dataMin - 30', 'dataMax + 30']}
/>
<Tooltip
formatter={(value: any) => [
formatMinutesAfter(Number(value), wakeup_ref),
'Wakeup',
]}
labelFormatter={(label) => label}
/>
<Line
type="monotone"
dataKey="minutes"
+2
View File
@@ -12,7 +12,9 @@ export interface SleepSessionCreate {
}
export interface SleepSessionUpdate {
start_time?: string;
end_time?: string;
notes?: string;
}
export type SleepSessionRead = SleepSession;