@rpg-engine/long-bow 0.8.155 → 0.8.156
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/BuyPanel.d.ts +1 -0
- package/dist/components/Marketplace/Marketplace.d.ts +1 -0
- package/dist/components/Marketplace/MarketplaceRows.d.ts +2 -0
- package/dist/long-bow.cjs.development.js +40 -28
- 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 +40 -28
- package/dist/long-bow.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Marketplace/BuyPanel.tsx +32 -27
- package/src/components/Marketplace/Marketplace.tsx +1 -0
- package/src/components/Marketplace/MarketplaceRows.tsx +16 -3
- package/src/stories/Features/trading/Marketplace.stories.tsx +7 -1
package/package.json
CHANGED
|
@@ -19,7 +19,7 @@ import { MarketplaceBuyModal, MarketplacePaymentMethod } from './MarketplaceBuyM
|
|
|
19
19
|
import { GroupedMarketplaceRow } from './MarketplaceRows';
|
|
20
20
|
import { itemRarityOptions, itemTypeOptions, orderByOptions } from './filters';
|
|
21
21
|
|
|
22
|
-
type MarketplaceBrowseMode = '
|
|
22
|
+
type MarketplaceBrowseMode = 'sell' | 'buy';
|
|
23
23
|
|
|
24
24
|
const BUY_REQUESTS_PER_PAGE = 5;
|
|
25
25
|
|
|
@@ -48,6 +48,7 @@ export interface IBuyPanelProps {
|
|
|
48
48
|
equipmentSet?: IEquipmentSet | null;
|
|
49
49
|
onMarketPlaceItemBuy?: (marketPlaceItemId: string, paymentMethod?: MarketplacePaymentMethod) => void;
|
|
50
50
|
onFulfillBuyOrder?: (buyOrderId: string) => void;
|
|
51
|
+
onDCCoinClick?: () => void;
|
|
51
52
|
characterId: string;
|
|
52
53
|
enableHotkeys?: () => void;
|
|
53
54
|
disableHotkeys?: () => void;
|
|
@@ -78,6 +79,7 @@ export const BuyPanel: React.FC<IBuyPanelProps> = ({
|
|
|
78
79
|
equipmentSet,
|
|
79
80
|
onMarketPlaceItemBuy,
|
|
80
81
|
onFulfillBuyOrder,
|
|
82
|
+
onDCCoinClick,
|
|
81
83
|
characterId,
|
|
82
84
|
enableHotkeys,
|
|
83
85
|
disableHotkeys,
|
|
@@ -96,7 +98,7 @@ export const BuyPanel: React.FC<IBuyPanelProps> = ({
|
|
|
96
98
|
}) => {
|
|
97
99
|
const [name, setName] = useState('');
|
|
98
100
|
const [showFilters, setShowFilters] = useState(false);
|
|
99
|
-
const [browseMode, setBrowseMode] = useState<MarketplaceBrowseMode>('
|
|
101
|
+
const [browseMode, setBrowseMode] = useState<MarketplaceBrowseMode>('sell');
|
|
100
102
|
const [selectedRarity, setSelectedRarity] = useState('');
|
|
101
103
|
const [mainLevel, setMainLevel] = useState<
|
|
102
104
|
[number | undefined, number | undefined]
|
|
@@ -171,8 +173,8 @@ export const BuyPanel: React.FC<IBuyPanelProps> = ({
|
|
|
171
173
|
});
|
|
172
174
|
}, [name, openBuyOrders, price, selectedRarity]);
|
|
173
175
|
|
|
174
|
-
const showSellSection = browseMode === '
|
|
175
|
-
const showBuySection = browseMode === '
|
|
176
|
+
const showSellSection = browseMode === 'sell';
|
|
177
|
+
const showBuySection = browseMode === 'buy';
|
|
176
178
|
const hasVisibleContent =
|
|
177
179
|
(showSellSection && groupedItems.length > 0) ||
|
|
178
180
|
(showBuySection && visibleBuyOrders.length > 0);
|
|
@@ -220,7 +222,6 @@ export const BuyPanel: React.FC<IBuyPanelProps> = ({
|
|
|
220
222
|
activeId={browseMode}
|
|
221
223
|
onChange={value => setBrowseMode(value as MarketplaceBrowseMode)}
|
|
222
224
|
options={[
|
|
223
|
-
{ id: 'all', label: 'All' },
|
|
224
225
|
{ id: 'sell', label: 'Sell Offers' },
|
|
225
226
|
{ id: 'buy', label: 'Buy Requests' },
|
|
226
227
|
]}
|
|
@@ -404,19 +405,10 @@ export const BuyPanel: React.FC<IBuyPanelProps> = ({
|
|
|
404
405
|
getDCEquivalentPrice={getDCEquivalentPrice}
|
|
405
406
|
characterId={characterId}
|
|
406
407
|
onBuy={setBuyingItemId}
|
|
408
|
+
onDCCoinClick={onDCCoinClick}
|
|
407
409
|
/>
|
|
408
410
|
))
|
|
409
411
|
)}
|
|
410
|
-
{totalItems > itemsPerPage && (
|
|
411
|
-
<SectionPager>
|
|
412
|
-
<Pager
|
|
413
|
-
totalItems={totalItems}
|
|
414
|
-
currentPage={currentPage}
|
|
415
|
-
itemsPerPage={itemsPerPage}
|
|
416
|
-
onPageChange={onPageChange}
|
|
417
|
-
/>
|
|
418
|
-
</SectionPager>
|
|
419
|
-
)}
|
|
420
412
|
</MarketSection>
|
|
421
413
|
)}
|
|
422
414
|
|
|
@@ -440,21 +432,30 @@ export const BuyPanel: React.FC<IBuyPanelProps> = ({
|
|
|
440
432
|
/>
|
|
441
433
|
))
|
|
442
434
|
)}
|
|
443
|
-
{openBuyOrdersTotal > BUY_REQUESTS_PER_PAGE && (
|
|
444
|
-
<SectionPager>
|
|
445
|
-
<Pager
|
|
446
|
-
totalItems={openBuyOrdersTotal}
|
|
447
|
-
currentPage={openBuyOrdersPage}
|
|
448
|
-
itemsPerPage={BUY_REQUESTS_PER_PAGE}
|
|
449
|
-
onPageChange={onOpenBuyOrdersPageChange ?? (() => {})}
|
|
450
|
-
/>
|
|
451
|
-
</SectionPager>
|
|
452
|
-
)}
|
|
453
435
|
</MarketSection>
|
|
454
436
|
)}
|
|
455
437
|
</>
|
|
456
438
|
)}
|
|
457
439
|
</ItemComponentScrollWrapper>
|
|
440
|
+
|
|
441
|
+
<PagerFooter>
|
|
442
|
+
{showSellSection && totalItems > itemsPerPage && (
|
|
443
|
+
<Pager
|
|
444
|
+
totalItems={totalItems}
|
|
445
|
+
currentPage={currentPage}
|
|
446
|
+
itemsPerPage={itemsPerPage}
|
|
447
|
+
onPageChange={onPageChange}
|
|
448
|
+
/>
|
|
449
|
+
)}
|
|
450
|
+
{showBuySection && openBuyOrdersTotal > BUY_REQUESTS_PER_PAGE && (
|
|
451
|
+
<Pager
|
|
452
|
+
totalItems={openBuyOrdersTotal}
|
|
453
|
+
currentPage={openBuyOrdersPage}
|
|
454
|
+
itemsPerPage={BUY_REQUESTS_PER_PAGE}
|
|
455
|
+
onPageChange={onOpenBuyOrdersPageChange ?? (() => {})}
|
|
456
|
+
/>
|
|
457
|
+
)}
|
|
458
|
+
</PagerFooter>
|
|
458
459
|
</>
|
|
459
460
|
);
|
|
460
461
|
};
|
|
@@ -637,10 +638,14 @@ const SectionEmpty = styled.div`
|
|
|
637
638
|
`;
|
|
638
639
|
|
|
639
640
|
|
|
640
|
-
const
|
|
641
|
+
const PagerFooter = styled.div`
|
|
641
642
|
display: flex;
|
|
642
643
|
justify-content: center;
|
|
643
|
-
|
|
644
|
+
align-items: center;
|
|
645
|
+
padding: 8px 0 4px;
|
|
646
|
+
min-height: 36px;
|
|
647
|
+
width: 95%;
|
|
648
|
+
margin: 0 auto;
|
|
644
649
|
`;
|
|
645
650
|
|
|
646
651
|
const StyledDropdown = styled(Dropdown)`
|
|
@@ -46,6 +46,7 @@ export interface IMarketPlaceProps {
|
|
|
46
46
|
equipmentSet?: IEquipmentSet | null;
|
|
47
47
|
onMarketPlaceItemBuy?: (marketPlaceItemId: string, paymentMethod?: MarketplacePaymentMethod) => void;
|
|
48
48
|
onFulfillBuyOrder?: (buyOrderId: string) => void;
|
|
49
|
+
onDCCoinClick?: () => void;
|
|
49
50
|
onMarketPlaceItemRemove?: (marketPlaceItemId: string) => void;
|
|
50
51
|
availableGold: number;
|
|
51
52
|
selectedItemToSell: IItem | null;
|
|
@@ -28,6 +28,7 @@ export interface IMarketPlaceRowsPropos {
|
|
|
28
28
|
scale?: number;
|
|
29
29
|
onMarketPlaceItemBuy?: () => void;
|
|
30
30
|
onMarketPlaceItemRemove?: () => void;
|
|
31
|
+
onDCCoinClick?: () => void;
|
|
31
32
|
disabled?: boolean;
|
|
32
33
|
}
|
|
33
34
|
|
|
@@ -41,6 +42,7 @@ export const MarketplaceRows: React.FC<IMarketPlaceRowsPropos> = ({
|
|
|
41
42
|
scale,
|
|
42
43
|
onMarketPlaceItemBuy,
|
|
43
44
|
onMarketPlaceItemRemove,
|
|
45
|
+
onDCCoinClick,
|
|
44
46
|
disabled,
|
|
45
47
|
}) => {
|
|
46
48
|
const renderGems = (item: IItem) => {
|
|
@@ -105,9 +107,9 @@ export const MarketplaceRows: React.FC<IMarketPlaceRowsPropos> = ({
|
|
|
105
107
|
<GoldPrice>{itemPrice}</GoldPrice>
|
|
106
108
|
</GoldPriceRow>
|
|
107
109
|
{dcEquivalentPrice !== undefined && (
|
|
108
|
-
<DCPriceRow>
|
|
110
|
+
<DCPriceRow $clickable={!!onDCCoinClick} onPointerDown={onDCCoinClick}>
|
|
109
111
|
<DCCoinWrapper>
|
|
110
|
-
<SimpleTooltip content=
|
|
112
|
+
<SimpleTooltip content={onDCCoinClick ? 'Buy Definya Coin' : 'Definya Coin'} direction="top">
|
|
111
113
|
<SpriteFromAtlas
|
|
112
114
|
atlasIMG={atlasIMG}
|
|
113
115
|
atlasJSON={atlasJSON}
|
|
@@ -150,6 +152,7 @@ export interface IGroupedMarketplaceRowProps {
|
|
|
150
152
|
getDCEquivalentPrice: (goldPrice: number) => number;
|
|
151
153
|
characterId: string;
|
|
152
154
|
onBuy: (id: string) => void;
|
|
155
|
+
onDCCoinClick?: () => void;
|
|
153
156
|
}
|
|
154
157
|
|
|
155
158
|
export const GroupedMarketplaceRow: React.FC<IGroupedMarketplaceRowProps> = ({
|
|
@@ -162,6 +165,7 @@ export const GroupedMarketplaceRow: React.FC<IGroupedMarketplaceRowProps> = ({
|
|
|
162
165
|
getDCEquivalentPrice,
|
|
163
166
|
characterId,
|
|
164
167
|
onBuy,
|
|
168
|
+
onDCCoinClick,
|
|
165
169
|
}) => {
|
|
166
170
|
const [expanded, setExpanded] = useState(false);
|
|
167
171
|
const totalOffers = otherListings.length + 1;
|
|
@@ -185,6 +189,7 @@ export const GroupedMarketplaceRow: React.FC<IGroupedMarketplaceRowProps> = ({
|
|
|
185
189
|
}
|
|
186
190
|
equipmentSet={equipmentSet}
|
|
187
191
|
onMarketPlaceItemBuy={() => onBuy(bestListing._id)}
|
|
192
|
+
onDCCoinClick={onDCCoinClick}
|
|
188
193
|
disabled={bestListing.owner === characterId}
|
|
189
194
|
/>
|
|
190
195
|
{hasMultiple && (
|
|
@@ -211,6 +216,7 @@ export const GroupedMarketplaceRow: React.FC<IGroupedMarketplaceRowProps> = ({
|
|
|
211
216
|
}
|
|
212
217
|
equipmentSet={equipmentSet}
|
|
213
218
|
onMarketPlaceItemBuy={() => onBuy(listing._id)}
|
|
219
|
+
onDCCoinClick={onDCCoinClick}
|
|
214
220
|
disabled={listing.owner === characterId}
|
|
215
221
|
/>
|
|
216
222
|
))}
|
|
@@ -347,11 +353,18 @@ const GoldPrice = styled.span`
|
|
|
347
353
|
line-height: 1;
|
|
348
354
|
`;
|
|
349
355
|
|
|
350
|
-
const DCPriceRow = styled.div
|
|
356
|
+
const DCPriceRow = styled.div<{ $clickable?: boolean }>`
|
|
351
357
|
display: flex;
|
|
352
358
|
align-items: center;
|
|
353
359
|
gap: 0.3rem;
|
|
354
360
|
margin-left: 0.5rem;
|
|
361
|
+
cursor: ${({ $clickable }) => ($clickable ? 'pointer' : 'default')};
|
|
362
|
+
border-radius: 4px;
|
|
363
|
+
transition: opacity 0.15s;
|
|
364
|
+
|
|
365
|
+
&:hover {
|
|
366
|
+
opacity: ${({ $clickable }) => ($clickable ? '0.75' : '1')};
|
|
367
|
+
}
|
|
355
368
|
`;
|
|
356
369
|
|
|
357
370
|
const DCCoinWrapper = styled.span`
|
|
@@ -46,6 +46,11 @@ const mockOpenBuyOrders: IMarketplaceBuyOrderItem[] = [
|
|
|
46
46
|
{ _id: 'obo-1', owner: 'player-2', itemBlueprintKey: 'items/abyssal-tide-staff', itemRarity: 'Epic', maxPrice: 1500, escrowedGold: 1500, fee: 75, status: MarketplaceBuyOrderStatus.Active, createdAt: daysAgo(1), updatedAt: daysAgo(1) },
|
|
47
47
|
{ _id: 'obo-2', owner: 'player-3', itemBlueprintKey: 'items/wooden-shield', maxPrice: 200, escrowedGold: 200, fee: 10, status: MarketplaceBuyOrderStatus.Active, createdAt: daysAgo(5), updatedAt: daysAgo(5) },
|
|
48
48
|
{ _id: 'obo-3', owner: 'player-4', itemBlueprintKey: 'items/fire-wand', itemRarity: 'Rare', maxPrice: 800, escrowedGold: 800, fee: 40, status: MarketplaceBuyOrderStatus.Active, createdAt: daysAgo(2), updatedAt: daysAgo(2) },
|
|
49
|
+
{ _id: 'obo-4', owner: 'player-5', itemBlueprintKey: 'items/broad-sword', maxPrice: 350, escrowedGold: 350, fee: 17, status: MarketplaceBuyOrderStatus.Active, createdAt: daysAgo(3), updatedAt: daysAgo(3) },
|
|
50
|
+
{ _id: 'obo-5', owner: 'player-6', itemBlueprintKey: 'items/barbarian-helmet', itemRarity: 'Uncommon', maxPrice: 600, escrowedGold: 600, fee: 30, status: MarketplaceBuyOrderStatus.Active, createdAt: daysAgo(1), updatedAt: daysAgo(1) },
|
|
51
|
+
{ _id: 'obo-6', owner: 'player-7', itemBlueprintKey: 'items/leather-armor', maxPrice: 420, escrowedGold: 420, fee: 21, status: MarketplaceBuyOrderStatus.Active, createdAt: daysAgo(4), updatedAt: daysAgo(4) },
|
|
52
|
+
{ _id: 'obo-7', owner: 'player-8', itemBlueprintKey: 'items/angelic-sword', itemRarity: 'Legendary', maxPrice: 5000, escrowedGold: 5000, fee: 250, status: MarketplaceBuyOrderStatus.Active, createdAt: daysAgo(6), updatedAt: daysAgo(6) },
|
|
53
|
+
{ _id: 'obo-8', owner: 'player-9', itemBlueprintKey: 'items/greater-life-potion', maxPrice: 90, stackQty: 10, escrowedGold: 900, fee: 45, status: MarketplaceBuyOrderStatus.Active, createdAt: daysAgo(2), updatedAt: daysAgo(2) },
|
|
49
54
|
];
|
|
50
55
|
|
|
51
56
|
const mockTransactions: IMarketplaceTransaction[] = [
|
|
@@ -111,6 +116,7 @@ const Template: Story = () => {
|
|
|
111
116
|
}))}
|
|
112
117
|
equipmentSet={equipmentSetMock}
|
|
113
118
|
onMarketPlaceItemBuy={tradeId => console.log(tradeId)}
|
|
119
|
+
onDCCoinClick={() => console.log('open store: packs tab')}
|
|
114
120
|
onFulfillBuyOrder={buyOrderId => console.log('fulfill buy order:', buyOrderId)}
|
|
115
121
|
availableGold={0}
|
|
116
122
|
selectedItemToSell={null}
|
|
@@ -163,7 +169,7 @@ const Template: Story = () => {
|
|
|
163
169
|
onYourBuyOrdersPageChange={p => console.log('your orders page:', p)}
|
|
164
170
|
onCancelBuyOrder={id => setYourBuyOrders(prev => prev.filter(o => o._id !== id))}
|
|
165
171
|
openBuyOrders={mockOpenBuyOrders}
|
|
166
|
-
openBuyOrdersTotal={mockOpenBuyOrders.length}
|
|
172
|
+
openBuyOrdersTotal={mockOpenBuyOrders.length} // 8 items → pagination shows (page size = 5)
|
|
167
173
|
openBuyOrdersPage={1}
|
|
168
174
|
onOpenBuyOrdersPageChange={(p: number) => console.log('open orders page:', p)}
|
|
169
175
|
// Blueprint Search props
|