One card per day pushed the week to roughly 1100px, so checking a change meant scrolling back up past the day you had just edited. All seven days now fit on one phone screen. Each row carries the day, an open switch, its slots inline and its two actions. The per-row "duplicate onto the other open days" button was repeated five times in prose; it is now a short labelled control on the row itself, with the full sentence kept as its accessible name. Unsaved days are marked with a dot rather than a badge, and the footer still names which days are about to change — the point of the preview is that it is readable without leaving the week. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012cSY9pVhZmJUKNN7wf1Myd
36 lines
1.0 KiB
TypeScript
36 lines
1.0 KiB
TypeScript
import { auth } from '@/lib/auth';
|
|
import { prisma } from '@/lib/db';
|
|
import type { Slot } from '@/lib/schedule/types';
|
|
import { toDraft } from '@/lib/schedule/week';
|
|
|
|
import WeekEditor from './WeekEditor';
|
|
|
|
export const metadata = { title: 'Horaires fixes — ITA ITO' };
|
|
|
|
export default async function HoursPage() {
|
|
const [session, rows] = await Promise.all([
|
|
auth(),
|
|
prisma.weeklySchedule.findMany({ orderBy: { dayOfWeek: 'asc' } }),
|
|
]);
|
|
|
|
const initial = toDraft(
|
|
rows.map((row) => ({
|
|
dayOfWeek: row.dayOfWeek,
|
|
isClosed: row.isClosed,
|
|
slots: (row.slots as Slot[] | null) ?? [],
|
|
})),
|
|
);
|
|
|
|
return (
|
|
<main className="mx-auto max-w-3xl px-4 py-8">
|
|
<h1 className="text-2xl">Horaires fixes</h1>
|
|
<p className="mt-1 text-sm text-[var(--ink-muted)]">
|
|
Semaine de référence. Fermetures ponctuelles, vacances et jours fériés priment sur ces
|
|
horaires.
|
|
</p>
|
|
|
|
<WeekEditor initial={initial} canEdit={session?.user?.role === 'admin'} />
|
|
</main>
|
|
);
|
|
}
|