@rpg-engine/long-bow 0.8.155 → 0.8.157
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/DCWallet/DCWalletContent.d.ts +27 -0
- package/dist/components/DCWallet/DCWalletModal.d.ts +2 -24
- package/dist/components/Marketplace/BuyPanel.d.ts +1 -0
- package/dist/components/Marketplace/Marketplace.d.ts +3 -0
- package/dist/components/Marketplace/MarketplaceRows.d.ts +2 -0
- package/dist/index.d.ts +1 -0
- package/dist/long-bow.cjs.development.js +159 -122
- 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 +159 -123
- package/dist/long-bow.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/DCWallet/DCHistoryPanel.tsx +32 -49
- package/src/components/DCWallet/DCWalletContent.tsx +183 -0
- package/src/components/DCWallet/DCWalletModal.tsx +6 -166
- package/src/components/Marketplace/BuyPanel.tsx +32 -27
- package/src/components/Marketplace/Marketplace.tsx +22 -1
- package/src/components/Marketplace/MarketplaceRows.tsx +16 -3
- package/src/components/shared/Tabs/Tabs.tsx +7 -6
- package/src/index.tsx +1 -0
- package/src/stories/Features/trading/Marketplace.stories.tsx +32 -1
|
@@ -12,12 +12,14 @@ import { Settings2 } from 'pixelarticons/react/Settings2';
|
|
|
12
12
|
import { ShoppingBag } from 'pixelarticons/react/ShoppingBag';
|
|
13
13
|
import { ShoppingCart } from 'pixelarticons/react/ShoppingCart';
|
|
14
14
|
import { Store } from 'pixelarticons/react/Store';
|
|
15
|
+
import { Wallet } from 'pixelarticons/react/Wallet';
|
|
15
16
|
import React, { useState } from 'react';
|
|
16
17
|
import styled from 'styled-components';
|
|
17
18
|
import { DraggableContainer } from '../DraggableContainer';
|
|
18
19
|
import { Pager } from '../Pager';
|
|
19
20
|
import { RPGUIContainerTypes } from '../RPGUI/RPGUIContainer';
|
|
20
21
|
import { Tabs } from '../shared/Tabs';
|
|
22
|
+
import { DCWalletContent, IDCWalletContentProps } from '../DCWallet/DCWalletContent';
|
|
21
23
|
import { BlueprintSearchModal } from './BlueprintSearchModal';
|
|
22
24
|
import { BuyOrderPanel } from './BuyOrderPanel';
|
|
23
25
|
import { BuyPanel } from './BuyPanel';
|
|
@@ -46,6 +48,7 @@ export interface IMarketPlaceProps {
|
|
|
46
48
|
equipmentSet?: IEquipmentSet | null;
|
|
47
49
|
onMarketPlaceItemBuy?: (marketPlaceItemId: string, paymentMethod?: MarketplacePaymentMethod) => void;
|
|
48
50
|
onFulfillBuyOrder?: (buyOrderId: string) => void;
|
|
51
|
+
onDCCoinClick?: () => void;
|
|
49
52
|
onMarketPlaceItemRemove?: (marketPlaceItemId: string) => void;
|
|
50
53
|
availableGold: number;
|
|
51
54
|
selectedItemToSell: IItem | null;
|
|
@@ -103,9 +106,12 @@ export interface IMarketPlaceProps {
|
|
|
103
106
|
historySelectedType?: string;
|
|
104
107
|
onHistoryTypeChange?: (type: string) => void;
|
|
105
108
|
onHistoryPageChange?: (page: number) => void;
|
|
109
|
+
|
|
110
|
+
// Wallet tab
|
|
111
|
+
walletProps?: IDCWalletContentProps;
|
|
106
112
|
}
|
|
107
113
|
|
|
108
|
-
type ActiveTab = 'marketplace' | 'sell' | 'buy-orders' | 'history' | 'settings';
|
|
114
|
+
type ActiveTab = 'marketplace' | 'sell' | 'buy-orders' | 'history' | 'wallet' | 'settings';
|
|
109
115
|
|
|
110
116
|
export const Marketplace: React.FC<IMarketPlaceProps> = props => {
|
|
111
117
|
const {
|
|
@@ -145,6 +151,8 @@ export const Marketplace: React.FC<IMarketPlaceProps> = props => {
|
|
|
145
151
|
historySelectedType = 'All',
|
|
146
152
|
onHistoryTypeChange,
|
|
147
153
|
onHistoryPageChange,
|
|
154
|
+
// Wallet
|
|
155
|
+
walletProps,
|
|
148
156
|
} = props;
|
|
149
157
|
|
|
150
158
|
const [activeTab, setActiveTab] = useState<ActiveTab>('marketplace');
|
|
@@ -203,6 +211,15 @@ export const Marketplace: React.FC<IMarketPlaceProps> = props => {
|
|
|
203
211
|
label: 'History',
|
|
204
212
|
icon: <Clock width={18} height={18} />,
|
|
205
213
|
},
|
|
214
|
+
...(walletProps
|
|
215
|
+
? [
|
|
216
|
+
{
|
|
217
|
+
id: 'wallet',
|
|
218
|
+
label: 'Wallet',
|
|
219
|
+
icon: <Wallet width={18} height={18} />,
|
|
220
|
+
},
|
|
221
|
+
]
|
|
222
|
+
: []),
|
|
206
223
|
{
|
|
207
224
|
id: 'settings',
|
|
208
225
|
label: 'Settings',
|
|
@@ -276,6 +293,10 @@ export const Marketplace: React.FC<IMarketPlaceProps> = props => {
|
|
|
276
293
|
/>
|
|
277
294
|
)}
|
|
278
295
|
|
|
296
|
+
{activeTab === 'wallet' && walletProps && (
|
|
297
|
+
<DCWalletContent {...walletProps} />
|
|
298
|
+
)}
|
|
299
|
+
|
|
279
300
|
{activeTab === 'settings' && (
|
|
280
301
|
<MarketplaceSettingsPanel
|
|
281
302
|
acceptedCurrency={acceptedCurrency}
|
|
@@ -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`
|
|
@@ -32,7 +32,7 @@ export const Tabs: React.FC<ITabsProps> = ({ options, activeTabId, onTabChange,
|
|
|
32
32
|
|
|
33
33
|
const TabsContainer = styled.div`
|
|
34
34
|
display: flex;
|
|
35
|
-
gap:
|
|
35
|
+
gap: 10px;
|
|
36
36
|
width: 95%;
|
|
37
37
|
margin: 0 auto 15px auto;
|
|
38
38
|
border-bottom: 2px solid rgba(255, 255, 255, 0.1);
|
|
@@ -42,18 +42,19 @@ const TabsContainer = styled.div`
|
|
|
42
42
|
const TabButton = styled.button<{ $active: boolean }>`
|
|
43
43
|
display: flex;
|
|
44
44
|
align-items: center;
|
|
45
|
-
gap:
|
|
45
|
+
gap: 5px;
|
|
46
46
|
background: transparent;
|
|
47
47
|
border: none;
|
|
48
48
|
border-bottom: ${({ $active }) => ($active ? '3px solid #f59e0b' : '3px solid transparent')};
|
|
49
49
|
color: ${({ $active }) => ($active ? '#ffffff' : '#888888')};
|
|
50
50
|
font-family: 'Press Start 2P', cursive;
|
|
51
|
-
font-size: 0.
|
|
52
|
-
letter-spacing:
|
|
51
|
+
font-size: 0.60rem;
|
|
52
|
+
letter-spacing: 0.5px;
|
|
53
53
|
cursor: pointer;
|
|
54
|
-
padding: 5px
|
|
54
|
+
padding: 5px 7px 10px 7px;
|
|
55
55
|
transition: color 0.2s, border-bottom 0.2s;
|
|
56
|
-
|
|
56
|
+
white-space: nowrap;
|
|
57
|
+
|
|
57
58
|
&:hover {
|
|
58
59
|
color: #ffffff;
|
|
59
60
|
}
|
package/src/index.tsx
CHANGED
|
@@ -11,6 +11,7 @@ export * from './components/CheckItem';
|
|
|
11
11
|
export * from './components/CircularController/CircularController';
|
|
12
12
|
export * from './components/CraftBook/CraftBook';
|
|
13
13
|
export * from './components/DailyTasks/DailyTasks';
|
|
14
|
+
export * from './components/DCWallet/DCWalletContent';
|
|
14
15
|
export * from './components/DCWallet/DCWalletModal';
|
|
15
16
|
export * from './components/LoginStreak/LoginStreakPanel';
|
|
16
17
|
export * from './components/DPad/JoystickDPad';
|
|
@@ -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
|
|
@@ -182,6 +188,31 @@ const Template: Story = () => {
|
|
|
182
188
|
onHistoryTypeChange={setHistoryType}
|
|
183
189
|
onHistoryPageChange={p => console.log('history page:', p)}
|
|
184
190
|
onActiveTabChange={tab => console.log('tab changed:', tab)}
|
|
191
|
+
// Wallet tab
|
|
192
|
+
walletProps={{
|
|
193
|
+
dcBalance: 150,
|
|
194
|
+
historyData: {
|
|
195
|
+
transactions: [
|
|
196
|
+
{ _id: 'tx-1', type: 'Purchase', amount: 100, balanceAfter: 150, createdAt: new Date(Date.now() - 1 * 86400000).toISOString() },
|
|
197
|
+
{ _id: 'tx-2', type: 'Transfer', amount: -25, balanceAfter: 50, relatedCharacterName: 'DarkKnight42', createdAt: new Date(Date.now() - 2 * 86400000).toISOString() },
|
|
198
|
+
{ _id: 'tx-3', type: 'MarketplaceSale', amount: 10, balanceAfter: 75, note: 'Angelic Sword', createdAt: new Date(Date.now() - 3 * 86400000).toISOString() },
|
|
199
|
+
{ _id: 'tx-4', type: 'StorePurchase', amount: -50, balanceAfter: 65, createdAt: new Date(Date.now() - 5 * 86400000).toISOString() },
|
|
200
|
+
{ _id: 'tx-5', type: 'Fee', amount: -2, balanceAfter: 115, createdAt: new Date(Date.now() - 7 * 86400000).toISOString() },
|
|
201
|
+
],
|
|
202
|
+
totalPages: 1,
|
|
203
|
+
currentPage: 1,
|
|
204
|
+
},
|
|
205
|
+
historyLoading: false,
|
|
206
|
+
onRequestHistory: (page, type) => console.log('wallet history:', page, type),
|
|
207
|
+
transferLoading: false,
|
|
208
|
+
transferResult: null,
|
|
209
|
+
onSendTransfer: (name, amount) => console.log('transfer:', name, amount),
|
|
210
|
+
onClearTransferResult: () => console.log('clear transfer result'),
|
|
211
|
+
characterName: 'HeroPlayer',
|
|
212
|
+
onBuyDC: () => console.log('buy DC'),
|
|
213
|
+
onSearchCharacter: (name) => console.log('search character:', name),
|
|
214
|
+
searchResults: [],
|
|
215
|
+
}}
|
|
185
216
|
/>
|
|
186
217
|
</RPGUIRoot>
|
|
187
218
|
);
|