@rpg-engine/long-bow 0.8.156 → 0.8.158

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rpg-engine/long-bow",
3
- "version": "0.8.156",
3
+ "version": "0.8.158",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import styled from 'styled-components';
3
3
  import { uiColors } from '../../constants/uiColors';
4
+ import { Dropdown, IOptionsProps } from '../Dropdown';
4
5
  import { Pagination } from '../shared/Pagination/Pagination';
5
6
 
6
7
  export interface IDCTransaction {
@@ -35,16 +36,16 @@ const TRANSACTION_TYPE_COLORS: Record<string, string> = {
35
36
  AdminAdjustment: '#9ca3af', // gray — admin
36
37
  };
37
38
 
38
- const TRANSACTION_TYPE_OPTIONS = [
39
- { value: '', label: 'All Types' },
40
- { value: 'Purchase', label: 'Purchase' },
41
- { value: 'Transfer', label: 'Transfer' },
42
- { value: 'MarketplaceSale', label: 'Marketplace Sale' },
43
- { value: 'MarketplacePurchase', label: 'Marketplace Buy' },
44
- { value: 'StorePurchase', label: 'Store Purchase' },
45
- { value: 'Fee', label: 'Fee' },
46
- { value: 'Refund', label: 'Refund' },
47
- { value: 'AdminAdjustment', label: 'Admin Adjustment' },
39
+ const TRANSACTION_TYPE_OPTIONS: IOptionsProps[] = [
40
+ { id: 1, value: '', option: 'All Types' },
41
+ { id: 2, value: 'Purchase', option: 'Purchase' },
42
+ { id: 3, value: 'Transfer', option: 'Transfer' },
43
+ { id: 4, value: 'MarketplaceSale', option: 'Marketplace Sale' },
44
+ { id: 5, value: 'MarketplacePurchase', option: 'Marketplace Buy' },
45
+ { id: 6, value: 'StorePurchase', option: 'Store Purchase' },
46
+ { id: 7, value: 'Fee', option: 'Fee' },
47
+ { id: 8, value: 'Refund', option: 'Refund' },
48
+ { id: 9, value: 'AdminAdjustment', option: 'Admin Adjustment' },
48
49
  ];
49
50
 
50
51
  export interface IDCHistoryPanelProps {
@@ -70,8 +71,7 @@ export const DCHistoryPanel: React.FC<IDCHistoryPanelProps> = ({
70
71
  // eslint-disable-next-line react-hooks/exhaustive-deps
71
72
  }, []);
72
73
 
73
- const handleTypeChange = (e: React.ChangeEvent<HTMLSelectElement>): void => {
74
- const value = e.target.value;
74
+ const handleTypeChange = (value: string): void => {
75
75
  setSelectedType(value);
76
76
  onRequestHistory(1, value || undefined);
77
77
  };
@@ -88,12 +88,13 @@ export const DCHistoryPanel: React.FC<IDCHistoryPanelProps> = ({
88
88
  return (
89
89
  <PanelContainer>
90
90
  <FilterRow>
91
- <FilterLabel>Filter:</FilterLabel>
92
- <TypeSelect value={selectedType} onChange={handleTypeChange}>
93
- {TRANSACTION_TYPE_OPTIONS.map((opt) => (
94
- <option key={opt.value} value={opt.value}>{opt.label}</option>
95
- ))}
96
- </TypeSelect>
91
+ <FilterLabel>FILTER BY TYPE</FilterLabel>
92
+ <StyledDropdown
93
+ key={selectedType}
94
+ options={TRANSACTION_TYPE_OPTIONS}
95
+ onChange={handleTypeChange}
96
+ width="100%"
97
+ />
97
98
  </FilterRow>
98
99
 
99
100
  {loading && (
@@ -154,42 +155,25 @@ const PanelContainer = styled.div`
154
155
  const FilterRow = styled.div`
155
156
  display: flex;
156
157
  align-items: center;
157
- gap: 8px;
158
- margin-bottom: 2px;
158
+ gap: 12px;
159
+ background: rgba(0, 0, 0, 0.15);
160
+ border-radius: 4px;
161
+ border: 1px solid rgba(255, 255, 255, 0.05);
162
+ padding: 8px 12px;
159
163
  `;
160
164
 
161
- const FilterLabel = styled.span`
162
- font-size: 7px;
163
- color: #f59e0b;
164
- font-family: 'Press Start 2P', cursive;
165
+ const FilterLabel = styled.p`
166
+ margin: 0 !important;
167
+ font-size: 0.7rem !important;
168
+ color: #ccc !important;
169
+ font-family: 'Press Start 2P', cursive !important;
170
+ text-transform: uppercase;
171
+ letter-spacing: 1px;
165
172
  white-space: nowrap;
166
173
  `;
167
174
 
168
- const TypeSelect = styled.select`
169
- background: rgba(0, 0, 0, 0.7);
170
- border: 1px solid rgba(245, 158, 11, 0.4);
171
- border-radius: 3px;
172
- color: #f59e0b;
173
- font-size: 7px;
174
- font-family: 'Press Start 2P', cursive;
175
- padding: 3px 5px;
176
- cursor: pointer;
177
- outline: none;
178
- flex: 1;
179
-
180
- option {
181
- background: #1a1a2e;
182
- color: #f59e0b;
183
- }
184
-
185
- &:hover {
186
- border-color: #f59e0b;
187
- }
188
-
189
- &:focus {
190
- border-color: #f59e0b;
191
- box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.3);
192
- }
175
+ const StyledDropdown = styled(Dropdown)`
176
+ margin: 0px !important;
193
177
  `;
194
178
 
195
179
  const TransactionList = styled.div`
@@ -238,29 +222,29 @@ const TxRight = styled.div`
238
222
  `;
239
223
 
240
224
  const TxType = styled.span`
241
- font-size: 7px;
242
- font-family: 'Press Start 2P', cursive;
225
+ font-size: 8px !important;
226
+ font-family: 'Press Start 2P', cursive !important;
243
227
  `;
244
228
 
245
229
  const TxAmount = styled.span`
246
- font-size: 8px;
247
- font-family: 'Press Start 2P', cursive;
230
+ font-size: 9px !important;
231
+ font-family: 'Press Start 2P', cursive !important;
248
232
  white-space: nowrap;
249
233
  `;
250
234
 
251
235
  const TxNote = styled.span`
252
- font-size: 6px;
253
- color: ${uiColors.lightGray};
254
- font-family: 'Press Start 2P', cursive;
236
+ font-size: 7px !important;
237
+ color: ${uiColors.lightGray} !important;
238
+ font-family: 'Press Start 2P', cursive !important;
255
239
  white-space: nowrap;
256
240
  overflow: hidden;
257
241
  text-overflow: ellipsis;
258
242
  `;
259
243
 
260
244
  const TxDate = styled.span`
261
- font-size: 6px;
262
- color: rgba(255, 255, 255, 0.4);
263
- font-family: 'Press Start 2P', cursive;
245
+ font-size: 7px !important;
246
+ color: rgba(255, 255, 255, 0.4) !important;
247
+ font-family: 'Press Start 2P', cursive !important;
264
248
  white-space: nowrap;
265
249
  `;
266
250
 
@@ -270,9 +254,9 @@ const LoadingRow = styled.div`
270
254
  gap: 8px;
271
255
  justify-content: center;
272
256
  padding: 16px;
273
- color: ${uiColors.white};
274
- font-size: 9px;
275
- font-family: 'Press Start 2P', cursive;
257
+ color: ${uiColors.white} !important;
258
+ font-size: 9px !important;
259
+ font-family: 'Press Start 2P', cursive !important;
276
260
  `;
277
261
 
278
262
  const Spinner = styled.div`
@@ -290,9 +274,9 @@ const Spinner = styled.div`
290
274
  `;
291
275
 
292
276
  const EmptyMessage = styled.div`
293
- font-size: 8px;
294
- color: ${uiColors.lightGray};
295
- font-family: 'Press Start 2P', cursive;
277
+ font-size: 8px !important;
278
+ color: ${uiColors.lightGray} !important;
279
+ font-family: 'Press Start 2P', cursive !important;
296
280
  text-align: center;
297
281
  padding: 20px;
298
282
  `;
@@ -213,21 +213,21 @@ const PanelContainer = styled.div`
213
213
  `;
214
214
 
215
215
  const FieldLabel = styled.label`
216
- font-size: 9px;
217
- color: #f59e0b;
218
- font-family: 'Press Start 2P', cursive;
216
+ font-size: 9px !important;
217
+ color: #f59e0b !important;
218
+ font-family: 'Press Start 2P', cursive !important;
219
219
  margin-top: 8px;
220
220
  `;
221
221
 
222
222
  const StyledInput = styled(Input)`
223
- background: rgba(0, 0, 0, 0.6);
224
- border: 1px solid #f59e0b;
225
- color: ${uiColors.white};
226
- padding: 6px 8px;
227
- font-size: 12px;
228
- font-family: 'Press Start 2P', cursive;
229
- width: 100%;
230
- box-sizing: border-box;
223
+ background: rgba(0, 0, 0, 0.6) !important;
224
+ border: 1px solid #f59e0b !important;
225
+ color: ${uiColors.white} !important;
226
+ padding: 6px 8px !important;
227
+ font-size: 11px !important;
228
+ font-family: 'Press Start 2P', cursive !important;
229
+ width: 100% !important;
230
+ box-sizing: border-box !important;
231
231
 
232
232
  &:disabled {
233
233
  opacity: 0.5;
@@ -235,7 +235,7 @@ const StyledInput = styled(Input)`
235
235
 
236
236
  &:focus {
237
237
  outline: none;
238
- border-color: ${uiColors.white};
238
+ border-color: ${uiColors.white} !important;
239
239
  }
240
240
  `;
241
241
 
@@ -261,18 +261,18 @@ const Spinner = styled.div`
261
261
  const ResultMessage = styled.div<{ $success: boolean }>`
262
262
  margin-top: 8px;
263
263
  padding: 8px;
264
- font-size: 9px;
265
- font-family: 'Press Start 2P', cursive;
266
- color: ${({ $success }) => ($success ? uiColors.green : uiColors.red)};
264
+ font-size: 9px !important;
265
+ font-family: 'Press Start 2P', cursive !important;
266
+ color: ${({ $success }) => ($success ? uiColors.green : uiColors.red)} !important;
267
267
  border: 1px solid ${({ $success }) => ($success ? uiColors.green : uiColors.red)};
268
268
  background: rgba(0, 0, 0, 0.4);
269
269
  text-align: center;
270
270
  `;
271
271
 
272
272
  const ErrorMessage = styled.div`
273
- font-size: 9px;
274
- color: ${uiColors.red};
275
- font-family: 'Press Start 2P', cursive;
273
+ font-size: 9px !important;
274
+ color: ${uiColors.red} !important;
275
+ font-family: 'Press Start 2P', cursive !important;
276
276
  `;
277
277
 
278
278
  const AutocompleteWrapper = styled.div`
@@ -0,0 +1,251 @@
1
+ import React from 'react';
2
+ import { FaShoppingCart } from 'react-icons/fa';
3
+ import styled from 'styled-components';
4
+ import { InternalTabs } from '../InternalTabs/InternalTabs';
5
+ import { DCHistoryPanel, IDCTransaction } from './DCHistoryPanel';
6
+ import { DCTransferPanel, IDCTransferCharacterResult } from './DCTransferPanel';
7
+
8
+ export interface IDCWalletContentProps {
9
+ dcBalance: number;
10
+ historyData: { transactions: IDCTransaction[]; totalPages: number; currentPage: number } | null;
11
+ historyLoading: boolean;
12
+ onRequestHistory: (page: number, type?: string) => void;
13
+ transferLoading: boolean;
14
+ transferResult: { success: boolean; message: string } | null;
15
+ onSendTransfer: (recipientName: string, amount: number) => void;
16
+ onClearTransferResult: () => void;
17
+ characterName?: string;
18
+ onInputFocus?: () => void;
19
+ onInputBlur?: () => void;
20
+ onBuyDC?: () => void;
21
+ onSearchCharacter?: (name: string) => void;
22
+ searchResults?: IDCTransferCharacterResult[];
23
+ }
24
+
25
+ const DC_TO_GOLD = 5500;
26
+ const DC_TO_USD = 100;
27
+
28
+ export const DCWalletContent: React.FC<IDCWalletContentProps> = ({
29
+ dcBalance,
30
+ historyData,
31
+ historyLoading,
32
+ onRequestHistory,
33
+ transferLoading,
34
+ transferResult,
35
+ onSendTransfer,
36
+ onClearTransferResult,
37
+ characterName,
38
+ onInputFocus,
39
+ onInputBlur,
40
+ onBuyDC,
41
+ onSearchCharacter,
42
+ searchResults,
43
+ }) => {
44
+ const usdValue = (dcBalance / DC_TO_USD).toFixed(2);
45
+ const goldValue = (dcBalance * DC_TO_GOLD).toLocaleString();
46
+
47
+ const tabs = [
48
+ {
49
+ id: 'transfer',
50
+ title: 'Transfer',
51
+ content: (
52
+ <DCTransferPanel
53
+ dcBalance={dcBalance}
54
+ transferLoading={transferLoading}
55
+ transferResult={transferResult}
56
+ onSendTransfer={onSendTransfer}
57
+ onClearTransferResult={onClearTransferResult}
58
+ characterName={characterName}
59
+ onInputFocus={onInputFocus}
60
+ onInputBlur={onInputBlur}
61
+ onSearchCharacter={onSearchCharacter}
62
+ searchResults={searchResults}
63
+ />
64
+ ),
65
+ },
66
+ {
67
+ id: 'history',
68
+ title: 'History',
69
+ content: (
70
+ <DCHistoryPanel
71
+ transactions={historyData?.transactions ?? []}
72
+ totalPages={historyData?.totalPages ?? 0}
73
+ currentPage={historyData?.currentPage ?? 1}
74
+ loading={historyLoading}
75
+ onRequestHistory={onRequestHistory}
76
+ />
77
+ ),
78
+ },
79
+ ];
80
+
81
+ return (
82
+ <WalletContainer>
83
+ <BalanceHeader>
84
+ <BalanceTop>
85
+ <BalanceBlock>
86
+ <BalanceLabel>DC BALANCE</BalanceLabel>
87
+ <BalanceAmount>{dcBalance.toLocaleString()} <BalanceDC>DC</BalanceDC></BalanceAmount>
88
+ <BalanceEquiv>≈ ${usdValue} USD &nbsp;·&nbsp; {goldValue} Gold</BalanceEquiv>
89
+ </BalanceBlock>
90
+ {onBuyDC && (
91
+ <BuyButton onPointerDown={onBuyDC} role="button" tabIndex={0} title="Buy Definya Coins">
92
+ <FaShoppingCart />
93
+ <BuyButtonLabel>Buy DC</BuyButtonLabel>
94
+ </BuyButton>
95
+ )}
96
+ </BalanceTop>
97
+ <RateStrip>
98
+ <RateItem><RateNum>1 DC</RateNum><RateSep>=</RateSep><RateVal>5,500 Gold</RateVal></RateItem>
99
+ <RateDivider />
100
+ <RateItem><RateNum>100 DC</RateNum><RateSep>=</RateSep><RateVal>1 USD</RateVal></RateItem>
101
+ <RateDivider />
102
+ <RateItem><RateNum>1 USD</RateNum><RateSep>=</RateSep><RateVal>550K Gold</RateVal></RateItem>
103
+ </RateStrip>
104
+ </BalanceHeader>
105
+
106
+ <TabsWrapper>
107
+ <InternalTabs
108
+ tabs={tabs}
109
+ onTabChange={(tabId) => {
110
+ if (tabId === 'history') onRequestHistory(1);
111
+ }}
112
+ activeTextColor="#000000"
113
+ activeColor="#fef08a"
114
+ inactiveColor="#6b7280"
115
+ borderColor="#f59e0b"
116
+ hoverColor="#fef3c7"
117
+ />
118
+ </TabsWrapper>
119
+ </WalletContainer>
120
+ );
121
+ };
122
+
123
+ const WalletContainer = styled.div`
124
+ display: flex;
125
+ flex-direction: column;
126
+ width: 100%;
127
+ min-height: 300px;
128
+ `;
129
+
130
+ const BalanceHeader = styled.div`
131
+ background: rgba(0, 0, 0, 0.35);
132
+ border: 1px solid rgba(245, 158, 11, 0.25);
133
+ border-radius: 6px;
134
+ padding: 14px 16px 10px;
135
+ margin: 0 2.5% 10px;
136
+ display: flex;
137
+ flex-direction: column;
138
+ gap: 10px;
139
+ `;
140
+
141
+ const BalanceTop = styled.div`
142
+ display: flex;
143
+ align-items: center;
144
+ justify-content: space-between;
145
+ gap: 12px;
146
+ `;
147
+
148
+ const BalanceBlock = styled.div`
149
+ display: flex;
150
+ flex-direction: column;
151
+ gap: 5px;
152
+ `;
153
+
154
+ const BalanceLabel = styled.span`
155
+ font-family: 'Press Start 2P', cursive !important;
156
+ font-size: 9px !important;
157
+ color: rgba(245, 158, 11, 0.7) !important;
158
+ letter-spacing: 1px;
159
+ `;
160
+
161
+ const BalanceAmount = styled.div`
162
+ font-family: 'Press Start 2P', cursive !important;
163
+ font-size: 24px !important;
164
+ color: #fef08a !important;
165
+ text-shadow: 2px 2px 0 #000 !important;
166
+ letter-spacing: 2px;
167
+ line-height: 1 !important;
168
+ `;
169
+
170
+ const BalanceDC = styled.span`
171
+ font-size: 14px !important;
172
+ color: rgba(254, 240, 138, 0.6) !important;
173
+ `;
174
+
175
+ const BalanceEquiv = styled.div`
176
+ font-family: 'Press Start 2P', cursive !important;
177
+ font-size: 8px !important;
178
+ color: rgba(255, 255, 255, 0.45) !important;
179
+ letter-spacing: 0.5px;
180
+ `;
181
+
182
+ const BuyButton = styled.div`
183
+ display: flex;
184
+ flex-direction: row;
185
+ align-items: center;
186
+ gap: 6px;
187
+ padding: 10px 16px;
188
+ background: #f59e0b;
189
+ border-radius: 4px;
190
+ color: #000 !important;
191
+ cursor: pointer;
192
+ flex-shrink: 0;
193
+ font-size: 14px;
194
+ white-space: nowrap;
195
+ user-select: none;
196
+ text-shadow: none !important;
197
+
198
+ &:hover { background: #fbbf24; }
199
+ &:active { background: #d97706; }
200
+ `;
201
+
202
+ const BuyButtonLabel = styled.span`
203
+ font-family: 'Press Start 2P', cursive !important;
204
+ font-size: 8px !important;
205
+ color: #000 !important;
206
+ white-space: nowrap !important;
207
+ text-shadow: none !important;
208
+ `;
209
+
210
+ const RateStrip = styled.div`
211
+ display: flex;
212
+ align-items: center;
213
+ border-top: 1px solid rgba(245, 158, 11, 0.1);
214
+ padding-top: 8px;
215
+ `;
216
+
217
+ const RateItem = styled.div`
218
+ display: flex;
219
+ align-items: center;
220
+ gap: 5px;
221
+ flex: 1;
222
+ justify-content: center;
223
+ `;
224
+
225
+ const RateDivider = styled.div`
226
+ width: 1px;
227
+ height: 12px;
228
+ background: rgba(245, 158, 11, 0.2);
229
+ `;
230
+
231
+ const RateNum = styled.span`
232
+ font-family: 'Press Start 2P', cursive !important;
233
+ font-size: 6px !important;
234
+ color: rgba(255, 255, 255, 0.5) !important;
235
+ `;
236
+
237
+ const RateSep = styled.span`
238
+ font-family: 'Press Start 2P', cursive !important;
239
+ font-size: 6px !important;
240
+ color: rgba(255, 255, 255, 0.2) !important;
241
+ `;
242
+
243
+ const RateVal = styled.span`
244
+ font-family: 'Press Start 2P', cursive !important;
245
+ font-size: 6px !important;
246
+ color: rgba(254, 240, 138, 0.6) !important;
247
+ `;
248
+
249
+ const TabsWrapper = styled.div`
250
+ padding: 0 2.5%;
251
+ `;