@@ -8,6 +8,8 @@ import { Timestamp } from '../../Message/Timestamp';
8
8
import { Avatar } from '../../Avatar' ;
9
9
import { Icon } from '../icons' ;
10
10
import { UnreadCountBadge } from '../UnreadCountBadge' ;
11
+
12
+ import { useChannelPreviewInfo } from '../../ChannelPreview' ;
11
13
import { useChatContext } from '../../../context' ;
12
14
import { useThreadsViewContext } from '../../ChatView' ;
13
15
import { useThreadListItemContext } from './ThreadListItem' ;
@@ -18,9 +20,6 @@ export type ThreadListItemUIProps = ComponentPropsWithoutRef<'button'>;
18
20
/**
19
21
* TODO:
20
22
* - maybe hover state? ask design
21
- * - move styling to CSS library and clean it up (separate layout and theme)
22
- * - use Moment/DayJs for proper created_at formatting (replace toLocaleTimeString)
23
- * - handle deleted message [in progress]
24
23
*/
25
24
26
25
export const attachmentTypeIconMap = {
@@ -84,11 +83,13 @@ export const ThreadListItemUI = (props: ThreadListItemUIProps) => {
84
83
[ client ] ,
85
84
) ;
86
85
87
- const [ latestReply , ownUnreadMessageCount , parentMessage , channelData , deletedAt ] = useStateStore (
86
+ const [ latestReply , ownUnreadMessageCount , parentMessage , channel , deletedAt ] = useStateStore (
88
87
thread . state ,
89
88
selector ,
90
89
) ;
91
90
91
+ const { displayTitle : channelDisplayTitle } = useChannelPreviewInfo ( { channel } ) ;
92
+
92
93
const { activeThread, setActiveThread } = useThreadsViewContext ( ) ;
93
94
94
95
const avatarProps = deletedAt ? null : latestReply ?. user ;
@@ -104,9 +105,7 @@ export const ThreadListItemUI = (props: ThreadListItemUIProps) => {
104
105
>
105
106
< div className = 'str-chat__thread-list-item__channel' >
106
107
< Icon . MessageBubble />
107
- < div className = 'str-chat__thread-list-item__channel-text' >
108
- { channelData . data ?. name || 'N/A' }
109
- </ div >
108
+ < div className = 'str-chat__thread-list-item__channel-text' > { channelDisplayTitle } </ div >
110
109
</ div >
111
110
< div className = 'str-chat__thread-list-item__parent-message' >
112
111
< div className = 'str-chat__thread-list-item__parent-message-text' >
0 commit comments