@rpg-engine/long-bow 0.8.227 → 0.8.228
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/Marketplace/CharacterTradePanel.d.ts +28 -0
- package/dist/index.d.ts +1 -0
- package/dist/long-bow.cjs.development.js +112 -60
- 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 +112 -61
- package/dist/long-bow.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Marketplace/CharacterTradePanel.tsx +151 -0
- package/src/components/Marketplace/Marketplace.tsx +26 -93
- package/src/index.tsx +1 -0
package/package.json
CHANGED
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { ICharacter, ICharacterListing } from '@rpg-engine/shared';
|
|
2
|
+
import React, { useState } from 'react';
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
import { CharacterMarketplacePanel } from './CharacterMarketplacePanel';
|
|
5
|
+
import { MyCharacterListingsPanel } from './MyCharacterListingsPanel';
|
|
6
|
+
|
|
7
|
+
export interface ICharacterTradePanelProps {
|
|
8
|
+
characterListings: ICharacterListing[];
|
|
9
|
+
characterListingsTotal: number;
|
|
10
|
+
characterListingsPage: number;
|
|
11
|
+
characterListingsItemsPerPage: number;
|
|
12
|
+
onCharacterListingsPageChange: (page: number) => void;
|
|
13
|
+
onCharacterBuy: (listingId: string) => void;
|
|
14
|
+
characterNameFilter?: string;
|
|
15
|
+
onCharacterNameFilterChange?: (name: string) => void;
|
|
16
|
+
characterListingsLoading?: boolean;
|
|
17
|
+
myCharacterListings: ICharacterListing[];
|
|
18
|
+
myCharacterListingsTotal: number;
|
|
19
|
+
myCharacterListingsPage: number;
|
|
20
|
+
onMyCharacterListingsPageChange: (page: number) => void;
|
|
21
|
+
onCharacterDelist: (listingId: string) => void;
|
|
22
|
+
accountCharacters: ICharacter[];
|
|
23
|
+
onCharacterList: (characterId: string, price: number) => void;
|
|
24
|
+
activeCharacterId?: string;
|
|
25
|
+
atlasJSON: any;
|
|
26
|
+
atlasIMG: any;
|
|
27
|
+
characterAtlasJSON?: any;
|
|
28
|
+
characterAtlasIMG?: any;
|
|
29
|
+
enableHotkeys?: () => void;
|
|
30
|
+
disableHotkeys?: () => void;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export const CharacterTradePanel: React.FC<ICharacterTradePanelProps> = ({
|
|
34
|
+
characterListings,
|
|
35
|
+
characterListingsTotal,
|
|
36
|
+
characterListingsPage,
|
|
37
|
+
characterListingsItemsPerPage,
|
|
38
|
+
onCharacterListingsPageChange,
|
|
39
|
+
onCharacterBuy,
|
|
40
|
+
characterNameFilter,
|
|
41
|
+
onCharacterNameFilterChange,
|
|
42
|
+
characterListingsLoading,
|
|
43
|
+
myCharacterListings,
|
|
44
|
+
myCharacterListingsTotal,
|
|
45
|
+
myCharacterListingsPage,
|
|
46
|
+
onMyCharacterListingsPageChange,
|
|
47
|
+
onCharacterDelist,
|
|
48
|
+
accountCharacters,
|
|
49
|
+
onCharacterList,
|
|
50
|
+
activeCharacterId,
|
|
51
|
+
atlasJSON,
|
|
52
|
+
atlasIMG,
|
|
53
|
+
characterAtlasJSON,
|
|
54
|
+
characterAtlasIMG,
|
|
55
|
+
enableHotkeys,
|
|
56
|
+
disableHotkeys,
|
|
57
|
+
}) => {
|
|
58
|
+
const [subTab, setSubTab] = useState<'browse' | 'my-listings'>('browse');
|
|
59
|
+
|
|
60
|
+
return (
|
|
61
|
+
<>
|
|
62
|
+
<CharacterSubTabs>
|
|
63
|
+
<CharacterSubTab
|
|
64
|
+
$active={subTab === 'browse'}
|
|
65
|
+
onClick={() => setSubTab('browse')}
|
|
66
|
+
type="button"
|
|
67
|
+
>
|
|
68
|
+
Browse
|
|
69
|
+
</CharacterSubTab>
|
|
70
|
+
<CharacterSubTab
|
|
71
|
+
$active={subTab === 'my-listings'}
|
|
72
|
+
onClick={() => setSubTab('my-listings')}
|
|
73
|
+
type="button"
|
|
74
|
+
>
|
|
75
|
+
My Listings
|
|
76
|
+
</CharacterSubTab>
|
|
77
|
+
</CharacterSubTabs>
|
|
78
|
+
|
|
79
|
+
{subTab === 'browse' && (
|
|
80
|
+
<CharacterMarketplacePanel
|
|
81
|
+
characterListings={characterListings}
|
|
82
|
+
totalCount={characterListingsTotal}
|
|
83
|
+
currentPage={characterListingsPage}
|
|
84
|
+
itemsPerPage={characterListingsItemsPerPage}
|
|
85
|
+
onPageChange={onCharacterListingsPageChange}
|
|
86
|
+
onCharacterBuy={onCharacterBuy}
|
|
87
|
+
atlasJSON={atlasJSON}
|
|
88
|
+
atlasIMG={atlasIMG}
|
|
89
|
+
characterAtlasJSON={characterAtlasJSON ?? atlasJSON}
|
|
90
|
+
characterAtlasIMG={characterAtlasIMG ?? atlasIMG}
|
|
91
|
+
enableHotkeys={enableHotkeys}
|
|
92
|
+
disableHotkeys={disableHotkeys}
|
|
93
|
+
nameFilter={characterNameFilter}
|
|
94
|
+
onNameFilterChange={onCharacterNameFilterChange}
|
|
95
|
+
isLoading={characterListingsLoading}
|
|
96
|
+
/>
|
|
97
|
+
)}
|
|
98
|
+
|
|
99
|
+
{subTab === 'my-listings' && (
|
|
100
|
+
<MyCharacterListingsPanel
|
|
101
|
+
myCharacterListings={myCharacterListings}
|
|
102
|
+
totalCount={myCharacterListingsTotal}
|
|
103
|
+
currentPage={myCharacterListingsPage}
|
|
104
|
+
itemsPerPage={10}
|
|
105
|
+
onPageChange={onMyCharacterListingsPageChange}
|
|
106
|
+
onCharacterDelist={onCharacterDelist}
|
|
107
|
+
accountCharacters={accountCharacters}
|
|
108
|
+
onCharacterList={onCharacterList}
|
|
109
|
+
activeCharacterId={activeCharacterId}
|
|
110
|
+
atlasJSON={atlasJSON}
|
|
111
|
+
atlasIMG={atlasIMG}
|
|
112
|
+
characterAtlasJSON={characterAtlasJSON ?? atlasJSON}
|
|
113
|
+
characterAtlasIMG={characterAtlasIMG ?? atlasIMG}
|
|
114
|
+
enableHotkeys={enableHotkeys}
|
|
115
|
+
disableHotkeys={disableHotkeys}
|
|
116
|
+
/>
|
|
117
|
+
)}
|
|
118
|
+
</>
|
|
119
|
+
);
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
const CharacterSubTabs = styled.div`
|
|
123
|
+
display: flex;
|
|
124
|
+
gap: 8px;
|
|
125
|
+
width: 95%;
|
|
126
|
+
margin: 10px auto 0 auto;
|
|
127
|
+
padding: 8px;
|
|
128
|
+
background: rgba(0, 0, 0, 0.2);
|
|
129
|
+
border-radius: 4px;
|
|
130
|
+
border: 1px solid rgba(255, 255, 255, 0.05);
|
|
131
|
+
`;
|
|
132
|
+
|
|
133
|
+
const CharacterSubTab = styled.button<{ $active: boolean }>`
|
|
134
|
+
flex: 1;
|
|
135
|
+
padding: 8px 12px;
|
|
136
|
+
font-family: 'Press Start 2P', cursive;
|
|
137
|
+
font-size: 0.45rem;
|
|
138
|
+
border-radius: 4px;
|
|
139
|
+
border: 1px solid ${({ $active }) => ($active ? '#f59e0b' : 'rgba(255,255,255,0.12)')};
|
|
140
|
+
background: ${({ $active }) => ($active ? 'rgba(245,158,11,0.15)' : 'rgba(0,0,0,0.3)')};
|
|
141
|
+
color: ${({ $active }) => ($active ? '#f59e0b' : '#777')};
|
|
142
|
+
cursor: pointer;
|
|
143
|
+
transition: border-color 0.15s, background 0.15s, color 0.15s;
|
|
144
|
+
text-transform: uppercase;
|
|
145
|
+
letter-spacing: 0.5px;
|
|
146
|
+
|
|
147
|
+
&:hover {
|
|
148
|
+
border-color: ${({ $active }) => ($active ? '#f59e0b' : 'rgba(255,255,255,0.3)')};
|
|
149
|
+
color: ${({ $active }) => ($active ? '#f59e0b' : '#bbb')};
|
|
150
|
+
}
|
|
151
|
+
`;
|
|
@@ -30,8 +30,7 @@ import { HistoryPanel } from './HistoryPanel';
|
|
|
30
30
|
import { ManagmentPanel } from './ManagmentPanel';
|
|
31
31
|
import { MarketplacePaymentMethod } from './MarketplaceBuyModal';
|
|
32
32
|
import { MarketplaceAcceptedCurrency, MarketplaceSettingsPanel } from './MarketplaceSettingsPanel';
|
|
33
|
-
import {
|
|
34
|
-
import { MyCharacterListingsPanel } from './MyCharacterListingsPanel';
|
|
33
|
+
import { CharacterTradePanel } from './CharacterTradePanel';
|
|
35
34
|
|
|
36
35
|
export interface IMarketPlaceProps {
|
|
37
36
|
items: IMarketplaceItem[];
|
|
@@ -207,8 +206,6 @@ export const Marketplace: React.FC<IMarketPlaceProps> = props => {
|
|
|
207
206
|
const [activeTab, setActiveTab] = useState<ActiveTab>('marketplace');
|
|
208
207
|
const [acceptedCurrency, setAcceptedCurrency] = useState<MarketplaceAcceptedCurrency>(acceptedCurrencyProp ?? MarketplaceAcceptedCurrency.GoldOrDc);
|
|
209
208
|
const [isBlueprintSearchOpen, setIsBlueprintSearchOpen] = useState(false);
|
|
210
|
-
const [characterSubTab, setCharacterSubTab] = useState<'browse' | 'my-listings'>('browse');
|
|
211
|
-
|
|
212
209
|
const handleCurrencyChange = (value: MarketplaceAcceptedCurrency) => {
|
|
213
210
|
setAcceptedCurrency(value);
|
|
214
211
|
onAcceptedCurrencyChange?.(value);
|
|
@@ -292,65 +289,31 @@ export const Marketplace: React.FC<IMarketPlaceProps> = props => {
|
|
|
292
289
|
)}
|
|
293
290
|
|
|
294
291
|
{activeTab === 'characters' && (
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
{
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
onCharacterBuy={onCharacterBuy ?? (() => {})}
|
|
321
|
-
atlasJSON={props.atlasJSON}
|
|
322
|
-
atlasIMG={props.atlasIMG}
|
|
323
|
-
characterAtlasJSON={characterAtlasJSON ?? props.atlasJSON}
|
|
324
|
-
characterAtlasIMG={characterAtlasIMG ?? props.atlasIMG}
|
|
325
|
-
enableHotkeys={props.enableHotkeys}
|
|
326
|
-
disableHotkeys={props.disableHotkeys}
|
|
327
|
-
nameFilter={characterNameFilter}
|
|
328
|
-
onNameFilterChange={onCharacterNameFilterChange}
|
|
329
|
-
isLoading={characterListingsLoading}
|
|
330
|
-
/>
|
|
331
|
-
)}
|
|
332
|
-
|
|
333
|
-
{characterSubTab === 'my-listings' && (
|
|
334
|
-
<MyCharacterListingsPanel
|
|
335
|
-
myCharacterListings={myCharacterListings ?? []}
|
|
336
|
-
totalCount={myCharacterListingsTotal ?? 0}
|
|
337
|
-
currentPage={myCharacterListingsPage ?? 1}
|
|
338
|
-
itemsPerPage={10}
|
|
339
|
-
onPageChange={onMyCharacterListingsPageChange ?? (() => {})}
|
|
340
|
-
onCharacterDelist={onCharacterDelist ?? (() => {})}
|
|
341
|
-
accountCharacters={accountCharacters ?? []}
|
|
342
|
-
onCharacterList={onCharacterList ?? (() => {})}
|
|
343
|
-
activeCharacterId={props.characterId}
|
|
344
|
-
atlasJSON={props.atlasJSON}
|
|
345
|
-
atlasIMG={props.atlasIMG}
|
|
346
|
-
characterAtlasJSON={characterAtlasJSON ?? props.atlasJSON}
|
|
347
|
-
characterAtlasIMG={characterAtlasIMG ?? props.atlasIMG}
|
|
348
|
-
enableHotkeys={props.enableHotkeys}
|
|
349
|
-
disableHotkeys={props.disableHotkeys}
|
|
350
|
-
/>
|
|
351
|
-
)}
|
|
352
|
-
|
|
353
|
-
</>
|
|
292
|
+
<CharacterTradePanel
|
|
293
|
+
characterListings={characterListings ?? []}
|
|
294
|
+
characterListingsTotal={characterListingsTotal ?? 0}
|
|
295
|
+
characterListingsPage={characterListingsPage ?? 1}
|
|
296
|
+
characterListingsItemsPerPage={characterListingsItemsPerPage ?? 10}
|
|
297
|
+
onCharacterListingsPageChange={onCharacterListingsPageChange ?? (() => {})}
|
|
298
|
+
onCharacterBuy={onCharacterBuy ?? (() => {})}
|
|
299
|
+
characterNameFilter={characterNameFilter}
|
|
300
|
+
onCharacterNameFilterChange={onCharacterNameFilterChange}
|
|
301
|
+
characterListingsLoading={characterListingsLoading}
|
|
302
|
+
myCharacterListings={myCharacterListings ?? []}
|
|
303
|
+
myCharacterListingsTotal={myCharacterListingsTotal ?? 0}
|
|
304
|
+
myCharacterListingsPage={myCharacterListingsPage ?? 1}
|
|
305
|
+
onMyCharacterListingsPageChange={onMyCharacterListingsPageChange ?? (() => {})}
|
|
306
|
+
onCharacterDelist={onCharacterDelist ?? (() => {})}
|
|
307
|
+
accountCharacters={accountCharacters ?? []}
|
|
308
|
+
onCharacterList={onCharacterList ?? (() => {})}
|
|
309
|
+
activeCharacterId={props.characterId}
|
|
310
|
+
atlasJSON={props.atlasJSON}
|
|
311
|
+
atlasIMG={props.atlasIMG}
|
|
312
|
+
characterAtlasJSON={characterAtlasJSON}
|
|
313
|
+
characterAtlasIMG={characterAtlasIMG}
|
|
314
|
+
enableHotkeys={props.enableHotkeys}
|
|
315
|
+
disableHotkeys={props.disableHotkeys}
|
|
316
|
+
/>
|
|
354
317
|
)}
|
|
355
318
|
|
|
356
319
|
{activeTab === 'sell' && (
|
|
@@ -442,33 +405,3 @@ const PagerContainer = styled.div`
|
|
|
442
405
|
padding: 4px 10px;
|
|
443
406
|
`;
|
|
444
407
|
|
|
445
|
-
const CharacterSubTabs = styled.div`
|
|
446
|
-
display: flex;
|
|
447
|
-
gap: 8px;
|
|
448
|
-
width: 95%;
|
|
449
|
-
margin: 10px auto 0 auto;
|
|
450
|
-
padding: 8px;
|
|
451
|
-
background: rgba(0, 0, 0, 0.2);
|
|
452
|
-
border-radius: 4px;
|
|
453
|
-
border: 1px solid rgba(255, 255, 255, 0.05);
|
|
454
|
-
`;
|
|
455
|
-
|
|
456
|
-
const CharacterSubTab = styled.button<{ $active: boolean }>`
|
|
457
|
-
flex: 1;
|
|
458
|
-
padding: 8px 12px;
|
|
459
|
-
font-family: 'Press Start 2P', cursive;
|
|
460
|
-
font-size: 0.45rem;
|
|
461
|
-
border-radius: 4px;
|
|
462
|
-
border: 1px solid ${({ $active }) => ($active ? '#f59e0b' : 'rgba(255,255,255,0.12)')};
|
|
463
|
-
background: ${({ $active }) => ($active ? 'rgba(245,158,11,0.15)' : 'rgba(0,0,0,0.3)')};
|
|
464
|
-
color: ${({ $active }) => ($active ? '#f59e0b' : '#777')};
|
|
465
|
-
cursor: pointer;
|
|
466
|
-
transition: border-color 0.15s, background 0.15s, color 0.15s;
|
|
467
|
-
text-transform: uppercase;
|
|
468
|
-
letter-spacing: 0.5px;
|
|
469
|
-
|
|
470
|
-
&:hover {
|
|
471
|
-
border-color: ${({ $active }) => ($active ? '#f59e0b' : 'rgba(255,255,255,0.3)')};
|
|
472
|
-
color: ${({ $active }) => ($active ? '#f59e0b' : '#bbb')};
|
|
473
|
-
}
|
|
474
|
-
`;
|
package/src/index.tsx
CHANGED
|
@@ -46,6 +46,7 @@ export * from './components/Marketplace/HistoryPanel';
|
|
|
46
46
|
export * from './components/Marketplace/BlueprintSearchModal';
|
|
47
47
|
export * from './components/Marketplace/CharacterMarketplacePanel';
|
|
48
48
|
export * from './components/Marketplace/CharacterMarketplaceRows';
|
|
49
|
+
export * from './components/Marketplace/CharacterTradePanel';
|
|
49
50
|
export * from './components/Marketplace/CharacterDetailModal';
|
|
50
51
|
export * from './components/Marketplace/CharacterListingForm';
|
|
51
52
|
export * from './components/Marketplace/CharacterListingModal';
|