@rpg-engine/long-bow 0.7.22 → 0.7.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Chat/Chat.d.ts +1 -1
- package/dist/components/ChatRevamp/ChatContent.d.ts +24 -0
- package/dist/components/ChatRevamp/ChatRevamp.d.ts +1 -33
- package/dist/components/ChatRevamp/ChatTabs.d.ts +11 -0
- package/dist/components/ChatRevamp/ExpandButton.d.ts +7 -0
- package/dist/components/ChatRevamp/RecentChats.d.ts +17 -0
- package/dist/components/ChatRevamp/SearchCharacter.d.ts +1 -1
- package/dist/components/ChatRevamp/types.d.ts +33 -0
- package/dist/hooks/useChat.d.ts +19 -0
- package/dist/long-bow.cjs.development.js +341 -209
- package/dist/long-bow.cjs.development.js.map +1 -1
- package/dist/long-bow.cjs.production.min.js +1 -1
- package/dist/long-bow.cjs.production.min.js.map +1 -1
- package/dist/long-bow.esm.js +341 -209
- package/dist/long-bow.esm.js.map +1 -1
- package/dist/stories/ChatRevamp.stories.d.ts +1 -1
- package/package.json +1 -1
- package/src/components/Chat/Chat.tsx +1 -1
- package/src/components/ChatRevamp/ChatContent.tsx +96 -0
- package/src/components/ChatRevamp/ChatRevamp.tsx +97 -408
- package/src/components/ChatRevamp/ChatTabs.tsx +51 -0
- package/src/components/ChatRevamp/ExpandButton.tsx +40 -0
- package/src/components/ChatRevamp/RecentChats.tsx +250 -0
- package/src/components/ChatRevamp/SearchCharacter.tsx +17 -20
- package/src/components/ChatRevamp/types.ts +41 -0
- package/src/hooks/useChat.ts +62 -0
- package/src/stories/Chat.stories.tsx +1 -0
- package/src/stories/ChatRevamp.stories.tsx +56 -99
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Meta } from '@storybook/react';
|
|
2
|
-
import { IChatRevampProps } from '../components/ChatRevamp/
|
|
2
|
+
import { IChatRevampProps } from '../components/ChatRevamp/types';
|
|
3
3
|
declare const meta: Meta;
|
|
4
4
|
export default meta;
|
|
5
5
|
export declare const Default: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, IChatRevampProps>;
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@ import { ErrorBoundary } from 'react-error-boundary';
|
|
|
4
4
|
import { FaTimes } from 'react-icons/fa';
|
|
5
5
|
import styled from 'styled-components';
|
|
6
6
|
import { uiColors } from '../../constants/uiColors';
|
|
7
|
-
import { ChatMessage } from '../ChatRevamp/
|
|
7
|
+
import { ChatMessage } from '../ChatRevamp/types';
|
|
8
8
|
|
|
9
9
|
export interface IStyles {
|
|
10
10
|
textColor?: string;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
import { Chat, IStyles } from '../Chat/Chat';
|
|
4
|
+
import { SearchCharacter } from './SearchCharacter';
|
|
5
|
+
import { ChatMessage, PrivateChatCharacter } from './types';
|
|
6
|
+
|
|
7
|
+
interface ChatContentProps {
|
|
8
|
+
isPrivate: boolean;
|
|
9
|
+
isTrade: boolean;
|
|
10
|
+
searchCharacterUI: boolean;
|
|
11
|
+
chatMessages: ChatMessage[];
|
|
12
|
+
onSendGlobalChatMessage: (message: string) => void;
|
|
13
|
+
onSendPrivateChatMessage: (message: string) => void;
|
|
14
|
+
onSendTradeMessage: (message: string) => void;
|
|
15
|
+
onCloseButton: () => void;
|
|
16
|
+
styles?: IStyles;
|
|
17
|
+
onFocus?: () => void;
|
|
18
|
+
onBlur?: () => void;
|
|
19
|
+
isExpanded: boolean;
|
|
20
|
+
autoCloseOnSend: boolean;
|
|
21
|
+
onChangeCharacterName: (characterName: string) => void;
|
|
22
|
+
privateChatCharacters?: PrivateChatCharacter[];
|
|
23
|
+
hideSearchCharacterUI: () => void;
|
|
24
|
+
onCharacterClick?: (character: PrivateChatCharacter) => void;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const ChatContent: React.FC<ChatContentProps> = ({
|
|
28
|
+
isPrivate,
|
|
29
|
+
isTrade,
|
|
30
|
+
searchCharacterUI,
|
|
31
|
+
chatMessages,
|
|
32
|
+
onSendGlobalChatMessage,
|
|
33
|
+
onSendPrivateChatMessage,
|
|
34
|
+
onSendTradeMessage,
|
|
35
|
+
onCloseButton,
|
|
36
|
+
styles,
|
|
37
|
+
onFocus,
|
|
38
|
+
onBlur,
|
|
39
|
+
isExpanded,
|
|
40
|
+
autoCloseOnSend,
|
|
41
|
+
onChangeCharacterName,
|
|
42
|
+
privateChatCharacters,
|
|
43
|
+
hideSearchCharacterUI,
|
|
44
|
+
onCharacterClick,
|
|
45
|
+
}) => {
|
|
46
|
+
const handleSendMessage = (message: string) => {
|
|
47
|
+
if (autoCloseOnSend) {
|
|
48
|
+
onCloseButton();
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (isPrivate) {
|
|
52
|
+
onSendPrivateChatMessage(message);
|
|
53
|
+
} else if (isTrade) {
|
|
54
|
+
onSendTradeMessage(message);
|
|
55
|
+
} else {
|
|
56
|
+
onSendGlobalChatMessage(message);
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
if (isPrivate && searchCharacterUI) {
|
|
61
|
+
return (
|
|
62
|
+
<SearchCharacter
|
|
63
|
+
onFocus={onFocus}
|
|
64
|
+
onBlur={onBlur}
|
|
65
|
+
onChangeCharacterName={onChangeCharacterName}
|
|
66
|
+
styles={styles}
|
|
67
|
+
recentCharacters={privateChatCharacters}
|
|
68
|
+
hideSearchCharacterUI={hideSearchCharacterUI}
|
|
69
|
+
onCharacterClick={onCharacterClick}
|
|
70
|
+
/>
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return (
|
|
75
|
+
<ChatWrapper>
|
|
76
|
+
<Chat
|
|
77
|
+
chatMessages={chatMessages}
|
|
78
|
+
onSendChatMessage={handleSendMessage}
|
|
79
|
+
sendMessage={true}
|
|
80
|
+
onCloseButton={onCloseButton}
|
|
81
|
+
styles={styles}
|
|
82
|
+
onFocus={onFocus}
|
|
83
|
+
onBlur={onBlur}
|
|
84
|
+
isExpanded={isExpanded}
|
|
85
|
+
/>
|
|
86
|
+
</ChatWrapper>
|
|
87
|
+
);
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
const ChatWrapper = styled.div`
|
|
91
|
+
flex-grow: 1;
|
|
92
|
+
overflow: hidden;
|
|
93
|
+
display: flex;
|
|
94
|
+
flex-direction: column;
|
|
95
|
+
position: relative;
|
|
96
|
+
`;
|
|
@@ -1,51 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
} from '
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import styled, { css } from 'styled-components';
|
|
11
|
-
import { uiColors } from '../../constants/uiColors';
|
|
12
|
-
import { uiFonts } from '../../constants/uiFonts';
|
|
13
|
-
import { Chat, IStyles } from '../Chat/Chat';
|
|
14
|
-
import { Ellipsis } from '../shared/Ellipsis';
|
|
15
|
-
import { SearchCharacter } from './SearchCharacter';
|
|
16
|
-
|
|
17
|
-
export type PrivateChatCharacter = Pick<ICharacter, '_id' | 'name'>;
|
|
18
|
-
|
|
19
|
-
export type ChatMessage =
|
|
20
|
-
| IChatMessage
|
|
21
|
-
| IPrivateChatMessage
|
|
22
|
-
| ITradeChatMessage;
|
|
23
|
-
export interface IChatRevampProps {
|
|
24
|
-
chatMessages: ChatMessage[];
|
|
25
|
-
onSendGlobalChatMessage: (message: string) => void;
|
|
26
|
-
onCloseButton: () => void;
|
|
27
|
-
onFocus?: () => void;
|
|
28
|
-
onBlur?: () => void;
|
|
29
|
-
styles?: IStyles;
|
|
30
|
-
tabs: { label: string; id: string }[];
|
|
31
|
-
activeTab: string;
|
|
32
|
-
onChangeTab: (tabId: string) => void;
|
|
33
|
-
privateChatCharacters?: PrivateChatCharacter[];
|
|
34
|
-
onChangeCharacterName: (characterName: string) => void;
|
|
35
|
-
onCharacterClick?: (character: PrivateChatCharacter) => void;
|
|
36
|
-
onSendPrivateChatMessage: (message: string) => void;
|
|
37
|
-
recentChatCharacters?: PrivateChatCharacter[];
|
|
38
|
-
recentSelectedChatCharacterId?: string;
|
|
39
|
-
onPreviousChatCharacterClick?: (character: PrivateChatCharacter) => void;
|
|
40
|
-
onRemoveRecentChatCharacter?: (character: PrivateChatCharacter) => void;
|
|
41
|
-
unseenMessageCharacterIds?: string[];
|
|
42
|
-
onSendTradeMessage: (message: string) => void;
|
|
43
|
-
searchCharacterUI: boolean;
|
|
44
|
-
hideSearchCharacterUI: () => void;
|
|
45
|
-
showSearchCharacterUI: () => void;
|
|
46
|
-
minimizedByDefault?: boolean;
|
|
47
|
-
autoCloseOnSend?: boolean;
|
|
48
|
-
}
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
import { useChat } from '../../hooks/useChat';
|
|
4
|
+
import { Chat } from '../Chat/Chat';
|
|
5
|
+
import { ChatContent } from './ChatContent';
|
|
6
|
+
import { ChatTabs } from './ChatTabs';
|
|
7
|
+
import { ExpandButton } from './ExpandButton';
|
|
8
|
+
import { RecentChats } from './RecentChats';
|
|
9
|
+
import { IChatRevampProps } from './types';
|
|
49
10
|
|
|
50
11
|
export const ChatRevamp: React.FC<IChatRevampProps> = ({
|
|
51
12
|
chatMessages,
|
|
@@ -57,174 +18,108 @@ export const ChatRevamp: React.FC<IChatRevampProps> = ({
|
|
|
57
18
|
styles,
|
|
58
19
|
tabs,
|
|
59
20
|
onChangeTab,
|
|
60
|
-
activeTab,
|
|
21
|
+
activeTab = 'global',
|
|
61
22
|
privateChatCharacters,
|
|
62
23
|
onCharacterClick,
|
|
63
24
|
onSendPrivateChatMessage,
|
|
64
25
|
recentChatCharacters,
|
|
65
|
-
recentSelectedChatCharacterId
|
|
26
|
+
recentSelectedChatCharacterId,
|
|
66
27
|
onPreviousChatCharacterClick,
|
|
67
28
|
onRemoveRecentChatCharacter,
|
|
68
|
-
unseenMessageCharacterIds
|
|
29
|
+
unseenMessageCharacterIds,
|
|
69
30
|
onSendTradeMessage,
|
|
70
31
|
searchCharacterUI,
|
|
71
32
|
hideSearchCharacterUI,
|
|
72
33
|
showSearchCharacterUI,
|
|
73
34
|
minimizedByDefault = false,
|
|
74
|
-
autoCloseOnSend
|
|
35
|
+
autoCloseOnSend,
|
|
75
36
|
}) => {
|
|
76
|
-
const [showRecentChats, setShowRecentChats] = useState(false);
|
|
77
|
-
const [isExpanded, setIsExpanded] = useState(!minimizedByDefault);
|
|
78
|
-
|
|
79
37
|
const isPrivate = activeTab === 'private';
|
|
80
38
|
const isTrade = activeTab === 'trade';
|
|
81
39
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
const toggleRecentChats = () => setShowRecentChats(prev => !prev);
|
|
91
|
-
|
|
92
|
-
const handleTabChange = (tabId: string) => {
|
|
93
|
-
if (tabId === 'private') {
|
|
94
|
-
setIsExpanded(true);
|
|
95
|
-
}
|
|
96
|
-
onChangeTab(tabId);
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
const handlePreviousChatCharacterClick = (
|
|
100
|
-
character: PrivateChatCharacter
|
|
101
|
-
) => {
|
|
102
|
-
onPreviousChatCharacterClick?.(character);
|
|
103
|
-
hideSearchCharacterUI();
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
const renderTabs = () => (
|
|
107
|
-
<TabContainer>
|
|
108
|
-
{tabs.map((tab, index) => (
|
|
109
|
-
<Tab
|
|
110
|
-
key={`${tab.label}_${index}`}
|
|
111
|
-
active={tab.id === activeTab}
|
|
112
|
-
onPointerDown={() => handleTabChange(tab.id)}
|
|
113
|
-
>
|
|
114
|
-
{tab.label}
|
|
115
|
-
</Tab>
|
|
116
|
-
))}
|
|
117
|
-
</TabContainer>
|
|
118
|
-
);
|
|
119
|
-
|
|
120
|
-
const renderRecentChatTopBar = () => (
|
|
121
|
-
<RecentChatTopBar>
|
|
122
|
-
<BurgerIconContainer
|
|
123
|
-
onPointerDown={toggleRecentChats}
|
|
124
|
-
hasUnseenMessages={unseenMessageCharacterIds.length > 0}
|
|
125
|
-
>
|
|
126
|
-
<BurgerLineIcon />
|
|
127
|
-
<BurgerLineIcon />
|
|
128
|
-
<BurgerLineIcon />
|
|
129
|
-
</BurgerIconContainer>
|
|
130
|
-
{showRecentChats && (
|
|
131
|
-
<SearchButton onPointerDown={showSearchCharacterUI}>
|
|
132
|
-
<RxMagnifyingGlass size={16} color={uiColors.white} />
|
|
133
|
-
</SearchButton>
|
|
134
|
-
)}
|
|
135
|
-
</RecentChatTopBar>
|
|
136
|
-
);
|
|
137
|
-
|
|
138
|
-
const renderRecentChatList = () => (
|
|
139
|
-
<RecentChatLogContainer isOpen={showRecentChats}>
|
|
140
|
-
{recentChatCharacters?.map(character => (
|
|
141
|
-
<ListElementContainer key={character._id}>
|
|
142
|
-
<ListElement
|
|
143
|
-
active={character._id === recentSelectedChatCharacterId}
|
|
144
|
-
onPointerDown={() => handlePreviousChatCharacterClick(character)}
|
|
145
|
-
>
|
|
146
|
-
<StatusDot
|
|
147
|
-
isUnseen={unseenMessageCharacterIds.includes(character._id)}
|
|
148
|
-
/>
|
|
149
|
-
<Ellipsis maxWidth="140px" maxLines={1}>
|
|
150
|
-
{character.name}
|
|
151
|
-
</Ellipsis>
|
|
152
|
-
</ListElement>
|
|
153
|
-
<CloseButton
|
|
154
|
-
className="close-button"
|
|
155
|
-
onPointerDown={() => onRemoveRecentChatCharacter?.(character)}
|
|
156
|
-
>
|
|
157
|
-
<RxCross2 size={16} />
|
|
158
|
-
</CloseButton>
|
|
159
|
-
</ListElementContainer>
|
|
160
|
-
))}
|
|
161
|
-
</RecentChatLogContainer>
|
|
162
|
-
);
|
|
163
|
-
|
|
164
|
-
const renderChatContent = () => {
|
|
165
|
-
if (isPrivate && searchCharacterUI) {
|
|
166
|
-
return (
|
|
167
|
-
<SearchCharacter
|
|
168
|
-
onFocus={onFocus}
|
|
169
|
-
onBlur={onBlur}
|
|
170
|
-
onChangeCharacterName={onChangeCharacterName}
|
|
171
|
-
styles={styles}
|
|
172
|
-
recentCharacters={privateChatCharacters}
|
|
173
|
-
hideSearchCharacterUI={hideSearchCharacterUI}
|
|
174
|
-
onCharacterClick={onCharacterClick}
|
|
175
|
-
/>
|
|
176
|
-
);
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
return (
|
|
180
|
-
<Chat
|
|
181
|
-
chatMessages={chatMessages}
|
|
182
|
-
onSendChatMessage={() => {
|
|
183
|
-
if (autoCloseOnSend) {
|
|
184
|
-
onCloseButton();
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
if (isPrivate) {
|
|
188
|
-
return onSendPrivateChatMessage;
|
|
189
|
-
} else if (isTrade) {
|
|
190
|
-
return onSendTradeMessage;
|
|
191
|
-
} else {
|
|
192
|
-
return onSendGlobalChatMessage;
|
|
193
|
-
}
|
|
194
|
-
}}
|
|
195
|
-
sendMessage={true}
|
|
196
|
-
onCloseButton={onCloseButton}
|
|
197
|
-
styles={styles}
|
|
198
|
-
onFocus={onFocus}
|
|
199
|
-
onBlur={onBlur}
|
|
200
|
-
isExpanded={isExpanded}
|
|
201
|
-
/>
|
|
202
|
-
);
|
|
203
|
-
};
|
|
40
|
+
const chatHook = useChat({
|
|
41
|
+
minimizedByDefault,
|
|
42
|
+
isPrivate,
|
|
43
|
+
onChangeTab,
|
|
44
|
+
onPreviousChatCharacterClick,
|
|
45
|
+
unseenMessageCharacterIds,
|
|
46
|
+
});
|
|
204
47
|
|
|
205
48
|
return (
|
|
206
49
|
<ChatRevampContainer>
|
|
207
|
-
<TopBar isExpanded={isExpanded}>
|
|
208
|
-
{isExpanded &&
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
50
|
+
<TopBar isExpanded={chatHook.isExpanded}>
|
|
51
|
+
{chatHook.isExpanded && (
|
|
52
|
+
<ChatTabs
|
|
53
|
+
tabs={tabs}
|
|
54
|
+
activeTab={activeTab}
|
|
55
|
+
onChangeTab={chatHook.handleTabChange}
|
|
56
|
+
/>
|
|
57
|
+
)}
|
|
58
|
+
<ExpandButton
|
|
59
|
+
isExpanded={chatHook.isExpanded}
|
|
60
|
+
onClick={chatHook.toggleExpand}
|
|
61
|
+
/>
|
|
212
62
|
</TopBar>
|
|
213
63
|
<PrivateChatContainer
|
|
214
64
|
width={styles?.width || '80%'}
|
|
215
65
|
height={styles?.height || 'auto'}
|
|
216
|
-
isExpanded={isExpanded}
|
|
66
|
+
isExpanded={chatHook.isExpanded}
|
|
217
67
|
>
|
|
218
|
-
{isExpanded
|
|
219
|
-
<
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
68
|
+
{chatHook.isExpanded ? (
|
|
69
|
+
<ExpandedChatContent>
|
|
70
|
+
{isPrivate && (
|
|
71
|
+
<RecentChats
|
|
72
|
+
showRecentChats={chatHook.showRecentChats}
|
|
73
|
+
toggleRecentChats={chatHook.toggleRecentChats}
|
|
74
|
+
hasUnseenMessages={chatHook.hasUnseenMessages || false}
|
|
75
|
+
showSearchCharacterUI={showSearchCharacterUI}
|
|
76
|
+
recentChatCharacters={recentChatCharacters}
|
|
77
|
+
recentSelectedChatCharacterId={recentSelectedChatCharacterId}
|
|
78
|
+
unseenMessageCharacterIds={unseenMessageCharacterIds}
|
|
79
|
+
onPreviousChatCharacterClick={
|
|
80
|
+
chatHook.handlePreviousChatCharacterClick
|
|
81
|
+
}
|
|
82
|
+
onRemoveRecentChatCharacter={onRemoveRecentChatCharacter}
|
|
83
|
+
isPrivate={isPrivate}
|
|
84
|
+
hideSearchCharacterUI={hideSearchCharacterUI}
|
|
85
|
+
/>
|
|
86
|
+
)}
|
|
87
|
+
<ChatContentWrapper isPrivate={isPrivate}>
|
|
88
|
+
<ChatContent
|
|
89
|
+
isPrivate={isPrivate}
|
|
90
|
+
isTrade={isTrade}
|
|
91
|
+
searchCharacterUI={searchCharacterUI}
|
|
92
|
+
chatMessages={chatMessages}
|
|
93
|
+
onSendGlobalChatMessage={onSendGlobalChatMessage}
|
|
94
|
+
onSendPrivateChatMessage={onSendPrivateChatMessage}
|
|
95
|
+
onSendTradeMessage={onSendTradeMessage}
|
|
96
|
+
onCloseButton={onCloseButton}
|
|
97
|
+
styles={styles}
|
|
98
|
+
onFocus={onFocus}
|
|
99
|
+
onBlur={onBlur}
|
|
100
|
+
isExpanded={chatHook.isExpanded}
|
|
101
|
+
autoCloseOnSend={autoCloseOnSend || false}
|
|
102
|
+
onChangeCharacterName={onChangeCharacterName}
|
|
103
|
+
privateChatCharacters={privateChatCharacters}
|
|
104
|
+
hideSearchCharacterUI={hideSearchCharacterUI}
|
|
105
|
+
onCharacterClick={onCharacterClick}
|
|
106
|
+
/>
|
|
107
|
+
</ChatContentWrapper>
|
|
108
|
+
</ExpandedChatContent>
|
|
109
|
+
) : (
|
|
110
|
+
<CollapsedChatInput>
|
|
111
|
+
<Chat
|
|
112
|
+
chatMessages={[]}
|
|
113
|
+
onSendChatMessage={onSendGlobalChatMessage}
|
|
114
|
+
sendMessage={true}
|
|
115
|
+
onCloseButton={onCloseButton}
|
|
116
|
+
styles={styles}
|
|
117
|
+
onFocus={onFocus}
|
|
118
|
+
onBlur={onBlur}
|
|
119
|
+
isExpanded={false}
|
|
120
|
+
/>
|
|
121
|
+
</CollapsedChatInput>
|
|
226
122
|
)}
|
|
227
|
-
<ChatWrapper>{renderChatContent()}</ChatWrapper>
|
|
228
123
|
</PrivateChatContainer>
|
|
229
124
|
</ChatRevampContainer>
|
|
230
125
|
);
|
|
@@ -237,68 +132,11 @@ const ChatRevampContainer = styled.div`
|
|
|
237
132
|
position: relative;
|
|
238
133
|
`;
|
|
239
134
|
|
|
240
|
-
|
|
241
|
-
isExpanded: boolean;
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
const TopBar = styled.div<ITopBarProps>`
|
|
135
|
+
const TopBar = styled.div<{ isExpanded: boolean }>`
|
|
245
136
|
display: flex;
|
|
246
137
|
align-items: center;
|
|
247
138
|
justify-content: flex-start;
|
|
248
|
-
|
|
249
|
-
${({ isExpanded }) =>
|
|
250
|
-
!isExpanded &&
|
|
251
|
-
css`
|
|
252
|
-
min-height: 32px; // Ensure there's always space for the expand button when its collapsed
|
|
253
|
-
`}
|
|
254
|
-
`;
|
|
255
|
-
|
|
256
|
-
const TabContainer = styled.div`
|
|
257
|
-
display: flex;
|
|
258
|
-
gap: 10px;
|
|
259
|
-
align-items: center;
|
|
260
|
-
flex-grow: 1;
|
|
261
|
-
`;
|
|
262
|
-
|
|
263
|
-
const Tab = styled.button<{ active: boolean }>`
|
|
264
|
-
width: 120px;
|
|
265
|
-
color: white;
|
|
266
|
-
font-size: 0.8rem;
|
|
267
|
-
all: unset;
|
|
268
|
-
padding: 0.6rem;
|
|
269
|
-
font-size: 0.8rem;
|
|
270
|
-
|
|
271
|
-
border-radius: 5px 5px 0 0;
|
|
272
|
-
border-width: 0.25rem 0.25rem 0 0.25rem;
|
|
273
|
-
border-style: solid;
|
|
274
|
-
border-color: ${props =>
|
|
275
|
-
props.active ? 'rgba(198, 81, 2, 0.5)' : 'rgba(128, 128, 128, 0.5)'};
|
|
276
|
-
|
|
277
|
-
background-color: ${props =>
|
|
278
|
-
props.active ? uiColors.orange : 'rgba(0, 0, 0, 0.2)'};
|
|
279
|
-
color: ${props => (props.active ? 'white' : uiColors.darkGray)};
|
|
280
|
-
`;
|
|
281
|
-
|
|
282
|
-
const ExpandButton = styled.button<{ isExpanded: boolean }>`
|
|
283
|
-
position: absolute;
|
|
284
|
-
top: 0;
|
|
285
|
-
${({ isExpanded }) => (isExpanded ? 'right: 0' : 'left: 0')};
|
|
286
|
-
width: 30px;
|
|
287
|
-
height: 30px;
|
|
288
|
-
background-color: ${uiColors.orange};
|
|
289
|
-
color: white;
|
|
290
|
-
border: none;
|
|
291
|
-
border-radius: 50%;
|
|
292
|
-
display: flex;
|
|
293
|
-
justify-content: center;
|
|
294
|
-
align-items: center;
|
|
295
|
-
cursor: pointer;
|
|
296
|
-
transition: all 0.3s ease;
|
|
297
|
-
z-index: 10;
|
|
298
|
-
|
|
299
|
-
&:hover {
|
|
300
|
-
background-color: ${uiColors.orange};
|
|
301
|
-
}
|
|
139
|
+
min-height: ${({ isExpanded }) => (isExpanded ? 'auto' : '32px')};
|
|
302
140
|
`;
|
|
303
141
|
|
|
304
142
|
const PrivateChatContainer = styled.div<{
|
|
@@ -315,173 +153,24 @@ const PrivateChatContainer = styled.div<{
|
|
|
315
153
|
flex-wrap: wrap;
|
|
316
154
|
`;
|
|
317
155
|
|
|
318
|
-
const
|
|
319
|
-
|
|
320
|
-
isOpen: boolean;
|
|
321
|
-
}>`
|
|
322
|
-
display: ${props => (props.isPrivate ? 'flex' : 'none')};
|
|
323
|
-
flex-direction: column;
|
|
324
|
-
border-right: 1px solid ${uiColors.gray};
|
|
325
|
-
outline: none;
|
|
326
|
-
width: ${props => (props.isOpen ? '25%' : '30px')};
|
|
327
|
-
max-width: 200px;
|
|
328
|
-
min-width: ${props => (props.isOpen ? '180px' : '30px')};
|
|
329
|
-
transition: all 0.3s ease-in-out;
|
|
156
|
+
const ChatContentWrapper = styled.div<{ isPrivate: boolean }>`
|
|
157
|
+
flex-grow: 1;
|
|
330
158
|
overflow: hidden;
|
|
331
|
-
height: 100%;
|
|
332
|
-
@media (max-width: 768px) {
|
|
333
|
-
width: ${props => (props.isOpen ? '50%' : '30px')};
|
|
334
|
-
min-width: ${props => (props.isOpen ? '150px' : '30px')};
|
|
335
|
-
}
|
|
336
|
-
`;
|
|
337
|
-
|
|
338
|
-
const RecentChatTopBar = styled.div`
|
|
339
|
-
display: flex;
|
|
340
|
-
align-items: center;
|
|
341
|
-
justify-content: space-between;
|
|
342
|
-
height: 30px;
|
|
343
|
-
flex-shrink: 0;
|
|
344
|
-
`;
|
|
345
|
-
|
|
346
|
-
const SearchButton = styled.button`
|
|
347
|
-
border: none;
|
|
348
|
-
background-color: transparent;
|
|
349
|
-
display: flex;
|
|
350
|
-
flex-direction: column;
|
|
351
|
-
align-items: flex-end;
|
|
352
|
-
gap: 2px;
|
|
353
|
-
padding: 4px;
|
|
354
|
-
position: relative;
|
|
355
|
-
`;
|
|
356
|
-
|
|
357
|
-
const BurgerIconContainer = styled.button<{ hasUnseenMessages: boolean }>`
|
|
358
|
-
border: none;
|
|
359
|
-
background-color: transparent;
|
|
360
159
|
display: flex;
|
|
361
160
|
flex-direction: column;
|
|
362
|
-
align-items: flex-end;
|
|
363
|
-
padding: 4px;
|
|
364
|
-
gap: 2px;
|
|
365
161
|
position: relative;
|
|
366
|
-
|
|
367
|
-
&:after {
|
|
368
|
-
content: '';
|
|
369
|
-
width: 6px;
|
|
370
|
-
height: 6px;
|
|
371
|
-
position: absolute;
|
|
372
|
-
top: 0;
|
|
373
|
-
right: 2px;
|
|
374
|
-
border-radius: 50%;
|
|
375
|
-
background-color: ${uiColors.lightGreen};
|
|
376
|
-
display: ${props => (props.hasUnseenMessages ? 'block' : 'none')};
|
|
377
|
-
}
|
|
378
|
-
`;
|
|
379
|
-
|
|
380
|
-
const BurgerLineIcon = styled.span`
|
|
381
|
-
width: 1rem;
|
|
382
|
-
height: 2px;
|
|
383
|
-
background-color: #ffffff;
|
|
162
|
+
width: ${props => (props.isPrivate ? '75%' : '100%')};
|
|
384
163
|
`;
|
|
385
164
|
|
|
386
|
-
const
|
|
387
|
-
display: ${props => (props.isOpen ? 'flex' : 'none')};
|
|
388
|
-
opacity: ${props => (props.isOpen ? 1 : 0)};
|
|
389
|
-
flex-direction: column;
|
|
390
|
-
gap: 0.25rem; // Reduce this from 0.5rem to 0.25rem
|
|
391
|
-
transition: opacity 0.3s ease-in-out;
|
|
392
|
-
padding: 0;
|
|
393
|
-
margin: 0;
|
|
394
|
-
overflow-y: auto;
|
|
395
|
-
flex-grow: 1;
|
|
396
|
-
height: 0;
|
|
397
|
-
|
|
398
|
-
/* Firefox */
|
|
399
|
-
scrollbar-width: thin;
|
|
400
|
-
scrollbar-color: rgba(51, 51, 51, 0.4) rgba(30, 30, 30, 0.4);
|
|
401
|
-
|
|
402
|
-
/* WebKit and Chromium-based browsers */
|
|
403
|
-
&::-webkit-scrollbar {
|
|
404
|
-
width: 8px;
|
|
405
|
-
height: 8px;
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
&::-webkit-scrollbar-track {
|
|
409
|
-
background: rgba(30, 30, 30, 0.2);
|
|
410
|
-
border-radius: 4px;
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
&::-webkit-scrollbar-thumb {
|
|
414
|
-
background-color: rgba(255, 102, 0, 0.5);
|
|
415
|
-
border-radius: 4px;
|
|
416
|
-
border: 2px solid rgba(30, 30, 30, 0.2);
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
&::-webkit-scrollbar-thumb:hover {
|
|
420
|
-
background-color: rgba(255, 102, 0, 0.7);
|
|
421
|
-
}
|
|
422
|
-
`;
|
|
423
|
-
|
|
424
|
-
const ListElementContainer = styled.div`
|
|
425
|
-
display: flex;
|
|
426
|
-
justify-content: space-between;
|
|
427
|
-
align-items: center;
|
|
428
|
-
padding: 2px 0; // Add small vertical padding
|
|
429
|
-
`;
|
|
430
|
-
|
|
431
|
-
const ListElement = styled.button<{ active: boolean }>`
|
|
432
|
-
margin: 0 !important; // Remove vertical margins
|
|
433
|
-
font-size: ${uiFonts.size.small} !important;
|
|
434
|
-
padding: 2px;
|
|
435
|
-
all: unset;
|
|
436
|
-
color: ${props => (props.active ? uiColors.yellow : uiColors.white)};
|
|
165
|
+
const CollapsedChatInput = styled.div`
|
|
437
166
|
width: 100%;
|
|
438
|
-
|
|
439
|
-
display: flex;
|
|
440
|
-
align-items: center;
|
|
441
|
-
gap: 4px;
|
|
442
|
-
|
|
443
|
-
&:hover {
|
|
444
|
-
color: #ff0;
|
|
445
|
-
}
|
|
446
|
-
max-width: calc(100% - 24px);
|
|
447
|
-
overflow: hidden;
|
|
448
|
-
text-overflow: ellipsis;
|
|
449
|
-
white-space: nowrap;
|
|
450
|
-
`;
|
|
451
|
-
|
|
452
|
-
const StatusDot = styled.span<{ isUnseen: boolean }>`
|
|
453
|
-
width: 6px;
|
|
454
|
-
height: 6px;
|
|
455
|
-
border-radius: 50%;
|
|
456
|
-
background-color: ${props =>
|
|
457
|
-
props.isUnseen ? uiColors.lightGreen : uiColors.gray};
|
|
458
|
-
display: inline-block;
|
|
459
|
-
margin-right: 6px;
|
|
460
|
-
`;
|
|
461
|
-
|
|
462
|
-
const CloseButton = styled.button`
|
|
463
|
-
all: unset;
|
|
464
|
-
font-size: ${uiFonts.size.xxsmall};
|
|
465
|
-
margin: 0 0.5rem;
|
|
466
|
-
transition: all 0.2s ease-in-out;
|
|
467
|
-
background-color: ${uiColors.red};
|
|
468
|
-
color: ${uiColors.white};
|
|
469
|
-
width: 16px;
|
|
470
|
-
height: 16px;
|
|
471
|
-
border-radius: 50%;
|
|
167
|
+
height: 100%;
|
|
472
168
|
display: flex;
|
|
473
|
-
justify-content: center;
|
|
474
169
|
align-items: center;
|
|
475
|
-
&:hover {
|
|
476
|
-
background-color: ${uiColors.white};
|
|
477
|
-
color: ${uiColors.red};
|
|
478
|
-
}
|
|
479
170
|
`;
|
|
480
171
|
|
|
481
|
-
const
|
|
482
|
-
flex-grow: 1;
|
|
483
|
-
overflow: hidden;
|
|
172
|
+
const ExpandedChatContent = styled.div`
|
|
484
173
|
display: flex;
|
|
485
|
-
|
|
486
|
-
|
|
174
|
+
width: 100%;
|
|
175
|
+
height: 100%;
|
|
487
176
|
`;
|