From e6ace54adb9be67a76f7945c0c0f4ab2c039209b Mon Sep 17 00:00:00 2001 From: Ian Philips Date: Wed, 3 Aug 2022 15:05:19 -0600 Subject: [PATCH] Cleanup --- web/components/groups/group-chat.tsx | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/web/components/groups/group-chat.tsx b/web/components/groups/group-chat.tsx index 5f36e3b7..6f7287fc 100644 --- a/web/components/groups/group-chat.tsx +++ b/web/components/groups/group-chat.tsx @@ -245,7 +245,7 @@ export function GroupChatInBubble(props: { )} @@ -256,32 +256,31 @@ export function GroupChatInBubble(props: { function GroupChatNotificationsIcon(props: { group: Group privateUser: PrivateUser - setAsSeen: boolean + shouldSetAsSeen: boolean }) { - const { privateUser, group, setAsSeen } = props + const { privateUser, group, shouldSetAsSeen } = props const preferredNotificationsForThisGroup = useUnseenPreferredNotifications( privateUser, { customHref: `/group/${group.slug}`, } ) - // Set notification as seen if our current page is equal to the isSeenOnHref property useEffect(() => { preferredNotificationsForThisGroup.forEach((notification) => { if ( - (setAsSeen && notification.isSeenOnHref?.includes('chat')) || + (shouldSetAsSeen && notification.isSeenOnHref?.includes('chat')) || // old style chat notif that simply ended with the group slug notification.isSeenOnHref?.endsWith(group.slug) ) { setNotificationsAsSeen([notification]) } }) - }, [group.slug, preferredNotificationsForThisGroup, setAsSeen]) + }, [group.slug, preferredNotificationsForThisGroup, shouldSetAsSeen]) return (
0 && !setAsSeen + preferredNotificationsForThisGroup.length > 0 && !shouldSetAsSeen ? 'absolute right-4 top-4 h-3 w-3 rounded-full border-2 border-white bg-red-500' : 'hidden' }