Fix bolded group chat not getting unbolded

This commit is contained in:
James Grugett 2022-08-11 00:00:40 -05:00
parent 61ae481a03
commit 6e93f11a59

View File

@ -21,6 +21,7 @@ import { Content, useTextEditor } from 'web/components/editor'
import { useUnseenPreferredNotifications } from 'web/hooks/use-notifications' import { useUnseenPreferredNotifications } from 'web/hooks/use-notifications'
import { ChevronDownIcon, UsersIcon } from '@heroicons/react/outline' import { ChevronDownIcon, UsersIcon } from '@heroicons/react/outline'
import { setNotificationsAsSeen } from 'web/pages/notifications' import { setNotificationsAsSeen } from 'web/pages/notifications'
import { usePrivateUser } from 'web/hooks/use-user'
export function GroupChat(props: { export function GroupChat(props: {
messages: Comment[] messages: Comment[]
@ -29,6 +30,9 @@ export function GroupChat(props: {
tips: CommentTipMap tips: CommentTipMap
}) { }) {
const { messages, user, group, tips } = props const { messages, user, group, tips } = props
const privateUser = usePrivateUser(user?.id)
const { editor, upload } = useTextEditor({ const { editor, upload } = useTextEditor({
simple: true, simple: true,
placeholder: 'Send a message', placeholder: 'Send a message',
@ -175,6 +179,15 @@ export function GroupChat(props: {
</div> </div>
</div> </div>
)} )}
{privateUser && (
<GroupChatNotificationsIcon
group={group}
privateUser={privateUser}
shouldSetAsSeen={true}
hidden={true}
/>
)}
</Col> </Col>
) )
} }
@ -248,6 +261,7 @@ export function GroupChatInBubble(props: {
group={group} group={group}
privateUser={privateUser} privateUser={privateUser}
shouldSetAsSeen={shouldShowChat} shouldSetAsSeen={shouldShowChat}
hidden={false}
/> />
)} )}
</button> </button>
@ -259,8 +273,9 @@ function GroupChatNotificationsIcon(props: {
group: Group group: Group
privateUser: PrivateUser privateUser: PrivateUser
shouldSetAsSeen: boolean shouldSetAsSeen: boolean
hidden: boolean
}) { }) {
const { privateUser, group, shouldSetAsSeen } = props const { privateUser, group, shouldSetAsSeen, hidden } = props
const preferredNotificationsForThisGroup = useUnseenPreferredNotifications( const preferredNotificationsForThisGroup = useUnseenPreferredNotifications(
privateUser, privateUser,
{ {
@ -282,7 +297,9 @@ function GroupChatNotificationsIcon(props: {
return ( return (
<div <div
className={ className={
preferredNotificationsForThisGroup.length > 0 && !shouldSetAsSeen !hidden &&
preferredNotificationsForThisGroup.length > 0 &&
!shouldSetAsSeen
? 'absolute right-4 top-4 h-3 w-3 rounded-full border-2 border-white bg-red-500' ? 'absolute right-4 top-4 h-3 w-3 rounded-full border-2 border-white bg-red-500'
: 'hidden' : 'hidden'
} }