From 616e9a3439eb0fe22acda523e0258501c7bd9069 Mon Sep 17 00:00:00 2001 From: Dylan Jeffers Date: Tue, 28 Mar 2023 10:26:22 -0700 Subject: [PATCH] [C-2386] Fix notification button not toggling panel (#3110) --- .../web/src/components/nav/desktop/NavColumn.tsx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/apps/audius-client/packages/web/src/components/nav/desktop/NavColumn.tsx b/apps/audius-client/packages/web/src/components/nav/desktop/NavColumn.tsx index 568602d1079..9107c5afafd 100644 --- a/apps/audius-client/packages/web/src/components/nav/desktop/NavColumn.tsx +++ b/apps/audius-client/packages/web/src/components/nav/desktop/NavColumn.tsx @@ -63,7 +63,10 @@ import { useUserProfilePicture } from 'hooks/useUserProfilePicture' import { NO_VISUALIZER_ROUTES } from 'pages/visualizer/Visualizer' import { openVisualizer } from 'pages/visualizer/store/slice' import { getNotificationPanelIsOpen } from 'store/application/ui/notifications/notificationsUISelectors' -import { openNotificationPanel } from 'store/application/ui/notifications/notificationsUISlice' +import { + openNotificationPanel, + closeNotificationPanel +} from 'store/application/ui/notifications/notificationsUISlice' import { getIsDragging } from 'store/dragndrop/selectors' import { AppState } from 'store/types' import { @@ -125,6 +128,7 @@ const NavColumn = ({ notificationCount, notificationPanelIsOpen, openNotificationPanel, + closeNotificationPanel, showCreatePlaylistModal, hideCreatePlaylistModalFolderTab, updatePlaylistLibrary, @@ -183,9 +187,11 @@ const NavColumn = ({ }, [account, goToRoute]) const onClickToggleNotificationPanel = useCallback(() => { - openNotificationPanel() if (!notificationPanelIsOpen) { + openNotificationPanel() record(make(Name.NOTIFICATIONS_OPEN, { source: 'button' })) + } else { + closeNotificationPanel() } if (notificationCount > 0) { markAllNotificationsAsViewed() @@ -193,6 +199,7 @@ const NavColumn = ({ }, [ notificationPanelIsOpen, openNotificationPanel, + closeNotificationPanel, record, notificationCount, markAllNotificationsAsViewed @@ -583,6 +590,7 @@ const mapDispatchToProps = (dispatch: Dispatch) => ({ showActionRequiresAccount: () => dispatch(signOnActions.showRequiresAccountModal()), openNotificationPanel: () => dispatch(openNotificationPanel()), + closeNotificationPanel: () => dispatch(closeNotificationPanel()), openCreatePlaylistModal: () => dispatch(createPlaylistModalActions.open()), closeCreatePlaylistModal: () => dispatch(createPlaylistModalActions.close()), updatePlaylistLastViewedAt: (playlistId: number) =>