11'use client'
2- import { BellIcon } from '@heroicons/react/outline'
3- import { BellIcon as SolidBellIcon } from '@heroicons/react/solid'
4- import { Row } from 'web/components/layout/row'
5- import { useEffect , useState } from 'react'
6- import { usePrivateUser } from 'web/hooks/use-user'
7- import { useGroupedUnseenNotifications } from 'web/hooks/use-notifications'
8- import { PrivateUser } from 'common/user'
9- import {
10- NOTIFICATIONS_PER_PAGE ,
11- NOTIFICATION_TYPES_TO_SELECT ,
12- } from 'common/notifications'
13- import { usePathname } from 'next/navigation'
2+ import { BellIcon } from '@heroicons/react/outline'
3+ import { BellIcon as SolidBellIcon } from '@heroicons/react/solid'
4+ import { Row } from 'web/components/layout/row'
5+ import { useEffect , useState } from 'react'
6+ import { usePrivateUser } from 'web/hooks/use-user'
7+ import { useGroupedUnseenNotifications } from 'web/hooks/use-notifications'
8+ import { PrivateUser } from 'common/user'
9+ import { NOTIFICATIONS_PER_PAGE , } from 'common/notifications'
10+ import { usePathname } from 'next/navigation'
1411
1512export function NotificationsIcon ( props : { className ?: string } ) {
1613 const privateUser = usePrivateUser ( )
17- const { className } = props
14+ const { className} = props
1815
1916 return (
2017 < Row className = "relative justify-center" >
21- { privateUser && < UnseenNotificationsBubble privateUser = { privateUser } /> }
22- < BellIcon className = { className } />
18+ { privateUser && < UnseenNotificationsBubble privateUser = { privateUser } /> }
19+ < BellIcon className = { className } />
2320 </ Row >
2421 )
2522}
2623
2724export function SolidNotificationsIcon ( props : { className ?: string } ) {
2825 const privateUser = usePrivateUser ( )
29- const { className } = props
26+ const { className} = props
3027 return (
3128 < Row className = "relative justify-center" >
32- { privateUser && < UnseenNotificationsBubble privateUser = { privateUser } /> }
33- < SolidBellIcon className = { className } />
29+ { privateUser && < UnseenNotificationsBubble privateUser = { privateUser } /> }
30+ < SolidBellIcon className = { className } />
3431 </ Row >
3532 )
3633}
3734
3835function UnseenNotificationsBubble ( props : { privateUser : PrivateUser } ) {
3936 const pathname = usePathname ( )
40- const { privateUser } = props
41- const selectTypes = NOTIFICATION_TYPES_TO_SELECT
37+ const { privateUser} = props
4238
4339 const [ seen , setSeen ] = useState ( false )
4440 const unseenSourceIdsToNotificationIds =
45- useGroupedUnseenNotifications ( privateUser . id , selectTypes ) ?? [ ]
41+ useGroupedUnseenNotifications (
42+ privateUser . id ,
43+ // NOTIFICATION_TYPES_TO_SELECT
44+ ) ?? [ ]
4645
4746 const unseenNotifs = Object . keys ( unseenSourceIdsToNotificationIds ) . length
4847
@@ -57,7 +56,8 @@ function UnseenNotificationsBubble(props: { privateUser: PrivateUser }) {
5756 }
5857
5958 return (
60- < div className = "-mt-0.75 text-ink-0 bg-primary-500 absolute ml-3.5 min-w-[15px] rounded-full p-[2px] text-center text-[10px] leading-3 lg:left-0 lg:-mt-1 lg:ml-2" >
59+ < div
60+ className = "-mt-0.75 text-ink-0 bg-primary-500 absolute ml-3.5 min-w-[15px] rounded-full p-[2px] text-center text-[10px] leading-3 lg:left-0 lg:-mt-1 lg:ml-2" >
6161 { unseenNotifs > NOTIFICATIONS_PER_PAGE
6262 ? `${ NOTIFICATIONS_PER_PAGE } +`
6363 : unseenNotifs }
0 commit comments