diff --git a/src/app/features/settings/notifications/Notifications.tsx b/src/app/features/settings/notifications/Notifications.tsx index 2324cff3a..a8ac4f43f 100644 --- a/src/app/features/settings/notifications/Notifications.tsx +++ b/src/app/features/settings/notifications/Notifications.tsx @@ -11,12 +11,19 @@ import { SequenceCard } from '../../../components/sequence-card'; import { SequenceCardStyle } from '../styles.css'; import { SettingTile } from '../../../components/setting-tile'; import { settingsAtom, Settings } from '../../../state/settings'; +import { notificationSnoozeUntilAtom } from '../../../state/notificationSnooze'; const PRESETS: Array<{ label: string; icon: IconSrc; description: string; patch: Partial; + // Whether applying this preset should also clear an active "Pause + // Notifications" snooze. Work/Gaming both claim notifications end up on, + // so a leftover snooze would silently contradict them (#48). Sleep's + // description ("All notifications off") is still true with a snooze left + // active, so it does not need to touch it. + clearSnooze: boolean; }> = [ { label: 'Gaming', @@ -29,6 +36,7 @@ const PRESETS: Array<{ inviteSoundId: 'none', quietHoursEnabled: false, }, + clearSnooze: true, }, { label: 'Work', @@ -41,6 +49,7 @@ const PRESETS: Array<{ inviteSoundId: 'invite', quietHoursEnabled: false, }, + clearSnooze: true, }, { label: 'Sleep', @@ -51,15 +60,23 @@ const PRESETS: Array<{ isNotificationSounds: false, quietHoursEnabled: false, }, + clearSnooze: false, }, ]; function NotificationPresets() { const settings = useAtomValue(settingsAtom); const setSettings = useSetAtom(settingsAtom); + const setSnoozeUntil = useSetAtom(notificationSnoozeUntilAtom); - const applyPreset = (patch: Partial) => { + const applyPreset = (patch: Partial, clearSnooze: boolean) => { setSettings({ ...settings, ...patch }); + // Work/Gaming promise notifications are on; an active snooze from an + // earlier "Pause Notifications" would otherwise keep them silently + // suppressed despite the preset applying successfully (#48). + if (clearSnooze) { + setSnoozeUntil(0); + } }; return ( @@ -71,7 +88,7 @@ function NotificationPresets() {