@rpg-engine/long-bow 0.5.43 → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rpg-engine/long-bow",
3
- "version": "0.5.43",
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.9.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",
@@ -161,8 +161,8 @@ interface IButtonProps {
161
161
  }
162
162
 
163
163
  const ChatContainer = styled.div<IContainerProps>`
164
- height: ${props => props.height} !important;
165
- width: 100%;
164
+ height: ${props => props.height};
165
+ width: ${({ width }) => width};
166
166
  padding: 10px;
167
167
  background-color: rgba(0, 0, 0, 0.2);
168
168
  height: auto;
@@ -178,7 +178,10 @@ const TextField = styled.input`
178
178
  const MessagesContainer = styled.div`
179
179
  height: 70%;
180
180
  margin-bottom: 10px;
181
- overflow-y: auto;
181
+ .chat-body {
182
+ max-height: auto;
183
+ overflow-y: auto;
184
+ }
182
185
  `;
183
186
 
184
187
  const Message = styled.div<IMessageProps>`
@@ -4,13 +4,16 @@ import {
4
4
  IPrivateChatMessage,
5
5
  } from '@rpg-engine/shared';
6
6
  import React, { useEffect, useState } from 'react';
7
- import { RxCross2, RxMagnifyingGlass } from 'react-icons/rx';
8
7
  import styled from 'styled-components';
9
8
  import { uiColors } from '../../constants/uiColors';
10
- import { uiFonts } from '../../constants/uiFonts';
11
9
  import { Chat, IStyles } from '../Chat/Chat';
12
10
  import { SearchCharacter } from './SearchCharacter';
13
11
 
12
+ export interface ITabStyles {
13
+ width?: string;
14
+ height?: string;
15
+ }
16
+
14
17
  export type PrivateChatCharacter = Pick<ICharacter, '_id' | 'name'>;
15
18
 
16
19
  export interface IChatRevampProps {
@@ -19,6 +22,7 @@ export interface IChatRevampProps {
19
22
  onCloseButton: () => void;
20
23
  onFocus?: () => void;
21
24
  onBlur?: () => void;
25
+ opacity?: number;
22
26
  styles?: IStyles;
23
27
  tabs: { label: string; id: string }[];
24
28
  activeTab: string;
@@ -27,11 +31,6 @@ export interface IChatRevampProps {
27
31
  onChangeCharacterName: (characterName: string) => void;
28
32
  onCharacterClick?: (character: PrivateChatCharacter) => void;
29
33
  onSendPrivateChatMessage: (message: string) => void;
30
- recentChatCharacters?: PrivateChatCharacter[];
31
- recentSelectedChatCharacterId?: string;
32
- onPreviousChatCharacterClick?: (character: PrivateChatCharacter) => void;
33
- onRemoveRecentChatCharacter?: (character: PrivateChatCharacter) => void;
34
- unseenMessageCharacterIds?: string[];
35
34
  }
36
35
 
37
36
  export const ChatRevamp = ({
@@ -48,29 +47,15 @@ export const ChatRevamp = ({
48
47
  privateChatCharacters,
49
48
  onCharacterClick,
50
49
  onSendPrivateChatMessage,
51
- recentChatCharacters,
52
- recentSelectedChatCharacterId = '',
53
- onPreviousChatCharacterClick,
54
- onRemoveRecentChatCharacter,
55
- unseenMessageCharacterIds = [],
56
50
  }: IChatRevampProps) => {
57
- const [showSearchCharacterUI, setShowSearchCharacterUI] = useState(true);
58
- const [showRecentChats, setShowRecentChats] = useState(false);
51
+ const [showSearchCharacter, setShowSearchCharacter] = useState(true);
59
52
 
60
53
  useEffect(() => {
61
- setShowSearchCharacterUI(true);
54
+ setShowSearchCharacter(true);
62
55
  }, [activeTab]);
63
56
 
64
57
  const isPrivate = activeTab === 'private';
65
58
 
66
- const handlePreviousChatCharacterClick = (
67
- character: PrivateChatCharacter
68
- ) => {
69
- if (!onPreviousChatCharacterClick) return;
70
- onPreviousChatCharacterClick(character);
71
- setShowSearchCharacterUI(false);
72
- };
73
-
74
59
  return (
75
60
  <>
76
61
  <TabContainer>
@@ -84,81 +69,29 @@ export const ChatRevamp = ({
84
69
  </Tab>
85
70
  ))}
86
71
  </TabContainer>
87
- <PrivateChatContainer
88
- width={styles?.width || '80%'}
89
- height={styles?.height || 'auto'}
90
- >
91
- <RecentChatTabContainer isPrivate={isPrivate} isOpen={showRecentChats}>
92
- <RecentChatTopBar isOpen={showRecentChats}>
93
- <BurgerIconContainer
94
- onPointerDown={() => setShowRecentChats(t => !t)}
95
- hasUnseenMessages={
96
- unseenMessageCharacterIds?.length > 0 ? true : false
97
- }
98
- >
99
- <BurgerLineIcon></BurgerLineIcon>
100
- <BurgerLineIcon></BurgerLineIcon>
101
- <BurgerLineIcon></BurgerLineIcon>
102
- </BurgerIconContainer>
103
- {showRecentChats && (
104
- <SearchButton
105
- onPointerDown={() => setShowSearchCharacterUI(true)}
106
- >
107
- <RxMagnifyingGlass size={16} color={uiColors.white} />
108
- </SearchButton>
109
- )}
110
- </RecentChatTopBar>
111
-
112
- <RecentChatLogContainer isOpen={showRecentChats}>
113
- {recentChatCharacters?.map(character => (
114
- <ListElementContainer key={character._id}>
115
- <ListElement
116
- active={character._id === recentSelectedChatCharacterId}
117
- onPointerDown={() =>
118
- handlePreviousChatCharacterClick(character)
119
- }
120
- >
121
- <StatusDot
122
- isUnseen={
123
- unseenMessageCharacterIds?.includes(character._id) ||
124
- false
125
- }
126
- />
127
- {character.name}
128
- </ListElement>
129
- <CloseButton
130
- onPointerDown={() => onRemoveRecentChatCharacter?.(character)}
131
- >
132
- <RxCross2 size={16} />
133
- </CloseButton>
134
- </ListElementContainer>
135
- ))}
136
- </RecentChatLogContainer>
137
- </RecentChatTabContainer>
138
- {isPrivate && showSearchCharacterUI ? (
139
- <SearchCharacter
140
- onFocus={onFocus}
141
- onBlur={onBlur}
142
- onChangeCharacterName={onChangeCharacterName}
143
- styles={styles}
144
- recentCharacters={privateChatCharacters}
145
- setShowSearchCharacter={setShowSearchCharacterUI}
146
- onCharacterClick={onCharacterClick}
147
- />
148
- ) : (
149
- <Chat
150
- chatMessages={chatMessages}
151
- onSendChatMessage={
152
- isPrivate ? onSendPrivateChatMessage : onSendGlobalChatMessage
153
- }
154
- sendMessage={true}
155
- onCloseButton={onCloseButton}
156
- styles={styles}
157
- onFocus={onFocus}
158
- onBlur={onBlur}
159
- />
160
- )}
161
- </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
+ )}
162
95
  </>
163
96
  );
164
97
  };
@@ -186,136 +119,3 @@ const Tab = styled.button<{ active: boolean }>`
186
119
  props.active ? uiColors.orange : 'transparent'};
187
120
  color: ${props => (props.active ? 'white' : uiColors.raisinBlack)};
188
121
  `;
189
-
190
- const PrivateChatContainer = styled.div<{ width: string; height: string }>`
191
- width: ${({ width }) => width};
192
- min-height: ${({ height }) => height} !important;
193
- padding: 10px;
194
- background-color: rgba(0, 0, 0, 0.2);
195
- height: auto;
196
- display: flex;
197
- gap: 10px;
198
- `;
199
-
200
- const RecentChatTabContainer = styled.div<{
201
- isPrivate: boolean;
202
- isOpen: boolean;
203
- }>`
204
- display: ${props => (props.isPrivate ? 'flex' : 'none')};
205
- flex-direction: column;
206
- border-right: 1px solid ${uiColors.gray};
207
- outline: none;
208
- width: ${props => (props.isOpen ? '20%' : '30px')} !important;
209
- transition: width 0.3s ease-in-out;
210
- overflow: hidden;
211
-
212
- @media (max-width: 768px) {
213
- width: ${props => (props.isOpen ? '40%' : '30px')} !important;
214
- }
215
- `;
216
-
217
- const RecentChatTopBar = styled.div<{ isOpen: boolean }>`
218
- display: flex;
219
- align-items: center;
220
- justify-content: space-between;
221
- height: 30px;
222
- `;
223
-
224
- const SearchButton = styled.button`
225
- border: none;
226
- background-color: transparent;
227
- display: flex;
228
- flex-direction: column;
229
- align-items: flex-end;
230
- gap: 2px;
231
- padding: 4px;
232
- position: relative;
233
- `;
234
-
235
- const BurgerIconContainer = styled.button<{ hasUnseenMessages?: boolean }>`
236
- border: none;
237
- background-color: transparent;
238
- display: flex;
239
- flex-direction: column;
240
- align-items: flex-end;
241
- padding: 4px;
242
- gap: 2px;
243
- position: relative;
244
-
245
- &:after {
246
- content: '';
247
- width: 6px;
248
- height: 6px;
249
- position: absolute;
250
- top: 0;
251
- right: 2px;
252
- border-radius: 50%;
253
- background-color: ${uiColors.lightGreen};
254
- display: ${props => (props.hasUnseenMessages ? 'block' : 'none')};
255
- }
256
- `;
257
-
258
- const BurgerLineIcon = styled.span`
259
- width: 1rem;
260
- height: 2px;
261
- background-color: #ffffff;
262
- `;
263
-
264
- const RecentChatLogContainer = styled.div<{ isOpen: boolean }>`
265
- border: none;
266
- list-style: none;
267
- display: flex;
268
- opacity: ${props => (props.isOpen ? 1 : 0)};
269
- flex-direction: column;
270
- gap: 0.5rem;
271
- transition: opacity 0.3s ease-in-out;
272
- padding: 0;
273
- margin: 0;
274
- flex: 1;
275
- `;
276
-
277
- const ListElementContainer = styled.div`
278
- display: flex;
279
- justify-content: space-between;
280
- align-items: center;
281
- `;
282
-
283
- const ListElement = styled.button<{ active: boolean }>`
284
- margin: 0.5rem 0 !important;
285
- font-size: ${uiFonts.size.small} !important;
286
- padding: 2px;
287
- all: unset;
288
- color: ${props => (props.active ? uiColors.yellow : uiColors.white)};
289
- width: 100%;
290
- position: relative;
291
- display: flex;
292
- align-items: center;
293
- gap: 4px;
294
-
295
- &:hover {
296
- color: #ff0;
297
- }
298
- `;
299
-
300
- const StatusDot = styled.span<{ isUnseen: boolean }>`
301
- width: 6px;
302
- height: 6px;
303
- border-radius: 50%;
304
- background-color: ${props =>
305
- props.isUnseen ? uiColors.lightGreen : uiColors.gray};
306
- display: inline-block;
307
- margin-right: 6px;
308
- `;
309
-
310
- const CloseButton = styled.button`
311
- all: unset;
312
- font-size: ${uiFonts.size.xxsmall};
313
- margin: 0 0.5rem;
314
- transition: all 0.2s ease-in-out;
315
- background-color: ${uiColors.red};
316
- color: ${uiColors.white};
317
- &:hover {
318
- background-color: ${uiColors.white};
319
- color: ${uiColors.red};
320
- }
321
- `;
@@ -50,18 +50,19 @@ export const SearchCharacter = ({
50
50
  };
51
51
 
52
52
  return (
53
- <SearchContainer>
53
+ <SearchCharacterContainer
54
+ width={styles?.width || '80%'}
55
+ height={styles?.height || 'auto'}
56
+ >
54
57
  <Form onSubmit={handleSubmit}>
55
58
  <Column flex={70}>
56
59
  <TextField
57
60
  value={characterName}
58
- id="characterName"
59
- name='characterName'
61
+ id="inputCharacterName"
60
62
  onChange={e => {
61
63
  setCharacterName(e.target.value);
62
64
  onChangeCharacterName(e.target.value);
63
65
  }}
64
- placeholder='Search for a character...'
65
66
  height={20}
66
67
  type="text"
67
68
  autoComplete="off"
@@ -69,11 +70,11 @@ export const SearchCharacter = ({
69
70
  onBlur={onBlur}
70
71
  onPointerDown={onFocus}
71
72
  autoFocus
72
- />
73
+ placeholder="Type a character name..."
74
+ />
73
75
  </Column>
74
76
  <Column justifyContent="flex-end">
75
77
  <SearchButton
76
- type='submit'
77
78
  buttonColor={styles?.buttonColor || '#005b96'}
78
79
  buttonBackgroundColor={
79
80
  styles?.buttonBackgroundColor || 'rgba(0,0,0,.5)'
@@ -95,19 +96,27 @@ export const SearchCharacter = ({
95
96
  ))}
96
97
  </ListContainer>
97
98
  )}
98
- </SearchContainer>
99
+ </SearchCharacterContainer>
99
100
  );
100
101
  };
101
102
 
103
+ interface IContainerProps {
104
+ width: string;
105
+ height: string;
106
+ }
102
107
 
103
108
  interface IButtonProps {
104
109
  buttonColor: string;
105
110
  buttonBackgroundColor: string;
106
111
  }
107
112
 
108
- const SearchContainer = styled.div`
109
- width: 100%;
110
- `
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
+ `;
111
120
 
112
121
  const Form = styled.form`
113
122
  display: flex;
@@ -141,7 +150,6 @@ const ListContainer = styled.ul`
141
150
  const ListElement = styled.li`
142
151
  margin: 0.5rem 0 !important;
143
152
  font-size: ${uiFonts.size.small};
144
- padding: 0.5rem 2px;
145
153
 
146
154
  &:hover {
147
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
- interface IItemsContainerProps {
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: ${({ isScrollable }) => (isScrollable ? 'scroll' : 'hidden')};
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: 20,
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
+ }
@@ -221,6 +221,7 @@ Default.args = {
221
221
  onSendGlobalChatMessage: () => {},
222
222
  onChangeCharacterName: () => {},
223
223
  chatMessages: chatMessagesMock,
224
+ opacity: 0.5,
224
225
  styles: { width: `calc(100% - 0.5rem * 2)`, height: '200px' },
225
226
  onCloseButton: () => console.log('closing chat...'),
226
227
  tabs: tabsMock,
@@ -236,6 +237,7 @@ PrivateCharacters.args = {
236
237
  onSendGlobalChatMessage: () => {},
237
238
  onChangeCharacterName: () => {},
238
239
  chatMessages: chatMessagesMock,
240
+ opacity: 0.5,
239
241
  styles: { width: `calc(100% - 0.5rem * 2)`, height: '200px' },
240
242
  onCloseButton: () => {},
241
243
  tabs: tabsMock,
@@ -243,7 +245,4 @@ PrivateCharacters.args = {
243
245
  activeTab: 'private',
244
246
  onChangeTab: () => {},
245
247
  onSendPrivateChatMessage: () => {},
246
- recentChatCharacters: recentPrivateChatCharactersMock,
247
- recentSelectedChatCharacterId: recentPrivateChatCharactersMock[0]._id,
248
- unseenMessageCharacterIds: [recentPrivateChatCharactersMock[0]._id],
249
248
  };