-
Notifications
You must be signed in to change notification settings - Fork 294
Expand file tree
/
Copy pathLoadingScreen.tsx
More file actions
75 lines (72 loc) · 2.83 KB
/
LoadingScreen.tsx
File metadata and controls
75 lines (72 loc) · 2.83 KB
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
import clsx from 'clsx';
import { type CSSProperties } from 'react';
import { LoadingChannel, LoadingChannels } from 'stream-chat-react';
// This component renders before the chat client is created. ChatView depends on ChatContext
// provided by <Chat>, so using ChatView here would run outside its provider and produce
// incomplete behavior/warnings. We intentionally mirror ChatView structure/classes to keep
// loading dimensions aligned with the final loaded layout.
// Update this layout every time layout in App.tsx is updated.
type LoadingScreenProps = {
initialAppLayoutStyle: CSSProperties;
initialChannelSelected: boolean;
initialSidebarOpen: boolean;
};
const selectorButtonCount = 4;
export const LoadingScreen = ({
initialAppLayoutStyle,
initialChannelSelected,
initialSidebarOpen,
}: LoadingScreenProps) => (
<div className='app-chat-layout' style={initialAppLayoutStyle}>
<div className='str-chat'>
<div className='str-chat__chat-view'>
<div className='str-chat__chat-view__channels'>
<div
className={clsx('app-chat-view__channels-layout', {
'app-chat-view__channels-layout--channel-selected': initialChannelSelected,
'app-chat-view__channels-layout--sidebar-collapsed': !initialSidebarOpen,
})}
>
<div className='app-chat-sidebar-overlay'>
<div className='str-chat__chat-view__selector'>
{Array.from({ length: selectorButtonCount }).map((_, index) => (
<div
className='str-chat__chat-view__selector-button-container'
key={index}
>
<div className='str-chat__chat-view__selector-button'>
<span className='str-chat__loading-channels-avatar' />
</div>
</div>
))}
</div>
<div className='str-chat__channel-list'>
<LoadingChannels />
</div>
</div>
<div
aria-orientation='vertical'
className='app-chat-resize-handle'
role='separator'
>
<div className='app-chat-resize-handle__hitbox'>
<div className='app-chat-resize-handle__line' />
</div>
</div>
<div className='str-chat__channel'>
<div className='str-chat__container'>
<div className='str-chat__main-panel'>
<div className='str-chat__main-panel-inner'>
<div className='str-chat__window app-loading-screen__window'>
<LoadingChannel />
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
);