-
Notifications
You must be signed in to change notification settings - Fork 7.4k
Expand file tree
/
Copy pathSettingsAccountsNewImapSmtpCaldavConnection.tsx
More file actions
62 lines (55 loc) · 2.04 KB
/
Copy pathSettingsAccountsNewImapSmtpCaldavConnection.tsx
File metadata and controls
62 lines (55 loc) · 2.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import { useLingui } from '@lingui/react/macro';
import { FormProvider } from 'react-hook-form';
import { SaveAndCancelButtons } from '@/settings/components/SaveAndCancelButtons/SaveAndCancelButtons';
import { SettingsPageContainer } from '@/settings/components/SettingsPageContainer';
import { SettingsPageLayout } from '@/settings/components/layout/SettingsPageLayout';
import { SettingsPath } from 'twenty-shared/types';
import { getSettingsPath } from 'twenty-shared/utils';
import { useNavigateSettings } from '~/hooks/useNavigateSettings';
import { SettingsAccountsConnectionForm } from '@/settings/accounts/components/SettingsAccountsConnectionForm';
import { useImapSmtpCaldavConnectionForm } from '@/settings/accounts/hooks/useImapSmtpCaldavConnectionForm';
export const SettingsAccountsNewImapSmtpCaldavConnection = () => {
const { t } = useLingui();
const navigate = useNavigateSettings();
const {
formMethods,
handleSave,
handleSubmit,
canSave,
isSubmitting,
loading,
} = useImapSmtpCaldavConnectionForm({});
const { control } = formMethods;
return (
// oxlint-disable-next-line react/jsx-props-no-spreading
<FormProvider {...formMethods}>
<SettingsPageLayout
title={t`New Account`}
links={[
{
children: t`User`,
href: getSettingsPath(SettingsPath.ProfilePage),
},
{
children: t`Accounts`,
href: getSettingsPath(SettingsPath.Accounts),
},
{ children: t`New Account` },
]}
actionButton={
<SaveAndCancelButtons
isSaveDisabled={!canSave}
isCancelDisabled={isSubmitting}
isLoading={loading}
onCancel={() => navigate(SettingsPath.Accounts)}
onSave={handleSubmit((data) => handleSave(data))}
/>
}
>
<SettingsPageContainer>
<SettingsAccountsConnectionForm control={control} isEditing={false} />
</SettingsPageContainer>
</SettingsPageLayout>
</FormProvider>
);
};