@rpg-engine/long-bow 0.5.44 → 0.5.45
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 +2 -6
- package/dist/components/ChatRevamp/ChatRevamp.d.ts +8 -10
- package/dist/index.d.ts +1 -0
- package/dist/long-bow.cjs.development.js +133 -211
- 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 +134 -213
- package/dist/long-bow.esm.js.map +1 -1
- package/dist/stories/ChatRevamp.stories.d.ts +1 -2
- package/package.json +2 -2
- package/src/components/Chat/Chat.tsx +16 -11
- package/src/components/ChatRevamp/ChatRevamp.tsx +32 -242
- package/src/components/ChatRevamp/SearchCharacter.tsx +22 -25
- package/src/components/Item/Inventory/ItemContainer.tsx +3 -13
- package/src/index.tsx +2 -0
- package/src/mocks/itemContainer.mocks.ts +3 -3
- package/src/stories/ChatRevamp.stories.tsx +4 -23
|
@@ -3,5 +3,4 @@ import { IChatRevampProps } from '../components/ChatRevamp/ChatRevamp';
|
|
|
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>;
|
|
6
|
-
export declare const
|
|
7
|
-
export declare const Trade: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, IChatRevampProps>;
|
|
6
|
+
export declare const PrivateCharacters: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, IChatRevampProps>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rpg-engine/long-bow",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.45",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
},
|
|
84
84
|
"dependencies": {
|
|
85
85
|
"@rollup/plugin-image": "^2.1.1",
|
|
86
|
-
"@rpg-engine/shared": "^0.
|
|
86
|
+
"@rpg-engine/shared": "^0.8.92",
|
|
87
87
|
"dayjs": "^1.11.2",
|
|
88
88
|
"font-awesome": "^4.7.0",
|
|
89
89
|
"fs-extra": "^10.1.0",
|
|
@@ -1,11 +1,16 @@
|
|
|
1
|
+
import { IChatMessage, IPrivateChatMessage } from '@rpg-engine/shared';
|
|
1
2
|
import dayjs from 'dayjs';
|
|
2
3
|
import React, { useEffect, useState } from 'react';
|
|
3
4
|
import { ErrorBoundary } from 'react-error-boundary';
|
|
4
5
|
import { RxPaperPlane } from 'react-icons/rx';
|
|
5
6
|
import styled from 'styled-components';
|
|
6
|
-
import { ChatMessage } from '../ChatRevamp/ChatRevamp';
|
|
7
7
|
import { Column } from '../shared/Column';
|
|
8
8
|
|
|
9
|
+
interface IEmitter {
|
|
10
|
+
_id: string;
|
|
11
|
+
name: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
9
14
|
export interface IStyles {
|
|
10
15
|
textColor?: string;
|
|
11
16
|
buttonColor?: string;
|
|
@@ -14,13 +19,8 @@ export interface IStyles {
|
|
|
14
19
|
height?: string;
|
|
15
20
|
}
|
|
16
21
|
|
|
17
|
-
export interface IEmitter {
|
|
18
|
-
_id: string;
|
|
19
|
-
name: string;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
22
|
export interface IChatProps {
|
|
23
|
-
chatMessages:
|
|
23
|
+
chatMessages: IChatMessage[] | IPrivateChatMessage[];
|
|
24
24
|
onSendChatMessage: (message: string) => void;
|
|
25
25
|
onCloseButton: () => void;
|
|
26
26
|
onFocus?: () => void;
|
|
@@ -80,7 +80,9 @@ export const Chat: React.FC<IChatProps> = ({
|
|
|
80
80
|
} ${message}`;
|
|
81
81
|
};
|
|
82
82
|
|
|
83
|
-
const onRenderChatMessages = (
|
|
83
|
+
const onRenderChatMessages = (
|
|
84
|
+
chatMessages: (IChatMessage | IPrivateChatMessage)[]
|
|
85
|
+
) => {
|
|
84
86
|
return chatMessages?.length ? (
|
|
85
87
|
chatMessages?.map((chatMessage, index) => (
|
|
86
88
|
<Message
|
|
@@ -159,8 +161,8 @@ interface IButtonProps {
|
|
|
159
161
|
}
|
|
160
162
|
|
|
161
163
|
const ChatContainer = styled.div<IContainerProps>`
|
|
162
|
-
height: ${props => props.height}
|
|
163
|
-
width:
|
|
164
|
+
height: ${props => props.height};
|
|
165
|
+
width: ${({ width }) => width};
|
|
164
166
|
padding: 10px;
|
|
165
167
|
background-color: rgba(0, 0, 0, 0.2);
|
|
166
168
|
height: auto;
|
|
@@ -176,7 +178,10 @@ const TextField = styled.input`
|
|
|
176
178
|
const MessagesContainer = styled.div`
|
|
177
179
|
height: 70%;
|
|
178
180
|
margin-bottom: 10px;
|
|
179
|
-
|
|
181
|
+
.chat-body {
|
|
182
|
+
max-height: auto;
|
|
183
|
+
overflow-y: auto;
|
|
184
|
+
}
|
|
180
185
|
`;
|
|
181
186
|
|
|
182
187
|
const Message = styled.div<IMessageProps>`
|
|
@@ -2,28 +2,27 @@ import {
|
|
|
2
2
|
ICharacter,
|
|
3
3
|
IChatMessage,
|
|
4
4
|
IPrivateChatMessage,
|
|
5
|
-
ITradeChatMessage,
|
|
6
5
|
} from '@rpg-engine/shared';
|
|
7
6
|
import React, { useEffect, useState } from 'react';
|
|
8
|
-
import { RxCross2, RxMagnifyingGlass } from 'react-icons/rx';
|
|
9
7
|
import styled from 'styled-components';
|
|
10
8
|
import { uiColors } from '../../constants/uiColors';
|
|
11
|
-
import { uiFonts } from '../../constants/uiFonts';
|
|
12
9
|
import { Chat, IStyles } from '../Chat/Chat';
|
|
13
10
|
import { SearchCharacter } from './SearchCharacter';
|
|
14
11
|
|
|
12
|
+
export interface ITabStyles {
|
|
13
|
+
width?: string;
|
|
14
|
+
height?: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
15
17
|
export type PrivateChatCharacter = Pick<ICharacter, '_id' | 'name'>;
|
|
16
18
|
|
|
17
|
-
export type ChatMessage =
|
|
18
|
-
| IChatMessage
|
|
19
|
-
| IPrivateChatMessage
|
|
20
|
-
| ITradeChatMessage;
|
|
21
19
|
export interface IChatRevampProps {
|
|
22
|
-
chatMessages:
|
|
20
|
+
chatMessages: IChatMessage[] | IPrivateChatMessage[];
|
|
23
21
|
onSendGlobalChatMessage: (message: string) => void;
|
|
24
22
|
onCloseButton: () => void;
|
|
25
23
|
onFocus?: () => void;
|
|
26
24
|
onBlur?: () => void;
|
|
25
|
+
opacity?: number;
|
|
27
26
|
styles?: IStyles;
|
|
28
27
|
tabs: { label: string; id: string }[];
|
|
29
28
|
activeTab: string;
|
|
@@ -32,12 +31,6 @@ export interface IChatRevampProps {
|
|
|
32
31
|
onChangeCharacterName: (characterName: string) => void;
|
|
33
32
|
onCharacterClick?: (character: PrivateChatCharacter) => void;
|
|
34
33
|
onSendPrivateChatMessage: (message: string) => void;
|
|
35
|
-
recentChatCharacters?: PrivateChatCharacter[];
|
|
36
|
-
recentSelectedChatCharacterId?: string;
|
|
37
|
-
onPreviousChatCharacterClick?: (character: PrivateChatCharacter) => void;
|
|
38
|
-
onRemoveRecentChatCharacter?: (character: PrivateChatCharacter) => void;
|
|
39
|
-
unseenMessageCharacterIds?: string[];
|
|
40
|
-
onSendTradeMessage: (message: string) => void;
|
|
41
34
|
}
|
|
42
35
|
|
|
43
36
|
export const ChatRevamp = ({
|
|
@@ -54,30 +47,14 @@ export const ChatRevamp = ({
|
|
|
54
47
|
privateChatCharacters,
|
|
55
48
|
onCharacterClick,
|
|
56
49
|
onSendPrivateChatMessage,
|
|
57
|
-
recentChatCharacters,
|
|
58
|
-
recentSelectedChatCharacterId = '',
|
|
59
|
-
onPreviousChatCharacterClick,
|
|
60
|
-
onRemoveRecentChatCharacter,
|
|
61
|
-
unseenMessageCharacterIds = [],
|
|
62
|
-
onSendTradeMessage,
|
|
63
50
|
}: IChatRevampProps) => {
|
|
64
|
-
const [
|
|
65
|
-
const [showRecentChats, setShowRecentChats] = useState(false);
|
|
51
|
+
const [showSearchCharacter, setShowSearchCharacter] = useState(true);
|
|
66
52
|
|
|
67
53
|
useEffect(() => {
|
|
68
|
-
|
|
54
|
+
setShowSearchCharacter(true);
|
|
69
55
|
}, [activeTab]);
|
|
70
56
|
|
|
71
57
|
const isPrivate = activeTab === 'private';
|
|
72
|
-
const isTrade = activeTab === 'trade';
|
|
73
|
-
|
|
74
|
-
const handlePreviousChatCharacterClick = (
|
|
75
|
-
character: PrivateChatCharacter
|
|
76
|
-
) => {
|
|
77
|
-
if (!onPreviousChatCharacterClick) return;
|
|
78
|
-
onPreviousChatCharacterClick(character);
|
|
79
|
-
setShowSearchCharacterUI(false);
|
|
80
|
-
};
|
|
81
58
|
|
|
82
59
|
return (
|
|
83
60
|
<>
|
|
@@ -92,83 +69,29 @@ export const ChatRevamp = ({
|
|
|
92
69
|
</Tab>
|
|
93
70
|
))}
|
|
94
71
|
</TabContainer>
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
<RecentChatLogContainer isOpen={showRecentChats}>
|
|
119
|
-
{recentChatCharacters?.map(character => (
|
|
120
|
-
<ListElementContainer key={character._id}>
|
|
121
|
-
<ListElement
|
|
122
|
-
active={character._id === recentSelectedChatCharacterId}
|
|
123
|
-
onPointerDown={() =>
|
|
124
|
-
handlePreviousChatCharacterClick(character)
|
|
125
|
-
}
|
|
126
|
-
>
|
|
127
|
-
<StatusDot
|
|
128
|
-
isUnseen={
|
|
129
|
-
unseenMessageCharacterIds?.includes(character._id) ||
|
|
130
|
-
false
|
|
131
|
-
}
|
|
132
|
-
/>
|
|
133
|
-
{character.name}
|
|
134
|
-
</ListElement>
|
|
135
|
-
<CloseButton
|
|
136
|
-
onPointerDown={() => onRemoveRecentChatCharacter?.(character)}
|
|
137
|
-
>
|
|
138
|
-
<RxCross2 size={16} />
|
|
139
|
-
</CloseButton>
|
|
140
|
-
</ListElementContainer>
|
|
141
|
-
))}
|
|
142
|
-
</RecentChatLogContainer>
|
|
143
|
-
</RecentChatTabContainer>
|
|
144
|
-
{isPrivate && showSearchCharacterUI ? (
|
|
145
|
-
<SearchCharacter
|
|
146
|
-
onFocus={onFocus}
|
|
147
|
-
onBlur={onBlur}
|
|
148
|
-
onChangeCharacterName={onChangeCharacterName}
|
|
149
|
-
styles={styles}
|
|
150
|
-
recentCharacters={privateChatCharacters}
|
|
151
|
-
setShowSearchCharacter={setShowSearchCharacterUI}
|
|
152
|
-
onCharacterClick={onCharacterClick}
|
|
153
|
-
/>
|
|
154
|
-
) : (
|
|
155
|
-
<Chat
|
|
156
|
-
chatMessages={chatMessages}
|
|
157
|
-
onSendChatMessage={
|
|
158
|
-
isPrivate
|
|
159
|
-
? onSendPrivateChatMessage
|
|
160
|
-
: isTrade
|
|
161
|
-
? onSendTradeMessage
|
|
162
|
-
: onSendGlobalChatMessage
|
|
163
|
-
}
|
|
164
|
-
sendMessage={true}
|
|
165
|
-
onCloseButton={onCloseButton}
|
|
166
|
-
styles={styles}
|
|
167
|
-
onFocus={onFocus}
|
|
168
|
-
onBlur={onBlur}
|
|
169
|
-
/>
|
|
170
|
-
)}
|
|
171
|
-
</PrivateChatContainer>
|
|
72
|
+
{isPrivate && showSearchCharacter ? (
|
|
73
|
+
<SearchCharacter
|
|
74
|
+
onFocus={onFocus}
|
|
75
|
+
onBlur={onBlur}
|
|
76
|
+
onChangeCharacterName={onChangeCharacterName}
|
|
77
|
+
styles={styles}
|
|
78
|
+
recentCharacters={privateChatCharacters}
|
|
79
|
+
setShowSearchCharacter={setShowSearchCharacter}
|
|
80
|
+
onCharacterClick={onCharacterClick}
|
|
81
|
+
/>
|
|
82
|
+
) : (
|
|
83
|
+
<Chat
|
|
84
|
+
chatMessages={chatMessages}
|
|
85
|
+
onSendChatMessage={
|
|
86
|
+
isPrivate ? onSendPrivateChatMessage : onSendGlobalChatMessage
|
|
87
|
+
}
|
|
88
|
+
sendMessage={true}
|
|
89
|
+
onCloseButton={onCloseButton}
|
|
90
|
+
styles={styles}
|
|
91
|
+
onFocus={onFocus}
|
|
92
|
+
onBlur={onBlur}
|
|
93
|
+
/>
|
|
94
|
+
)}
|
|
172
95
|
</>
|
|
173
96
|
);
|
|
174
97
|
};
|
|
@@ -196,136 +119,3 @@ const Tab = styled.button<{ active: boolean }>`
|
|
|
196
119
|
props.active ? uiColors.orange : 'transparent'};
|
|
197
120
|
color: ${props => (props.active ? 'white' : uiColors.raisinBlack)};
|
|
198
121
|
`;
|
|
199
|
-
|
|
200
|
-
const PrivateChatContainer = styled.div<{ width: string; height: string }>`
|
|
201
|
-
width: ${({ width }) => width};
|
|
202
|
-
min-height: ${({ height }) => height} !important;
|
|
203
|
-
padding: 10px;
|
|
204
|
-
background-color: rgba(0, 0, 0, 0.2);
|
|
205
|
-
height: auto;
|
|
206
|
-
display: flex;
|
|
207
|
-
gap: 10px;
|
|
208
|
-
`;
|
|
209
|
-
|
|
210
|
-
const RecentChatTabContainer = styled.div<{
|
|
211
|
-
isPrivate: boolean;
|
|
212
|
-
isOpen: boolean;
|
|
213
|
-
}>`
|
|
214
|
-
display: ${props => (props.isPrivate ? 'flex' : 'none')};
|
|
215
|
-
flex-direction: column;
|
|
216
|
-
border-right: 1px solid ${uiColors.gray};
|
|
217
|
-
outline: none;
|
|
218
|
-
width: ${props => (props.isOpen ? '20%' : '30px')} !important;
|
|
219
|
-
transition: width 0.3s ease-in-out;
|
|
220
|
-
overflow: hidden;
|
|
221
|
-
|
|
222
|
-
@media (max-width: 768px) {
|
|
223
|
-
width: ${props => (props.isOpen ? '40%' : '30px')} !important;
|
|
224
|
-
}
|
|
225
|
-
`;
|
|
226
|
-
|
|
227
|
-
const RecentChatTopBar = styled.div<{ isOpen: boolean }>`
|
|
228
|
-
display: flex;
|
|
229
|
-
align-items: center;
|
|
230
|
-
justify-content: space-between;
|
|
231
|
-
height: 30px;
|
|
232
|
-
`;
|
|
233
|
-
|
|
234
|
-
const SearchButton = styled.button`
|
|
235
|
-
border: none;
|
|
236
|
-
background-color: transparent;
|
|
237
|
-
display: flex;
|
|
238
|
-
flex-direction: column;
|
|
239
|
-
align-items: flex-end;
|
|
240
|
-
gap: 2px;
|
|
241
|
-
padding: 4px;
|
|
242
|
-
position: relative;
|
|
243
|
-
`;
|
|
244
|
-
|
|
245
|
-
const BurgerIconContainer = styled.button<{ hasUnseenMessages?: boolean }>`
|
|
246
|
-
border: none;
|
|
247
|
-
background-color: transparent;
|
|
248
|
-
display: flex;
|
|
249
|
-
flex-direction: column;
|
|
250
|
-
align-items: flex-end;
|
|
251
|
-
padding: 4px;
|
|
252
|
-
gap: 2px;
|
|
253
|
-
position: relative;
|
|
254
|
-
|
|
255
|
-
&:after {
|
|
256
|
-
content: '';
|
|
257
|
-
width: 6px;
|
|
258
|
-
height: 6px;
|
|
259
|
-
position: absolute;
|
|
260
|
-
top: 0;
|
|
261
|
-
right: 2px;
|
|
262
|
-
border-radius: 50%;
|
|
263
|
-
background-color: ${uiColors.lightGreen};
|
|
264
|
-
display: ${props => (props.hasUnseenMessages ? 'block' : 'none')};
|
|
265
|
-
}
|
|
266
|
-
`;
|
|
267
|
-
|
|
268
|
-
const BurgerLineIcon = styled.span`
|
|
269
|
-
width: 1rem;
|
|
270
|
-
height: 2px;
|
|
271
|
-
background-color: #ffffff;
|
|
272
|
-
`;
|
|
273
|
-
|
|
274
|
-
const RecentChatLogContainer = styled.div<{ isOpen: boolean }>`
|
|
275
|
-
border: none;
|
|
276
|
-
list-style: none;
|
|
277
|
-
display: flex;
|
|
278
|
-
opacity: ${props => (props.isOpen ? 1 : 0)};
|
|
279
|
-
flex-direction: column;
|
|
280
|
-
gap: 0.5rem;
|
|
281
|
-
transition: opacity 0.3s ease-in-out;
|
|
282
|
-
padding: 0;
|
|
283
|
-
margin: 0;
|
|
284
|
-
flex: 1;
|
|
285
|
-
`;
|
|
286
|
-
|
|
287
|
-
const ListElementContainer = styled.div`
|
|
288
|
-
display: flex;
|
|
289
|
-
justify-content: space-between;
|
|
290
|
-
align-items: center;
|
|
291
|
-
`;
|
|
292
|
-
|
|
293
|
-
const ListElement = styled.button<{ active: boolean }>`
|
|
294
|
-
margin: 0.5rem 0 !important;
|
|
295
|
-
font-size: ${uiFonts.size.small} !important;
|
|
296
|
-
padding: 2px;
|
|
297
|
-
all: unset;
|
|
298
|
-
color: ${props => (props.active ? uiColors.yellow : uiColors.white)};
|
|
299
|
-
width: 100%;
|
|
300
|
-
position: relative;
|
|
301
|
-
display: flex;
|
|
302
|
-
align-items: center;
|
|
303
|
-
gap: 4px;
|
|
304
|
-
|
|
305
|
-
&:hover {
|
|
306
|
-
color: #ff0;
|
|
307
|
-
}
|
|
308
|
-
`;
|
|
309
|
-
|
|
310
|
-
const StatusDot = styled.span<{ isUnseen: boolean }>`
|
|
311
|
-
width: 6px;
|
|
312
|
-
height: 6px;
|
|
313
|
-
border-radius: 50%;
|
|
314
|
-
background-color: ${props =>
|
|
315
|
-
props.isUnseen ? uiColors.lightGreen : uiColors.gray};
|
|
316
|
-
display: inline-block;
|
|
317
|
-
margin-right: 6px;
|
|
318
|
-
`;
|
|
319
|
-
|
|
320
|
-
const CloseButton = styled.button`
|
|
321
|
-
all: unset;
|
|
322
|
-
font-size: ${uiFonts.size.xxsmall};
|
|
323
|
-
margin: 0 0.5rem;
|
|
324
|
-
transition: all 0.2s ease-in-out;
|
|
325
|
-
background-color: ${uiColors.red};
|
|
326
|
-
color: ${uiColors.white};
|
|
327
|
-
&:hover {
|
|
328
|
-
background-color: ${uiColors.white};
|
|
329
|
-
color: ${uiColors.red};
|
|
330
|
-
}
|
|
331
|
-
`;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
2
|
import { RxMagnifyingGlass } from 'react-icons/rx';
|
|
3
3
|
import styled from 'styled-components';
|
|
4
4
|
import { uiColors } from '../../constants/uiColors';
|
|
@@ -33,17 +33,6 @@ export const SearchCharacter = ({
|
|
|
33
33
|
},
|
|
34
34
|
}: ISearchCharacterProps) => {
|
|
35
35
|
const [characterName, setCharacterName] = useState('');
|
|
36
|
-
const searchCharacterRef = useRef<HTMLInputElement>(null);
|
|
37
|
-
|
|
38
|
-
useEffect(() => {
|
|
39
|
-
const timer = setTimeout(() => {
|
|
40
|
-
if (searchCharacterRef.current) {
|
|
41
|
-
searchCharacterRef.current.focus();
|
|
42
|
-
}
|
|
43
|
-
}, 100);
|
|
44
|
-
|
|
45
|
-
return () => clearTimeout(timer);
|
|
46
|
-
}, []);
|
|
47
36
|
|
|
48
37
|
const handleSubmit = (event: React.SyntheticEvent<HTMLFormElement>) => {
|
|
49
38
|
event.preventDefault();
|
|
@@ -58,33 +47,34 @@ export const SearchCharacter = ({
|
|
|
58
47
|
setCharacterName('');
|
|
59
48
|
onCharacterClick(character);
|
|
60
49
|
setShowSearchCharacter(false);
|
|
61
|
-
};
|
|
50
|
+
};
|
|
62
51
|
|
|
63
52
|
return (
|
|
64
|
-
<
|
|
53
|
+
<SearchCharacterContainer
|
|
54
|
+
width={styles?.width || '80%'}
|
|
55
|
+
height={styles?.height || 'auto'}
|
|
56
|
+
>
|
|
65
57
|
<Form onSubmit={handleSubmit}>
|
|
66
58
|
<Column flex={70}>
|
|
67
59
|
<TextField
|
|
68
60
|
value={characterName}
|
|
69
|
-
|
|
70
|
-
id="characterName"
|
|
71
|
-
name='characterName'
|
|
61
|
+
id="inputCharacterName"
|
|
72
62
|
onChange={e => {
|
|
73
63
|
setCharacterName(e.target.value);
|
|
74
64
|
onChangeCharacterName(e.target.value);
|
|
75
65
|
}}
|
|
76
|
-
placeholder='Search for a character...'
|
|
77
66
|
height={20}
|
|
78
67
|
type="text"
|
|
79
68
|
autoComplete="off"
|
|
80
69
|
onFocus={onFocus}
|
|
81
70
|
onBlur={onBlur}
|
|
82
71
|
onPointerDown={onFocus}
|
|
83
|
-
|
|
72
|
+
autoFocus
|
|
73
|
+
placeholder="Type a character name..."
|
|
74
|
+
/>
|
|
84
75
|
</Column>
|
|
85
76
|
<Column justifyContent="flex-end">
|
|
86
77
|
<SearchButton
|
|
87
|
-
type='submit'
|
|
88
78
|
buttonColor={styles?.buttonColor || '#005b96'}
|
|
89
79
|
buttonBackgroundColor={
|
|
90
80
|
styles?.buttonBackgroundColor || 'rgba(0,0,0,.5)'
|
|
@@ -106,19 +96,27 @@ export const SearchCharacter = ({
|
|
|
106
96
|
))}
|
|
107
97
|
</ListContainer>
|
|
108
98
|
)}
|
|
109
|
-
|
|
99
|
+
</SearchCharacterContainer>
|
|
110
100
|
);
|
|
111
101
|
};
|
|
112
102
|
|
|
103
|
+
interface IContainerProps {
|
|
104
|
+
width: string;
|
|
105
|
+
height: string;
|
|
106
|
+
}
|
|
113
107
|
|
|
114
108
|
interface IButtonProps {
|
|
115
109
|
buttonColor: string;
|
|
116
110
|
buttonBackgroundColor: string;
|
|
117
111
|
}
|
|
118
112
|
|
|
119
|
-
const
|
|
120
|
-
|
|
121
|
-
|
|
113
|
+
const SearchCharacterContainer = styled.div<IContainerProps>`
|
|
114
|
+
height: ${props => props.height};
|
|
115
|
+
width: ${({ width }) => width};
|
|
116
|
+
padding: 10px;
|
|
117
|
+
background-color: rgba(0, 0, 0, 0.2);
|
|
118
|
+
height: auto;
|
|
119
|
+
`;
|
|
122
120
|
|
|
123
121
|
const Form = styled.form`
|
|
124
122
|
display: flex;
|
|
@@ -152,7 +150,6 @@ const ListContainer = styled.ul`
|
|
|
152
150
|
const ListElement = styled.li`
|
|
153
151
|
margin: 0.5rem 0 !important;
|
|
154
152
|
font-size: ${uiFonts.size.small};
|
|
155
|
-
padding: 0.5rem 2px;
|
|
156
153
|
|
|
157
154
|
&:hover {
|
|
158
155
|
color: #ff0;
|
|
@@ -66,8 +66,6 @@ type onDragStart =
|
|
|
66
66
|
| undefined;
|
|
67
67
|
type onDragEnd = ((quantity?: number) => void) | undefined;
|
|
68
68
|
|
|
69
|
-
const MIN_SLOTS_FOR_SCROLL = 20;
|
|
70
|
-
|
|
71
69
|
export const ItemContainer: React.FC<IItemContainerProps> = ({
|
|
72
70
|
itemContainer,
|
|
73
71
|
onClose,
|
|
@@ -243,11 +241,7 @@ export const ItemContainer: React.FC<IItemContainerProps> = ({
|
|
|
243
241
|
atlasJSON={atlasJSON}
|
|
244
242
|
/>
|
|
245
243
|
)}
|
|
246
|
-
<ItemsContainer
|
|
247
|
-
className="item-container-body"
|
|
248
|
-
ref={containerRef}
|
|
249
|
-
isScrollable={itemContainer.slotQty > MIN_SLOTS_FOR_SCROLL}
|
|
250
|
-
>
|
|
244
|
+
<ItemsContainer className="item-container-body" ref={containerRef}>
|
|
251
245
|
{onRenderSlots()}
|
|
252
246
|
</ItemsContainer>
|
|
253
247
|
</SlotsContainer>
|
|
@@ -261,16 +255,12 @@ export const ItemContainer: React.FC<IItemContainerProps> = ({
|
|
|
261
255
|
);
|
|
262
256
|
};
|
|
263
257
|
|
|
264
|
-
|
|
265
|
-
isScrollable: boolean;
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
const ItemsContainer = styled.div<IItemsContainerProps>`
|
|
258
|
+
const ItemsContainer = styled.div`
|
|
269
259
|
display: flex;
|
|
270
260
|
justify-content: center;
|
|
271
261
|
flex-wrap: wrap;
|
|
272
262
|
max-height: 270px;
|
|
273
|
-
overflow-y:
|
|
263
|
+
overflow-y: auto;
|
|
274
264
|
overflow-x: hidden;
|
|
275
265
|
width: 415px;
|
|
276
266
|
`;
|
package/src/index.tsx
CHANGED
|
@@ -32,6 +32,7 @@ export * from './components/RPGUI/RPGUIContainer';
|
|
|
32
32
|
export * from './components/RPGUI/RPGUIRoot';
|
|
33
33
|
export * from './components/RadioButton';
|
|
34
34
|
export * from './components/RangeSlider';
|
|
35
|
+
export * from './components/ShopModal/ShopModal';
|
|
35
36
|
export * from './components/Shortcuts/Shortcuts';
|
|
36
37
|
export * from './components/SkillProgressBar';
|
|
37
38
|
export * from './components/SkillsContainer';
|
|
@@ -44,3 +45,4 @@ export * from './components/itemSelector/ItemSelector';
|
|
|
44
45
|
export * from './components/shared/SpriteFromAtlas';
|
|
45
46
|
export * from './components/typography/DynamicText';
|
|
46
47
|
export { useEventListener } from './hooks/useEventListener';
|
|
48
|
+
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
ItemSlotType,
|
|
6
6
|
ItemSubType,
|
|
7
7
|
ItemType,
|
|
8
|
-
UserAccountTypes
|
|
8
|
+
UserAccountTypes
|
|
9
9
|
} from '@rpg-engine/shared';
|
|
10
10
|
|
|
11
11
|
export const items: IItem[] = [
|
|
@@ -586,7 +586,7 @@ export const itemContainerMock = (
|
|
|
586
586
|
_id: '629ba0b6fe3f43002f58f23b',
|
|
587
587
|
name: 'Item Container',
|
|
588
588
|
owner: '629ba0b6fe3f43002f58f23b',
|
|
589
|
-
slotQty:
|
|
589
|
+
slotQty: 60,
|
|
590
590
|
slots: {
|
|
591
591
|
0: items[0],
|
|
592
592
|
1: items[1],
|
|
@@ -614,4 +614,4 @@ export const itemContainerMock = (
|
|
|
614
614
|
...props,
|
|
615
615
|
};
|
|
616
616
|
}
|
|
617
|
-
}
|
|
617
|
+
}
|
|
@@ -202,7 +202,6 @@ const chatMessagesMock = [
|
|
|
202
202
|
const tabsMock = [
|
|
203
203
|
{ label: 'Global', id: 'global' },
|
|
204
204
|
{ label: 'Private', id: 'private' },
|
|
205
|
-
{ label: 'Trade', id: 'trade' },
|
|
206
205
|
];
|
|
207
206
|
|
|
208
207
|
const recentPrivateChatCharactersMock = [
|
|
@@ -222,6 +221,7 @@ Default.args = {
|
|
|
222
221
|
onSendGlobalChatMessage: () => {},
|
|
223
222
|
onChangeCharacterName: () => {},
|
|
224
223
|
chatMessages: chatMessagesMock,
|
|
224
|
+
opacity: 0.5,
|
|
225
225
|
styles: { width: `calc(100% - 0.5rem * 2)`, height: '200px' },
|
|
226
226
|
onCloseButton: () => console.log('closing chat...'),
|
|
227
227
|
tabs: tabsMock,
|
|
@@ -229,15 +229,15 @@ Default.args = {
|
|
|
229
229
|
activeTab: 'global',
|
|
230
230
|
onChangeTab: () => {},
|
|
231
231
|
onSendPrivateChatMessage: () => {},
|
|
232
|
-
onSendTradeMessage: () => {},
|
|
233
232
|
};
|
|
234
233
|
|
|
235
|
-
export const
|
|
234
|
+
export const PrivateCharacters = Template.bind({});
|
|
236
235
|
|
|
237
|
-
|
|
236
|
+
PrivateCharacters.args = {
|
|
238
237
|
onSendGlobalChatMessage: () => {},
|
|
239
238
|
onChangeCharacterName: () => {},
|
|
240
239
|
chatMessages: chatMessagesMock,
|
|
240
|
+
opacity: 0.5,
|
|
241
241
|
styles: { width: `calc(100% - 0.5rem * 2)`, height: '200px' },
|
|
242
242
|
onCloseButton: () => {},
|
|
243
243
|
tabs: tabsMock,
|
|
@@ -245,23 +245,4 @@ Private.args = {
|
|
|
245
245
|
activeTab: 'private',
|
|
246
246
|
onChangeTab: () => {},
|
|
247
247
|
onSendPrivateChatMessage: () => {},
|
|
248
|
-
recentChatCharacters: recentPrivateChatCharactersMock,
|
|
249
|
-
recentSelectedChatCharacterId: recentPrivateChatCharactersMock[0]._id,
|
|
250
|
-
unseenMessageCharacterIds: [recentPrivateChatCharactersMock[0]._id],
|
|
251
|
-
onSendTradeMessage: () => {},
|
|
252
|
-
};
|
|
253
|
-
|
|
254
|
-
export const Trade = Template.bind({});
|
|
255
|
-
|
|
256
|
-
Trade.args = {
|
|
257
|
-
onSendGlobalChatMessage: () => {},
|
|
258
|
-
onChangeCharacterName: () => {},
|
|
259
|
-
chatMessages: chatMessagesMock,
|
|
260
|
-
styles: { width: `calc(100% - 0.5rem * 2)`, height: '200px' },
|
|
261
|
-
onCloseButton: () => {},
|
|
262
|
-
tabs: tabsMock,
|
|
263
|
-
privateChatCharacters: recentPrivateChatCharactersMock,
|
|
264
|
-
activeTab: 'trade',
|
|
265
|
-
onChangeTab: () => {},
|
|
266
|
-
onSendTradeMessage: () => {},
|
|
267
248
|
};
|