From 9af4f903535fefcfa9498f226ad2793dc5697a9a Mon Sep 17 00:00:00 2001 From: Max Makaluk <70341920+FussuChalice@users.noreply.github.com> Date: Fri, 22 Nov 2024 15:57:44 +0200 Subject: [PATCH] fix(notifications): toggle notification open state on click --- src/features/app_notification/index.tsx | 10 ++++++---- src/features/app_notification/useAppNotification.tsx | 11 +++-------- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/src/features/app_notification/index.tsx b/src/features/app_notification/index.tsx index 5bad1ae57b..ee91826cda 100644 --- a/src/features/app_notification/index.tsx +++ b/src/features/app_notification/index.tsx @@ -5,12 +5,11 @@ import ButtonIcon from '@components/icon_button'; import NotificationContainer from './container'; const AppNotification = () => { - const { handleCloseNotification, handleOpenNotification, open, count } = - useAppNotification(); + const { handleToggleNotificationState, open, count } = useAppNotification(); return ( <> - + { - + ); }; diff --git a/src/features/app_notification/useAppNotification.tsx b/src/features/app_notification/useAppNotification.tsx index 1c8b7acf7e..c0b1455b84 100644 --- a/src/features/app_notification/useAppNotification.tsx +++ b/src/features/app_notification/useAppNotification.tsx @@ -14,20 +14,15 @@ const useAppNotification = () => { const count = notifications.filter((record) => !record.read).length; - const handleOpenNotification = async () => { + const handleToggleNotificationState = async () => { setIsMyAssignmentOpen(false); - setOpen(true); - }; - - const handleCloseNotification = () => { - setOpen(false); + setOpen((prev) => !prev); }; return { open, - handleOpenNotification, - handleCloseNotification, + handleToggleNotificationState, count, }; };