mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-16 21:03:29 +00:00
40 lines
935 B
TypeScript
40 lines
935 B
TypeScript
import { cx } from '../../../common/utils/styleUtils';
|
|
|
|
import { getScheduledTimes } from './schedule.utils';
|
|
import { useSchedule } from './ScheduleContext';
|
|
import ScheduleItem from './ScheduleItem';
|
|
|
|
import './Schedule.scss';
|
|
|
|
interface ScheduleProps {
|
|
className?: string;
|
|
}
|
|
|
|
export default function Schedule({ className }: ScheduleProps) {
|
|
const { events, containerRef } = useSchedule();
|
|
|
|
if (events?.length < 1) {
|
|
return null;
|
|
}
|
|
|
|
return (
|
|
<ul className={cx(['schedule', className])} ref={containerRef}>
|
|
{events.map((event) => {
|
|
const { timeStart, timeEnd, delay } = getScheduledTimes(event);
|
|
|
|
return (
|
|
<ScheduleItem
|
|
key={event.id}
|
|
timeStart={timeStart}
|
|
timeEnd={timeEnd}
|
|
title={event.title}
|
|
colour={event.colour}
|
|
skip={event.skip}
|
|
delay={delay}
|
|
/>
|
|
);
|
|
})}
|
|
</ul>
|
|
);
|
|
}
|