-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathDemoApp.tsx
53 lines (45 loc) · 1.36 KB
/
DemoApp.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import {
Chat,
Channel,
ChannelHeader,
Thread,
Window,
MessageList,
MessageInput
} from "stream-chat-react"; // Importing components from stream-chat-react library
import { StreamChat } from "stream-chat"; // Importing StreamChat from stream-chat library
import "stream-chat-react/dist/css/index.css"; // Importing CSS for stream-chat-react
// Creating a new StreamChat client with a demo key
const chatClient = new StreamChat("qk4nn7rpcn75");
// Demo user token
const userToken =
"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiY29vbC1za3ktOSJ9.mhikC6HPqPKoCP4aHHfuH9dFgPQ2Fth5QoRAfolJjC4";
// Setting the user for the chat client
chatClient.setUser(
{
id: "cool-sky-9",
name: "Cool sky",
image: "https://getstream.io/random_svg/?id=cool-sky-9&name=Cool+sky"
},
userToken
);
// Creating a channel for the chat client
const channel = chatClient.channel("messaging", "godevs", {
image:
"https://cdn.chrisshort.net/testing-certificate-chains-in-go/GOPHER_MIC_DROP.png",
name: "Talk about Go"
});
// Defining the App component
const App = () => (
<Chat client={chatClient} theme={"messaging light"}>
<Channel channel={channel}>
<Window>
<ChannelHeader />
<MessageList />
<MessageInput />
</Window>
<Thread />
</Channel>
</Chat>
);
export default App; // Exporting the App component