@rpg-engine/long-bow 0.4.6 → 0.4.8
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/ConfirmModal.d.ts +8 -0
- package/dist/components/DraggableContainer.d.ts +1 -0
- package/dist/components/Item/Inventory/ItemSlot.d.ts +7 -7
- package/dist/components/Marketplace/BuyPanel.d.ts +22 -0
- package/dist/components/Marketplace/ManagmentPanel.d.ts +18 -0
- package/dist/components/Marketplace/Marketplace.d.ts +22 -9
- package/dist/components/Marketplace/MarketplaceRows.d.ts +3 -1
- package/dist/components/Marketplace/{__mocks__ → filters}/index.d.ts +1 -3
- package/dist/components/Pager.d.ts +9 -0
- package/dist/components/SkillProgressBar.d.ts +1 -0
- package/dist/long-bow.cjs.development.js +552 -147
- 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 +552 -147
- package/dist/long-bow.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/components/ConfirmModal.tsx +87 -0
- package/src/components/DraggableContainer.tsx +3 -0
- package/src/components/Dropdown.tsx +14 -6
- package/src/components/Item/Inventory/ItemSlot.tsx +31 -16
- package/src/components/Marketplace/BuyPanel.tsx +296 -0
- package/src/components/Marketplace/ManagmentPanel.tsx +247 -0
- package/src/components/Marketplace/Marketplace.tsx +74 -100
- package/src/components/Marketplace/MarketplaceRows.tsx +82 -92
- package/src/components/Marketplace/{__mocks__ → filters}/index.tsx +13 -11
- package/src/components/Pager.tsx +94 -0
- package/src/components/SkillProgressBar.tsx +69 -4
- package/src/components/SkillsContainer.tsx +1 -0
- package/src/components/Spellbook/Spell.tsx +0 -1
- package/src/components/Spellbook/Spellbook.tsx +1 -17
- package/src/components/Spellbook/mockSpells.ts +68 -68
- package/src/components/shared/Ellipsis.tsx +10 -2
- package/src/mocks/skills.mocks.ts +2 -0
- package/src/stories/Marketplace.stories.tsx +22 -11
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
import { IEquipmentSet, IItem, IMarketplaceItem } from '@rpg-engine/shared';
|
|
2
|
+
import React, { useState } from 'react';
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
import { uiColors } from '../../constants/uiColors';
|
|
5
|
+
import { uiFonts } from '../../constants/uiFonts';
|
|
6
|
+
import { Button, ButtonTypes } from '../Button';
|
|
7
|
+
import { ConfirmModal } from '../ConfirmModal';
|
|
8
|
+
import { Input } from '../Input';
|
|
9
|
+
import { ItemSlot } from '../Item/Inventory/ItemSlot';
|
|
10
|
+
import { MarketplaceRows } from './MarketplaceRows';
|
|
11
|
+
|
|
12
|
+
export interface IManagmentPanelProps {
|
|
13
|
+
items: IMarketplaceItem[];
|
|
14
|
+
atlasJSON: any;
|
|
15
|
+
atlasIMG: any;
|
|
16
|
+
onChangeNameInput: (value: string) => void;
|
|
17
|
+
equipmentSet?: IEquipmentSet | null;
|
|
18
|
+
availableGold: number;
|
|
19
|
+
onMarketPlaceItemRemove?: (marketPlaceItemId: string) => void;
|
|
20
|
+
selectedItemToSell: IItem | null;
|
|
21
|
+
onSelectedItemToSellRemove: (item: IItem) => void;
|
|
22
|
+
onAddItemToMarketplace: (item: IItem, price: number) => void;
|
|
23
|
+
enableHotkeys?: () => void;
|
|
24
|
+
disableHotkeys?: () => void;
|
|
25
|
+
onMoneyWithdraw: () => void;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const ManagmentPanel: React.FC<IManagmentPanelProps> = ({
|
|
29
|
+
items,
|
|
30
|
+
atlasIMG,
|
|
31
|
+
atlasJSON,
|
|
32
|
+
onChangeNameInput,
|
|
33
|
+
equipmentSet,
|
|
34
|
+
availableGold,
|
|
35
|
+
onMarketPlaceItemRemove,
|
|
36
|
+
selectedItemToSell,
|
|
37
|
+
onSelectedItemToSellRemove,
|
|
38
|
+
onAddItemToMarketplace,
|
|
39
|
+
enableHotkeys,
|
|
40
|
+
disableHotkeys,
|
|
41
|
+
onMoneyWithdraw,
|
|
42
|
+
}) => {
|
|
43
|
+
const [name, setName] = useState('');
|
|
44
|
+
const [price, setPrice] = useState('');
|
|
45
|
+
const [isCreatingOffer, setIsCreatingOffer] = useState(false);
|
|
46
|
+
const [removingItemId, setRemovingItemId] = useState<string | null>(null);
|
|
47
|
+
|
|
48
|
+
return (
|
|
49
|
+
<>
|
|
50
|
+
{isCreatingOffer && (
|
|
51
|
+
<ConfirmModal
|
|
52
|
+
onClose={setIsCreatingOffer.bind(null, false)}
|
|
53
|
+
onConfirm={() => {
|
|
54
|
+
if (selectedItemToSell && price && Number(price)) {
|
|
55
|
+
onAddItemToMarketplace(selectedItemToSell, Number(price));
|
|
56
|
+
setPrice('');
|
|
57
|
+
onSelectedItemToSellRemove(selectedItemToSell);
|
|
58
|
+
setIsCreatingOffer(false);
|
|
59
|
+
enableHotkeys?.();
|
|
60
|
+
}
|
|
61
|
+
}}
|
|
62
|
+
message="Are you sure to create this offer?"
|
|
63
|
+
/>
|
|
64
|
+
)}
|
|
65
|
+
{removingItemId && (
|
|
66
|
+
<ConfirmModal
|
|
67
|
+
onClose={setRemovingItemId.bind(null, null)}
|
|
68
|
+
onConfirm={() => {
|
|
69
|
+
onMarketPlaceItemRemove?.(removingItemId);
|
|
70
|
+
setRemovingItemId(null);
|
|
71
|
+
enableHotkeys?.();
|
|
72
|
+
}}
|
|
73
|
+
message="Are you sure to remove this item?"
|
|
74
|
+
/>
|
|
75
|
+
)}
|
|
76
|
+
<InputWrapper>
|
|
77
|
+
<p>Search By Name</p>
|
|
78
|
+
<Input
|
|
79
|
+
onChange={e => {
|
|
80
|
+
setName(e.target.value);
|
|
81
|
+
onChangeNameInput(e.target.value);
|
|
82
|
+
}}
|
|
83
|
+
value={name}
|
|
84
|
+
placeholder="Enter name..."
|
|
85
|
+
onBlur={enableHotkeys}
|
|
86
|
+
onFocus={disableHotkeys}
|
|
87
|
+
/>
|
|
88
|
+
</InputWrapper>
|
|
89
|
+
|
|
90
|
+
<OptionsWrapper>
|
|
91
|
+
<InnerOptionsWrapper>
|
|
92
|
+
<SellDescription>
|
|
93
|
+
Click on item in inventory to sell it
|
|
94
|
+
</SellDescription>
|
|
95
|
+
<Flex>
|
|
96
|
+
<ItemSlot
|
|
97
|
+
slotIndex={0}
|
|
98
|
+
atlasIMG={atlasIMG}
|
|
99
|
+
atlasJSON={atlasJSON}
|
|
100
|
+
onPointerDown={(_, __, item) => onSelectedItemToSellRemove(item)}
|
|
101
|
+
item={selectedItemToSell}
|
|
102
|
+
/>
|
|
103
|
+
<PriceInputWrapper>
|
|
104
|
+
<p>Enter price</p>
|
|
105
|
+
<Flex>
|
|
106
|
+
<Input
|
|
107
|
+
onChange={e => {
|
|
108
|
+
setPrice(e.target.value);
|
|
109
|
+
}}
|
|
110
|
+
value={price}
|
|
111
|
+
placeholder="Enter price..."
|
|
112
|
+
type="number"
|
|
113
|
+
disabled={!selectedItemToSell}
|
|
114
|
+
onBlur={enableHotkeys}
|
|
115
|
+
onFocus={disableHotkeys}
|
|
116
|
+
/>
|
|
117
|
+
<Button
|
|
118
|
+
buttonType={ButtonTypes.RPGUIButton}
|
|
119
|
+
disabled={!selectedItemToSell || !price}
|
|
120
|
+
onPointerDown={() => {
|
|
121
|
+
if (selectedItemToSell && price && Number(price)) {
|
|
122
|
+
setIsCreatingOffer(true);
|
|
123
|
+
}
|
|
124
|
+
}}
|
|
125
|
+
>
|
|
126
|
+
Create offer
|
|
127
|
+
</Button>
|
|
128
|
+
</Flex>
|
|
129
|
+
</PriceInputWrapper>
|
|
130
|
+
</Flex>
|
|
131
|
+
</InnerOptionsWrapper>
|
|
132
|
+
<InnerOptionsWrapper>
|
|
133
|
+
<AvailableGold $disabled={availableGold === 0}>
|
|
134
|
+
<p>Available gold</p>
|
|
135
|
+
<p className="center">${availableGold}</p>
|
|
136
|
+
<Button
|
|
137
|
+
buttonType={ButtonTypes.RPGUIButton}
|
|
138
|
+
disabled={availableGold === 0}
|
|
139
|
+
onPointerDown={() => availableGold > 0 && onMoneyWithdraw()}
|
|
140
|
+
>
|
|
141
|
+
Withdraw
|
|
142
|
+
</Button>
|
|
143
|
+
</AvailableGold>
|
|
144
|
+
</InnerOptionsWrapper>
|
|
145
|
+
</OptionsWrapper>
|
|
146
|
+
|
|
147
|
+
<ItemComponentScrollWrapper id="MarketContainer">
|
|
148
|
+
{items?.map(({ item, price, _id }, index) => (
|
|
149
|
+
<MarketplaceRows
|
|
150
|
+
key={`${item.key}_${index}`}
|
|
151
|
+
atlasIMG={atlasIMG}
|
|
152
|
+
atlasJSON={atlasJSON}
|
|
153
|
+
item={item}
|
|
154
|
+
itemPrice={price}
|
|
155
|
+
equipmentSet={equipmentSet}
|
|
156
|
+
onMarketPlaceItemRemove={setRemovingItemId.bind(null, _id)}
|
|
157
|
+
/>
|
|
158
|
+
))}
|
|
159
|
+
</ItemComponentScrollWrapper>
|
|
160
|
+
</>
|
|
161
|
+
);
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
const Flex = styled.div`
|
|
165
|
+
display: flex;
|
|
166
|
+
gap: 5px;
|
|
167
|
+
align-items: center;
|
|
168
|
+
`;
|
|
169
|
+
|
|
170
|
+
const InputWrapper = styled.div`
|
|
171
|
+
width: 95%;
|
|
172
|
+
display: flex !important;
|
|
173
|
+
justify-content: flex-start;
|
|
174
|
+
align-items: center;
|
|
175
|
+
margin: auto;
|
|
176
|
+
|
|
177
|
+
p {
|
|
178
|
+
width: auto;
|
|
179
|
+
margin-right: 20px;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
input {
|
|
183
|
+
width: 68%;
|
|
184
|
+
height: 10px;
|
|
185
|
+
}
|
|
186
|
+
`;
|
|
187
|
+
|
|
188
|
+
const OptionsWrapper = styled.div`
|
|
189
|
+
width: 100%;
|
|
190
|
+
height: 100px;
|
|
191
|
+
display: flex;
|
|
192
|
+
align-items: center;
|
|
193
|
+
justify-content: space-around;
|
|
194
|
+
`;
|
|
195
|
+
|
|
196
|
+
const InnerOptionsWrapper = styled.div`
|
|
197
|
+
display: flex;
|
|
198
|
+
justify-content: space-between;
|
|
199
|
+
flex-direction: column;
|
|
200
|
+
height: 100%;
|
|
201
|
+
`;
|
|
202
|
+
|
|
203
|
+
const ItemComponentScrollWrapper = styled.div`
|
|
204
|
+
overflow-y: scroll;
|
|
205
|
+
height: 390px;
|
|
206
|
+
width: 100%;
|
|
207
|
+
margin-top: 1rem;
|
|
208
|
+
|
|
209
|
+
@media (max-width: 950px) {
|
|
210
|
+
height: 250px;
|
|
211
|
+
}
|
|
212
|
+
`;
|
|
213
|
+
|
|
214
|
+
const PriceInputWrapper = styled.div`
|
|
215
|
+
p {
|
|
216
|
+
margin: 0;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
input {
|
|
220
|
+
width: 200px;
|
|
221
|
+
}
|
|
222
|
+
`;
|
|
223
|
+
|
|
224
|
+
const SellDescription = styled.p`
|
|
225
|
+
margin: 0;
|
|
226
|
+
font-size: ${uiFonts.size.xsmall} !important;
|
|
227
|
+
`;
|
|
228
|
+
|
|
229
|
+
const AvailableGold = styled.div<{ $disabled: boolean }>`
|
|
230
|
+
height: 100%;
|
|
231
|
+
display: flex;
|
|
232
|
+
flex-direction: column;
|
|
233
|
+
justify-content: space-between;
|
|
234
|
+
|
|
235
|
+
p {
|
|
236
|
+
margin: 0;
|
|
237
|
+
color: ${props =>
|
|
238
|
+
props.$disabled ? uiColors.lightGray : 'white'} !important;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
.center {
|
|
242
|
+
text-align: center;
|
|
243
|
+
font-size: ${uiFonts.size.large} !important;
|
|
244
|
+
color: ${props =>
|
|
245
|
+
props.$disabled ? uiColors.lightGray : uiColors.lightGreen} !important;
|
|
246
|
+
}
|
|
247
|
+
`;
|
|
@@ -1,45 +1,53 @@
|
|
|
1
|
-
import { IEquipmentSet, IItem } from '@rpg-engine/shared';
|
|
2
|
-
import React, {
|
|
1
|
+
import { IEquipmentSet, IItem, IMarketplaceItem } from '@rpg-engine/shared';
|
|
2
|
+
import React, { useState } from 'react';
|
|
3
3
|
import styled from 'styled-components';
|
|
4
|
+
import { Button, ButtonTypes } from '../Button';
|
|
4
5
|
import { DraggableContainer } from '../DraggableContainer';
|
|
5
|
-
import {
|
|
6
|
-
import { Input } from '../Input';
|
|
6
|
+
import { Pager } from '../Pager';
|
|
7
7
|
import { RPGUIContainerTypes } from '../RPGUIContainer';
|
|
8
|
-
import {
|
|
8
|
+
import { BuyPanel } from './BuyPanel';
|
|
9
|
+
import { ManagmentPanel } from './ManagmentPanel';
|
|
9
10
|
|
|
10
11
|
export interface IMarketPlaceProps {
|
|
11
|
-
items:
|
|
12
|
+
items: IMarketplaceItem[];
|
|
12
13
|
atlasJSON: any;
|
|
13
14
|
atlasIMG: any;
|
|
14
|
-
optionsType: IOptionsProps[];
|
|
15
|
-
optionsRarity: IOptionsProps[];
|
|
16
|
-
optionsPrice: IOptionsProps[];
|
|
17
15
|
onClose: () => void;
|
|
18
16
|
onChangeType: (value: string) => void;
|
|
19
17
|
onChangeRarity: (value: string) => void;
|
|
20
18
|
onChangeOrder: (value: string) => void;
|
|
21
|
-
onChangeNameInput: (
|
|
19
|
+
onChangeNameInput: (value: string) => void;
|
|
20
|
+
onChangeMainLevelInput: (
|
|
21
|
+
value: [number | undefined, number | undefined]
|
|
22
|
+
) => void;
|
|
23
|
+
onChangeSecondaryLevelInput: (
|
|
24
|
+
value: [number | undefined, number | undefined]
|
|
25
|
+
) => void;
|
|
26
|
+
onChangePriceInput: (value: [number | undefined, number | undefined]) => void;
|
|
22
27
|
scale?: number;
|
|
23
28
|
equipmentSet?: IEquipmentSet | null;
|
|
24
|
-
|
|
29
|
+
onMarketPlaceItemBuy?: (marketPlaceItemId: string) => void;
|
|
30
|
+
onMarketPlaceItemRemove?: (marketPlaceItemId: string) => void;
|
|
31
|
+
availableGold: number;
|
|
32
|
+
selectedItemToSell: IItem | null;
|
|
33
|
+
onSelectedItemToSellRemove: (item: IItem) => void;
|
|
34
|
+
onYourPanelToggle: (yourPanel: boolean) => void;
|
|
35
|
+
onAddItemToMarketplace: (item: IItem, price: number) => void;
|
|
36
|
+
characterId: string;
|
|
37
|
+
enableHotkeys?: () => void;
|
|
38
|
+
disableHotkeys?: () => void;
|
|
39
|
+
onMoneyWithdraw: () => void;
|
|
40
|
+
totalItems: number;
|
|
41
|
+
currentPage: number;
|
|
42
|
+
itemsPerPage: number;
|
|
43
|
+
onPageChange: (page: number) => void;
|
|
25
44
|
}
|
|
26
45
|
|
|
27
|
-
export const Marketplace: React.FC<IMarketPlaceProps> =
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
optionsType,
|
|
33
|
-
optionsRarity,
|
|
34
|
-
optionsPrice,
|
|
35
|
-
onChangeType,
|
|
36
|
-
onChangeRarity,
|
|
37
|
-
onChangeOrder,
|
|
38
|
-
onChangeNameInput,
|
|
39
|
-
scale,
|
|
40
|
-
equipmentSet,
|
|
41
|
-
onHandleClick,
|
|
42
|
-
}) => {
|
|
46
|
+
export const Marketplace: React.FC<IMarketPlaceProps> = props => {
|
|
47
|
+
const { onClose, scale, onYourPanelToggle } = props;
|
|
48
|
+
|
|
49
|
+
const [isYourPanel, setIsYourPanel] = useState(false);
|
|
50
|
+
|
|
43
51
|
return (
|
|
44
52
|
<DraggableContainer
|
|
45
53
|
type={RPGUIContainerTypes.Framed}
|
|
@@ -47,86 +55,52 @@ export const Marketplace: React.FC<IMarketPlaceProps> = ({
|
|
|
47
55
|
if (onClose) onClose();
|
|
48
56
|
}}
|
|
49
57
|
width="800px"
|
|
50
|
-
cancelDrag="#MarketContainer"
|
|
58
|
+
cancelDrag="#MarketContainer, .rpgui-dropdown-imp, input, .empty-slot, button"
|
|
51
59
|
scale={scale}
|
|
52
60
|
>
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
<
|
|
56
|
-
|
|
57
|
-
|
|
61
|
+
{isYourPanel && (
|
|
62
|
+
<>
|
|
63
|
+
<ManagmentPanel {...props} />
|
|
64
|
+
|
|
65
|
+
<PagerContainer>
|
|
66
|
+
<Button
|
|
67
|
+
buttonType={ButtonTypes.RPGUIButton}
|
|
68
|
+
onPointerDown={() => {
|
|
69
|
+
onYourPanelToggle(false);
|
|
70
|
+
setIsYourPanel(false);
|
|
71
|
+
}}
|
|
72
|
+
>
|
|
73
|
+
Go to marketplace
|
|
74
|
+
</Button>
|
|
75
|
+
<Pager {...props} />
|
|
76
|
+
</PagerContainer>
|
|
77
|
+
</>
|
|
78
|
+
)}
|
|
79
|
+
{!isYourPanel && (
|
|
80
|
+
<>
|
|
81
|
+
<BuyPanel {...props} />
|
|
58
82
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
width={'220px'}
|
|
74
|
-
/>
|
|
75
|
-
</WrapperContainer>
|
|
76
|
-
<ItemComponentScrollWrapper id="MarketContainer">
|
|
77
|
-
{items?.map((item, index) => (
|
|
78
|
-
<MarketplaceRows
|
|
79
|
-
key={`${item.key}_${index}`}
|
|
80
|
-
atlasIMG={atlasIMG}
|
|
81
|
-
atlasJSON={atlasJSON}
|
|
82
|
-
item={item}
|
|
83
|
-
itemPrice={10}
|
|
84
|
-
equipmentSet={equipmentSet}
|
|
85
|
-
onHandleClick={onHandleClick}
|
|
86
|
-
/>
|
|
87
|
-
))}
|
|
88
|
-
</ItemComponentScrollWrapper>
|
|
89
|
-
</>
|
|
83
|
+
<PagerContainer>
|
|
84
|
+
<Button
|
|
85
|
+
buttonType={ButtonTypes.RPGUIButton}
|
|
86
|
+
onPointerDown={() => {
|
|
87
|
+
onYourPanelToggle(true);
|
|
88
|
+
setIsYourPanel(true);
|
|
89
|
+
}}
|
|
90
|
+
>
|
|
91
|
+
Go to your panel
|
|
92
|
+
</Button>
|
|
93
|
+
<Pager {...props} />
|
|
94
|
+
</PagerContainer>
|
|
95
|
+
</>
|
|
96
|
+
)}
|
|
90
97
|
</DraggableContainer>
|
|
91
98
|
);
|
|
92
99
|
};
|
|
93
100
|
|
|
94
|
-
const
|
|
95
|
-
width: 95%;
|
|
101
|
+
const PagerContainer = styled.div`
|
|
96
102
|
display: flex;
|
|
97
|
-
justify-content: flex-start;
|
|
98
|
-
align-items: center;
|
|
99
|
-
margin: auto;
|
|
100
|
-
margin-bottom: 10px;
|
|
101
|
-
p {
|
|
102
|
-
width: auto;
|
|
103
|
-
margin-right: 20px;
|
|
104
|
-
}
|
|
105
|
-
input {
|
|
106
|
-
width: 68%;
|
|
107
|
-
height: 10px;
|
|
108
|
-
}
|
|
109
|
-
`;
|
|
110
|
-
|
|
111
|
-
const WrapperContainer = styled.div`
|
|
112
|
-
display: grid;
|
|
113
|
-
grid-template-columns: 30% 30% 30%;
|
|
114
103
|
justify-content: space-between;
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
.rpgui-content .rpgui-dropdown-imp-header {
|
|
118
|
-
padding: 0px 10px 0 !important;
|
|
119
|
-
}
|
|
120
|
-
`;
|
|
121
|
-
|
|
122
|
-
const ItemComponentScrollWrapper = styled.div`
|
|
123
|
-
overflow-y: scroll;
|
|
124
|
-
height: 390px;
|
|
125
|
-
width: 100%;
|
|
126
|
-
margin-top: 1rem;
|
|
127
|
-
`;
|
|
128
|
-
|
|
129
|
-
const StyledDropdown = styled(Dropdown)`
|
|
130
|
-
margin: 3px !important;
|
|
131
|
-
width: 170px !important;
|
|
104
|
+
align-items: center;
|
|
105
|
+
width: calc(100% - 30px);
|
|
132
106
|
`;
|
|
@@ -19,7 +19,9 @@ export interface IMarketPlaceRowsPropos {
|
|
|
19
19
|
itemPrice: number;
|
|
20
20
|
equipmentSet?: IEquipmentSet | null;
|
|
21
21
|
scale?: number;
|
|
22
|
-
|
|
22
|
+
onMarketPlaceItemBuy?: () => void;
|
|
23
|
+
onMarketPlaceItemRemove?: () => void;
|
|
24
|
+
disabled?: boolean;
|
|
23
25
|
}
|
|
24
26
|
|
|
25
27
|
export const MarketplaceRows: React.FC<IMarketPlaceRowsPropos> = ({
|
|
@@ -29,19 +31,21 @@ export const MarketplaceRows: React.FC<IMarketPlaceRowsPropos> = ({
|
|
|
29
31
|
itemPrice,
|
|
30
32
|
equipmentSet,
|
|
31
33
|
scale,
|
|
32
|
-
|
|
34
|
+
onMarketPlaceItemBuy,
|
|
35
|
+
onMarketPlaceItemRemove,
|
|
36
|
+
disabled,
|
|
33
37
|
}) => {
|
|
34
38
|
return (
|
|
35
|
-
<
|
|
36
|
-
<
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
>
|
|
39
|
+
<MarketplaceWrapper>
|
|
40
|
+
<ItemInfoWrapper
|
|
41
|
+
item={item}
|
|
42
|
+
atlasIMG={atlasIMG}
|
|
43
|
+
atlasJSON={atlasJSON}
|
|
44
|
+
equipmentSet={equipmentSet}
|
|
45
|
+
scale={scale}
|
|
46
|
+
>
|
|
47
|
+
<ItemIconContainer>
|
|
48
|
+
<SpriteContainer>
|
|
45
49
|
<SpriteFromAtlas
|
|
46
50
|
atlasIMG={atlasIMG}
|
|
47
51
|
atlasJSON={atlasJSON}
|
|
@@ -56,70 +60,86 @@ export const MarketplaceRows: React.FC<IMarketPlaceRowsPropos> = ({
|
|
|
56
60
|
)}
|
|
57
61
|
imgScale={2}
|
|
58
62
|
/>
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
63
|
+
<QuantityContainer>
|
|
64
|
+
{item.stackQty &&
|
|
65
|
+
item.stackQty > 1 &&
|
|
66
|
+
`x${Math.round(item.stackQty * 10) / 10}`}
|
|
67
|
+
</QuantityContainer>
|
|
68
|
+
</SpriteContainer>
|
|
69
|
+
<PriceValue>
|
|
70
|
+
<p>
|
|
71
|
+
<Ellipsis maxLines={1} maxWidth="200px" fontSize="10px">
|
|
72
|
+
{item.name}
|
|
73
|
+
</Ellipsis>
|
|
74
|
+
</p>
|
|
75
|
+
</PriceValue>
|
|
76
|
+
</ItemIconContainer>
|
|
77
|
+
</ItemInfoWrapper>
|
|
78
|
+
<Flex>
|
|
79
|
+
<ItemIconContainer>
|
|
80
|
+
<SpriteContainer>
|
|
81
|
+
<SpriteFromAtlas
|
|
82
|
+
atlasIMG={atlasIMG}
|
|
83
|
+
atlasJSON={atlasJSON}
|
|
84
|
+
spriteKey="others/gold-coin-qty-5.png"
|
|
85
|
+
imgScale={2}
|
|
86
|
+
/>
|
|
87
|
+
</SpriteContainer>
|
|
88
|
+
<PriceValue>
|
|
89
|
+
<p>
|
|
90
|
+
<Ellipsis maxLines={1} maxWidth="200px" fontSize="10px">
|
|
91
|
+
${itemPrice}
|
|
75
92
|
</Ellipsis>
|
|
76
|
-
</
|
|
77
|
-
</
|
|
78
|
-
</
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
</PriceValue>
|
|
96
|
-
</ItemIconContainer>
|
|
97
|
-
<ButtonContainer>
|
|
98
|
-
<Button
|
|
99
|
-
buttonType={ButtonTypes.RPGUIButton}
|
|
100
|
-
onClick={() => onHandleClick(item.name)}
|
|
101
|
-
>
|
|
102
|
-
Buy
|
|
103
|
-
</Button>
|
|
104
|
-
</ButtonContainer>
|
|
105
|
-
</MarketPlaceWrapper>
|
|
93
|
+
</p>
|
|
94
|
+
</PriceValue>
|
|
95
|
+
</ItemIconContainer>
|
|
96
|
+
<ButtonContainer>
|
|
97
|
+
<Button
|
|
98
|
+
buttonType={ButtonTypes.RPGUIButton}
|
|
99
|
+
disabled={disabled}
|
|
100
|
+
onPointerDown={() => {
|
|
101
|
+
if (disabled) return;
|
|
102
|
+
|
|
103
|
+
onMarketPlaceItemBuy?.();
|
|
104
|
+
onMarketPlaceItemRemove?.();
|
|
105
|
+
}}
|
|
106
|
+
>
|
|
107
|
+
{onMarketPlaceItemBuy ? 'Buy' : 'Remove'}
|
|
108
|
+
</Button>
|
|
109
|
+
</ButtonContainer>
|
|
110
|
+
</Flex>
|
|
111
|
+
</MarketplaceWrapper>
|
|
106
112
|
);
|
|
107
113
|
};
|
|
108
114
|
|
|
109
|
-
const
|
|
115
|
+
const MarketplaceWrapper = styled.div`
|
|
110
116
|
margin: auto;
|
|
111
|
-
display:
|
|
112
|
-
|
|
117
|
+
display: flex;
|
|
118
|
+
justify-content: space-between;
|
|
119
|
+
padding: 0.5rem;
|
|
113
120
|
|
|
114
121
|
&:hover {
|
|
115
122
|
background-color: ${uiColors.darkGray};
|
|
116
123
|
}
|
|
117
|
-
|
|
124
|
+
|
|
118
125
|
p {
|
|
119
126
|
font-size: 0.8rem;
|
|
120
127
|
}
|
|
121
128
|
`;
|
|
122
129
|
|
|
130
|
+
const QuantityContainer = styled.p`
|
|
131
|
+
position: absolute;
|
|
132
|
+
display: block;
|
|
133
|
+
top: 15px;
|
|
134
|
+
left: 25px;
|
|
135
|
+
font-size: ${uiFonts.size.xsmall} !important;
|
|
136
|
+
`;
|
|
137
|
+
|
|
138
|
+
const Flex = styled.div`
|
|
139
|
+
display: flex;
|
|
140
|
+
gap: 24px;
|
|
141
|
+
`;
|
|
142
|
+
|
|
123
143
|
const ItemIconContainer = styled.div`
|
|
124
144
|
display: flex;
|
|
125
145
|
justify-content: flex-start;
|
|
@@ -132,36 +152,6 @@ const SpriteContainer = styled.div`
|
|
|
132
152
|
left: 0.5rem;
|
|
133
153
|
`;
|
|
134
154
|
|
|
135
|
-
const Item = styled.span`
|
|
136
|
-
color: white;
|
|
137
|
-
text-align: center;
|
|
138
|
-
z-index: 1;
|
|
139
|
-
width: 100%;
|
|
140
|
-
`;
|
|
141
|
-
|
|
142
|
-
const TextOverlay = styled.div`
|
|
143
|
-
width: 100%;
|
|
144
|
-
position: relative;
|
|
145
|
-
`;
|
|
146
|
-
|
|
147
|
-
interface IContainerProps {
|
|
148
|
-
percentageWidth?: number;
|
|
149
|
-
minWidth?: number;
|
|
150
|
-
style?: Record<string, any>;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
const QuantityContainer = styled.div<IContainerProps>`
|
|
154
|
-
position: relative;
|
|
155
|
-
display: flex;
|
|
156
|
-
min-width: 100px;
|
|
157
|
-
justify-content: center;
|
|
158
|
-
align-items: center;
|
|
159
|
-
`;
|
|
160
|
-
|
|
161
|
-
const QuantityDisplay = styled.div`
|
|
162
|
-
font-size: ${uiFonts.size.small};
|
|
163
|
-
`;
|
|
164
|
-
|
|
165
155
|
const PriceValue = styled.div`
|
|
166
156
|
margin-left: 40px;
|
|
167
157
|
`;
|