import React, { FC, useCallback } from 'react'; import { Card } from '~/components/containers/Card'; import { Group } from '~/components/containers/Group'; import { Zone } from '~/components/containers/Zone'; import { Button } from '~/components/input/Button'; import { InputRow } from '~/components/input/InputRow'; import { Toggle } from '~/components/input/Toggle'; import { useNotificationSettingsForm } from '~/hooks/notifications/useNotificationSettingsForm'; import { NotificationSettings } from '~/types/notifications'; import styles from './styles.module.scss'; interface NotificationSettingsFormProps { value: NotificationSettings; onSubmit: (val: Partial) => Promise; telegramConnected: boolean; onConnectTelegram: () => void; } const NotificationSettingsForm: FC = ({ value, onSubmit, telegramConnected, onConnectTelegram, }) => { const { setFieldValue, values } = useNotificationSettingsForm( value, onSubmit, ); const toggle = useCallback( (key: keyof NotificationSettings, disabled?: boolean) => ( setFieldValue(key, val)} value={values[key]} disabled={disabled} /> ), [setFieldValue, values], ); const telegramInput = telegramConnected ? ( toggle('sendTelegram', !values.enabled) ) : ( ); return ( Получать уведомления
Новые посты Комментарии
На иконке профиля Телеграм ); }; export { NotificationSettingsForm };