@rpg-engine/long-bow 0.8.67 → 0.8.68
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/Store/Store.d.ts +13 -1
- package/dist/long-bow.cjs.development.js +17 -8
- 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 +18 -9
- package/dist/long-bow.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Store/Store.tsx +31 -2
- package/src/stories/Features/store/Store.stories.tsx +3 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { IItemPack,
|
|
1
|
+
import { IItemPack, IPurchase, IStoreItem, ItemRarities, ItemSubType, ItemType, UserAccountTypes } from '@rpg-engine/shared';
|
|
2
2
|
import React, { useMemo, useState } from 'react';
|
|
3
|
-
import { FaShoppingCart } from 'react-icons/fa';
|
|
3
|
+
import { FaHistory, FaShoppingCart } from 'react-icons/fa';
|
|
4
4
|
import styled from 'styled-components';
|
|
5
5
|
import { uiColors } from '../../constants/uiColors';
|
|
6
6
|
import { DraggableContainer } from '../DraggableContainer';
|
|
@@ -14,12 +14,27 @@ import { StoreItemsSection } from './sections/StoreItemsSection';
|
|
|
14
14
|
import { StorePacksSection } from './sections/StorePacksSection';
|
|
15
15
|
import { StoreItemDetails } from './StoreItemDetails';
|
|
16
16
|
|
|
17
|
+
// Define IStoreProps locally as a workaround
|
|
18
|
+
export interface IStoreProps {
|
|
19
|
+
items: IStoreItem[];
|
|
20
|
+
packs?: IItemPack[];
|
|
21
|
+
atlasJSON: any;
|
|
22
|
+
atlasIMG: string;
|
|
23
|
+
onPurchase: (purchase: Partial<IPurchase>) => Promise<boolean>;
|
|
24
|
+
onShowHistory?: () => void; // Add the new optional prop
|
|
25
|
+
userAccountType: UserAccountTypes;
|
|
26
|
+
loading?: boolean;
|
|
27
|
+
error?: string;
|
|
28
|
+
onClose?: () => void;
|
|
29
|
+
}
|
|
30
|
+
|
|
17
31
|
export const Store: React.FC<IStoreProps> = ({
|
|
18
32
|
items,
|
|
19
33
|
packs = [],
|
|
20
34
|
atlasJSON,
|
|
21
35
|
atlasIMG,
|
|
22
36
|
onPurchase,
|
|
37
|
+
onShowHistory, // Destructure the new prop
|
|
23
38
|
userAccountType,
|
|
24
39
|
loading = false,
|
|
25
40
|
error,
|
|
@@ -202,6 +217,15 @@ export const Store: React.FC<IStoreProps> = ({
|
|
|
202
217
|
) : (
|
|
203
218
|
<Container>
|
|
204
219
|
<TopBar>
|
|
220
|
+
<HistoryButton>
|
|
221
|
+
{onShowHistory && (
|
|
222
|
+
<CTAButton
|
|
223
|
+
icon={<FaHistory />}
|
|
224
|
+
label="History"
|
|
225
|
+
onClick={onShowHistory}
|
|
226
|
+
/>
|
|
227
|
+
)}
|
|
228
|
+
</HistoryButton>
|
|
205
229
|
<CartButton>
|
|
206
230
|
<CTAButton
|
|
207
231
|
icon={<FaShoppingCart />}
|
|
@@ -267,6 +291,11 @@ const TopBar = styled.div`
|
|
|
267
291
|
margin-top: 0.5rem;
|
|
268
292
|
`;
|
|
269
293
|
|
|
294
|
+
const HistoryButton = styled.div`
|
|
295
|
+
min-width: fit-content;
|
|
296
|
+
margin-right: auto;
|
|
297
|
+
`;
|
|
298
|
+
|
|
270
299
|
const CartButton = styled.div`
|
|
271
300
|
min-width: fit-content;
|
|
272
301
|
`;
|
|
@@ -238,9 +238,11 @@ export const Default: Story = {
|
|
|
238
238
|
items={duplicatedItems}
|
|
239
239
|
packs={mockPacks}
|
|
240
240
|
userAccountType={UserAccountTypes.Free}
|
|
241
|
-
onPurchase={(purchase: IPurchase) => {
|
|
241
|
+
onPurchase={(purchase: Partial<IPurchase>) => {
|
|
242
242
|
console.log('Purchase details:', purchase);
|
|
243
|
+
return Promise.resolve(true);
|
|
243
244
|
}}
|
|
245
|
+
onShowHistory={() => console.log('Show History clicked in story')}
|
|
244
246
|
onClose={() => console.log('Store closed')}
|
|
245
247
|
atlasJSON={itemsAtlasJSON}
|
|
246
248
|
atlasIMG={itemsAtlasIMG}
|