@rpg-engine/long-bow 0.3.0 → 0.3.24
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/Chat/Chat.d.ts +4 -0
- package/dist/components/Chatdeprecated/ChatDeprecated.d.ts +13 -0
- package/dist/index.d.ts +5 -4
- package/dist/long-bow.cjs.development.js +261 -132
- 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 +261 -133
- package/dist/long-bow.esm.js.map +1 -1
- package/dist/stories/ChatDeprecated.stories.d.ts +5 -0
- package/package.json +3 -1
- package/src/.DS_Store +0 -0
- package/src/components/Chat/Chat.tsx +81 -105
- package/src/components/Chatdeprecated/ChatDeprecated.tsx +200 -0
- package/src/components/NPCDialog/.DS_Store +0 -0
- package/src/components/NPCDialog/img/.DS_Store +0 -0
- package/src/index.tsx +5 -4
- package/src/mocks/.DS_Store +0 -0
- package/src/mocks/atlas/.DS_Store +0 -0
- package/src/stories/Chat.stories.tsx +17 -2
- package/src/stories/ChatDeprecated.stories.tsx +170 -0
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { IChatMessage } from '@rpg-engine/shared';
|
|
2
|
+
import { Meta } from '@storybook/react';
|
|
3
|
+
declare const meta: Meta;
|
|
4
|
+
export default meta;
|
|
5
|
+
export declare const Default: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, IChatMessage>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rpg-engine/long-bow",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.24",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -85,6 +85,7 @@
|
|
|
85
85
|
"@rollup/plugin-image": "^2.1.1",
|
|
86
86
|
"@rpg-engine/shared": "^0.6.57",
|
|
87
87
|
"dayjs": "^1.11.2",
|
|
88
|
+
"font-awesome": "^4.7.0",
|
|
88
89
|
"fs-extra": "^10.1.0",
|
|
89
90
|
"is-mobile": "^3.1.1",
|
|
90
91
|
"lodash": "^4.17.21",
|
|
@@ -93,6 +94,7 @@
|
|
|
93
94
|
"mobx-react": "^7.5.0",
|
|
94
95
|
"react-draggable": "^4.4.5",
|
|
95
96
|
"react-error-boundary": "^3.1.4",
|
|
97
|
+
"react-icons": "^4.7.1",
|
|
96
98
|
"rollup-plugin-image-files": "^1.4.2",
|
|
97
99
|
"rpgui": "^1.0.3"
|
|
98
100
|
}
|
package/src/.DS_Store
ADDED
|
Binary file
|
|
@@ -2,18 +2,15 @@ import { IChatMessage } from '@rpg-engine/shared';
|
|
|
2
2
|
import dayjs from 'dayjs';
|
|
3
3
|
import React, { useEffect, useState } from 'react';
|
|
4
4
|
import { ErrorBoundary } from 'react-error-boundary';
|
|
5
|
+
import { CiPaperplane } from 'react-icons/ci';
|
|
5
6
|
import styled from 'styled-components';
|
|
6
|
-
import { uiColors } from '../../constants/uiColors';
|
|
7
|
-
import { uiFonts } from '../../constants/uiFonts';
|
|
8
|
-
import { Button, ButtonTypes } from '../Button';
|
|
9
|
-
import { Input } from '../Input';
|
|
10
|
-
import { RPGUIContainer, RPGUIContainerTypes } from '../RPGUIContainer';
|
|
11
7
|
import { Column } from '../shared/Column';
|
|
12
8
|
|
|
13
9
|
interface IEmitter {
|
|
14
10
|
_id: string;
|
|
15
11
|
name: string;
|
|
16
12
|
}
|
|
13
|
+
|
|
17
14
|
export interface IChatProps {
|
|
18
15
|
chatMessages: IChatMessage[];
|
|
19
16
|
onSendChatMessage: (message: string) => void;
|
|
@@ -23,17 +20,22 @@ export interface IChatProps {
|
|
|
23
20
|
opacity?: number;
|
|
24
21
|
width?: string;
|
|
25
22
|
height?: string;
|
|
23
|
+
sendMessage: boolean;
|
|
24
|
+
color?: string;
|
|
25
|
+
buttonColor?: string;
|
|
26
|
+
buttonBackgroundColor?: string;
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
export const Chat: React.FC<IChatProps> = ({
|
|
29
30
|
chatMessages,
|
|
30
31
|
onSendChatMessage,
|
|
31
|
-
|
|
32
|
-
width = '100%',
|
|
32
|
+
width = '80%',
|
|
33
33
|
height = '250px',
|
|
34
|
-
onCloseButton,
|
|
35
34
|
onFocus,
|
|
36
35
|
onBlur,
|
|
36
|
+
color = '#c65102',
|
|
37
|
+
buttonColor = '#005b96',
|
|
38
|
+
buttonBackgroundColor = '#FFF',
|
|
37
39
|
}) => {
|
|
38
40
|
const [message, setMessage] = useState('');
|
|
39
41
|
|
|
@@ -74,114 +76,88 @@ export const Chat: React.FC<IChatProps> = ({
|
|
|
74
76
|
const onRenderChatMessages = (chatMessages: IChatMessage[]) => {
|
|
75
77
|
return chatMessages?.length ? (
|
|
76
78
|
chatMessages?.map(({ _id, createdAt, emitter, message }, index) => (
|
|
77
|
-
<
|
|
79
|
+
<Message color={color} key={`${_id}_${index}`}>
|
|
78
80
|
{onRenderMessageLines(emitter, createdAt, message)}
|
|
79
|
-
</
|
|
81
|
+
</Message>
|
|
80
82
|
))
|
|
81
83
|
) : (
|
|
82
|
-
<
|
|
84
|
+
<Message color={color}>No messages available.</Message>
|
|
83
85
|
);
|
|
84
86
|
};
|
|
85
87
|
|
|
86
88
|
return (
|
|
87
|
-
<
|
|
88
|
-
<
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
>
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
autoComplete="off"
|
|
120
|
-
onFocus={onFocus}
|
|
121
|
-
onBlur={onBlur}
|
|
122
|
-
/>
|
|
123
|
-
</Column>
|
|
124
|
-
<Column justifyContent="flex-end">
|
|
125
|
-
<Button
|
|
126
|
-
buttonType={ButtonTypes.RPGUIButton}
|
|
127
|
-
id="chat-send-button"
|
|
128
|
-
>
|
|
129
|
-
Send
|
|
130
|
-
</Button>
|
|
131
|
-
</Column>
|
|
132
|
-
</Form>
|
|
133
|
-
</ErrorBoundary>
|
|
134
|
-
</CustomContainer>
|
|
135
|
-
</Container>
|
|
89
|
+
<ChatContainer width={width} height={height}>
|
|
90
|
+
<ErrorBoundary fallback={<p>Oops! Your chat has crashed.</p>}>
|
|
91
|
+
<MessagesContainer>
|
|
92
|
+
{onRenderChatMessages(chatMessages)}
|
|
93
|
+
</MessagesContainer>
|
|
94
|
+
|
|
95
|
+
<Form onSubmit={handleSubmit}>
|
|
96
|
+
<Column flex={70}>
|
|
97
|
+
<TextField
|
|
98
|
+
value={message}
|
|
99
|
+
id="inputMessage"
|
|
100
|
+
onChange={e => getInputValue(e.target.value)}
|
|
101
|
+
height={20}
|
|
102
|
+
type="text"
|
|
103
|
+
autoComplete="off"
|
|
104
|
+
onFocus={onFocus}
|
|
105
|
+
onBlur={onBlur}
|
|
106
|
+
/>
|
|
107
|
+
</Column>
|
|
108
|
+
<Column justifyContent="flex-end">
|
|
109
|
+
<Button
|
|
110
|
+
buttonColor={buttonColor}
|
|
111
|
+
buttonBackgroundColor={buttonBackgroundColor}
|
|
112
|
+
id="chat-send-button"
|
|
113
|
+
style={{ borderRadius: '20%' }}
|
|
114
|
+
>
|
|
115
|
+
<CiPaperplane size={20} />
|
|
116
|
+
</Button>
|
|
117
|
+
</Column>
|
|
118
|
+
</Form>
|
|
119
|
+
</ErrorBoundary>
|
|
120
|
+
</ChatContainer>
|
|
136
121
|
);
|
|
137
122
|
};
|
|
138
123
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
const CloseButton = styled.div`
|
|
144
|
-
position: absolute;
|
|
145
|
-
top: 2px;
|
|
146
|
-
right: 0px;
|
|
147
|
-
color: white;
|
|
148
|
-
z-index: 22;
|
|
149
|
-
font-size: 0.7rem;
|
|
150
|
-
`;
|
|
151
|
-
|
|
152
|
-
const CustomInput = styled(Input)`
|
|
153
|
-
height: 30px;
|
|
154
|
-
width: 100%;
|
|
155
|
-
|
|
156
|
-
.rpgui-content .input {
|
|
157
|
-
min-height: 39px;
|
|
158
|
-
}
|
|
159
|
-
`;
|
|
124
|
+
interface IContainerProps {
|
|
125
|
+
width: string;
|
|
126
|
+
height: string;
|
|
127
|
+
}
|
|
160
128
|
|
|
161
|
-
interface
|
|
162
|
-
|
|
129
|
+
interface IMessageProps {
|
|
130
|
+
color: string;
|
|
163
131
|
}
|
|
164
132
|
|
|
165
|
-
|
|
166
|
-
|
|
133
|
+
interface IButtonProps {
|
|
134
|
+
buttonColor: string;
|
|
135
|
+
buttonBackgroundColor: string;
|
|
136
|
+
}
|
|
167
137
|
|
|
168
|
-
|
|
138
|
+
const ChatContainer = styled.div<IContainerProps>`
|
|
139
|
+
height: ${props => props.height};
|
|
140
|
+
width: ${({ width }) => width};
|
|
141
|
+
padding: 10px;
|
|
142
|
+
margin-top: 100px;
|
|
143
|
+
background-color: rgba(0, 0, 0, 0.1);
|
|
144
|
+
`;
|
|
169
145
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
146
|
+
const TextField = styled.input`
|
|
147
|
+
width: 100%;
|
|
148
|
+
background-color: rgba(0, 0, 0, 0.2) !important;
|
|
149
|
+
border: none !important;
|
|
150
|
+
`;
|
|
173
151
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
152
|
+
const MessagesContainer = styled.div`
|
|
153
|
+
overflow: hidden;
|
|
154
|
+
height: 70%;
|
|
155
|
+
margin-bottom: 10px;
|
|
156
|
+
`;
|
|
177
157
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
}
|
|
182
|
-
max-height: 170px;
|
|
183
|
-
overflow-y: auto;
|
|
184
|
-
}
|
|
158
|
+
const Message = styled.div<IMessageProps>`
|
|
159
|
+
margin-bottom: 8px;
|
|
160
|
+
color: ${({ color }) => color};
|
|
185
161
|
`;
|
|
186
162
|
|
|
187
163
|
const Form = styled.form`
|
|
@@ -191,10 +167,10 @@ const Form = styled.form`
|
|
|
191
167
|
align-items: center;
|
|
192
168
|
`;
|
|
193
169
|
|
|
194
|
-
const
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
170
|
+
const Button = styled.button<IButtonProps>`
|
|
171
|
+
color: ${({ buttonColor }) => buttonColor};
|
|
172
|
+
background-color: ${({ buttonBackgroundColor }) => buttonBackgroundColor};
|
|
173
|
+
width: 50px;
|
|
174
|
+
height: 40px;
|
|
175
|
+
border: none !important;
|
|
200
176
|
`;
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import { IChatMessage } from '@rpg-engine/shared';
|
|
2
|
+
import dayjs from 'dayjs';
|
|
3
|
+
import React, { useEffect, useState } from 'react';
|
|
4
|
+
import { ErrorBoundary } from 'react-error-boundary';
|
|
5
|
+
import styled from 'styled-components';
|
|
6
|
+
import { uiColors } from '../../constants/uiColors';
|
|
7
|
+
import { uiFonts } from '../../constants/uiFonts';
|
|
8
|
+
import { Button, ButtonTypes } from '../Button';
|
|
9
|
+
import { Input } from '../Input';
|
|
10
|
+
import { RPGUIContainer, RPGUIContainerTypes } from '../RPGUIContainer';
|
|
11
|
+
import { Column } from '../shared/Column';
|
|
12
|
+
|
|
13
|
+
interface IEmitter {
|
|
14
|
+
_id: string;
|
|
15
|
+
name: string;
|
|
16
|
+
}
|
|
17
|
+
export interface IChatDeprecatedProps {
|
|
18
|
+
chatMessages: IChatMessage[];
|
|
19
|
+
onSendChatMessage: (message: string) => void;
|
|
20
|
+
onCloseButton: () => void;
|
|
21
|
+
onFocus?: () => void;
|
|
22
|
+
onBlur?: () => void;
|
|
23
|
+
opacity?: number;
|
|
24
|
+
width?: string;
|
|
25
|
+
height?: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const ChatDeprecated: React.FC<IChatDeprecatedProps> = ({
|
|
29
|
+
chatMessages,
|
|
30
|
+
onSendChatMessage,
|
|
31
|
+
opacity = 1,
|
|
32
|
+
width = '100%',
|
|
33
|
+
height = '250px',
|
|
34
|
+
onCloseButton,
|
|
35
|
+
onFocus,
|
|
36
|
+
onBlur,
|
|
37
|
+
}) => {
|
|
38
|
+
const [message, setMessage] = useState('');
|
|
39
|
+
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
scrollChatToBottom();
|
|
42
|
+
}, []);
|
|
43
|
+
|
|
44
|
+
useEffect(() => {
|
|
45
|
+
scrollChatToBottom();
|
|
46
|
+
}, [chatMessages]);
|
|
47
|
+
|
|
48
|
+
const scrollChatToBottom = () => {
|
|
49
|
+
const scrollingElement = document.querySelector('.chat-body');
|
|
50
|
+
if (scrollingElement) {
|
|
51
|
+
scrollingElement.scrollTop = scrollingElement.scrollHeight;
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const handleSubmit = (event: React.SyntheticEvent<HTMLFormElement>) => {
|
|
56
|
+
event.preventDefault();
|
|
57
|
+
onSendChatMessage(message);
|
|
58
|
+
setMessage('');
|
|
59
|
+
};
|
|
60
|
+
const getInputValue = (value: string) => {
|
|
61
|
+
setMessage(value);
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const onRenderMessageLines = (
|
|
65
|
+
emitter: IEmitter,
|
|
66
|
+
createdAt: string | undefined,
|
|
67
|
+
message: string
|
|
68
|
+
) => {
|
|
69
|
+
return `${dayjs(createdAt || new Date()).format('HH:mm')} ${
|
|
70
|
+
emitter?.name ? `${emitter.name}: ` : 'Unknown: '
|
|
71
|
+
} ${message}`;
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
const onRenderChatMessages = (chatMessages: IChatMessage[]) => {
|
|
75
|
+
return chatMessages?.length ? (
|
|
76
|
+
chatMessages?.map(({ _id, createdAt, emitter, message }, index) => (
|
|
77
|
+
<MessageText key={`${_id}_${index}`}>
|
|
78
|
+
{onRenderMessageLines(emitter, createdAt, message)}
|
|
79
|
+
</MessageText>
|
|
80
|
+
))
|
|
81
|
+
) : (
|
|
82
|
+
<MessageText>No messages available.</MessageText>
|
|
83
|
+
);
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
return (
|
|
87
|
+
<Container>
|
|
88
|
+
<CustomContainer
|
|
89
|
+
type={RPGUIContainerTypes.FramedGrey}
|
|
90
|
+
width={width}
|
|
91
|
+
height={height}
|
|
92
|
+
className="chat-container"
|
|
93
|
+
opacity={opacity}
|
|
94
|
+
>
|
|
95
|
+
<ErrorBoundary fallback={<p>Oops! Your chat has crashed.</p>}>
|
|
96
|
+
{onCloseButton && (
|
|
97
|
+
<CloseButton onClick={onCloseButton} onTouchStart={onCloseButton}>
|
|
98
|
+
X
|
|
99
|
+
</CloseButton>
|
|
100
|
+
)}
|
|
101
|
+
<RPGUIContainer
|
|
102
|
+
type={RPGUIContainerTypes.FramedGrey}
|
|
103
|
+
width={'100%'}
|
|
104
|
+
height={'80%'}
|
|
105
|
+
className="chat-body dark-background"
|
|
106
|
+
>
|
|
107
|
+
{onRenderChatMessages(chatMessages)}
|
|
108
|
+
</RPGUIContainer>
|
|
109
|
+
|
|
110
|
+
<Form onSubmit={handleSubmit}>
|
|
111
|
+
<Column flex={70}>
|
|
112
|
+
<CustomInput
|
|
113
|
+
value={message}
|
|
114
|
+
id="inputMessage"
|
|
115
|
+
onChange={e => getInputValue(e.target.value)}
|
|
116
|
+
height={20}
|
|
117
|
+
className="chat-input dark-background"
|
|
118
|
+
type="text"
|
|
119
|
+
autoComplete="off"
|
|
120
|
+
onFocus={onFocus}
|
|
121
|
+
onBlur={onBlur}
|
|
122
|
+
/>
|
|
123
|
+
</Column>
|
|
124
|
+
<Column justifyContent="flex-end">
|
|
125
|
+
<Button
|
|
126
|
+
buttonType={ButtonTypes.RPGUIButton}
|
|
127
|
+
id="chat-send-button"
|
|
128
|
+
>
|
|
129
|
+
Send
|
|
130
|
+
</Button>
|
|
131
|
+
</Column>
|
|
132
|
+
</Form>
|
|
133
|
+
</ErrorBoundary>
|
|
134
|
+
</CustomContainer>
|
|
135
|
+
</Container>
|
|
136
|
+
);
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
const Container = styled.div`
|
|
140
|
+
position: relative;
|
|
141
|
+
`;
|
|
142
|
+
|
|
143
|
+
const CloseButton = styled.div`
|
|
144
|
+
position: absolute;
|
|
145
|
+
top: 2px;
|
|
146
|
+
right: 0px;
|
|
147
|
+
color: white;
|
|
148
|
+
z-index: 22;
|
|
149
|
+
font-size: 0.7rem;
|
|
150
|
+
`;
|
|
151
|
+
|
|
152
|
+
const CustomInput = styled(Input)`
|
|
153
|
+
height: 30px;
|
|
154
|
+
width: 100%;
|
|
155
|
+
|
|
156
|
+
.rpgui-content .input {
|
|
157
|
+
min-height: 39px;
|
|
158
|
+
}
|
|
159
|
+
`;
|
|
160
|
+
|
|
161
|
+
interface ICustomContainerProps {
|
|
162
|
+
opacity: number;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
const CustomContainer = styled(RPGUIContainer)`
|
|
166
|
+
display: block;
|
|
167
|
+
|
|
168
|
+
opacity: ${(props: ICustomContainerProps) => props.opacity};
|
|
169
|
+
|
|
170
|
+
&:hover {
|
|
171
|
+
opacity: 1;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
.dark-background {
|
|
175
|
+
background-color: ${uiColors.darkGray} !important;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.chat-body {
|
|
179
|
+
&.rpgui-container.framed-grey {
|
|
180
|
+
background: unset;
|
|
181
|
+
}
|
|
182
|
+
max-height: 170px;
|
|
183
|
+
overflow-y: auto;
|
|
184
|
+
}
|
|
185
|
+
`;
|
|
186
|
+
|
|
187
|
+
const Form = styled.form`
|
|
188
|
+
display: flex;
|
|
189
|
+
width: 100%;
|
|
190
|
+
justify-content: center;
|
|
191
|
+
align-items: center;
|
|
192
|
+
`;
|
|
193
|
+
|
|
194
|
+
const MessageText = styled.p`
|
|
195
|
+
display: block !important;
|
|
196
|
+
width: 100%;
|
|
197
|
+
font-size: ${uiFonts.size.xsmall} !important;
|
|
198
|
+
overflow-y: auto;
|
|
199
|
+
margin: 0;
|
|
200
|
+
`;
|
|
Binary file
|
|
Binary file
|
package/src/index.tsx
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from './components/Button';
|
|
2
2
|
export * from './components/Character/CharacterSelection';
|
|
3
3
|
export * from './components/Chat/Chat';
|
|
4
|
+
export * from './components/Chatdeprecated/ChatDeprecated';
|
|
4
5
|
export * from './components/CheckButton';
|
|
5
6
|
export * from './components/CraftBook/CraftBook';
|
|
6
7
|
export * from './components/DraggableContainer';
|
|
@@ -12,6 +13,7 @@ export * from './components/Input';
|
|
|
12
13
|
export { ErrorBoundary } from './components/Item/Inventory/ErrorBoundary';
|
|
13
14
|
export * from './components/Item/Inventory/ItemContainer';
|
|
14
15
|
export * from './components/Item/Inventory/ItemSlot';
|
|
16
|
+
export * from './components/itemSelector/ItemSelector';
|
|
15
17
|
export * from './components/ListMenu';
|
|
16
18
|
export * from './components/NPCDialog/NPCDialog';
|
|
17
19
|
export * from './components/NPCDialog/NPCMultiDialog';
|
|
@@ -20,17 +22,16 @@ export * from './components/ProgressBar';
|
|
|
20
22
|
export * from './components/PropertySelect/PropertySelect';
|
|
21
23
|
export * from './components/QuestInfo/QuestInfo';
|
|
22
24
|
export * from './components/QuestList';
|
|
23
|
-
export * from './components/RPGUIContainer';
|
|
24
|
-
export * from './components/RPGUIRoot';
|
|
25
25
|
export * from './components/RadioButton';
|
|
26
26
|
export * from './components/RangeSlider';
|
|
27
|
+
export * from './components/RPGUIContainer';
|
|
28
|
+
export * from './components/RPGUIRoot';
|
|
29
|
+
export * from './components/shared/SpriteFromAtlas';
|
|
27
30
|
export * from './components/SkillProgressBar';
|
|
28
31
|
export * from './components/SkillsContainer';
|
|
29
32
|
export * from './components/TextArea';
|
|
30
33
|
export * from './components/TimeWidget/TimeWidget';
|
|
31
34
|
export * from './components/TradingMenu/TradingMenu';
|
|
32
35
|
export * from './components/Truncate';
|
|
33
|
-
export * from './components/itemSelector/ItemSelector';
|
|
34
|
-
export * from './components/shared/SpriteFromAtlas';
|
|
35
36
|
export * from './components/typography/DynamicText';
|
|
36
37
|
export { useEventListener } from './hooks/useEventListener';
|
|
Binary file
|
|
Binary file
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ChatMessageType, IChatMessage } from '@rpg-engine/shared';
|
|
2
2
|
import { Meta, Story } from '@storybook/react';
|
|
3
3
|
import React from 'react';
|
|
4
|
-
import { Chat } from '
|
|
5
|
-
import { RPGUIRoot } from '
|
|
4
|
+
import { Chat } from '../components/Chat/Chat';
|
|
5
|
+
import { RPGUIRoot } from '../components/RPGUIRoot';
|
|
6
6
|
|
|
7
7
|
const meta: Meta = {
|
|
8
8
|
title: 'Chat',
|
|
@@ -152,6 +152,20 @@ const chatMessagesMock = [
|
|
|
152
152
|
createdAt: '2020-08-20T16:00:00.000Z',
|
|
153
153
|
updatedAt: '2020-08-20T16:00:00.000Z',
|
|
154
154
|
},
|
|
155
|
+
{
|
|
156
|
+
_id: 'test-id-9',
|
|
157
|
+
message: '22222EEECT!',
|
|
158
|
+
emitter: {
|
|
159
|
+
_id: 'someid',
|
|
160
|
+
name: 'Guilherme',
|
|
161
|
+
},
|
|
162
|
+
type: ChatMessageType.Global,
|
|
163
|
+
x: 128,
|
|
164
|
+
y: 128,
|
|
165
|
+
scene: 'MainScene',
|
|
166
|
+
createdAt: '2020-08-20T16:00:00.000Z',
|
|
167
|
+
updatedAt: '2020-08-20T16:00:00.000Z',
|
|
168
|
+
},
|
|
155
169
|
];
|
|
156
170
|
|
|
157
171
|
const Template: Story<IChatMessage> = args => (
|
|
@@ -162,6 +176,7 @@ const Template: Story<IChatMessage> = args => (
|
|
|
162
176
|
opacity={0.5}
|
|
163
177
|
height={'200px'}
|
|
164
178
|
onCloseButton={() => console.log('closing chat...')}
|
|
179
|
+
sendMessage={true}
|
|
165
180
|
{...args}
|
|
166
181
|
/>
|
|
167
182
|
</RPGUIRoot>
|