@@ -19,6 +19,7 @@ import {
1919 ThreadList ,
2020 useCreateChatClient ,
2121 VirtualizedMessageList as MessageList ,
22+ // MessageList,
2223 Window ,
2324} from 'stream-chat-react' ;
2425import { createTextComposerEmojiMiddleware , EmojiPicker } from 'stream-chat-react/emojis' ;
@@ -29,6 +30,7 @@ import { humanId } from 'human-id';
2930init ( { data } ) ;
3031
3132const apiKey = import . meta. env . VITE_STREAM_API_KEY ;
33+ const token = import . meta. env . VITE_USER_TOKEN ;
3234
3335if ( ! apiKey ) {
3436 throw new Error ( 'VITE_STREAM_API_KEY is not defined' ) ;
@@ -43,6 +45,7 @@ const isMessageAIGenerated = (message: LocalMessage) => !!message?.ai_generated;
4345const useUser = ( ) => {
4446 const userId = useMemo ( ( ) => {
4547 return (
48+ import . meta. env . VITE_USER_ID ||
4649 new URLSearchParams ( window . location . search ) . get ( 'user_id' ) ||
4750 localStorage . getItem ( 'user_id' ) ||
4851 humanId ( { separator : '_' , capitalize : false } )
@@ -58,11 +61,13 @@ const useUser = () => {
5861 } , [ userId ] ) ;
5962
6063 const tokenProvider = useCallback ( ( ) => {
61- return fetch (
62- `https://pronto.getstream.io/api/auth/create-token?environment=shared-chat-redesign&user_id=${ userId } ` ,
63- )
64- . then ( ( response ) => response . json ( ) )
65- . then ( ( data ) => data . token as string ) ;
64+ return token
65+ ? Promise . resolve ( token )
66+ : fetch (
67+ `https://pronto.getstream.io/api/auth/create-token?environment=shared-chat-redesign&user_id=${ userId } ` ,
68+ )
69+ . then ( ( response ) => response . json ( ) )
70+ . then ( ( data ) => data . token as string ) ;
6671 } , [ userId ] ) ;
6772
6873 return { userId : userId , tokenProvider } ;
@@ -97,6 +102,11 @@ const App = () => {
97102 position : { before : 'stream-io/text-composer/mentions-middleware' } ,
98103 unique : true ,
99104 } ) ;
105+
106+ composer . updateConfig ( {
107+ linkPreviews : { enabled : true } ,
108+ location : { enabled : true } ,
109+ } ) ;
100110 } ) ;
101111 } , [ chatClient ] ) ;
102112
@@ -120,7 +130,12 @@ const App = () => {
120130 < ChannelHeader Avatar = { ChannelAvatar } />
121131 < MessageList returnAllReadData />
122132 < AIStateIndicator />
123- < MessageInput focus audioRecordingEnabled />
133+ < MessageInput
134+ focus
135+ audioRecordingEnabled
136+ maxRows = { 10 }
137+ asyncMessagesMultiSendEnabled
138+ />
124139 </ Window >
125140 < Thread virtualized />
126141 </ Channel >
0 commit comments