@rpg-engine/long-bow 0.2.29 → 0.2.34
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/TradingMenu/items.mock.d.ts +2 -2
- package/dist/components/shared/Ellipsis.d.ts +3 -1
- package/dist/index.d.ts +3 -3
- package/dist/long-bow.cjs.development.js +543 -502
- 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 +543 -502
- 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} +30 -52
- package/src/components/TradingMenu/items.mock.ts +21 -20
- 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.34",
|
|
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
|
);
|
|
@@ -49,7 +48,7 @@ export const TrandingMenu: React.FC<ITrandingMenu> = ({
|
|
|
49
48
|
};
|
|
50
49
|
|
|
51
50
|
return (
|
|
52
|
-
<
|
|
51
|
+
<DraggableContainer
|
|
53
52
|
type={RPGUIContainerTypes.Framed}
|
|
54
53
|
onCloseButton={() => {
|
|
55
54
|
if (onClose) onClose();
|
|
@@ -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>
|
|
@@ -104,76 +102,56 @@ export const TrandingMenu: React.FC<ITrandingMenu> = ({
|
|
|
104
102
|
<Button buttonType={ButtonTypes.RPGUIButton}>Cancel</Button>
|
|
105
103
|
</ButtonWrapper>
|
|
106
104
|
</>
|
|
107
|
-
</
|
|
105
|
+
</DraggableContainer>
|
|
108
106
|
);
|
|
109
107
|
};
|
|
110
108
|
|
|
111
|
-
const TradingMenuDraggableContainer = styled(DraggableContainer)`
|
|
112
|
-
.container-close {
|
|
113
|
-
top: 10px;
|
|
114
|
-
right: 10px;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
.quest-title {
|
|
118
|
-
text-align: left;
|
|
119
|
-
margin-left: 44px;
|
|
120
|
-
margin-top: 20px;
|
|
121
|
-
color: yellow;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
.quest-desc {
|
|
125
|
-
margin-top: 12px;
|
|
126
|
-
margin-left: 44px;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
.rpgui-progress {
|
|
130
|
-
min-width: 80%;
|
|
131
|
-
margin: 0 auto;
|
|
132
|
-
}
|
|
133
|
-
`;
|
|
134
|
-
|
|
135
109
|
const Title = styled.h1`
|
|
136
110
|
z-index: 22;
|
|
137
111
|
font-size: 0.6rem;
|
|
138
112
|
color: yellow !important;
|
|
139
113
|
`;
|
|
140
114
|
|
|
141
|
-
const
|
|
115
|
+
const TradingComponentScrollWrapper = styled.div`
|
|
142
116
|
overflow-y: scroll;
|
|
143
|
-
height:
|
|
117
|
+
height: 390px;
|
|
144
118
|
width: 100%;
|
|
119
|
+
margin-top: 1rem;
|
|
145
120
|
`;
|
|
146
121
|
|
|
147
122
|
const ItemWrapper = styled.div`
|
|
148
|
-
width: 80%;
|
|
149
123
|
margin: auto;
|
|
150
124
|
display: flex;
|
|
151
125
|
justify-content: space-between;
|
|
152
126
|
`;
|
|
153
127
|
|
|
154
128
|
const TotalWrapper = styled.div`
|
|
155
|
-
|
|
129
|
+
margin-top: 1rem;
|
|
156
130
|
display: flex;
|
|
157
|
-
margin: auto;
|
|
158
131
|
justify-content: space-between;
|
|
159
132
|
height: 20px;
|
|
133
|
+
p {
|
|
134
|
+
color: white !important;
|
|
135
|
+
}
|
|
136
|
+
width: 100%;
|
|
137
|
+
margin-left: 0.8rem;
|
|
160
138
|
`;
|
|
161
139
|
|
|
162
140
|
const GoldWrapper = styled.div`
|
|
163
|
-
|
|
141
|
+
margin-top: 1rem;
|
|
164
142
|
display: flex;
|
|
165
|
-
margin: auto;
|
|
166
143
|
justify-content: space-between;
|
|
167
144
|
height: 20px;
|
|
168
145
|
p {
|
|
169
146
|
color: yellow !important;
|
|
170
147
|
}
|
|
148
|
+
width: 100%;
|
|
149
|
+
margin-left: 0.8rem;
|
|
171
150
|
`;
|
|
172
151
|
|
|
173
152
|
const AlertWrapper = styled.div`
|
|
174
|
-
width: 80%;
|
|
175
153
|
display: flex;
|
|
176
|
-
|
|
154
|
+
width: 100%;
|
|
177
155
|
justify-content: center;
|
|
178
156
|
height: 20px;
|
|
179
157
|
p {
|
|
@@ -182,9 +160,9 @@ const AlertWrapper = styled.div`
|
|
|
182
160
|
`;
|
|
183
161
|
|
|
184
162
|
const ButtonWrapper = styled.div`
|
|
185
|
-
width: 80%;
|
|
186
|
-
margin: auto;
|
|
187
163
|
display: flex;
|
|
188
164
|
justify-content: space-around;
|
|
189
165
|
padding-top: 20px;
|
|
166
|
+
width: 100%;
|
|
167
|
+
margin-top: 1rem;
|
|
190
168
|
`;
|