@rpg-engine/long-bow 0.8.141 → 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.
- package/dist/components/Marketplace/BlueprintSearchModal.d.ts +17 -0
- package/dist/components/Marketplace/BuyOrderDetailsModal.d.ts +17 -0
- package/dist/components/Marketplace/BuyOrderPanel.d.ts +24 -0
- package/dist/components/Marketplace/BuyOrderRows.d.ts +13 -0
- package/dist/components/Marketplace/BuyPanel.d.ts +9 -1
- package/dist/components/Marketplace/HistoryPanel.d.ts +18 -0
- package/dist/components/Marketplace/ManagmentPanel.d.ts +3 -2
- package/dist/components/Marketplace/Marketplace.d.ts +35 -2
- package/dist/components/Marketplace/MarketplaceSettingsPanel.d.ts +2 -1
- package/dist/components/Store/PaymentMethodModal.d.ts +1 -0
- package/dist/components/shared/LabelPill/LabelPill.d.ts +9 -0
- package/dist/components/shared/LabelPill/index.d.ts +1 -0
- package/dist/components/shared/SegmentedToggle/SegmentedToggle.d.ts +12 -0
- package/dist/components/shared/SegmentedToggle/index.d.ts +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/long-bow.cjs.development.js +11529 -1288
- 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 +11518 -1290
- package/dist/long-bow.esm.js.map +1 -1
- package/dist/stories/Features/marketplace/BlueprintSearchModal.stories.d.ts +1 -0
- package/dist/stories/Features/marketplace/BuyOrderPanel.stories.d.ts +1 -0
- package/dist/stories/Features/marketplace/BuyOrderRows.stories.d.ts +1 -0
- package/dist/stories/Features/marketplace/HistoryPanel.stories.d.ts +1 -0
- package/dist/stories/Features/trading/MarketplaceRows.stories.d.ts +2 -1
- package/dist/stories/UI/buttonsAndInputs/SegmentedToggle.stories.d.ts +6 -0
- package/dist/stories/UI/text/LabelPill.stories.d.ts +7 -0
- package/dist/utils/atlasUtils.d.ts +2 -0
- package/package.json +2 -2
- package/src/components/Marketplace/BlueprintSearchModal.tsx +418 -0
- package/src/components/Marketplace/BuyOrderDetailsModal.tsx +307 -0
- package/src/components/Marketplace/BuyOrderPanel.tsx +266 -0
- package/src/components/Marketplace/BuyOrderRows.tsx +287 -0
- package/src/components/Marketplace/BuyPanel.tsx +406 -166
- package/src/components/Marketplace/HistoryPanel.tsx +422 -0
- package/src/components/Marketplace/ManagmentPanel.tsx +13 -15
- package/src/components/Marketplace/Marketplace.tsx +181 -30
- package/src/components/Marketplace/MarketplaceBuyModal.tsx +1 -0
- package/src/components/Marketplace/MarketplaceRows.tsx +41 -10
- package/src/components/Marketplace/MarketplaceSettingsPanel.tsx +4 -3
- package/src/components/Store/CartView.tsx +11 -0
- package/src/components/Store/PaymentMethodModal.tsx +26 -9
- package/src/components/shared/LabelPill/LabelPill.tsx +45 -0
- package/src/components/shared/LabelPill/index.ts +1 -0
- package/src/components/shared/SegmentedToggle/SegmentedToggle.tsx +61 -0
- package/src/components/shared/SegmentedToggle/index.ts +1 -0
- package/src/components/shared/SpriteFromAtlas.tsx +7 -2
- package/src/index.tsx +4 -0
- package/src/mocks/atlas/items/items.json +33998 -25238
- package/src/mocks/atlas/items/items.png +0 -0
- package/src/mocks/itemContainer.mocks.ts +31 -0
- package/src/stories/Features/marketplace/BlueprintSearchModal.stories.tsx +145 -0
- package/src/stories/Features/marketplace/BuyOrderPanel.stories.tsx +207 -0
- package/src/stories/Features/marketplace/BuyOrderRows.stories.tsx +116 -0
- package/src/stories/Features/marketplace/HistoryPanel.stories.tsx +157 -0
- package/src/stories/Features/trading/Marketplace.stories.tsx +107 -0
- package/src/stories/Features/trading/MarketplaceRows.stories.tsx +11 -0
- package/src/stories/UI/buttonsAndInputs/SegmentedToggle.stories.tsx +54 -0
- package/src/stories/UI/text/LabelPill.stories.tsx +43 -0
- package/src/utils/__test__/atlasUtils.spec.ts +26 -0
- package/src/utils/atlasUtils.ts +80 -0
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
import {
|
|
2
|
+
IMarketplaceBlueprintSummary,
|
|
3
|
+
} from '@rpg-engine/shared';
|
|
4
|
+
import { ShoppingCart } from 'pixelarticons/react/ShoppingCart';
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import { FaTimes } from 'react-icons/fa';
|
|
7
|
+
import styled from 'styled-components';
|
|
8
|
+
import { Dropdown } from '../Dropdown';
|
|
9
|
+
import { IOptionsProps } from '../Dropdown';
|
|
10
|
+
import { Input } from '../Input';
|
|
11
|
+
import ModalPortal from '../Abstractions/ModalPortal';
|
|
12
|
+
import { CTAButton } from '../shared/CTAButton/CTAButton';
|
|
13
|
+
import { SpriteFromAtlas } from '../shared/SpriteFromAtlas';
|
|
14
|
+
|
|
15
|
+
export interface IBuyOrderDetailsModalProps {
|
|
16
|
+
isOpen: boolean;
|
|
17
|
+
onClose: () => void;
|
|
18
|
+
blueprint: IMarketplaceBlueprintSummary | null;
|
|
19
|
+
quantity: number;
|
|
20
|
+
maxPrice: number;
|
|
21
|
+
rarity: string;
|
|
22
|
+
onQuantityChange: (quantity: number) => void;
|
|
23
|
+
onMaxPriceChange: (price: number) => void;
|
|
24
|
+
onRarityChange: (rarity: string) => void;
|
|
25
|
+
onConfirm: () => void;
|
|
26
|
+
atlasJSON: any;
|
|
27
|
+
atlasIMG: any;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const rarityOptions: IOptionsProps[] = [
|
|
31
|
+
{ id: 1, value: 'Common', option: 'Common' },
|
|
32
|
+
{ id: 2, value: 'Uncommon', option: 'Uncommon' },
|
|
33
|
+
{ id: 3, value: 'Rare', option: 'Rare' },
|
|
34
|
+
{ id: 4, value: 'Epic', option: 'Epic' },
|
|
35
|
+
{ id: 5, value: 'Legendary', option: 'Legendary' },
|
|
36
|
+
];
|
|
37
|
+
|
|
38
|
+
export const BuyOrderDetailsModal: React.FC<IBuyOrderDetailsModalProps> = ({
|
|
39
|
+
isOpen,
|
|
40
|
+
onClose,
|
|
41
|
+
blueprint,
|
|
42
|
+
quantity,
|
|
43
|
+
maxPrice,
|
|
44
|
+
rarity,
|
|
45
|
+
onQuantityChange,
|
|
46
|
+
onMaxPriceChange,
|
|
47
|
+
onRarityChange,
|
|
48
|
+
onConfirm,
|
|
49
|
+
atlasJSON,
|
|
50
|
+
atlasIMG,
|
|
51
|
+
}) => {
|
|
52
|
+
if (!isOpen || !blueprint) return null;
|
|
53
|
+
|
|
54
|
+
const stopPropagation = (e: React.MouseEvent | React.PointerEvent): void => {
|
|
55
|
+
e.stopPropagation();
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const handleClose = (e: React.PointerEvent | React.MouseEvent): void => {
|
|
59
|
+
e.preventDefault();
|
|
60
|
+
e.stopPropagation();
|
|
61
|
+
onClose();
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
return (
|
|
65
|
+
<ModalPortal>
|
|
66
|
+
<Overlay onPointerDown={handleClose} />
|
|
67
|
+
<ModalContainer>
|
|
68
|
+
<ModalContent
|
|
69
|
+
onClick={stopPropagation as React.MouseEventHandler}
|
|
70
|
+
onPointerDown={stopPropagation as React.PointerEventHandler}
|
|
71
|
+
>
|
|
72
|
+
<Header>
|
|
73
|
+
<Title>Place Buy Request</Title>
|
|
74
|
+
<CloseButton onPointerDown={handleClose} aria-label="Close">
|
|
75
|
+
<FaTimes />
|
|
76
|
+
</CloseButton>
|
|
77
|
+
</Header>
|
|
78
|
+
|
|
79
|
+
<ItemDisplay>
|
|
80
|
+
<SpriteWrapper>
|
|
81
|
+
<SpriteFromAtlas
|
|
82
|
+
atlasJSON={atlasJSON}
|
|
83
|
+
atlasIMG={atlasIMG}
|
|
84
|
+
spriteKey={blueprint.texturePath || blueprint.key}
|
|
85
|
+
width={32}
|
|
86
|
+
height={32}
|
|
87
|
+
imgScale={2}
|
|
88
|
+
/>
|
|
89
|
+
</SpriteWrapper>
|
|
90
|
+
<ItemInfo>
|
|
91
|
+
<ItemName>{blueprint.name}</ItemName>
|
|
92
|
+
<ItemKey>{blueprint.type} - {blueprint.subType} - T{blueprint.tier}</ItemKey>
|
|
93
|
+
</ItemInfo>
|
|
94
|
+
</ItemDisplay>
|
|
95
|
+
|
|
96
|
+
<FormSection>
|
|
97
|
+
<FieldRow>
|
|
98
|
+
<Label>Quantity</Label>
|
|
99
|
+
<StyledInput
|
|
100
|
+
value={quantity || ''}
|
|
101
|
+
onChange={(e) => onQuantityChange(Number(e.target.value))}
|
|
102
|
+
placeholder="Qty"
|
|
103
|
+
type="number"
|
|
104
|
+
min={1}
|
|
105
|
+
/>
|
|
106
|
+
</FieldRow>
|
|
107
|
+
|
|
108
|
+
<FieldRow>
|
|
109
|
+
<Label>Max Gold</Label>
|
|
110
|
+
<StyledInput
|
|
111
|
+
value={maxPrice || ''}
|
|
112
|
+
onChange={(e) => onMaxPriceChange(Number(e.target.value))}
|
|
113
|
+
placeholder="Max gold"
|
|
114
|
+
type="number"
|
|
115
|
+
min={1}
|
|
116
|
+
/>
|
|
117
|
+
</FieldRow>
|
|
118
|
+
|
|
119
|
+
<FieldRow>
|
|
120
|
+
<Label>Rarity</Label>
|
|
121
|
+
<StyledDropdown
|
|
122
|
+
key={rarity}
|
|
123
|
+
options={rarityOptions}
|
|
124
|
+
onChange={onRarityChange}
|
|
125
|
+
width="100%"
|
|
126
|
+
/>
|
|
127
|
+
</FieldRow>
|
|
128
|
+
</FormSection>
|
|
129
|
+
|
|
130
|
+
<ActionsRow>
|
|
131
|
+
<CancelButton onPointerDown={handleClose}>Cancel</CancelButton>
|
|
132
|
+
<CTAButton
|
|
133
|
+
icon={<ShoppingCart width={16} height={16} />}
|
|
134
|
+
label="Place Request"
|
|
135
|
+
disabled={quantity <= 0 || maxPrice <= 0}
|
|
136
|
+
onClick={onConfirm}
|
|
137
|
+
/>
|
|
138
|
+
</ActionsRow>
|
|
139
|
+
</ModalContent>
|
|
140
|
+
</ModalContainer>
|
|
141
|
+
</ModalPortal>
|
|
142
|
+
);
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
const Overlay = styled.div`
|
|
146
|
+
position: fixed;
|
|
147
|
+
inset: 0;
|
|
148
|
+
background: rgba(0, 0, 0, 0.7);
|
|
149
|
+
z-index: 1000;
|
|
150
|
+
`;
|
|
151
|
+
|
|
152
|
+
const ModalContainer = styled.div`
|
|
153
|
+
position: fixed;
|
|
154
|
+
inset: 0;
|
|
155
|
+
display: flex;
|
|
156
|
+
align-items: center;
|
|
157
|
+
justify-content: center;
|
|
158
|
+
z-index: 1001;
|
|
159
|
+
pointer-events: none;
|
|
160
|
+
`;
|
|
161
|
+
|
|
162
|
+
const ModalContent = styled.div`
|
|
163
|
+
background: #1a1a2e;
|
|
164
|
+
border: 2px solid #f59e0b;
|
|
165
|
+
border-radius: 8px;
|
|
166
|
+
padding: 20px 24px;
|
|
167
|
+
width: 400px;
|
|
168
|
+
max-width: 90%;
|
|
169
|
+
display: flex;
|
|
170
|
+
flex-direction: column;
|
|
171
|
+
gap: 16px;
|
|
172
|
+
pointer-events: auto;
|
|
173
|
+
animation: scaleIn 0.15s ease-out;
|
|
174
|
+
|
|
175
|
+
@keyframes scaleIn {
|
|
176
|
+
from { transform: scale(0.85); opacity: 0; }
|
|
177
|
+
to { transform: scale(1); opacity: 1; }
|
|
178
|
+
}
|
|
179
|
+
`;
|
|
180
|
+
|
|
181
|
+
const Header = styled.div`
|
|
182
|
+
display: flex;
|
|
183
|
+
align-items: center;
|
|
184
|
+
justify-content: space-between;
|
|
185
|
+
`;
|
|
186
|
+
|
|
187
|
+
const Title = styled.h3`
|
|
188
|
+
margin: 0;
|
|
189
|
+
font-family: 'Press Start 2P', cursive;
|
|
190
|
+
font-size: 0.7rem;
|
|
191
|
+
color: #fef08a;
|
|
192
|
+
`;
|
|
193
|
+
|
|
194
|
+
const CloseButton = styled.button`
|
|
195
|
+
background: none;
|
|
196
|
+
border: none;
|
|
197
|
+
color: rgba(255, 255, 255, 0.6);
|
|
198
|
+
cursor: pointer;
|
|
199
|
+
font-size: 1rem;
|
|
200
|
+
padding: 4px;
|
|
201
|
+
display: flex;
|
|
202
|
+
align-items: center;
|
|
203
|
+
pointer-events: auto;
|
|
204
|
+
|
|
205
|
+
&:hover {
|
|
206
|
+
color: #ffffff;
|
|
207
|
+
}
|
|
208
|
+
`;
|
|
209
|
+
|
|
210
|
+
const ItemDisplay = styled.div`
|
|
211
|
+
display: flex;
|
|
212
|
+
align-items: center;
|
|
213
|
+
gap: 12px;
|
|
214
|
+
padding: 12px;
|
|
215
|
+
background: rgba(0, 0, 0, 0.2);
|
|
216
|
+
border: 1px solid rgba(255, 255, 255, 0.05);
|
|
217
|
+
border-radius: 4px;
|
|
218
|
+
`;
|
|
219
|
+
|
|
220
|
+
const SpriteWrapper = styled.div`
|
|
221
|
+
display: flex;
|
|
222
|
+
align-items: center;
|
|
223
|
+
justify-content: center;
|
|
224
|
+
`;
|
|
225
|
+
|
|
226
|
+
const ItemInfo = styled.div`
|
|
227
|
+
display: flex;
|
|
228
|
+
flex-direction: column;
|
|
229
|
+
gap: 2px;
|
|
230
|
+
overflow: hidden;
|
|
231
|
+
`;
|
|
232
|
+
|
|
233
|
+
const ItemName = styled.span`
|
|
234
|
+
font-size: 0.55rem;
|
|
235
|
+
color: #ddd;
|
|
236
|
+
overflow: hidden;
|
|
237
|
+
text-overflow: ellipsis;
|
|
238
|
+
white-space: nowrap;
|
|
239
|
+
`;
|
|
240
|
+
|
|
241
|
+
const ItemKey = styled.span`
|
|
242
|
+
font-size: 0.4rem;
|
|
243
|
+
color: #666;
|
|
244
|
+
overflow: hidden;
|
|
245
|
+
text-overflow: ellipsis;
|
|
246
|
+
white-space: nowrap;
|
|
247
|
+
`;
|
|
248
|
+
|
|
249
|
+
const FormSection = styled.div`
|
|
250
|
+
display: flex;
|
|
251
|
+
flex-direction: column;
|
|
252
|
+
gap: 12px;
|
|
253
|
+
`;
|
|
254
|
+
|
|
255
|
+
const FieldRow = styled.div`
|
|
256
|
+
display: flex;
|
|
257
|
+
flex-direction: column;
|
|
258
|
+
gap: 6px;
|
|
259
|
+
|
|
260
|
+
.rpgui-content .rpgui-dropdown-imp-header {
|
|
261
|
+
padding: 0px 10px 0 !important;
|
|
262
|
+
}
|
|
263
|
+
`;
|
|
264
|
+
|
|
265
|
+
const Label = styled.label`
|
|
266
|
+
font-size: 0.5rem;
|
|
267
|
+
color: #aaa;
|
|
268
|
+
text-transform: uppercase;
|
|
269
|
+
letter-spacing: 0.5px;
|
|
270
|
+
`;
|
|
271
|
+
|
|
272
|
+
const StyledInput = styled(Input)`
|
|
273
|
+
height: 10px;
|
|
274
|
+
width: 100%;
|
|
275
|
+
`;
|
|
276
|
+
|
|
277
|
+
const StyledDropdown = styled(Dropdown)`
|
|
278
|
+
margin: 0px !important;
|
|
279
|
+
width: 100% !important;
|
|
280
|
+
`;
|
|
281
|
+
|
|
282
|
+
const ActionsRow = styled.div`
|
|
283
|
+
display: flex;
|
|
284
|
+
gap: 8px;
|
|
285
|
+
margin-top: 4px;
|
|
286
|
+
`;
|
|
287
|
+
|
|
288
|
+
const CancelButton = styled.button`
|
|
289
|
+
flex: 1;
|
|
290
|
+
background: rgba(255, 255, 255, 0.05);
|
|
291
|
+
border: 1px solid rgba(255, 255, 255, 0.1);
|
|
292
|
+
color: #ccc;
|
|
293
|
+
border-radius: 4px;
|
|
294
|
+
padding: 8px 12px;
|
|
295
|
+
font-size: 0.5rem;
|
|
296
|
+
font-family: 'Press Start 2P', cursive;
|
|
297
|
+
cursor: pointer;
|
|
298
|
+
text-transform: uppercase;
|
|
299
|
+
letter-spacing: 0.5px;
|
|
300
|
+
transition: background 0.1s, border-color 0.1s;
|
|
301
|
+
pointer-events: auto;
|
|
302
|
+
|
|
303
|
+
&:hover {
|
|
304
|
+
background: rgba(255, 255, 255, 0.08);
|
|
305
|
+
border-color: rgba(255, 255, 255, 0.15);
|
|
306
|
+
}
|
|
307
|
+
`;
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
import {
|
|
2
|
+
IMarketplaceBlueprintSummary,
|
|
3
|
+
IMarketplaceBuyOrderItem,
|
|
4
|
+
} from '@rpg-engine/shared';
|
|
5
|
+
import { Search } from 'pixelarticons/react/Search';
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import styled from 'styled-components';
|
|
8
|
+
import { Pager } from '../Pager';
|
|
9
|
+
import { CTAButton } from '../shared/CTAButton/CTAButton';
|
|
10
|
+
import { rarityColor } from '../Item/Inventory/ItemSlotRarity';
|
|
11
|
+
import { SpriteFromAtlas } from '../shared/SpriteFromAtlas';
|
|
12
|
+
import { BuyOrderDetailsModal } from './BuyOrderDetailsModal';
|
|
13
|
+
import { BuyOrderRow } from './BuyOrderRows';
|
|
14
|
+
|
|
15
|
+
export interface IBuyOrderPanelProps {
|
|
16
|
+
atlasJSON?: any;
|
|
17
|
+
atlasIMG?: any;
|
|
18
|
+
selectedBlueprint?: IMarketplaceBlueprintSummary;
|
|
19
|
+
onOpenBlueprintSearch: () => void;
|
|
20
|
+
onCloseDetails?: () => void;
|
|
21
|
+
onQuantityChange: (quantity: number) => void;
|
|
22
|
+
onMaxPriceChange: (price: number) => void;
|
|
23
|
+
onRarityChange: (rarity: string) => void;
|
|
24
|
+
onPlaceBuyOrder: () => void;
|
|
25
|
+
currentQuantity: number;
|
|
26
|
+
currentMaxPrice: number;
|
|
27
|
+
selectedRarity: string;
|
|
28
|
+
|
|
29
|
+
yourBuyOrders: IMarketplaceBuyOrderItem[];
|
|
30
|
+
yourBuyOrdersTotal: number;
|
|
31
|
+
yourBuyOrdersPage: number;
|
|
32
|
+
onYourBuyOrdersPageChange: (page: number) => void;
|
|
33
|
+
onCancelBuyOrder: (buyOrderId: string) => void;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const BUY_ORDERS_PER_PAGE = 5;
|
|
37
|
+
|
|
38
|
+
export const BuyOrderPanel: React.FC<IBuyOrderPanelProps> = (props) => {
|
|
39
|
+
const {
|
|
40
|
+
atlasJSON,
|
|
41
|
+
atlasIMG,
|
|
42
|
+
selectedBlueprint,
|
|
43
|
+
onOpenBlueprintSearch,
|
|
44
|
+
onCloseDetails,
|
|
45
|
+
onQuantityChange,
|
|
46
|
+
onMaxPriceChange,
|
|
47
|
+
onRarityChange,
|
|
48
|
+
onPlaceBuyOrder,
|
|
49
|
+
currentQuantity,
|
|
50
|
+
currentMaxPrice,
|
|
51
|
+
selectedRarity,
|
|
52
|
+
yourBuyOrders,
|
|
53
|
+
yourBuyOrdersTotal,
|
|
54
|
+
yourBuyOrdersPage,
|
|
55
|
+
onYourBuyOrdersPageChange,
|
|
56
|
+
onCancelBuyOrder,
|
|
57
|
+
} = props;
|
|
58
|
+
|
|
59
|
+
const handleConfirm = () => {
|
|
60
|
+
onPlaceBuyOrder();
|
|
61
|
+
onCloseDetails?.();
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const handleCloseDetails = () => {
|
|
65
|
+
onCloseDetails?.();
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
return (
|
|
69
|
+
<PanelWrapper>
|
|
70
|
+
{/* ── Details modal ── */}
|
|
71
|
+
{selectedBlueprint && (
|
|
72
|
+
<BuyOrderDetailsModal
|
|
73
|
+
isOpen
|
|
74
|
+
onClose={handleCloseDetails}
|
|
75
|
+
blueprint={selectedBlueprint}
|
|
76
|
+
quantity={currentQuantity}
|
|
77
|
+
maxPrice={currentMaxPrice}
|
|
78
|
+
rarity={selectedRarity}
|
|
79
|
+
onQuantityChange={onQuantityChange}
|
|
80
|
+
onMaxPriceChange={onMaxPriceChange}
|
|
81
|
+
onRarityChange={onRarityChange}
|
|
82
|
+
onConfirm={handleConfirm}
|
|
83
|
+
atlasJSON={atlasJSON}
|
|
84
|
+
atlasIMG={atlasIMG}
|
|
85
|
+
/>
|
|
86
|
+
)}
|
|
87
|
+
|
|
88
|
+
{/* ── Form row — outside scroll so dropdown isn't clipped ── */}
|
|
89
|
+
<FormRow>
|
|
90
|
+
{selectedBlueprint ? (
|
|
91
|
+
<SelectedBlueprintDisplay onPointerDown={onOpenBlueprintSearch}>
|
|
92
|
+
<RarityContainer $rarity={selectedRarity}>
|
|
93
|
+
<SpriteFromAtlas
|
|
94
|
+
atlasIMG={atlasIMG}
|
|
95
|
+
atlasJSON={atlasJSON}
|
|
96
|
+
spriteKey={selectedBlueprint.texturePath || selectedBlueprint.key}
|
|
97
|
+
width={32}
|
|
98
|
+
height={32}
|
|
99
|
+
imgScale={2}
|
|
100
|
+
centered
|
|
101
|
+
/>
|
|
102
|
+
</RarityContainer>
|
|
103
|
+
<ChangeTextWrapper>
|
|
104
|
+
<BlueprintName>{selectedBlueprint.name}</BlueprintName>
|
|
105
|
+
<ChangeText>change</ChangeText>
|
|
106
|
+
</ChangeTextWrapper>
|
|
107
|
+
</SelectedBlueprintDisplay>
|
|
108
|
+
) : (
|
|
109
|
+
<CTAButton
|
|
110
|
+
icon={<Search width={18} height={18} />}
|
|
111
|
+
label="Select Item"
|
|
112
|
+
iconColor="#f59e0b"
|
|
113
|
+
onClick={onOpenBlueprintSearch}
|
|
114
|
+
/>
|
|
115
|
+
)}
|
|
116
|
+
</FormRow>
|
|
117
|
+
|
|
118
|
+
{/* ── Scrollable lists ──────────────────────────────── */}
|
|
119
|
+
<ScrollArea id="MarketContainer">
|
|
120
|
+
<Section>
|
|
121
|
+
<SectionTitle>Your Buy Requests</SectionTitle>
|
|
122
|
+
{yourBuyOrders.length === 0 ? (
|
|
123
|
+
<EmptyState>No requests yet</EmptyState>
|
|
124
|
+
) : (
|
|
125
|
+
yourBuyOrders.map((order) => (
|
|
126
|
+
<BuyOrderRow
|
|
127
|
+
key={order._id}
|
|
128
|
+
buyOrder={order}
|
|
129
|
+
atlasJSON={atlasJSON}
|
|
130
|
+
atlasIMG={atlasIMG}
|
|
131
|
+
isOwn
|
|
132
|
+
onCancel={onCancelBuyOrder}
|
|
133
|
+
/>
|
|
134
|
+
))
|
|
135
|
+
)}
|
|
136
|
+
{yourBuyOrdersTotal > BUY_ORDERS_PER_PAGE && (
|
|
137
|
+
<PagerRow>
|
|
138
|
+
<Pager
|
|
139
|
+
totalItems={yourBuyOrdersTotal}
|
|
140
|
+
currentPage={yourBuyOrdersPage}
|
|
141
|
+
itemsPerPage={BUY_ORDERS_PER_PAGE}
|
|
142
|
+
onPageChange={onYourBuyOrdersPageChange}
|
|
143
|
+
/>
|
|
144
|
+
</PagerRow>
|
|
145
|
+
)}
|
|
146
|
+
</Section>
|
|
147
|
+
|
|
148
|
+
</ScrollArea>
|
|
149
|
+
</PanelWrapper>
|
|
150
|
+
);
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
const PanelWrapper = styled.div`
|
|
154
|
+
display: flex;
|
|
155
|
+
flex-direction: column;
|
|
156
|
+
gap: 8px;
|
|
157
|
+
padding: 0 2.5%;
|
|
158
|
+
width: 100%;
|
|
159
|
+
box-sizing: border-box;
|
|
160
|
+
`;
|
|
161
|
+
|
|
162
|
+
const FormRow = styled.div`
|
|
163
|
+
display: flex;
|
|
164
|
+
gap: 8px;
|
|
165
|
+
align-items: center;
|
|
166
|
+
background: rgba(0, 0, 0, 0.15);
|
|
167
|
+
border-radius: 4px;
|
|
168
|
+
border: 1px solid rgba(255, 255, 255, 0.05);
|
|
169
|
+
padding: 8px 12px;
|
|
170
|
+
overflow: visible;
|
|
171
|
+
`;
|
|
172
|
+
|
|
173
|
+
const ScrollArea = styled.div`
|
|
174
|
+
display: flex;
|
|
175
|
+
flex-direction: column;
|
|
176
|
+
gap: 6px;
|
|
177
|
+
overflow-y: scroll;
|
|
178
|
+
max-height: 420px;
|
|
179
|
+
`;
|
|
180
|
+
|
|
181
|
+
const Section = styled.div`
|
|
182
|
+
display: flex;
|
|
183
|
+
flex-direction: column;
|
|
184
|
+
gap: 2px;
|
|
185
|
+
`;
|
|
186
|
+
|
|
187
|
+
const SectionTitle = styled.p`
|
|
188
|
+
margin: 0 0 2px 0;
|
|
189
|
+
font-size: 0.45rem;
|
|
190
|
+
color: #666;
|
|
191
|
+
text-transform: uppercase;
|
|
192
|
+
letter-spacing: 1px;
|
|
193
|
+
`;
|
|
194
|
+
|
|
195
|
+
const SelectedBlueprintDisplay = styled.button`
|
|
196
|
+
background: rgba(245, 158, 11, 0.08);
|
|
197
|
+
border: 1px solid rgba(245, 158, 11, 0.4);
|
|
198
|
+
border-radius: 4px;
|
|
199
|
+
padding: 6px 10px;
|
|
200
|
+
cursor: pointer;
|
|
201
|
+
text-align: left;
|
|
202
|
+
display: flex;
|
|
203
|
+
align-items: center;
|
|
204
|
+
gap: 8px;
|
|
205
|
+
transition: background 0.1s;
|
|
206
|
+
|
|
207
|
+
/* Adjust sprite position slightly down and right */
|
|
208
|
+
> div:first-child {
|
|
209
|
+
position: relative;
|
|
210
|
+
top: 2px;
|
|
211
|
+
left: 2px;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
&:hover {
|
|
215
|
+
background: rgba(245, 158, 11, 0.15);
|
|
216
|
+
}
|
|
217
|
+
`;
|
|
218
|
+
|
|
219
|
+
const RarityContainer = styled.div<{ $rarity: string }>`
|
|
220
|
+
border-color: ${({ $rarity }) => rarityColor({ rarity: $rarity } as any)};
|
|
221
|
+
box-shadow: ${({ $rarity }) => `0 0 5px 8px ${rarityColor({ rarity: $rarity } as any)}`} inset,
|
|
222
|
+
${({ $rarity }) => `0 0 8px 6px ${rarityColor({ rarity: $rarity } as any)}`};
|
|
223
|
+
width: 32px;
|
|
224
|
+
height: 32px;
|
|
225
|
+
`;
|
|
226
|
+
|
|
227
|
+
const ChangeTextWrapper = styled.div`
|
|
228
|
+
display: flex;
|
|
229
|
+
flex-direction: column;
|
|
230
|
+
gap: 2px;
|
|
231
|
+
min-width: 0;
|
|
232
|
+
`;
|
|
233
|
+
|
|
234
|
+
const BlueprintName = styled.span`
|
|
235
|
+
font-size: 0.5rem;
|
|
236
|
+
color: #ddd;
|
|
237
|
+
white-space: nowrap;
|
|
238
|
+
overflow: hidden;
|
|
239
|
+
text-overflow: ellipsis;
|
|
240
|
+
`;
|
|
241
|
+
|
|
242
|
+
const ChangeText = styled.span`
|
|
243
|
+
font-size: 0.4rem;
|
|
244
|
+
color: #f59e0b;
|
|
245
|
+
`;
|
|
246
|
+
|
|
247
|
+
const EmptyState = styled.div`
|
|
248
|
+
display: flex;
|
|
249
|
+
align-items: center;
|
|
250
|
+
justify-content: center;
|
|
251
|
+
height: 45px;
|
|
252
|
+
font-size: 0.45rem;
|
|
253
|
+
color: #555;
|
|
254
|
+
text-transform: uppercase;
|
|
255
|
+
letter-spacing: 1px;
|
|
256
|
+
background: rgba(0, 0, 0, 0.15);
|
|
257
|
+
border-radius: 4px;
|
|
258
|
+
`;
|
|
259
|
+
|
|
260
|
+
const PagerRow = styled.div`
|
|
261
|
+
display: flex;
|
|
262
|
+
justify-content: center;
|
|
263
|
+
margin-top: 4px;
|
|
264
|
+
`;
|
|
265
|
+
|
|
266
|
+
export { BUY_ORDERS_PER_PAGE };
|