File tree Expand file tree Collapse file tree 1 file changed +53
-0
lines changed Expand file tree Collapse file tree 1 file changed +53
-0
lines changed Original file line number Diff line number Diff line change
1
+ import {
2
+ Chat ,
3
+ Channel ,
4
+ ChannelHeader ,
5
+ Thread ,
6
+ Window ,
7
+ MessageList ,
8
+ MessageInput
9
+ } from "stream-chat-react" ; // Importing components from stream-chat-react library
10
+ import { StreamChat } from "stream-chat" ; // Importing StreamChat from stream-chat library
11
+
12
+ import "stream-chat-react/dist/css/index.css" ; // Importing CSS for stream-chat-react
13
+
14
+ // Creating a new StreamChat client with a demo key
15
+ const chatClient = new StreamChat ( "qk4nn7rpcn75" ) ;
16
+
17
+ // Demo user token
18
+ const userToken =
19
+ "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiY29vbC1za3ktOSJ9.mhikC6HPqPKoCP4aHHfuH9dFgPQ2Fth5QoRAfolJjC4" ;
20
+
21
+ // Setting the user for the chat client
22
+ chatClient . setUser (
23
+ {
24
+ id : "cool-sky-9" ,
25
+ name : "Cool sky" ,
26
+ image : "https://getstream.io/random_svg/?id=cool-sky-9&name=Cool+sky"
27
+ } ,
28
+ userToken
29
+ ) ;
30
+
31
+ // Creating a channel for the chat client
32
+ const channel = chatClient . channel ( "messaging" , "godevs" , {
33
+ image :
34
+ "https://cdn.chrisshort.net/testing-certificate-chains-in-go/GOPHER_MIC_DROP.png" ,
35
+ name : "Talk about Go"
36
+ } ) ;
37
+
38
+ // Defining the App component
39
+ const App = ( ) => (
40
+ < Chat client = { chatClient } theme = { "messaging light" } >
41
+ < Channel channel = { channel } >
42
+ < Window >
43
+ < ChannelHeader />
44
+ < MessageList />
45
+ < MessageInput />
46
+ </ Window >
47
+ < Thread />
48
+ </ Channel >
49
+ </ Chat >
50
+ ) ;
51
+
52
+ export default App ; // Exporting the App component
53
+
You can’t perform that action at this time.
0 commit comments