@rpg-engine/long-bow 0.2.29 → 0.2.33
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/Arrow/SelectArrow.d.ts +8 -0
- package/dist/components/TradingMenu/TradingItemRow.d.ts +9 -0
- package/dist/components/TradingMenu/TradingMenu.d.ts +12 -0
- package/dist/components/shared/Ellipsis.d.ts +3 -1
- package/dist/index.d.ts +3 -3
- package/dist/long-bow.cjs.development.js +544 -499
- 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 +544 -499
- package/dist/long-bow.esm.js.map +1 -1
- package/dist/stories/Arrow.stories.d.ts +5 -0
- package/dist/stories/ItemTradingComponent.stories.d.ts +1 -1
- package/dist/stories/{TrandingMenu.stories.d.ts → TradingMenu.stories.d.ts} +1 -1
- package/package.json +2 -2
- package/src/components/Arrow/SelectArrow.tsx +65 -0
- package/src/components/{PropertySelect/img/ui-arrows → Arrow/img}/arrow01-left-clicked.png +0 -0
- package/src/components/{PropertySelect/img/ui-arrows → Arrow/img}/arrow01-left.png +0 -0
- package/src/components/{PropertySelect/img/ui-arrows → Arrow/img}/arrow01-right-clicked.png +0 -0
- package/src/components/{PropertySelect/img/ui-arrows → Arrow/img}/arrow01-right.png +0 -0
- package/src/components/{PropertySelect/img/ui-arrows → Arrow/img}/arrow02-left-clicked.png +0 -0
- package/src/components/{PropertySelect/img/ui-arrows → Arrow/img}/arrow02-left.png +0 -0
- package/src/components/{PropertySelect/img/ui-arrows → Arrow/img}/arrow02-right-clicked.png +0 -0
- package/src/components/{PropertySelect/img/ui-arrows → Arrow/img}/arrow02-right.png +0 -0
- package/src/components/NPCDialog/.DS_Store +0 -0
- package/src/components/NPCDialog/img/.DS_Store +0 -0
- package/src/components/PropertySelect/PropertySelect.tsx +12 -34
- package/src/components/QuestInfo/QuestInfo.tsx +8 -34
- package/src/components/TradingMenu/TradingItemRow.tsx +172 -0
- package/src/components/TradingMenu/{TrandingMenu.tsx → TradingMenu.tsx} +22 -24
- package/src/components/TradingMenu/items.mock.ts +19 -18
- package/src/components/shared/Ellipsis.tsx +25 -6
- package/src/index.tsx +3 -3
- package/src/stories/Arrow.stories.tsx +26 -0
- package/src/stories/ItemTradingComponent.stories.tsx +6 -6
- package/src/stories/{TrandingMenu.stories.tsx → TradingMenu.stories.tsx} +5 -5
- package/dist/components/TradingMenu/TrandingMenu.d.ts +0 -12
- package/dist/components/TradingMenu/itemComponent.d.ts +0 -9
- package/src/components/TradingMenu/itemComponent.tsx +0 -158
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Meta } from '@storybook/react';
|
|
2
|
+
import { ArrowBarProps } from '../components/Arrow/SelectArrow';
|
|
3
|
+
declare const meta: Meta;
|
|
4
|
+
export default meta;
|
|
5
|
+
export declare const Default: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, ArrowBarProps>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Meta } from '@storybook/react';
|
|
2
|
-
import { ITradeComponentProps } from '../components/TradingMenu/
|
|
2
|
+
import { ITradeComponentProps } from '../components/TradingMenu/TradingItemRow';
|
|
3
3
|
declare const meta: Meta;
|
|
4
4
|
export default meta;
|
|
5
5
|
export declare const Default: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, ITradeComponentProps>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Meta } from '@storybook/react';
|
|
2
|
-
import { ITrandingMenu } from '../components/TradingMenu/
|
|
2
|
+
import { ITrandingMenu } from '../components/TradingMenu/TradingMenu';
|
|
3
3
|
declare const meta: Meta;
|
|
4
4
|
export default meta;
|
|
5
5
|
export declare const Default: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, ITrandingMenu>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rpg-engine/long-bow",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.33",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
},
|
|
84
84
|
"dependencies": {
|
|
85
85
|
"@rollup/plugin-image": "^2.1.1",
|
|
86
|
-
"@rpg-engine/shared": "^0.5.
|
|
86
|
+
"@rpg-engine/shared": "^0.5.69",
|
|
87
87
|
"dayjs": "^1.11.2",
|
|
88
88
|
"fs-extra": "^10.1.0",
|
|
89
89
|
"lodash": "^4.17.21",
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
import LeftArrowClickIcon from './img/arrow01-left-clicked.png';
|
|
4
|
+
import LeftArrowIcon from './img/arrow01-left.png';
|
|
5
|
+
import RightArrowClickIcon from './img/arrow01-right-clicked.png';
|
|
6
|
+
import RightArrowIcon from './img/arrow01-right.png';
|
|
7
|
+
|
|
8
|
+
export interface ArrowBarProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
9
|
+
direction: 'right' | 'left';
|
|
10
|
+
onClick: () => void;
|
|
11
|
+
size?: number;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const SelectArrow: React.FC<ArrowBarProps> = ({
|
|
15
|
+
direction = 'left',
|
|
16
|
+
size,
|
|
17
|
+
onClick,
|
|
18
|
+
...props
|
|
19
|
+
}) => {
|
|
20
|
+
return (
|
|
21
|
+
<>
|
|
22
|
+
{direction === 'left' ? (
|
|
23
|
+
<LeftArrow size={size} onClick={() => onClick()} {...props}></LeftArrow>
|
|
24
|
+
) : (
|
|
25
|
+
<RightArrow
|
|
26
|
+
size={size}
|
|
27
|
+
onClick={() => onClick()}
|
|
28
|
+
{...props}
|
|
29
|
+
></RightArrow>
|
|
30
|
+
)}
|
|
31
|
+
</>
|
|
32
|
+
);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
interface IArrowProps {
|
|
36
|
+
size?: number;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const LeftArrow = styled.span<IArrowProps>`
|
|
40
|
+
background-image: url(${LeftArrowIcon});
|
|
41
|
+
background-size: 100% 100%;
|
|
42
|
+
left: 0;
|
|
43
|
+
position: absolute;
|
|
44
|
+
width: ${props => props.size || 40}px;
|
|
45
|
+
height: ${props => props.size || 42}px;
|
|
46
|
+
:active {
|
|
47
|
+
background-image: url(${LeftArrowClickIcon});
|
|
48
|
+
}
|
|
49
|
+
z-index: 2;
|
|
50
|
+
`;
|
|
51
|
+
|
|
52
|
+
const RightArrow = styled.span<IArrowProps>`
|
|
53
|
+
background-image: url(${RightArrowIcon});
|
|
54
|
+
right: 0;
|
|
55
|
+
position: absolute;
|
|
56
|
+
width: ${props => props.size || 40}px;
|
|
57
|
+
height: ${props => props.size || 42}px;
|
|
58
|
+
background-size: 100% 100%;
|
|
59
|
+
:active {
|
|
60
|
+
background-image: url(${RightArrowClickIcon});
|
|
61
|
+
}
|
|
62
|
+
z-index: 2;
|
|
63
|
+
`;
|
|
64
|
+
|
|
65
|
+
export default SelectArrow;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
Binary file
|
|
Binary file
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
|
+
import SelectArrow from '../Arrow/SelectArrow';
|
|
3
4
|
import { Ellipsis } from '../shared/Ellipsis';
|
|
4
|
-
import LeftArrowClickIcon from './img/ui-arrows/arrow01-left-clicked.png';
|
|
5
|
-
import LeftArrowIcon from './img/ui-arrows/arrow01-left.png';
|
|
6
|
-
import RightArrowClickIcon from './img/ui-arrows/arrow01-right-clicked.png';
|
|
7
|
-
import RightArrowIcon from './img/ui-arrows/arrow01-right.png';
|
|
8
5
|
|
|
9
6
|
export interface IPropertySelectProps {
|
|
10
7
|
availableProperties: Array<IPropertiesProps>;
|
|
@@ -54,16 +51,23 @@ export const PropertySelect: React.FC<IPropertySelectProps> = ({
|
|
|
54
51
|
<Container>
|
|
55
52
|
<TextOverlay>
|
|
56
53
|
<Item>
|
|
57
|
-
<Ellipsis maxLines={1}
|
|
54
|
+
<Ellipsis maxLines={1} maxWidth={200}>
|
|
55
|
+
{getCurrentSelectionName()}
|
|
56
|
+
</Ellipsis>
|
|
58
57
|
</Item>
|
|
59
58
|
</TextOverlay>
|
|
60
59
|
<div className="rpgui-progress-track"></div>
|
|
61
60
|
|
|
62
|
-
<
|
|
63
|
-
|
|
61
|
+
<SelectArrow
|
|
62
|
+
direction="left"
|
|
63
|
+
onClick={onLeftClick}
|
|
64
|
+
onTouchStart={onLeftClick}
|
|
65
|
+
></SelectArrow>
|
|
66
|
+
<SelectArrow
|
|
67
|
+
direction="right"
|
|
64
68
|
onClick={onRightClick}
|
|
65
69
|
onTouchStart={onRightClick}
|
|
66
|
-
></
|
|
70
|
+
></SelectArrow>
|
|
67
71
|
</Container>
|
|
68
72
|
);
|
|
69
73
|
};
|
|
@@ -99,30 +103,4 @@ const Container = styled.div<IContainerProps>`
|
|
|
99
103
|
width: 40%;
|
|
100
104
|
`;
|
|
101
105
|
|
|
102
|
-
const LeftArrow = styled.div`
|
|
103
|
-
background-image: url(${LeftArrowIcon});
|
|
104
|
-
background-size: 100% 100%;
|
|
105
|
-
left: 0;
|
|
106
|
-
position: absolute;
|
|
107
|
-
width: 40px;
|
|
108
|
-
height: 42px;
|
|
109
|
-
:active {
|
|
110
|
-
background-image: url(${LeftArrowClickIcon});
|
|
111
|
-
}
|
|
112
|
-
z-index: 2;
|
|
113
|
-
`;
|
|
114
|
-
|
|
115
|
-
const RightArrow = styled.div`
|
|
116
|
-
background-image: url(${RightArrowIcon});
|
|
117
|
-
right: 0;
|
|
118
|
-
position: absolute;
|
|
119
|
-
width: 40px;
|
|
120
|
-
background-size: 100% 100%;
|
|
121
|
-
height: 42px;
|
|
122
|
-
:active {
|
|
123
|
-
background-image: url(${RightArrowClickIcon});
|
|
124
|
-
}
|
|
125
|
-
z-index: 2;
|
|
126
|
-
`;
|
|
127
|
-
|
|
128
106
|
export default PropertySelect;
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { IQuest } from '@rpg-engine/shared';
|
|
2
2
|
import React, { useEffect, useState } from 'react';
|
|
3
3
|
import styled from 'styled-components';
|
|
4
|
+
import SelectArrow from '../Arrow/SelectArrow';
|
|
4
5
|
import { Button, ButtonTypes } from '../Button';
|
|
5
6
|
import { DraggableContainer } from '../DraggableContainer';
|
|
6
|
-
|
|
7
|
-
import LeftArrowIcon from '../PropertySelect/img/ui-arrows/arrow01-left.png';
|
|
8
|
-
import RightArrowClickIcon from '../PropertySelect/img/ui-arrows/arrow01-right-clicked.png';
|
|
9
|
-
import RightArrowIcon from '../PropertySelect/img/ui-arrows/arrow01-right.png';
|
|
7
|
+
|
|
10
8
|
import { RPGUIContainerTypes } from '../RPGUIContainer';
|
|
11
9
|
import { Column } from '../shared/Column';
|
|
12
10
|
import thumbnailDefault from './img/default.png';
|
|
@@ -60,18 +58,18 @@ export const QuestInfo: React.FC<IQuestInfoProps> = ({
|
|
|
60
58
|
{quests.length >= 2 ? (
|
|
61
59
|
<QuestsContainer>
|
|
62
60
|
{currentIndex !== 0 && (
|
|
63
|
-
<
|
|
64
|
-
|
|
61
|
+
<SelectArrow
|
|
62
|
+
direction="left"
|
|
65
63
|
onClick={onLeftClick}
|
|
66
64
|
onTouchStart={onLeftClick}
|
|
67
|
-
></
|
|
65
|
+
></SelectArrow>
|
|
68
66
|
)}
|
|
69
67
|
{currentIndex !== quests.length - 1 && (
|
|
70
|
-
<
|
|
71
|
-
|
|
68
|
+
<SelectArrow
|
|
69
|
+
direction="right"
|
|
72
70
|
onClick={onRightClick}
|
|
73
71
|
onTouchStart={onRightClick}
|
|
74
|
-
></
|
|
72
|
+
></SelectArrow>
|
|
75
73
|
)}
|
|
76
74
|
|
|
77
75
|
<QuestContainer>
|
|
@@ -229,27 +227,3 @@ const Thumbnail = styled.img`
|
|
|
229
227
|
width: 64px;
|
|
230
228
|
margin-right: 0.5rem;
|
|
231
229
|
`;
|
|
232
|
-
|
|
233
|
-
const LeftArrow = styled.div`
|
|
234
|
-
background-image: url(${LeftArrowIcon});
|
|
235
|
-
background-size: 100% 100%;
|
|
236
|
-
left: 0;
|
|
237
|
-
position: absolute;
|
|
238
|
-
width: 40px;
|
|
239
|
-
height: 42px;
|
|
240
|
-
:active {
|
|
241
|
-
background-image: url(${LeftArrowClickIcon});
|
|
242
|
-
}
|
|
243
|
-
`;
|
|
244
|
-
|
|
245
|
-
const RightArrow = styled.div`
|
|
246
|
-
background-image: url(${RightArrowIcon});
|
|
247
|
-
right: 0;
|
|
248
|
-
position: absolute;
|
|
249
|
-
width: 40px;
|
|
250
|
-
background-size: 100% 100%;
|
|
251
|
-
height: 42px;
|
|
252
|
-
:active {
|
|
253
|
-
background-image: url(${RightArrowClickIcon});
|
|
254
|
-
}
|
|
255
|
-
`;
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { ITradeResponseItem } from '@rpg-engine/shared';
|
|
2
|
+
import capitalize from 'lodash/capitalize';
|
|
3
|
+
import React, { useState } from 'react';
|
|
4
|
+
import styled from 'styled-components';
|
|
5
|
+
import { colors } from '../../constants/uiColors';
|
|
6
|
+
import SelectArrow from '../Arrow/SelectArrow';
|
|
7
|
+
import { Ellipsis } from '../shared/Ellipsis';
|
|
8
|
+
import { SpriteFromAtlas } from '../shared/SpriteFromAtlas';
|
|
9
|
+
|
|
10
|
+
export interface ITradeComponentProps {
|
|
11
|
+
traderItem: ITradeResponseItem;
|
|
12
|
+
updateChartTotals: (traderItem: ITradeResponseItem) => void;
|
|
13
|
+
atlasJSON: any;
|
|
14
|
+
atlasIMG: any;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const TradingItemRow: React.FC<ITradeComponentProps> = ({
|
|
18
|
+
atlasIMG,
|
|
19
|
+
atlasJSON,
|
|
20
|
+
updateChartTotals,
|
|
21
|
+
traderItem,
|
|
22
|
+
}) => {
|
|
23
|
+
const [itemQuantity, setItemQuantity] = useState(0);
|
|
24
|
+
|
|
25
|
+
const onLeftClick = () => {
|
|
26
|
+
if (itemQuantity > 0) {
|
|
27
|
+
const newQuantity = itemQuantity - 1;
|
|
28
|
+
setItemQuantity(newQuantity);
|
|
29
|
+
updateChartTotals({
|
|
30
|
+
key: traderItem.key,
|
|
31
|
+
itemId: traderItem.itemId,
|
|
32
|
+
qty: newQuantity,
|
|
33
|
+
price: traderItem.price,
|
|
34
|
+
texturePath: traderItem.texturePath,
|
|
35
|
+
name: traderItem.name,
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
const onRightClick = () => {
|
|
40
|
+
if (itemQuantity < 999) {
|
|
41
|
+
const newQuantity = itemQuantity + 1;
|
|
42
|
+
setItemQuantity(newQuantity);
|
|
43
|
+
updateChartTotals({
|
|
44
|
+
key: traderItem.key,
|
|
45
|
+
itemId: traderItem.itemId,
|
|
46
|
+
qty: newQuantity,
|
|
47
|
+
price: traderItem.price,
|
|
48
|
+
texturePath: traderItem.texturePath,
|
|
49
|
+
name: traderItem.name,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
return (
|
|
55
|
+
<ItemWrapper>
|
|
56
|
+
<ItemIconContainer>
|
|
57
|
+
<SpriteContainer>
|
|
58
|
+
<SpriteFromAtlas
|
|
59
|
+
atlasIMG={atlasIMG}
|
|
60
|
+
atlasJSON={atlasJSON}
|
|
61
|
+
spriteKey={traderItem.texturePath}
|
|
62
|
+
imgScale={2.5}
|
|
63
|
+
/>
|
|
64
|
+
</SpriteContainer>
|
|
65
|
+
</ItemIconContainer>
|
|
66
|
+
<ItemNameContainer>
|
|
67
|
+
<NameValue>
|
|
68
|
+
<Ellipsis maxLines={1} maxWidth={250}>
|
|
69
|
+
{capitalize(traderItem.name)}
|
|
70
|
+
</Ellipsis>
|
|
71
|
+
<p>${traderItem.price}</p>
|
|
72
|
+
</NameValue>
|
|
73
|
+
</ItemNameContainer>
|
|
74
|
+
|
|
75
|
+
<QuantityContainer>
|
|
76
|
+
<SelectArrow
|
|
77
|
+
size={32}
|
|
78
|
+
className="arrow-selector"
|
|
79
|
+
direction="left"
|
|
80
|
+
onClick={onLeftClick}
|
|
81
|
+
onTouchStart={onLeftClick}
|
|
82
|
+
></SelectArrow>
|
|
83
|
+
<QuantityDisplay>
|
|
84
|
+
<TextOverlay>
|
|
85
|
+
<Item>{itemQuantity}</Item>
|
|
86
|
+
</TextOverlay>
|
|
87
|
+
</QuantityDisplay>
|
|
88
|
+
<SelectArrow
|
|
89
|
+
size={32}
|
|
90
|
+
className="arrow-selector"
|
|
91
|
+
direction="right"
|
|
92
|
+
onClick={onRightClick}
|
|
93
|
+
onTouchStart={onRightClick}
|
|
94
|
+
></SelectArrow>
|
|
95
|
+
</QuantityContainer>
|
|
96
|
+
</ItemWrapper>
|
|
97
|
+
);
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
const ItemWrapper = styled.div`
|
|
101
|
+
width: 100%;
|
|
102
|
+
margin: auto;
|
|
103
|
+
display: flex;
|
|
104
|
+
justify-content: space-between;
|
|
105
|
+
margin-bottom: 1rem;
|
|
106
|
+
|
|
107
|
+
&:hover {
|
|
108
|
+
background-color: ${colors.darkGrey};
|
|
109
|
+
}
|
|
110
|
+
padding: 0.5rem;
|
|
111
|
+
`;
|
|
112
|
+
|
|
113
|
+
const ItemNameContainer = styled.div`
|
|
114
|
+
flex: 60%;
|
|
115
|
+
`;
|
|
116
|
+
|
|
117
|
+
const ItemIconContainer = styled.div`
|
|
118
|
+
display: flex;
|
|
119
|
+
justify-content: flex-start;
|
|
120
|
+
align-items: center;
|
|
121
|
+
|
|
122
|
+
flex: 0 0 58px;
|
|
123
|
+
`;
|
|
124
|
+
|
|
125
|
+
const SpriteContainer = styled.div`
|
|
126
|
+
position: relative;
|
|
127
|
+
top: -0.5rem;
|
|
128
|
+
left: 0.5rem;
|
|
129
|
+
`;
|
|
130
|
+
|
|
131
|
+
const NameValue = styled.div`
|
|
132
|
+
p {
|
|
133
|
+
font-size: 0.75rem;
|
|
134
|
+
margin: 0;
|
|
135
|
+
}
|
|
136
|
+
`;
|
|
137
|
+
|
|
138
|
+
const Item = styled.span`
|
|
139
|
+
font-size: 1rem;
|
|
140
|
+
color: white;
|
|
141
|
+
text-align: center;
|
|
142
|
+
z-index: 1;
|
|
143
|
+
|
|
144
|
+
width: 100%;
|
|
145
|
+
`;
|
|
146
|
+
|
|
147
|
+
const TextOverlay = styled.div`
|
|
148
|
+
width: 100%;
|
|
149
|
+
position: relative;
|
|
150
|
+
`;
|
|
151
|
+
|
|
152
|
+
interface IContainerProps {
|
|
153
|
+
percentageWidth?: number;
|
|
154
|
+
minWidth?: number;
|
|
155
|
+
style?: Record<string, any>;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
const QuantityContainer = styled.div<IContainerProps>`
|
|
159
|
+
position: relative;
|
|
160
|
+
display: flex;
|
|
161
|
+
|
|
162
|
+
min-width: 100px;
|
|
163
|
+
width: 40%;
|
|
164
|
+
justify-content: center;
|
|
165
|
+
align-items: center;
|
|
166
|
+
|
|
167
|
+
flex: 20%;
|
|
168
|
+
`;
|
|
169
|
+
|
|
170
|
+
const QuantityDisplay = styled.div`
|
|
171
|
+
font-size: 0.8rem;
|
|
172
|
+
`;
|
|
@@ -1,22 +1,21 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ITradeResponseItem, TradeTransactionType } from '@rpg-engine/shared';
|
|
2
|
+
import React, { useEffect, useState } from 'react';
|
|
2
3
|
import styled from 'styled-components';
|
|
4
|
+
import { Button, ButtonTypes } from '../Button';
|
|
3
5
|
import { DraggableContainer } from '../DraggableContainer';
|
|
4
6
|
import { RPGUIContainerTypes } from '../RPGUIContainer';
|
|
5
|
-
import {
|
|
6
|
-
import { ItemTradingComponent } from './itemComponent';
|
|
7
|
-
import { ITransactionItem, TradeTransactionType } from '@rpg-engine/shared';
|
|
8
|
-
import { v4 as uuidv4 } from 'uuid';
|
|
7
|
+
import { TradingItemRow } from './TradingItemRow';
|
|
9
8
|
export interface ITrandingMenu {
|
|
10
|
-
traderItems:
|
|
9
|
+
traderItems: ITradeResponseItem[];
|
|
11
10
|
onClose: () => void;
|
|
12
11
|
type: TradeTransactionType;
|
|
13
12
|
atlasJSON: any;
|
|
14
13
|
atlasIMG: any;
|
|
15
14
|
characterAvailableGold: number;
|
|
16
|
-
onChangeTraderItems: (traderItems:
|
|
15
|
+
onChangeTraderItems: (traderItems: ITradeResponseItem[]) => void;
|
|
17
16
|
}
|
|
18
17
|
|
|
19
|
-
export const
|
|
18
|
+
export const TradingMenu: React.FC<ITrandingMenu> = ({
|
|
20
19
|
traderItems,
|
|
21
20
|
onClose,
|
|
22
21
|
type,
|
|
@@ -27,7 +26,7 @@ export const TrandingMenu: React.FC<ITrandingMenu> = ({
|
|
|
27
26
|
}) => {
|
|
28
27
|
const [sum, setSum] = useState(0);
|
|
29
28
|
let newSumArray = 0;
|
|
30
|
-
const updateChartTotals = (item:
|
|
29
|
+
const updateChartTotals = (item: ITradeResponseItem) => {
|
|
31
30
|
const itemIndex = traderItems.findIndex(
|
|
32
31
|
itemArray => itemArray.itemId === item.itemId
|
|
33
32
|
);
|
|
@@ -59,14 +58,13 @@ export const TrandingMenu: React.FC<ITrandingMenu> = ({
|
|
|
59
58
|
>
|
|
60
59
|
<>
|
|
61
60
|
<div style={{ width: '100%' }}>
|
|
62
|
-
<Title>{Capitalize(type)}</Title>
|
|
61
|
+
<Title>{Capitalize(type)} Menu</Title>
|
|
63
62
|
<hr className="golden" />
|
|
64
63
|
</div>
|
|
65
|
-
<
|
|
64
|
+
<TradingComponentScrollWrapper>
|
|
66
65
|
{traderItems.map(tradeItem => (
|
|
67
|
-
<ItemWrapper
|
|
68
|
-
<
|
|
69
|
-
key={uuidv4()}
|
|
66
|
+
<ItemWrapper>
|
|
67
|
+
<TradingItemRow
|
|
70
68
|
atlasIMG={atlasIMG}
|
|
71
69
|
atlasJSON={atlasJSON}
|
|
72
70
|
updateChartTotals={updateChartTotals}
|
|
@@ -74,7 +72,7 @@ export const TrandingMenu: React.FC<ITrandingMenu> = ({
|
|
|
74
72
|
/>
|
|
75
73
|
</ItemWrapper>
|
|
76
74
|
))}
|
|
77
|
-
</
|
|
75
|
+
</TradingComponentScrollWrapper>
|
|
78
76
|
<GoldWrapper>
|
|
79
77
|
<p>Available Gold:</p>
|
|
80
78
|
<p>${characterAvailableGold}</p>
|
|
@@ -138,42 +136,42 @@ const Title = styled.h1`
|
|
|
138
136
|
color: yellow !important;
|
|
139
137
|
`;
|
|
140
138
|
|
|
141
|
-
const
|
|
139
|
+
const TradingComponentScrollWrapper = styled.div`
|
|
142
140
|
overflow-y: scroll;
|
|
143
141
|
height: 500px;
|
|
144
142
|
width: 100%;
|
|
143
|
+
margin-top: 1rem;
|
|
145
144
|
`;
|
|
146
145
|
|
|
147
146
|
const ItemWrapper = styled.div`
|
|
148
|
-
width: 80%;
|
|
149
147
|
margin: auto;
|
|
150
148
|
display: flex;
|
|
151
149
|
justify-content: space-between;
|
|
152
150
|
`;
|
|
153
151
|
|
|
154
152
|
const TotalWrapper = styled.div`
|
|
155
|
-
width: 80%;
|
|
156
153
|
display: flex;
|
|
157
154
|
margin: auto;
|
|
158
155
|
justify-content: space-between;
|
|
159
156
|
height: 20px;
|
|
157
|
+
margin-left: 0.8rem;
|
|
160
158
|
`;
|
|
161
159
|
|
|
162
160
|
const GoldWrapper = styled.div`
|
|
163
|
-
|
|
161
|
+
margin-top: 1rem;
|
|
164
162
|
display: flex;
|
|
165
|
-
margin: auto;
|
|
166
163
|
justify-content: space-between;
|
|
167
164
|
height: 20px;
|
|
168
165
|
p {
|
|
169
166
|
color: yellow !important;
|
|
170
167
|
}
|
|
168
|
+
width: 100%;
|
|
169
|
+
margin-left: 0.8rem;
|
|
171
170
|
`;
|
|
172
171
|
|
|
173
172
|
const AlertWrapper = styled.div`
|
|
174
|
-
width: 80%;
|
|
175
173
|
display: flex;
|
|
176
|
-
|
|
174
|
+
width: 100%;
|
|
177
175
|
justify-content: center;
|
|
178
176
|
height: 20px;
|
|
179
177
|
p {
|
|
@@ -182,9 +180,9 @@ const AlertWrapper = styled.div`
|
|
|
182
180
|
`;
|
|
183
181
|
|
|
184
182
|
const ButtonWrapper = styled.div`
|
|
185
|
-
width: 80%;
|
|
186
|
-
margin: auto;
|
|
187
183
|
display: flex;
|
|
188
184
|
justify-content: space-around;
|
|
189
185
|
padding-top: 20px;
|
|
186
|
+
width: 100%;
|
|
187
|
+
margin-top: 1rem;
|
|
190
188
|
`;
|
|
@@ -1,87 +1,88 @@
|
|
|
1
1
|
import { ITransactionItem } from '@rpg-engine/shared';
|
|
2
2
|
export const itemMock: ITransactionItem[] = [
|
|
3
|
+
{
|
|
4
|
+
texturePath: 'swords/broad-sword.png',
|
|
5
|
+
itemId: 'itemId03',
|
|
6
|
+
name: 'Silver Short Sword Premium',
|
|
7
|
+
price: 100,
|
|
8
|
+
key: 'Short sword',
|
|
9
|
+
},
|
|
3
10
|
{
|
|
4
11
|
texturePath: 'swords/broad-sword.png',
|
|
5
12
|
itemId: 'itemId01',
|
|
6
|
-
name: 'sword',
|
|
13
|
+
name: 'Short sword',
|
|
7
14
|
price: 100,
|
|
8
15
|
key: 'Short sword',
|
|
9
16
|
},
|
|
10
17
|
{
|
|
11
18
|
texturePath: 'swords/broad-sword.png',
|
|
12
19
|
itemId: 'itemId02',
|
|
13
|
-
name: 'sword',
|
|
20
|
+
name: 'Short sword',
|
|
14
21
|
price: 100,
|
|
15
22
|
key: 'Short sword',
|
|
16
23
|
},
|
|
17
24
|
{
|
|
18
25
|
texturePath: 'swords/broad-sword.png',
|
|
19
26
|
itemId: 'itemId03',
|
|
20
|
-
name: 'sword',
|
|
27
|
+
name: 'Short sword',
|
|
21
28
|
price: 100,
|
|
22
29
|
key: 'Short sword',
|
|
23
30
|
},
|
|
24
31
|
{
|
|
25
32
|
texturePath: 'swords/broad-sword.png',
|
|
26
33
|
itemId: 'itemId01',
|
|
27
|
-
name: 'sword',
|
|
34
|
+
name: 'Short sword',
|
|
28
35
|
price: 100,
|
|
29
36
|
key: 'Short sword',
|
|
30
37
|
},
|
|
31
38
|
{
|
|
32
39
|
texturePath: 'swords/broad-sword.png',
|
|
33
40
|
itemId: 'itemId02',
|
|
34
|
-
name: 'sword',
|
|
41
|
+
name: 'Short sword',
|
|
35
42
|
price: 100,
|
|
36
43
|
key: 'Short sword',
|
|
37
44
|
},
|
|
38
45
|
{
|
|
39
46
|
texturePath: 'swords/broad-sword.png',
|
|
40
47
|
itemId: 'itemId03',
|
|
41
|
-
name: 'sword',
|
|
48
|
+
name: 'Short sword',
|
|
42
49
|
price: 100,
|
|
43
50
|
key: 'Short sword',
|
|
44
51
|
},
|
|
45
52
|
{
|
|
46
53
|
texturePath: 'swords/broad-sword.png',
|
|
47
54
|
itemId: 'itemId01',
|
|
48
|
-
name: 'sword',
|
|
55
|
+
name: 'Short sword',
|
|
49
56
|
price: 100,
|
|
50
57
|
key: 'Short sword',
|
|
51
58
|
},
|
|
52
59
|
{
|
|
53
60
|
texturePath: 'swords/broad-sword.png',
|
|
54
61
|
itemId: 'itemId02',
|
|
55
|
-
name: 'sword',
|
|
62
|
+
name: 'Short sword',
|
|
56
63
|
price: 100,
|
|
57
64
|
key: 'Short sword',
|
|
58
65
|
},
|
|
59
66
|
{
|
|
60
67
|
texturePath: 'swords/broad-sword.png',
|
|
61
68
|
itemId: 'itemId03',
|
|
62
|
-
name: 'sword',
|
|
69
|
+
name: 'Short sword',
|
|
63
70
|
price: 100,
|
|
64
71
|
key: 'Short sword',
|
|
65
72
|
},
|
|
66
73
|
{
|
|
67
74
|
texturePath: 'swords/broad-sword.png',
|
|
68
75
|
itemId: 'itemId01',
|
|
69
|
-
name: 'sword',
|
|
76
|
+
name: 'Short sword',
|
|
70
77
|
price: 100,
|
|
71
78
|
key: 'Short sword',
|
|
72
79
|
},
|
|
73
80
|
{
|
|
74
81
|
texturePath: 'swords/broad-sword.png',
|
|
75
82
|
itemId: 'itemId02',
|
|
76
|
-
name: 'sword',
|
|
77
|
-
price: 100,
|
|
78
|
-
key: 'Short sword',
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
texturePath: 'swords/broad-sword.png',
|
|
82
|
-
itemId: 'itemId03',
|
|
83
|
-
name: 'sword',
|
|
83
|
+
name: 'Short sword',
|
|
84
84
|
price: 100,
|
|
85
85
|
key: 'Short sword',
|
|
86
86
|
},
|
|
87
|
+
|
|
87
88
|
];
|