export const AddToCalendar: React.VFC<Props> = ({ appointment }) => {
const saveToCalendar = useCallback(
(e) => {
e.preventDefault();
atcb_action({
trigger: 'click',
name: `${appointment?.visit_reason}`,
startDate: `${formatApptDate(appointment?.start_time)}`,
endDate: `${formatApptDate(appointment?.end_time)}`,
startTime: `${formatApptTime(appointment?.start_time)}`,
endTime: `${formatApptTime(appointment?.end_time)}`,
location: `${addressToString(appointment?.clinic.address)}`,
options: ['Apple', 'Google', 'iCal', 'Microsoft365', 'Outlook.com', 'Yahoo'],
timeZone: 'America/Los_Angeles',
iCalFileName: 'Reminder-Event',
});
},
[appointment?.clinic.address, appointment?.end_time, appointment?.start_time, appointment?.visit_reason]
);
return (
<IconButton
onClick={saveToCalendar}
icon={<CalendarIcon />}
/>
);
};