@rpg-engine/long-bow 0.8.131 → 0.8.133
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/PaymentMethodModal.d.ts +8 -0
- package/dist/components/Store/Store.d.ts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/long-bow.cjs.development.js +68 -6
- 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 +69 -8
- package/dist/long-bow.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Store/PaymentMethodModal.tsx +140 -0
- package/src/components/Store/Store.tsx +3 -1
- package/src/components/Store/StoreItemDetails.tsx +1 -0
- package/src/components/Store/StoreItemRow.tsx +4 -1
- package/src/index.tsx +1 -0
- package/src/stories/Features/store/Store.stories.tsx +2 -0
package/package.json
CHANGED
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
|
+
import { FaCreditCard } from 'react-icons/fa';
|
|
3
|
+
import { GiCrystalBall } from 'react-icons/gi';
|
|
4
|
+
import styled from 'styled-components';
|
|
5
|
+
import ModalPortal from '../Abstractions/ModalPortal';
|
|
6
|
+
import { Button, ButtonTypes } from '../Button';
|
|
7
|
+
|
|
8
|
+
export interface IPaymentMethodModalProps {
|
|
9
|
+
dcBalance: number;
|
|
10
|
+
onPayWithDC: () => void;
|
|
11
|
+
onPayWithCard: () => void;
|
|
12
|
+
onClose: () => void;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const PaymentMethodModal: React.FC<IPaymentMethodModalProps> = ({
|
|
16
|
+
dcBalance,
|
|
17
|
+
onPayWithDC,
|
|
18
|
+
onPayWithCard,
|
|
19
|
+
onClose,
|
|
20
|
+
}) => {
|
|
21
|
+
const stopPropagation = useCallback((e: React.MouseEvent | React.TouchEvent | React.PointerEvent) => {
|
|
22
|
+
e.stopPropagation();
|
|
23
|
+
}, []);
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<ModalPortal>
|
|
27
|
+
<Overlay onPointerDown={onClose} />
|
|
28
|
+
<ModalContainer>
|
|
29
|
+
<ModalContent
|
|
30
|
+
onClick={stopPropagation as React.MouseEventHandler}
|
|
31
|
+
onTouchStart={stopPropagation as React.TouchEventHandler}
|
|
32
|
+
onPointerDown={stopPropagation as React.PointerEventHandler}
|
|
33
|
+
>
|
|
34
|
+
<Title>How would you like to pay?</Title>
|
|
35
|
+
|
|
36
|
+
<OptionButton onClick={onPayWithDC} className="rpgui-button">
|
|
37
|
+
<GiCrystalBall />
|
|
38
|
+
<OptionLabel>
|
|
39
|
+
<span>Pay with DC</span>
|
|
40
|
+
<OptionBalance>{dcBalance.toLocaleString()} DC available</OptionBalance>
|
|
41
|
+
</OptionLabel>
|
|
42
|
+
</OptionButton>
|
|
43
|
+
|
|
44
|
+
<OptionButton onClick={onPayWithCard} className="rpgui-button">
|
|
45
|
+
<FaCreditCard />
|
|
46
|
+
<OptionLabel>
|
|
47
|
+
<span>Pay with Credit Card</span>
|
|
48
|
+
</OptionLabel>
|
|
49
|
+
</OptionButton>
|
|
50
|
+
|
|
51
|
+
<CancelWrapper>
|
|
52
|
+
<Button buttonType={ButtonTypes.RPGUIButton} onPointerDown={onClose}>
|
|
53
|
+
Cancel
|
|
54
|
+
</Button>
|
|
55
|
+
</CancelWrapper>
|
|
56
|
+
</ModalContent>
|
|
57
|
+
</ModalContainer>
|
|
58
|
+
</ModalPortal>
|
|
59
|
+
);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const Overlay = styled.div`
|
|
63
|
+
position: fixed;
|
|
64
|
+
inset: 0;
|
|
65
|
+
background: rgba(0, 0, 0, 0.65);
|
|
66
|
+
z-index: 1000;
|
|
67
|
+
`;
|
|
68
|
+
|
|
69
|
+
const ModalContainer = styled.div`
|
|
70
|
+
position: fixed;
|
|
71
|
+
inset: 0;
|
|
72
|
+
display: flex;
|
|
73
|
+
align-items: center;
|
|
74
|
+
justify-content: center;
|
|
75
|
+
z-index: 1001;
|
|
76
|
+
pointer-events: none;
|
|
77
|
+
`;
|
|
78
|
+
|
|
79
|
+
const ModalContent = styled.div`
|
|
80
|
+
background: #1a1a2e;
|
|
81
|
+
border: 2px solid #f59e0b;
|
|
82
|
+
border-radius: 8px;
|
|
83
|
+
padding: 24px;
|
|
84
|
+
min-width: 320px;
|
|
85
|
+
max-width: 90%;
|
|
86
|
+
display: flex;
|
|
87
|
+
flex-direction: column;
|
|
88
|
+
gap: 12px;
|
|
89
|
+
pointer-events: auto;
|
|
90
|
+
animation: scaleIn 0.2s ease-out;
|
|
91
|
+
|
|
92
|
+
@keyframes scaleIn {
|
|
93
|
+
from { transform: scale(0.85); opacity: 0; }
|
|
94
|
+
to { transform: scale(1); opacity: 1; }
|
|
95
|
+
}
|
|
96
|
+
`;
|
|
97
|
+
|
|
98
|
+
const Title = styled.h3`
|
|
99
|
+
margin: 0 0 8px;
|
|
100
|
+
font-family: 'Press Start 2P', cursive;
|
|
101
|
+
font-size: 0.75rem;
|
|
102
|
+
color: #fef08a;
|
|
103
|
+
text-align: center;
|
|
104
|
+
`;
|
|
105
|
+
|
|
106
|
+
const OptionButton = styled.button`
|
|
107
|
+
display: flex;
|
|
108
|
+
align-items: center;
|
|
109
|
+
gap: 12px;
|
|
110
|
+
width: 100%;
|
|
111
|
+
padding: 10px 14px;
|
|
112
|
+
cursor: pointer;
|
|
113
|
+
font-family: 'Press Start 2P', cursive;
|
|
114
|
+
font-size: 0.65rem;
|
|
115
|
+
|
|
116
|
+
svg {
|
|
117
|
+
font-size: 1.25rem;
|
|
118
|
+
flex-shrink: 0;
|
|
119
|
+
}
|
|
120
|
+
`;
|
|
121
|
+
|
|
122
|
+
const OptionLabel = styled.div`
|
|
123
|
+
display: flex;
|
|
124
|
+
flex-direction: column;
|
|
125
|
+
align-items: flex-start;
|
|
126
|
+
gap: 4px;
|
|
127
|
+
`;
|
|
128
|
+
|
|
129
|
+
const OptionBalance = styled.span`
|
|
130
|
+
font-size: 0.55rem;
|
|
131
|
+
color: #fef08a;
|
|
132
|
+
opacity: 0.8;
|
|
133
|
+
`;
|
|
134
|
+
|
|
135
|
+
const CancelWrapper = styled.div`
|
|
136
|
+
display: flex;
|
|
137
|
+
justify-content: center;
|
|
138
|
+
margin-top: 4px;
|
|
139
|
+
filter: grayscale(0.6);
|
|
140
|
+
`;
|
|
@@ -27,6 +27,7 @@ export interface IStoreProps {
|
|
|
27
27
|
onShowHistory?: () => void;
|
|
28
28
|
onShowWallet?: () => void;
|
|
29
29
|
walletLabel?: string;
|
|
30
|
+
packsTabLabel?: string;
|
|
30
31
|
userAccountType: UserAccountTypes;
|
|
31
32
|
loading?: boolean;
|
|
32
33
|
error?: string;
|
|
@@ -58,6 +59,7 @@ export const Store: React.FC<IStoreProps> = ({
|
|
|
58
59
|
textInputItemKeys = [],
|
|
59
60
|
customPacksContent,
|
|
60
61
|
customWalletContent,
|
|
62
|
+
packsTabLabel = 'Packs',
|
|
61
63
|
}) => {
|
|
62
64
|
const [selectedPack, setSelectedPack] = useState<IItemPack | null>(null);
|
|
63
65
|
const [activeTab, setActiveTab] = useState<TabId>(() => {
|
|
@@ -171,7 +173,7 @@ export const Store: React.FC<IStoreProps> = ({
|
|
|
171
173
|
},
|
|
172
174
|
packs: {
|
|
173
175
|
id: 'packs',
|
|
174
|
-
title:
|
|
176
|
+
title: packsTabLabel,
|
|
175
177
|
content: customPacksContent ?? (
|
|
176
178
|
<StorePacksSection
|
|
177
179
|
packs={packs.filter(pack => pack.priceUSD < 9.99)}
|
|
@@ -44,6 +44,7 @@ export const StoreItemDetails: React.FC<IStoreItemDetailsProps> = ({
|
|
|
44
44
|
<ItemName>{item.name}</ItemName>
|
|
45
45
|
<ItemPrice>
|
|
46
46
|
${'priceUSD' in item ? item.priceUSD : item.price}
|
|
47
|
+
{(item as any).dcPrice ? ` · ${((item as any).dcPrice as number).toLocaleString()} DC` : ''}
|
|
47
48
|
</ItemPrice>
|
|
48
49
|
<Description>{item.description}</Description>
|
|
49
50
|
</ItemInfo>
|
|
@@ -71,7 +71,10 @@ export const StoreItemRow: React.FC<IStoreItemRowProps> = ({
|
|
|
71
71
|
|
|
72
72
|
<ItemDetails>
|
|
73
73
|
<ItemName>{item.name}</ItemName>
|
|
74
|
-
<ItemPrice
|
|
74
|
+
<ItemPrice>
|
|
75
|
+
${item.price}
|
|
76
|
+
{(item as any).dcPrice ? ` · ${((item as any).dcPrice as number).toLocaleString()} DC` : ''}
|
|
77
|
+
</ItemPrice>
|
|
75
78
|
<ItemDescription>{item.description}</ItemDescription>
|
|
76
79
|
</ItemDetails>
|
|
77
80
|
|
package/src/index.tsx
CHANGED
|
@@ -61,6 +61,7 @@ export * from './components/Store/CartView';
|
|
|
61
61
|
export * from './components/Store/hooks/useStoreCart';
|
|
62
62
|
export * from './components/Store/MetadataCollector';
|
|
63
63
|
export * from './components/Store/Store';
|
|
64
|
+
export * from './components/Store/PaymentMethodModal';
|
|
64
65
|
export * from './components/Table/Table';
|
|
65
66
|
export * from './components/TextArea';
|
|
66
67
|
export * from './components/TimeWidget/TimeWidget';
|
|
@@ -230,6 +230,8 @@ export const Default: Story = {
|
|
|
230
230
|
return Promise.resolve(true);
|
|
231
231
|
}}
|
|
232
232
|
onShowHistory={() => console.log('Show History clicked in story')}
|
|
233
|
+
onShowWallet={() => console.log('DC Wallet clicked in story')}
|
|
234
|
+
walletLabel="DC Wallet: 1,200"
|
|
233
235
|
onClose={() => console.log('Store closed')}
|
|
234
236
|
atlasJSON={itemsAtlasJSON}
|
|
235
237
|
atlasIMG={itemsAtlasIMG}
|