import { useCallback } from 'react'; import { FormattedMessage } from 'react-intl'; import { updateNotificationsPolicy } from 'mastodon/actions/notification_policies'; import { useAppSelector, useAppDispatch } from 'mastodon/store'; import { CheckboxWithLabel } from './checkbox_with_label'; // eslint-disable-next-line @typescript-eslint/no-empty-function const noop = () => {}; export const PolicyControls: React.FC = () => { const dispatch = useAppDispatch(); const notificationPolicy = useAppSelector( (state) => state.notificationPolicy, ); const handleFilterNotFollowing = useCallback( (checked: boolean) => { void dispatch( updateNotificationsPolicy({ filter_not_following: checked }), ); }, [dispatch], ); const handleFilterNotFollowers = useCallback( (checked: boolean) => { void dispatch( updateNotificationsPolicy({ filter_not_followers: checked }), ); }, [dispatch], ); const handleFilterNewAccounts = useCallback( (checked: boolean) => { void dispatch( updateNotificationsPolicy({ filter_new_accounts: checked }), ); }, [dispatch], ); const handleFilterPrivateMentions = useCallback( (checked: boolean) => { void dispatch( updateNotificationsPolicy({ filter_private_mentions: checked }), ); }, [dispatch], ); if (!notificationPolicy) return null; return (

); };