import { groupBy } from "lodash"; import * as React from "react"; import { ParsedTimeSlotOption } from "utils/date-time-utils"; import PollOptions from "./poll-options"; export interface TimeSlotOptionsProps { options: ParsedTimeSlotOption[]; editable?: boolean; selectedParticipantId?: string; } const TimeSlotOptions: React.VoidFunctionComponent = ({ options, editable, selectedParticipantId, }) => { const grouped = groupBy(options, (option) => { return `${option.dow} ${option.day} ${option.month}`; }); return (
{Object.entries(grouped).map(([day, options]) => { return (
{day}
); })}
); }; export default TimeSlotOptions;