mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 04:46:40 +07:00
notifications: notification settings page
This commit is contained in:
parent
d77a01d8bc
commit
7135d06673
17 changed files with 319 additions and 35 deletions
30
src/containers/notifications/NotificationSettings/index.tsx
Normal file
30
src/containers/notifications/NotificationSettings/index.tsx
Normal file
|
@ -0,0 +1,30 @@
|
|||
import { FC } from 'react';
|
||||
|
||||
import { Padder } from '~/components/containers/Padder';
|
||||
import { NotificationSettingsForm } from '~/components/notifications/NotificationSettingsForm';
|
||||
import { useOAuth } from '~/hooks/auth/useOAuth';
|
||||
import { useNotificationSettings } from '~/hooks/notifications/useNotificationSettings';
|
||||
|
||||
interface NotificationSettingsProps {}
|
||||
|
||||
const NotificationSettings: FC<NotificationSettingsProps> = () => {
|
||||
const { settings, update } = useNotificationSettings();
|
||||
const { hasTelegram, showTelegramModal } = useOAuth();
|
||||
|
||||
if (!settings) {
|
||||
return <>{null}</>;
|
||||
}
|
||||
|
||||
return (
|
||||
<Padder>
|
||||
<NotificationSettingsForm
|
||||
value={settings}
|
||||
onSubmit={update}
|
||||
telegramConnected={hasTelegram}
|
||||
onConnectTelegram={showTelegramModal}
|
||||
/>
|
||||
</Padder>
|
||||
);
|
||||
};
|
||||
|
||||
export { NotificationSettings };
|
|
@ -15,18 +15,14 @@ import styles from './styles.module.scss';
|
|||
type ProfileAccountsProps = {};
|
||||
|
||||
const ProfileAccounts: FC<ProfileAccountsProps> = () => {
|
||||
const { isLoading, accounts, dropAccount, openOauthWindow } = useOAuth();
|
||||
const { showModal } = useModal();
|
||||
|
||||
const hasTelegram = useMemo(
|
||||
() => accounts.some((acc) => acc.provider === 'telegram'),
|
||||
[accounts],
|
||||
);
|
||||
|
||||
const showTelegramModal = useCallback(
|
||||
() => showModal(Dialog.TelegramAttach, {}),
|
||||
[],
|
||||
);
|
||||
const {
|
||||
isLoading,
|
||||
accounts,
|
||||
dropAccount,
|
||||
openOauthWindow,
|
||||
hasTelegram,
|
||||
showTelegramModal,
|
||||
} = useOAuth();
|
||||
|
||||
return (
|
||||
<Group className={styles.wrap}>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue