@rpg-engine/long-bow 0.8.180 → 0.8.182

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.
@@ -0,0 +1,324 @@
1
+ import { ICharacterListing } from '@rpg-engine/shared';
2
+ import { Meta, Story } from '@storybook/react';
3
+ import React from 'react';
4
+ import { RPGUIRoot } from '../../..';
5
+ import { CharacterMarketplacePanel } from '../../../components/Marketplace/CharacterMarketplacePanel';
6
+ import { MyCharacterListingsPanel } from '../../../components/Marketplace/MyCharacterListingsPanel';
7
+ import atlasJSON from '../../../mocks/atlas/items/items.json';
8
+ import atlasIMG from '../../../mocks/atlas/items/items.png';
9
+
10
+ const meta: Meta = {
11
+ title: 'Features/Marketplace/CharacterMarketplace',
12
+ component: CharacterMarketplacePanel,
13
+ };
14
+
15
+ export default meta;
16
+
17
+ const now = new Date();
18
+ const daysAgo = (days: number): Date =>
19
+ new Date(now.getTime() - days * 24 * 60 * 60 * 1000);
20
+
21
+ const mockCharacterListings: ICharacterListing[] = [
22
+ {
23
+ _id: 'cl-1',
24
+ character: 'char-1',
25
+ seller: 'player-2',
26
+ listedByCharacterName: 'WarriorKing',
27
+ price: 50000,
28
+ isBeingBought: false,
29
+ characterSnapshot: {
30
+ name: 'Sir Galahad',
31
+ level: 25,
32
+ class: 'Warrior',
33
+ race: 'Human',
34
+ faction: 'Alliance',
35
+ mode: 'Hardcore',
36
+ skills: { sword: 10, shield: 8 },
37
+ equipment: [
38
+ { slot: 'weapon', itemName: 'Broad Sword', itemKey: 'items/broad-sword', rarity: 'Common' },
39
+ { slot: 'armor', itemName: 'Steel Armor', itemKey: 'items/steel-armor', rarity: 'Rare' },
40
+ ],
41
+ textureKey: 'characters/warrior/male',
42
+ },
43
+ createdAt: daysAgo(3),
44
+ updatedAt: daysAgo(3),
45
+ },
46
+ {
47
+ _id: 'cl-2',
48
+ character: 'char-2',
49
+ seller: 'player-3',
50
+ listedByCharacterName: 'MageLord',
51
+ price: 75000,
52
+ isBeingBought: false,
53
+ characterSnapshot: {
54
+ name: 'Merlin Jr.',
55
+ level: 30,
56
+ class: 'Mage',
57
+ race: 'Elf',
58
+ faction: 'Horde',
59
+ mode: 'Standard',
60
+ skills: { fireball: 15, frostbolt: 12 },
61
+ equipment: [
62
+ { slot: 'weapon', itemName: 'Fire Staff', itemKey: 'items/fire-staff', rarity: 'Epic' },
63
+ ],
64
+ textureKey: 'characters/mage/male',
65
+ },
66
+ createdAt: daysAgo(1),
67
+ updatedAt: daysAgo(1),
68
+ },
69
+ {
70
+ _id: 'cl-3',
71
+ character: 'char-3',
72
+ seller: 'player-4',
73
+ listedByCharacterName: 'RogueShadow',
74
+ price: 40000,
75
+ isBeingBought: true,
76
+ characterSnapshot: {
77
+ name: 'ShadowStep',
78
+ level: 20,
79
+ class: 'Rogue',
80
+ race: 'Dark Elf',
81
+ faction: 'Horde',
82
+ mode: 'Hardcore',
83
+ skills: { stealth: 10, backstab: 12 },
84
+ equipment: [
85
+ { slot: 'weapon', itemName: 'Dagger', itemKey: 'items/dagger', rarity: 'Uncommon' },
86
+ ],
87
+ textureKey: 'characters/rogue/female',
88
+ },
89
+ createdAt: daysAgo(7),
90
+ updatedAt: daysAgo(1),
91
+ },
92
+ {
93
+ _id: 'cl-4',
94
+ character: 'char-4',
95
+ seller: 'player-5',
96
+ listedByCharacterName: 'PaladinLight',
97
+ price: 100000,
98
+ isBeingBought: false,
99
+ characterSnapshot: {
100
+ name: 'Lightbringer',
101
+ level: 40,
102
+ class: 'Paladin',
103
+ race: 'Human',
104
+ faction: 'Alliance',
105
+ mode: 'Standard',
106
+ skills: { holy: 20, shield: 15 },
107
+ equipment: [
108
+ { slot: 'weapon', itemName: 'Holy Sword', itemKey: 'items/holy-sword', rarity: 'Legendary' },
109
+ { slot: 'armor', itemName: 'Divine Armor', itemKey: 'items/divine-armor', rarity: 'Epic' },
110
+ ],
111
+ textureKey: 'characters/paladin/male',
112
+ },
113
+ createdAt: daysAgo(14),
114
+ updatedAt: daysAgo(14),
115
+ },
116
+ {
117
+ _id: 'cl-5',
118
+ character: 'char-5',
119
+ seller: 'player-6',
120
+ listedByCharacterName: 'ArcherQueen',
121
+ price: 35000,
122
+ isBeingBought: false,
123
+ characterSnapshot: {
124
+ name: 'ArrowStorm',
125
+ level: 18,
126
+ class: 'Archer',
127
+ race: 'Wood Elf',
128
+ faction: 'Alliance',
129
+ mode: 'Standard',
130
+ skills: { archery: 12, tracking: 8 },
131
+ equipment: [
132
+ { slot: 'weapon', itemName: 'Longbow', itemKey: 'items/longbow', rarity: 'Rare' },
133
+ ],
134
+ textureKey: 'characters/archer/female',
135
+ },
136
+ createdAt: daysAgo(2),
137
+ updatedAt: daysAgo(2),
138
+ },
139
+ ];
140
+
141
+ const mockMyCharacterListings: ICharacterListing[] = [
142
+ {
143
+ _id: 'cl-10',
144
+ character: 'char-10',
145
+ seller: 'player-1',
146
+ listedByCharacterName: 'MyMainChar',
147
+ price: 80000,
148
+ isBeingBought: false,
149
+ characterSnapshot: {
150
+ name: 'MyWarrior',
151
+ level: 35,
152
+ class: 'Warrior',
153
+ race: 'Human',
154
+ faction: 'Alliance',
155
+ mode: 'Standard',
156
+ skills: { sword: 18, shield: 16 },
157
+ equipment: [
158
+ { slot: 'weapon', itemName: 'Epic Sword', itemKey: 'items/epic-sword', rarity: 'Epic' },
159
+ ],
160
+ textureKey: 'characters/warrior/male',
161
+ },
162
+ createdAt: daysAgo(10),
163
+ updatedAt: daysAgo(10),
164
+ },
165
+ {
166
+ _id: 'cl-11',
167
+ character: 'char-11',
168
+ seller: 'player-1',
169
+ listedByCharacterName: 'MyMainChar',
170
+ price: 25000,
171
+ isBeingBought: true,
172
+ characterSnapshot: {
173
+ name: 'MyAltMage',
174
+ level: 15,
175
+ class: 'Mage',
176
+ race: 'Human',
177
+ faction: 'Alliance',
178
+ mode: 'Standard',
179
+ skills: { fireball: 8 },
180
+ equipment: [
181
+ { slot: 'weapon', itemName: 'Basic Staff', itemKey: 'items/staff', rarity: 'Common' },
182
+ ],
183
+ textureKey: 'characters/mage/female',
184
+ },
185
+ createdAt: daysAgo(5),
186
+ updatedAt: daysAgo(1),
187
+ },
188
+ ];
189
+
190
+ export const CharacterBrowse: Story = () => (
191
+ <RPGUIRoot>
192
+ <CharacterMarketplacePanel
193
+ characterListings={mockCharacterListings}
194
+ totalCount={50}
195
+ currentPage={1}
196
+ itemsPerPage={8}
197
+ onPageChange={() => {}}
198
+ onCharacterBuy={() => {}}
199
+ atlasJSON={atlasJSON}
200
+ atlasIMG={atlasIMG}
201
+ nameFilter=""
202
+ onNameFilterChange={() => {}}
203
+ isLoading={false}
204
+ />
205
+ </RPGUIRoot>
206
+ );
207
+
208
+ CharacterBrowse.storyName = 'Browse Character Listings';
209
+
210
+ export const CharacterBrowseLoading: Story = () => (
211
+ <RPGUIRoot>
212
+ <CharacterMarketplacePanel
213
+ characterListings={[]}
214
+ totalCount={0}
215
+ currentPage={1}
216
+ itemsPerPage={8}
217
+ onPageChange={() => {}}
218
+ onCharacterBuy={() => {}}
219
+ atlasJSON={atlasJSON}
220
+ atlasIMG={atlasIMG}
221
+ nameFilter=""
222
+ onNameFilterChange={() => {}}
223
+ isLoading={true}
224
+ />
225
+ </RPGUIRoot>
226
+ );
227
+
228
+ CharacterBrowseLoading.storyName = 'Loading State';
229
+
230
+ export const CharacterBrowseEmpty: Story = () => (
231
+ <RPGUIRoot>
232
+ <CharacterMarketplacePanel
233
+ characterListings={[]}
234
+ totalCount={0}
235
+ currentPage={1}
236
+ itemsPerPage={8}
237
+ onPageChange={() => {}}
238
+ onCharacterBuy={() => {}}
239
+ atlasJSON={atlasJSON}
240
+ atlasIMG={atlasIMG}
241
+ nameFilter=""
242
+ onNameFilterChange={() => {}}
243
+ isLoading={false}
244
+ />
245
+ </RPGUIRoot>
246
+ );
247
+
248
+ CharacterBrowseEmpty.storyName = 'Empty State';
249
+
250
+ export const CharacterBrowseFiltered: Story = () => (
251
+ <RPGUIRoot>
252
+ <CharacterMarketplacePanel
253
+ characterListings={mockCharacterListings.filter(l =>
254
+ l.characterSnapshot.name.toLowerCase().includes('warrior')
255
+ )}
256
+ totalCount={2}
257
+ currentPage={1}
258
+ itemsPerPage={8}
259
+ onPageChange={() => {}}
260
+ onCharacterBuy={() => {}}
261
+ atlasJSON={atlasJSON}
262
+ atlasIMG={atlasIMG}
263
+ nameFilter="warrior"
264
+ onNameFilterChange={() => {}}
265
+ isLoading={false}
266
+ />
267
+ </RPGUIRoot>
268
+ );
269
+
270
+ CharacterBrowseFiltered.storyName = 'With Name Filter';
271
+
272
+ export const MyCharacterListings: Story = () => (
273
+ <RPGUIRoot>
274
+ <MyCharacterListingsPanel
275
+ myCharacterListings={mockMyCharacterListings}
276
+ totalCount={2}
277
+ currentPage={1}
278
+ itemsPerPage={8}
279
+ onPageChange={() => {}}
280
+ onCharacterDelist={() => {}}
281
+ atlasJSON={atlasJSON}
282
+ atlasIMG={atlasIMG}
283
+ />
284
+ </RPGUIRoot>
285
+ );
286
+
287
+ MyCharacterListings.storyName = 'My Character Listings';
288
+
289
+ export const MyCharacterListingsEmpty: Story = () => (
290
+ <RPGUIRoot>
291
+ <MyCharacterListingsPanel
292
+ myCharacterListings={[]}
293
+ totalCount={0}
294
+ currentPage={1}
295
+ itemsPerPage={8}
296
+ onPageChange={() => {}}
297
+ onCharacterDelist={() => {}}
298
+ atlasJSON={atlasJSON}
299
+ atlasIMG={atlasIMG}
300
+ />
301
+ </RPGUIRoot>
302
+ );
303
+
304
+ MyCharacterListingsEmpty.storyName = 'My Listings - Empty State';
305
+
306
+ export const CharacterListingPending: Story = () => (
307
+ <RPGUIRoot>
308
+ <CharacterMarketplacePanel
309
+ characterListings={[mockCharacterListings[2]]} // The one with isBeingBought: true
310
+ totalCount={1}
311
+ currentPage={1}
312
+ itemsPerPage={8}
313
+ onPageChange={() => {}}
314
+ onCharacterBuy={() => {}}
315
+ atlasJSON={atlasJSON}
316
+ atlasIMG={atlasIMG}
317
+ nameFilter=""
318
+ onNameFilterChange={() => {}}
319
+ isLoading={false}
320
+ />
321
+ </RPGUIRoot>
322
+ );
323
+
324
+ CharacterListingPending.storyName = 'Listing with Pending Sale';