11import clsx from 'clsx'
2- import { User } from 'common/user'
3- import { parseJsonContentToText } from 'common/util/parse'
2+ import { User } from 'common/user'
3+ import { parseJsonContentToText } from 'common/util/parse'
44import Link from 'next/link'
5- import { Col } from 'web/components/layout/col'
6- import { PageBase } from 'web/components/page-base'
7- import { Row } from 'web/components/layout/row'
5+ import { Col } from 'web/components/layout/col'
6+ import { PageBase } from 'web/components/page-base'
7+ import { Row } from 'web/components/layout/row'
88import NewMessageButton from 'web/components/messaging/new-message-button'
9- import { RelativeTimestamp } from 'web/components/relative-timestamp'
10- import { Title } from 'web/components/widgets/title'
9+ import { RelativeTimestamp } from 'web/components/relative-timestamp'
10+ import { Title } from 'web/components/widgets/title'
1111import {
1212 usePrivateMessages ,
1313 useSortedPrivateMessageMemberships ,
1414 useUnseenPrivateMessageChannels ,
1515} from 'web/hooks/use-private-messages'
16- import { useUser } from 'web/hooks/use-user'
17- import { useUsersInStore } from 'web/hooks/use-user-supabase'
18- import { useRedirectIfSignedOut } from 'web/hooks/use-redirect-if-signed-out'
19- import { MultipleOrSingleAvatars } from 'web/components/multiple-or-single-avatars'
20- import { BannedBadge } from 'web/components/widgets/user-link'
21- import { PrivateMessageChannel } from 'common/supabase/private-messages'
16+ import { useUser } from 'web/hooks/use-user'
17+ import { useUsersInStore } from 'web/hooks/use-user-supabase'
18+ import { useRedirectIfSignedOut } from 'web/hooks/use-redirect-if-signed-out'
19+ import { MultipleOrSingleAvatars } from 'web/components/multiple-or-single-avatars'
20+ import { BannedBadge } from 'web/components/widgets/user-link'
21+ import { PrivateMessageChannel } from 'common/supabase/private-messages'
2222import { SEO } from "web/components/SEO" ;
2323
2424
@@ -33,17 +33,17 @@ export default function MessagesPage() {
3333 description = { 'Your Messages' }
3434 url = { `/messages` }
3535 />
36- { currentUser && < MessagesContent currentUser = { currentUser } /> }
36+ { currentUser && < MessagesContent currentUser = { currentUser } /> }
3737 </ PageBase >
3838 )
3939}
4040
4141export function MessagesContent ( props : { currentUser : User } ) {
42- const { currentUser } = props
43- const { channels, memberIdsByChannelId } = useSortedPrivateMessageMemberships (
42+ const { currentUser} = props
43+ const { channels, memberIdsByChannelId} = useSortedPrivateMessageMemberships (
4444 currentUser . id
4545 )
46- const { lastSeenChatTimeByChannelId } = useUnseenPrivateMessageChannels (
46+ const { lastSeenChatTimeByChannelId} = useUnseenPrivateMessageChannels (
4747 currentUser . id ,
4848 true
4949 )
@@ -52,7 +52,7 @@ export function MessagesContent(props: { currentUser: User }) {
5252 < >
5353 < Row className = "justify-between" >
5454 < Title > Messages</ Title >
55- < NewMessageButton />
55+ < NewMessageButton />
5656 </ Row >
5757 < Col className = { 'w-full overflow-hidden' } >
5858 { channels && channels . length === 0 && (
@@ -79,13 +79,14 @@ export function MessagesContent(props: { currentUser: User }) {
7979 </ >
8080 )
8181}
82+
8283export const MessageChannelRow = ( props : {
8384 otherUserIds : string [ ]
8485 currentUser : User
8586 channel : PrivateMessageChannel
8687 lastSeenTime : string
8788} ) => {
88- const { otherUserIds, lastSeenTime, currentUser, channel } = props
89+ const { otherUserIds, lastSeenTime, currentUser, channel} = props
8990 const channelId = channel . channel_id
9091 const otherUsers = useUsersInStore ( otherUserIds , `${ channelId } ` , 100 )
9192 const messages = usePrivateMessages ( channelId , 1 , currentUser . id )
@@ -120,10 +121,10 @@ export const MessageChannelRow = (props: {
120121 { otherUsers . length > 2 && ` & ${ otherUsers . length - 2 } more` }
121122 </ span >
122123 ) }
123- { isBanned && < BannedBadge /> }
124+ { isBanned && < BannedBadge /> }
124125 </ span >
125126 < span className = { 'text-ink-400 dark:text-ink-500 text-xs' } >
126- { chat && < RelativeTimestamp time = { chat . createdTime } /> }
127+ { chat && < RelativeTimestamp time = { chat . createdTime } /> }
127128 </ span >
128129 </ Row >
129130 < Row className = "items-center justify-between gap-1" >
0 commit comments