Skip to content
This repository has been archived by the owner on Oct 4, 2023. It is now read-only.

Commit

Permalink
[C-2386] Fix notification button not toggling panel (#3110)
Browse files Browse the repository at this point in the history
  • Loading branch information
dylanjeffers authored Mar 28, 2023
1 parent a3c2e91 commit b90eaf6
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions packages/web/src/components/nav/desktop/NavColumn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -125,6 +128,7 @@ const NavColumn = ({
notificationCount,
notificationPanelIsOpen,
openNotificationPanel,
closeNotificationPanel,
showCreatePlaylistModal,
hideCreatePlaylistModalFolderTab,
updatePlaylistLibrary,
Expand Down Expand Up @@ -183,16 +187,19 @@ const NavColumn = ({
}, [account, goToRoute])

const onClickToggleNotificationPanel = useCallback(() => {
openNotificationPanel()
if (!notificationPanelIsOpen) {
openNotificationPanel()
record(make(Name.NOTIFICATIONS_OPEN, { source: 'button' }))
} else {
closeNotificationPanel()
}
if (notificationCount > 0) {
markAllNotificationsAsViewed()
}
}, [
notificationPanelIsOpen,
openNotificationPanel,
closeNotificationPanel,
record,
notificationCount,
markAllNotificationsAsViewed
Expand Down Expand Up @@ -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) =>
Expand Down

0 comments on commit b90eaf6

Please sign in to comment.