'use client';
import type { CalendarEventView } from '@/services/ScheduleService';
import { eventsOnDay, formatTime, toISODate } from '@/lib/calendar/grid';
import {
SOURCE_COLORS,
SOURCE_CHIP_BORDER,
WEEKDAY_LABELS,
} from '@/components/calendar/sourceColors';
/**
* 週表示。日〜土の7日を並べ、各日のイベントを開始時刻付きで表示する。
*/
export function WeekView({
events,
days,
todayKey,
onSelectDate,
}: {
events: CalendarEventView[];
days: Date[];
todayKey: string;
onSelectDate: (dateKey: string) => void;
}) {
return (
{days.map((d) => {
const key = toISODate(d);
return (
);
})}
{days.map((d) => {
const key = toISODate(d);
const dayEvents = eventsOnDay(events, key);
return (
{dayEvents.length === 0 ? (
-
) : (
dayEvents.map((e) => (
))
)}
);
})}
);
}