1 import { useState } from 'react';
3 import { c } from 'ttag';
5 import { Button } from '@proton/atoms';
6 import type { ModalStateProps } from '@proton/components';
7 import { ModalTwo, ModalTwoContent, ModalTwoFooter, ModalTwoHeader, PrimaryButton } from '@proton/components';
8 import type { WeekStartsOn } from '@proton/shared/lib/date-fns-utc/interface';
9 import type { DateTimeModel, FrequencyModel } from '@proton/shared/lib/interfaces/calendar';
11 import CustomFrequencySelector from './CustomFrequencySelector';
14 frequencyModel: FrequencyModel;
16 displayWeekNumbers: boolean;
17 weekStartsOn: WeekStartsOn;
20 onChange: (value: FrequencyModel) => void;
21 modalProps: ModalStateProps;
24 const CustomFrequencyModal = ({
34 const [values, setValues] = useState(frequencyModel);
37 <ModalTwo {...modalProps}>
38 <ModalTwoHeader title={c('Header').t`Custom recurrence`} />
40 <CustomFrequencySelector
41 frequencyModel={values}
43 displayWeekNumbers={displayWeekNumbers}
44 weekStartsOn={weekStartsOn}
46 isSubmitted={isSubmitted}
52 <Button onClick={modalProps.onClose}>{c('Action').t`Cancel`}</Button>
57 >{c('Action').t`Done`}</PrimaryButton>
63 export default CustomFrequencyModal;