@rpg-engine/long-bow 0.5.14 → 0.5.15

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,248 @@
1
+ import { ChatMessageType } from '@rpg-engine/shared';
2
+ import { Meta, Story } from '@storybook/react';
3
+ import React from 'react';
4
+ import {
5
+ ChatRevamp,
6
+ IChatRevampProps,
7
+ } from '../components/ChatRevamp/ChatRevamp';
8
+ import { RPGUIRoot } from '../components/RPGUIRoot';
9
+
10
+ const meta: Meta = {
11
+ title: 'ChatRevamp',
12
+ component: ChatRevamp,
13
+ };
14
+
15
+ export default meta;
16
+
17
+ const chatMessagesMock = [
18
+ {
19
+ _id: 'test-id-1',
20
+ message: 'test message',
21
+ emitter: {
22
+ _id: 'someid',
23
+ name: 'Guilherme',
24
+ },
25
+ type: ChatMessageType.Global,
26
+ x: 128,
27
+ y: 128,
28
+ scene: 'MainScene',
29
+ createdAt: '2020-08-20T16:00:00.000Z',
30
+ updatedAt: '2020-08-20T16:00:00.000Z',
31
+ },
32
+ {
33
+ _id: 'test-id-1',
34
+ message: 'test message',
35
+ emitter: {
36
+ _id: 'someid',
37
+ name: 'Guilherme',
38
+ },
39
+ type: ChatMessageType.Global,
40
+ x: 128,
41
+ y: 128,
42
+ scene: 'MainScene',
43
+ createdAt: '2020-08-20T16:00:00.000Z',
44
+ updatedAt: '2020-08-20T16:00:00.000Z',
45
+ },
46
+ {
47
+ _id: 'test-id-2',
48
+ message: 'Good morning!',
49
+ emitter: {
50
+ _id: 'someid',
51
+ name: 'Guilherme',
52
+ },
53
+ type: ChatMessageType.Global,
54
+ x: 128,
55
+ y: 128,
56
+ scene: 'MainScene',
57
+ createdAt: '2020-08-20T16:00:00.000Z',
58
+ updatedAt: '2020-08-20T16:00:00.000Z',
59
+ },
60
+ {
61
+ _id: 'test-id-3',
62
+ message: 'How are you doing?',
63
+ emitter: {
64
+ _id: 'someid',
65
+ name: 'Guilherme',
66
+ },
67
+ type: ChatMessageType.Global,
68
+ x: 128,
69
+ y: 128,
70
+ scene: 'MainScene',
71
+ createdAt: '2020-08-20T16:00:00.000Z',
72
+ updatedAt: '2020-08-20T16:00:00.000Z',
73
+ },
74
+ {
75
+ _id: 'test-id-4',
76
+ message: 'Hey hey hey!!!',
77
+ emitter: {
78
+ _id: 'someid',
79
+ name: 'Guilherme',
80
+ },
81
+ type: ChatMessageType.Global,
82
+ x: 128,
83
+ y: 128,
84
+ scene: 'MainScene',
85
+ createdAt: '2020-08-20T16:00:00.000Z',
86
+ updatedAt: '2020-08-20T16:00:00.000Z',
87
+ },
88
+ {
89
+ _id: 'test-id-5',
90
+ message: 'BITCONNEEEEEEEEECT!',
91
+ emitter: {
92
+ _id: 'someid',
93
+ name: 'Guilherme',
94
+ },
95
+ type: ChatMessageType.Global,
96
+ x: 128,
97
+ y: 128,
98
+ scene: 'MainScene',
99
+ createdAt: '2020-08-20T16:00:00.000Z',
100
+ updatedAt: '2020-08-20T16:00:00.000Z',
101
+ },
102
+ {
103
+ _id: 'test-id-6',
104
+ message: 'BITCONNEEEEEEEEECT!',
105
+ emitter: {
106
+ _id: 'someid',
107
+ name: 'Guilherme',
108
+ },
109
+ type: ChatMessageType.Global,
110
+ x: 128,
111
+ y: 128,
112
+ scene: 'MainScene',
113
+ createdAt: '2020-08-20T16:00:00.000Z',
114
+ updatedAt: '2020-08-20T16:00:00.000Z',
115
+ },
116
+ {
117
+ _id: 'test-id-7',
118
+ message: 'BITCONNEEEEEEEEECT!',
119
+ emitter: {
120
+ _id: 'someid',
121
+ name: 'Guilherme',
122
+ },
123
+ type: ChatMessageType.Global,
124
+ x: 128,
125
+ y: 128,
126
+ scene: 'MainScene',
127
+ createdAt: '2020-08-20T16:00:00.000Z',
128
+ updatedAt: '2020-08-20T16:00:00.000Z',
129
+ },
130
+ {
131
+ _id: 'test-id-8',
132
+ message: 'BITCONNEEEEEEEEECT!',
133
+ emitter: {
134
+ _id: 'someid',
135
+ name: 'Guilherme',
136
+ },
137
+ type: ChatMessageType.Global,
138
+ x: 128,
139
+ y: 128,
140
+ scene: 'MainScene',
141
+ createdAt: '2020-08-20T16:00:00.000Z',
142
+ updatedAt: '2020-08-20T16:00:00.000Z',
143
+ },
144
+ {
145
+ _id: 'test-id-9',
146
+ message: 'BITCONNEEEEEEEEECT!',
147
+ emitter: {
148
+ _id: 'someid',
149
+ name: 'Guilherme',
150
+ },
151
+ type: ChatMessageType.Global,
152
+ x: 128,
153
+ y: 128,
154
+ scene: 'MainScene',
155
+ createdAt: '2020-08-20T16:00:00.000Z',
156
+ updatedAt: '2020-08-20T16:00:00.000Z',
157
+ },
158
+ {
159
+ _id: 'test-id-9',
160
+ message: '22222EEECT!',
161
+ emitter: {
162
+ _id: 'someid',
163
+ name: 'Guilherme',
164
+ },
165
+ type: ChatMessageType.Global,
166
+ x: 128,
167
+ y: 128,
168
+ scene: 'MainScene',
169
+ createdAt: '2020-08-20T16:00:00.000Z',
170
+ updatedAt: '2020-08-20T16:00:00.000Z',
171
+ },
172
+ {
173
+ _id: 'test-id-9',
174
+ message: '22222EEECT!',
175
+ emitter: {
176
+ _id: 'someid',
177
+ name: 'Guilherme',
178
+ },
179
+ type: ChatMessageType.Global,
180
+ x: 128,
181
+ y: 128,
182
+ scene: 'MainScene',
183
+ createdAt: '2020-08-20T16:00:00.000Z',
184
+ updatedAt: '2020-08-20T16:00:00.000Z',
185
+ },
186
+ {
187
+ _id: 'test-id-9',
188
+ message: '22222EEECT!',
189
+ emitter: {
190
+ _id: 'someid',
191
+ name: 'Guilherme',
192
+ },
193
+ type: ChatMessageType.Global,
194
+ x: 128,
195
+ y: 128,
196
+ scene: 'MainScene',
197
+ createdAt: '2020-08-20T16:00:00.000Z',
198
+ updatedAt: '2020-08-20T16:00:00.000Z',
199
+ },
200
+ ];
201
+
202
+ const tabsMock = [
203
+ { label: 'Global', id: 'global' },
204
+ { label: 'Private', id: 'private' },
205
+ ];
206
+
207
+ const recentPrivateChatCharactersMock = [
208
+ { _id: 'someid', name: 'Guilherme' },
209
+ { _id: 'someid2', name: 'Guilherme2' },
210
+ ];
211
+
212
+ const Template: Story<IChatRevampProps> = args => (
213
+ <RPGUIRoot>
214
+ <ChatRevamp {...args} />
215
+ </RPGUIRoot>
216
+ );
217
+
218
+ export const Default = Template.bind({});
219
+
220
+ Default.args = {
221
+ onSendGlobalChatMessage: () => {},
222
+ onChangeCharacterName: () => {},
223
+ chatMessages: chatMessagesMock,
224
+ opacity: 0.5,
225
+ styles: { width: `calc(100% - 0.5rem * 2)`, height: '200px' },
226
+ onCloseButton: () => console.log('closing chat...'),
227
+ tabs: tabsMock,
228
+ privateChatCharacters: recentPrivateChatCharactersMock,
229
+ activeTab: 'global',
230
+ onChangeTab: () => {},
231
+ onSendPrivateChatMessage: () => {},
232
+ };
233
+
234
+ export const PrivateCharacters = Template.bind({});
235
+
236
+ PrivateCharacters.args = {
237
+ onSendGlobalChatMessage: () => {},
238
+ onChangeCharacterName: () => {},
239
+ chatMessages: chatMessagesMock,
240
+ opacity: 0.5,
241
+ styles: { width: `calc(100% - 0.5rem * 2)`, height: '200px' },
242
+ onCloseButton: () => {},
243
+ tabs: tabsMock,
244
+ privateChatCharacters: recentPrivateChatCharactersMock,
245
+ activeTab: 'private',
246
+ onChangeTab: () => {},
247
+ onSendPrivateChatMessage: () => {},
248
+ };