diff --git a/web/hooks/use-notifications.ts b/web/hooks/use-notifications.ts index b9bef469..a3ddeb29 100644 --- a/web/hooks/use-notifications.ts +++ b/web/hooks/use-notifications.ts @@ -32,15 +32,10 @@ export function usePreferredGroupedNotifications( if (!result.data) return cachedNotifications ?? [] const notifications = result.data as Notification[] - const notificationsToShow = getAppropriateNotifications( + return getAppropriateNotifications( notifications, privateUser.notificationPreferences ).filter((n) => !n.isSeenOnHref) - const cachedIds = cachedNotifications?.map((n) => n.id) - if (notificationsToShow.some((n) => !cachedIds?.includes(n.id))) { - return notificationsToShow - } - return cachedNotifications }, [ cachedNotifications, privateUser.notificationPreferences, diff --git a/web/pages/notifications.tsx b/web/pages/notifications.tsx index 084b143c..a45bf030 100644 --- a/web/pages/notifications.tsx +++ b/web/pages/notifications.tsx @@ -47,12 +47,12 @@ import Custom404 from 'web/pages/404' import { track } from '@amplitude/analytics-browser' import { Pagination } from 'web/components/pagination' import { useWindowSize } from 'web/hooks/use-window-size' -import Router from 'next/router' import { safeLocalStorage } from 'web/lib/util/local' import { getServerAuthenticatedUid, redirectIfLoggedOut, } from 'web/lib/firebase/server-auth' +import { SiteLink } from 'web/components/site-link' export const NOTIFICATIONS_PER_PAGE = 30 const MULTIPLE_USERS_KEY = 'multipleUsers' @@ -100,7 +100,8 @@ export default function Notifications(props: { user: User }) { privateUser={privateUser} cachedNotifications={localNotifications} /> - ) : localNotifications && localNotifications.length > 0 ? ( + ) : localNotificationGroups && + localNotificationGroups.length > 0 ? (
- +
+
@@ -466,7 +471,7 @@ function IncomeNotificationItem(props: {
- +
) } @@ -655,24 +660,24 @@ function NotificationItem(props: { highlighted && HIGHLIGHT_CLASS )} > -
{ - event.stopPropagation() - Router.push(getSourceUrl(notification) ?? '') - track('Notification Clicked', { - type: 'notification item', - sourceType, - sourceUserName, - sourceUserAvatarUrl, - sourceUpdateType, - reasonText, - reason, - sourceUserUsername, - sourceText, - }) - }} - > +
+ + track('Notification Clicked', { + type: 'notification item', + sourceType, + sourceUserName, + sourceUserAvatarUrl, + sourceUpdateType, + reasonText, + reason, + sourceUserUsername, + sourceText, + }) + } + /> )} @@ -764,10 +769,8 @@ function QuestionOrGroupLink(props: { ) return ( - {sourceContractTitle || sourceTitle} - + ) }