@rpg-engine/long-bow 0.8.140 → 0.8.145

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.
Files changed (68) hide show
  1. package/dist/components/Marketplace/BlueprintSearchModal.d.ts +17 -0
  2. package/dist/components/Marketplace/BuyOrderDetailsModal.d.ts +17 -0
  3. package/dist/components/Marketplace/BuyOrderPanel.d.ts +24 -0
  4. package/dist/components/Marketplace/BuyOrderRows.d.ts +13 -0
  5. package/dist/components/Marketplace/BuyPanel.d.ts +9 -1
  6. package/dist/components/Marketplace/HistoryPanel.d.ts +18 -0
  7. package/dist/components/Marketplace/ManagmentPanel.d.ts +4 -3
  8. package/dist/components/Marketplace/Marketplace.d.ts +38 -2
  9. package/dist/components/Marketplace/MarketplaceRows.d.ts +13 -1
  10. package/dist/components/Marketplace/MarketplaceSettingsPanel.d.ts +8 -0
  11. package/dist/components/Store/PaymentMethodModal.d.ts +1 -0
  12. package/dist/components/shared/LabelPill/LabelPill.d.ts +9 -0
  13. package/dist/components/shared/LabelPill/index.d.ts +1 -0
  14. package/dist/components/shared/SegmentedToggle/SegmentedToggle.d.ts +12 -0
  15. package/dist/components/shared/SegmentedToggle/index.d.ts +1 -0
  16. package/dist/components/shared/Tabs/Tabs.d.ts +13 -0
  17. package/dist/components/shared/Tabs/index.d.ts +1 -0
  18. package/dist/index.d.ts +5 -0
  19. package/dist/long-bow.cjs.development.js +12074 -1449
  20. package/dist/long-bow.cjs.development.js.map +1 -1
  21. package/dist/long-bow.cjs.production.min.js +1 -1
  22. package/dist/long-bow.cjs.production.min.js.map +1 -1
  23. package/dist/long-bow.esm.js +12060 -1450
  24. package/dist/long-bow.esm.js.map +1 -1
  25. package/dist/stories/Features/marketplace/BlueprintSearchModal.stories.d.ts +1 -0
  26. package/dist/stories/Features/marketplace/BuyOrderPanel.stories.d.ts +1 -0
  27. package/dist/stories/Features/marketplace/BuyOrderRows.stories.d.ts +1 -0
  28. package/dist/stories/Features/marketplace/HistoryPanel.stories.d.ts +1 -0
  29. package/dist/stories/Features/trading/MarketplaceRows.stories.d.ts +2 -1
  30. package/dist/stories/UI/buttonsAndInputs/SegmentedToggle.stories.d.ts +6 -0
  31. package/dist/stories/UI/text/LabelPill.stories.d.ts +7 -0
  32. package/dist/utils/atlasUtils.d.ts +2 -0
  33. package/package.json +3 -2
  34. package/src/components/ConfirmModal.tsx +50 -27
  35. package/src/components/Marketplace/BlueprintSearchModal.tsx +418 -0
  36. package/src/components/Marketplace/BuyOrderDetailsModal.tsx +307 -0
  37. package/src/components/Marketplace/BuyOrderPanel.tsx +266 -0
  38. package/src/components/Marketplace/BuyOrderRows.tsx +287 -0
  39. package/src/components/Marketplace/BuyPanel.tsx +486 -170
  40. package/src/components/Marketplace/HistoryPanel.tsx +422 -0
  41. package/src/components/Marketplace/ManagmentPanel.tsx +176 -98
  42. package/src/components/Marketplace/Marketplace.tsx +227 -40
  43. package/src/components/Marketplace/MarketplaceBuyModal.tsx +1 -0
  44. package/src/components/Marketplace/MarketplaceRows.tsx +274 -80
  45. package/src/components/Marketplace/MarketplaceSettingsPanel.tsx +128 -0
  46. package/src/components/Store/CartView.tsx +11 -0
  47. package/src/components/Store/PaymentMethodModal.tsx +26 -9
  48. package/src/components/shared/LabelPill/LabelPill.tsx +45 -0
  49. package/src/components/shared/LabelPill/index.ts +1 -0
  50. package/src/components/shared/SegmentedToggle/SegmentedToggle.tsx +61 -0
  51. package/src/components/shared/SegmentedToggle/index.ts +1 -0
  52. package/src/components/shared/SpriteFromAtlas.tsx +7 -2
  53. package/src/components/shared/Tabs/Tabs.tsx +60 -0
  54. package/src/components/shared/Tabs/index.ts +1 -0
  55. package/src/index.tsx +5 -0
  56. package/src/mocks/atlas/items/items.json +33998 -25238
  57. package/src/mocks/atlas/items/items.png +0 -0
  58. package/src/mocks/itemContainer.mocks.ts +31 -0
  59. package/src/stories/Features/marketplace/BlueprintSearchModal.stories.tsx +145 -0
  60. package/src/stories/Features/marketplace/BuyOrderPanel.stories.tsx +207 -0
  61. package/src/stories/Features/marketplace/BuyOrderRows.stories.tsx +116 -0
  62. package/src/stories/Features/marketplace/HistoryPanel.stories.tsx +157 -0
  63. package/src/stories/Features/trading/Marketplace.stories.tsx +109 -0
  64. package/src/stories/Features/trading/MarketplaceRows.stories.tsx +11 -0
  65. package/src/stories/UI/buttonsAndInputs/SegmentedToggle.stories.tsx +54 -0
  66. package/src/stories/UI/text/LabelPill.stories.tsx +43 -0
  67. package/src/utils/__test__/atlasUtils.spec.ts +26 -0
  68. package/src/utils/atlasUtils.ts +80 -0
@@ -1,25 +1,28 @@
1
- import { IEquipmentSet, IItem, IMarketplaceItem } from '@rpg-engine/shared';
1
+ import { IEquipmentSet, IItem, IMarketplaceItem, MarketplaceAcceptedCurrency } from '@rpg-engine/shared';
2
+ import { Coins } from 'pixelarticons/react/Coins';
3
+ import { ShoppingBag } from 'pixelarticons/react/ShoppingBag';
2
4
  import React, { useEffect, useRef, useState } from 'react';
3
5
  import styled from 'styled-components';
4
6
  import { uiColors } from '../../constants/uiColors';
5
- import { uiFonts } from '../../constants/uiFonts';
6
- import { Button, ButtonTypes } from '../Button';
7
7
  import { ConfirmModal } from '../ConfirmModal';
8
8
  import { Input } from '../Input';
9
9
  import { ItemSlot } from '../Item/Inventory/ItemSlot';
10
+ import { CTAButton } from '../shared/CTAButton/CTAButton';
11
+ import { SpriteFromAtlas } from '../shared/SpriteFromAtlas';
10
12
  import { MarketplaceRows } from './MarketplaceRows';
11
13
 
12
14
  export interface IManagmentPanelProps {
13
15
  items: IMarketplaceItem[];
14
16
  atlasJSON: any;
15
17
  atlasIMG: any;
16
- onChangeNameInput: (value: string) => void;
17
18
  equipmentSet?: IEquipmentSet | null;
18
19
  availableGold: number;
20
+ dcBalance?: number;
19
21
  onMarketPlaceItemRemove?: (marketPlaceItemId: string) => void;
20
22
  selectedItemToSell: IItem | null;
21
23
  onSelectedItemToSellRemove: (item: IItem) => void;
22
- onAddItemToMarketplace: (item: IItem, price: number) => void;
24
+ onAddItemToMarketplace: (item: IItem, price: number, acceptedCurrency?: MarketplaceAcceptedCurrency) => void;
25
+ acceptedCurrency?: MarketplaceAcceptedCurrency;
23
26
  enableHotkeys?: () => void;
24
27
  disableHotkeys?: () => void;
25
28
  onMoneyWithdraw: () => void;
@@ -30,19 +33,19 @@ export const ManagmentPanel: React.FC<IManagmentPanelProps> = ({
30
33
  items,
31
34
  atlasIMG,
32
35
  atlasJSON,
33
- onChangeNameInput,
34
36
  equipmentSet,
35
37
  availableGold,
38
+ dcBalance,
36
39
  onMarketPlaceItemRemove,
37
40
  selectedItemToSell,
38
41
  onSelectedItemToSellRemove,
39
42
  onAddItemToMarketplace,
43
+ acceptedCurrency,
40
44
  enableHotkeys,
41
45
  disableHotkeys,
42
46
  onMoneyWithdraw,
43
47
  currentPage,
44
48
  }) => {
45
- const [name, setName] = useState('');
46
49
  const [price, setPrice] = useState('');
47
50
  const [isCreatingOffer, setIsCreatingOffer] = useState(false);
48
51
  const [removingItemId, setRemovingItemId] = useState<string | null>(null);
@@ -60,7 +63,7 @@ export const ManagmentPanel: React.FC<IManagmentPanelProps> = ({
60
63
  onClose={setIsCreatingOffer.bind(null, false)}
61
64
  onConfirm={() => {
62
65
  if (selectedItemToSell && price && Number(price)) {
63
- onAddItemToMarketplace(selectedItemToSell, Number(price));
66
+ onAddItemToMarketplace(selectedItemToSell, Number(price), acceptedCurrency);
64
67
  setPrice('');
65
68
  onSelectedItemToSellRemove(selectedItemToSell);
66
69
  setIsCreatingOffer(false);
@@ -81,26 +84,14 @@ export const ManagmentPanel: React.FC<IManagmentPanelProps> = ({
81
84
  message="Are you sure to remove this item?"
82
85
  />
83
86
  )}
84
- <InputWrapper>
85
- <p>Search By Name</p>
86
- <Input
87
- onChange={e => {
88
- setName(e.target.value);
89
- onChangeNameInput(e.target.value);
90
- }}
91
- value={name}
92
- placeholder="Enter name..."
93
- onBlur={enableHotkeys}
94
- onFocus={disableHotkeys}
95
- />
96
- </InputWrapper>
97
87
 
98
88
  <OptionsWrapper>
99
89
  <InnerOptionsWrapper>
100
- <SellDescription>
101
- Click on item in inventory to sell it
102
- </SellDescription>
103
- <Flex>
90
+ <div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: '12px' }}>
91
+ <SectionLabel style={{ marginBottom: 0 }}>Create Offer</SectionLabel>
92
+ {!selectedItemToSell && <SellDescription>Select item in inventory to sell</SellDescription>}
93
+ </div>
94
+ <Flex style={{ gap: '15px', alignItems: 'center' }}>
104
95
  <ItemSlot
105
96
  slotIndex={0}
106
97
  atlasIMG={atlasIMG}
@@ -108,52 +99,77 @@ export const ManagmentPanel: React.FC<IManagmentPanelProps> = ({
108
99
  onPointerDown={(_, __, item) => onSelectedItemToSellRemove(item)}
109
100
  item={selectedItemToSell}
110
101
  />
102
+
111
103
  <PriceInputWrapper>
112
- <p>Enter price</p>
113
- <Flex>
104
+ <p>SET PRICE (GOLD)</p>
105
+ <Flex style={{ width: '100%', alignItems: 'center', gap: '8px' }}>
114
106
  <Input
115
- onChange={e => {
116
- setPrice(e.target.value);
117
- }}
107
+ onChange={e => setPrice(e.target.value)}
118
108
  value={price}
119
- placeholder="Enter price..."
109
+ placeholder="Amount..."
120
110
  type="number"
121
111
  disabled={!selectedItemToSell}
122
112
  onBlur={enableHotkeys}
123
113
  onFocus={disableHotkeys}
114
+ className="price-input"
124
115
  />
125
- <Button
126
- buttonType={ButtonTypes.RPGUIButton}
116
+ <SmallCTAButton
117
+ icon={<ShoppingBag width={18} height={18} />}
118
+ label="Offer"
127
119
  disabled={!selectedItemToSell || !price}
128
- onPointerDown={() => {
120
+ onClick={() => {
129
121
  if (selectedItemToSell && price && Number(price)) {
130
122
  setIsCreatingOffer(true);
131
123
  }
132
124
  }}
133
- >
134
- Create offer
135
- </Button>
125
+ />
136
126
  </Flex>
137
127
  </PriceInputWrapper>
138
128
  </Flex>
139
129
  </InnerOptionsWrapper>
130
+
140
131
  <InnerOptionsWrapper>
141
- <AvailableGold $disabled={availableGold === 0}>
142
- <p>Available gold</p>
143
- <p className="center">${availableGold}</p>
144
- <Button
145
- buttonType={ButtonTypes.RPGUIButton}
132
+ <SectionLabel style={{ marginBottom: '8px' }}>Your Wealth</SectionLabel>
133
+ <WealthWrapper>
134
+ <BalanceRow>
135
+ <GoldIcon>
136
+ <SpriteFromAtlas
137
+ atlasIMG={atlasIMG}
138
+ atlasJSON={atlasJSON}
139
+ spriteKey="others/gold-coin-qty-5.png"
140
+ imgScale={1.2}
141
+ />
142
+ </GoldIcon>
143
+ <BalanceAmount $disabled={availableGold === 0}>{availableGold}</BalanceAmount>
144
+ <BalanceCurrencyLabel>GOLD</BalanceCurrencyLabel>
145
+ </BalanceRow>
146
+ {dcBalance !== undefined && (
147
+ <BalanceRow>
148
+ <GoldIcon>
149
+ <SpriteFromAtlas
150
+ atlasIMG={atlasIMG}
151
+ atlasJSON={atlasJSON}
152
+ spriteKey="others/definya-coin.png"
153
+ imgScale={1.2}
154
+ />
155
+ </GoldIcon>
156
+ <BalanceAmount $disabled={false}>{dcBalance}</BalanceAmount>
157
+ <BalanceCurrencyLabel>DC</BalanceCurrencyLabel>
158
+ </BalanceRow>
159
+ )}
160
+ <SmallCTAButton
161
+ icon={<Coins width={18} height={18} />}
162
+ label="Withdraw Gold"
146
163
  disabled={availableGold === 0}
147
- onPointerDown={() => availableGold > 0 && onMoneyWithdraw()}
148
- >
149
- Withdraw
150
- </Button>
151
- </AvailableGold>
164
+ onClick={() => availableGold > 0 && onMoneyWithdraw()}
165
+ fullWidth
166
+ />
167
+ </WealthWrapper>
152
168
  </InnerOptionsWrapper>
153
169
  </OptionsWrapper>
154
170
 
155
171
  <ItemComponentScrollWrapper id="MarketContainer" ref={itemsContainer}>
156
- {items?.map(({ item, price, _id }, index) => (
172
+ {items?.map(({ item, price, _id }: IMarketplaceItem, index: number) => (
157
173
  <MarketplaceRows
158
174
  key={`${item.key}_${index}`}
159
175
  atlasIMG={atlasIMG}
@@ -175,81 +191,143 @@ const Flex = styled.div`
175
191
  align-items: center;
176
192
  `;
177
193
 
178
- const InputWrapper = styled.div`
194
+ const OptionsWrapper = styled.div`
179
195
  width: 95%;
180
- display: flex !important;
181
- justify-content: flex-start;
182
- align-items: center;
183
- margin: auto;
196
+ margin: 0 auto;
197
+ display: grid;
198
+ grid-template-columns: 2fr 1fr;
199
+ gap: 15px;
200
+ align-items: stretch;
201
+ `;
202
+
203
+ const InnerOptionsWrapper = styled.div`
204
+ background: rgba(0, 0, 0, 0.15);
205
+ border-radius: 4px;
206
+ border: 1px solid rgba(255, 255, 255, 0.05);
207
+ padding: 12px 15px;
208
+ display: flex;
209
+ flex-direction: column;
210
+ `;
211
+
212
+ const SectionLabel = styled.p`
213
+ margin: 0 0 12px 0;
214
+ font-size: 0.65rem;
215
+ color: #aaa;
216
+ text-transform: uppercase;
217
+ letter-spacing: 1px;
218
+ `;
219
+
220
+
221
+ const SellDescription = styled.p`
222
+ margin: 0;
223
+ font-size: 0.5rem;
224
+ color: #888;
225
+ text-align: right;
226
+ line-height: 1.4;
227
+ `;
228
+
229
+ const PriceInputWrapper = styled.div`
230
+ display: flex;
231
+ flex-direction: column;
232
+ flex-grow: 1;
184
233
 
185
234
  p {
186
- width: auto;
187
- margin-right: 20px;
235
+ margin: 0 0 8px 0;
236
+ font-size: 0.6rem;
237
+ color: #888;
238
+ text-transform: uppercase;
239
+ letter-spacing: 0.5px;
188
240
  }
189
241
 
190
- input {
191
- width: 68%;
192
- height: 10px;
242
+ .price-input {
243
+ width: 60px;
244
+ height: 32px;
245
+ flex-grow: 1;
246
+ font-size: 0.7rem;
247
+ }
248
+
249
+ .offer-btn {
250
+ padding: 10px 14px;
251
+ height: 32px;
193
252
  }
194
253
  `;
195
254
 
196
- const OptionsWrapper = styled.div`
197
- width: 100%;
198
- height: 100px;
255
+ const GoldIcon = styled.div`
256
+ position: relative;
199
257
  display: flex;
200
258
  align-items: center;
201
- justify-content: space-around;
259
+ justify-content: center;
260
+ width: 20px;
261
+ height: 20px;
262
+ margin-right: 4px;
263
+ flex-shrink: 0;
264
+ top: -0.5rem;
265
+ left: -0.5rem;
202
266
  `;
203
267
 
204
- const InnerOptionsWrapper = styled.div`
268
+ const WealthWrapper = styled.div`
205
269
  display: flex;
206
- justify-content: space-between;
207
270
  flex-direction: column;
208
- height: 100%;
209
- `;
210
-
211
- const ItemComponentScrollWrapper = styled.div`
212
- overflow-y: scroll;
213
- height: 390px;
214
- width: 100%;
215
- margin-top: 1rem;
271
+ gap: 8px;
272
+ flex-grow: 1;
216
273
 
217
- @media (max-width: 950px) {
218
- height: 250px;
274
+ & > :last-child {
275
+ margin-top: auto;
219
276
  }
220
277
  `;
221
278
 
222
- const PriceInputWrapper = styled.div`
223
- p {
224
- margin: 0;
225
- }
279
+ const BalanceRow = styled.div`
280
+ display: flex;
281
+ align-items: center;
282
+ justify-content: flex-end;
283
+ gap: 10px;
284
+ background: rgba(0, 0, 0, 0.3);
285
+ border-radius: 4px;
286
+ border: 1px solid rgba(255, 255, 255, 0.05);
287
+ padding: 8px 12px;
288
+ `;
226
289
 
227
- input {
228
- width: 200px;
229
- }
290
+ const BalanceAmount = styled.span<{ $disabled: boolean }>`
291
+ font-family: 'Press Start 2P', cursive;
292
+ font-size: 0.8rem;
293
+ color: ${props => props.$disabled ? uiColors.lightGray : '#fef08a'};
294
+ text-shadow: 0 2px 4px rgba(0,0,0,0.5);
295
+ margin-left: auto;
230
296
  `;
231
297
 
232
- const SellDescription = styled.p`
233
- margin: 0;
234
- font-size: ${uiFonts.size.xsmall} !important;
298
+ const BalanceCurrencyLabel = styled.span`
299
+ font-size: 0.5rem;
300
+ color: #888;
301
+ text-transform: uppercase;
302
+ letter-spacing: 0.5px;
303
+ min-width: 45px;
304
+ text-align: right;
235
305
  `;
236
306
 
237
- const AvailableGold = styled.div<{ $disabled: boolean }>`
238
- height: 100%;
239
- display: flex;
240
- flex-direction: column;
241
- justify-content: space-between;
242
307
 
243
- p {
244
- margin: 0;
245
- color: ${props =>
246
- props.$disabled ? uiColors.lightGray : 'white'} !important;
308
+ const ItemComponentScrollWrapper = styled.div`
309
+ overflow-y: scroll;
310
+ height: 335px;
311
+ width: 95%;
312
+ margin: 1rem auto 0 auto;
313
+ background: rgba(0, 0, 0, 0.2);
314
+ border: 1px solid rgba(255, 255, 255, 0.05);
315
+ border-radius: 4px;
316
+
317
+ @media (max-width: 950px) {
318
+ height: 195px;
247
319
  }
320
+ `;
248
321
 
249
- .center {
250
- text-align: center;
251
- font-size: ${uiFonts.size.large} !important;
252
- color: ${props =>
253
- props.$disabled ? uiColors.lightGray : uiColors.lightGreen} !important;
322
+ const SmallCTAButton = styled(CTAButton)`
323
+ padding: 8px 12px;
324
+ height: 32px;
325
+
326
+ span {
327
+ font-size: 0.65rem;
328
+ }
329
+
330
+ svg {
331
+ font-size: 1.1rem;
254
332
  }
255
333
  `;