Fixed a littlebit. now back to plan.md
This commit is contained in:
@@ -57,20 +57,20 @@ const BedtimePlot: React.FC<WakeupBedtimeProps> = ({ from_date, to_date, wakeup_
|
|||||||
tickLine={false}
|
tickLine={false}
|
||||||
axisLine={{ stroke: '#e5e7eb' }}
|
axisLine={{ stroke: '#e5e7eb' }}
|
||||||
/>
|
/>
|
||||||
<YAxis
|
<YAxis
|
||||||
tick={{ fontSize: 12 }}
|
tick={{ fontSize: 12 }}
|
||||||
tickLine={false}
|
tickLine={false}
|
||||||
axisLine={{ stroke: '#e5e7eb' }}
|
axisLine={{ stroke: '#e5e7eb' }}
|
||||||
tickFormatter={(value) => formatMinutesAfter(value, bedtime_ref)}
|
tickFormatter={(value) => formatMinutesAfter(Number(value), bedtime_ref)}
|
||||||
domain={['dataMin - 30', 'dataMax + 30']}
|
domain={['dataMin - 30', 'dataMax + 30']}
|
||||||
/>
|
/>
|
||||||
<Tooltip
|
<Tooltip
|
||||||
formatter={(value: number) => [
|
formatter={(value: any) => [
|
||||||
formatMinutesAfter(value, bedtime_ref),
|
formatMinutesAfter(Number(value), bedtime_ref),
|
||||||
'Bedtime',
|
'Bedtime',
|
||||||
]}
|
]}
|
||||||
labelFormatter={(label) => label}
|
labelFormatter={(label) => label}
|
||||||
/>
|
/>
|
||||||
<Line
|
<Line
|
||||||
type="monotone"
|
type="monotone"
|
||||||
dataKey="minutes"
|
dataKey="minutes"
|
||||||
|
|||||||
@@ -86,22 +86,22 @@ const DailySummary: React.FC<DailySummaryProps> = ({ from_date, to_date, day_sta
|
|||||||
margin={{ top: 5, right: 30, left: 60, bottom: 5 }}
|
margin={{ top: 5, right: 30, left: 60, bottom: 5 }}
|
||||||
>
|
>
|
||||||
<CartesianGrid strokeDasharray="3 3" stroke="#e5e7eb" />
|
<CartesianGrid strokeDasharray="3 3" stroke="#e5e7eb" />
|
||||||
<XAxis
|
<XAxis
|
||||||
type="number"
|
type="number"
|
||||||
tickFormatter={(value) => `${Math.round(value)}h`}
|
tickFormatter={(value) => `${Math.round(Number(value))}h`}
|
||||||
tick={{ fontSize: 12 }}
|
tick={{ fontSize: 12 }}
|
||||||
tickLine={false}
|
tickLine={false}
|
||||||
/>
|
/>
|
||||||
<YAxis
|
<YAxis
|
||||||
type="category"
|
type="category"
|
||||||
dataKey="date"
|
dataKey="date"
|
||||||
tick={{ fontSize: 12 }}
|
tick={{ fontSize: 12 }}
|
||||||
tickLine={false}
|
tickLine={false}
|
||||||
width={60}
|
width={60}
|
||||||
/>
|
/>
|
||||||
<Tooltip
|
<Tooltip
|
||||||
formatter={(value: number, name: string) => [
|
formatter={(value: any, name: any) => [
|
||||||
formatMinutes(Math.round((value ?? 0) * 60)),
|
formatMinutes(Math.round(Number(value ?? 0) * 60)),
|
||||||
name === 'daySleep' ? 'Day' : 'Night',
|
name === 'daySleep' ? 'Day' : 'Night',
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -7,21 +7,21 @@ import { formatDateTime, toLocalDatetimeInputValue, getDurationMinutes, formatMi
|
|||||||
export function SessionList() {
|
export function SessionList() {
|
||||||
const { sessions, isLoading, updateSession, deleteSession, isDeleting } = useSessions();
|
const { sessions, isLoading, updateSession, deleteSession, isDeleting } = useSessions();
|
||||||
const [editingId, setEditingId] = useState<number | null>(null);
|
const [editingId, setEditingId] = useState<number | null>(null);
|
||||||
const [editStart, setEditStart] = useState('');
|
const [editStart, setEditStart] = useState<string>('');
|
||||||
const [editEnd, setEditEnd] = useState('');
|
const [editEnd, setEditEnd] = useState<string>('');
|
||||||
|
|
||||||
if (isLoading) return <div className="text-center p-4">Loading sessions...</div>;
|
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>;
|
if (!sessions.length) return <div className="text-center p-4 text-gray-500">No sessions recorded.</div>;
|
||||||
|
|
||||||
const handleSave = async (id: number) => {
|
const handleSave = async (id: number) => {
|
||||||
try {
|
try {
|
||||||
await updateSession({
|
await updateSession({
|
||||||
sessionId: id,
|
sessionId: id,
|
||||||
payload: {
|
payload: {
|
||||||
start_time: new Date(editStart).toISOString(),
|
start_time: new Date(editStart).toISOString(),
|
||||||
end_time: editEnd ? new Date(editEnd).toISOString() : null,
|
end_time: editEnd ? new Date(editEnd).toISOString() : undefined,
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
setEditingId(null);
|
setEditingId(null);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
|
|||||||
@@ -59,20 +59,20 @@ const WakeupPlot: React.FC<WakeupBedtimeProps> = ({ from_date, to_date, wakeup_r
|
|||||||
tickLine={false}
|
tickLine={false}
|
||||||
axisLine={{ stroke: '#e5e7eb' }}
|
axisLine={{ stroke: '#e5e7eb' }}
|
||||||
/>
|
/>
|
||||||
<YAxis
|
<YAxis
|
||||||
tick={{ fontSize: 12 }}
|
tick={{ fontSize: 12 }}
|
||||||
tickLine={false}
|
tickLine={false}
|
||||||
axisLine={{ stroke: '#e5e7eb' }}
|
axisLine={{ stroke: '#e5e7eb' }}
|
||||||
tickFormatter={(value) => formatMinutesAfter(value, wakeup_ref)}
|
tickFormatter={(value) => formatMinutesAfter(Number(value), wakeup_ref)}
|
||||||
domain={['dataMin - 30', 'dataMax + 30']}
|
domain={['dataMin - 30', 'dataMax + 30']}
|
||||||
/>
|
/>
|
||||||
<Tooltip
|
<Tooltip
|
||||||
formatter={(value: number) => [
|
formatter={(value: any) => [
|
||||||
formatMinutesAfter(value, wakeup_ref),
|
formatMinutesAfter(Number(value), wakeup_ref),
|
||||||
'Wakeup',
|
'Wakeup',
|
||||||
]}
|
]}
|
||||||
labelFormatter={(label) => label}
|
labelFormatter={(label) => label}
|
||||||
/>
|
/>
|
||||||
<Line
|
<Line
|
||||||
type="monotone"
|
type="monotone"
|
||||||
dataKey="minutes"
|
dataKey="minutes"
|
||||||
|
|||||||
@@ -12,7 +12,9 @@ export interface SleepSessionCreate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface SleepSessionUpdate {
|
export interface SleepSessionUpdate {
|
||||||
|
start_time?: string;
|
||||||
end_time?: string;
|
end_time?: string;
|
||||||
|
notes?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type SleepSessionRead = SleepSession;
|
export type SleepSessionRead = SleepSession;
|
||||||
|
|||||||
Reference in New Issue
Block a user