1 import React, { useCallback, useRef } from 'react';
3 import debounce from 'lodash/debounce';
5 import type { SimpleMap } from '@proton/shared/lib/interfaces';
6 import type { AttendeeModel } from '@proton/shared/lib/interfaces/calendar';
7 import type { ContactEmail } from '@proton/shared/lib/interfaces/contacts';
9 import { busySlotsActions } from '../../../store/busySlots/busySlotsSlice';
10 import { useCalendarDispatch } from '../../../store/hooks';
11 import BusyParticipantRow from './BusyParticipantRow';
12 import ParticipantRow from './ParticipantRow';
15 attendeeModel: AttendeeModel[];
16 contactEmailsMap: SimpleMap<ContactEmail>;
17 isBusySlotsAvailable: boolean;
18 onDelete: (attendee: AttendeeModel) => void;
19 toggleIsOptional: (attendee: AttendeeModel) => void;
22 const ParticipantRows = ({
29 const dispatch = useCalendarDispatch();
30 const busyAttendeeHighlighted = useRef<string | undefined>(undefined);
32 const onChangeHighlight = useCallback(
34 dispatch(busySlotsActions.setHighlightedAttendee(busyAttendeeHighlighted.current));
40 <div className="pt-1 border-bottom border-weak mb-1">
41 {attendeeModel.map((participant) => {
42 return isBusySlotsAvailable ? (
44 key={participant.email}
45 attendee={participant}
46 contactEmailsMap={contactEmailsMap}
47 onToggleOptional={toggleIsOptional}
49 onHighlight={(email, highlighted) => {
50 busyAttendeeHighlighted.current = highlighted ? email : undefined;
56 key={participant.email}
57 attendee={participant}
58 contactEmailsMap={contactEmailsMap}
59 onToggleOptional={toggleIsOptional}
68 export default ParticipantRows;