@rpg-engine/long-bow 0.7.22 → 0.7.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 +1 -1
- package/dist/components/ChatRevamp/ChatContent.d.ts +24 -0
- package/dist/components/ChatRevamp/ChatRevamp.d.ts +1 -33
- package/dist/components/ChatRevamp/ChatTabs.d.ts +11 -0
- package/dist/components/ChatRevamp/ExpandButton.d.ts +7 -0
- package/dist/components/ChatRevamp/RecentChats.d.ts +17 -0
- package/dist/components/ChatRevamp/SearchCharacter.d.ts +1 -1
- package/dist/components/ChatRevamp/types.d.ts +33 -0
- package/dist/hooks/useChat.d.ts +19 -0
- package/dist/long-bow.cjs.development.js +341 -209
- 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 +341 -209
- package/dist/long-bow.esm.js.map +1 -1
- package/dist/stories/ChatRevamp.stories.d.ts +1 -1
- package/package.json +1 -1
- package/src/components/Chat/Chat.tsx +1 -1
- package/src/components/ChatRevamp/ChatContent.tsx +96 -0
- package/src/components/ChatRevamp/ChatRevamp.tsx +97 -408
- package/src/components/ChatRevamp/ChatTabs.tsx +51 -0
- package/src/components/ChatRevamp/ExpandButton.tsx +40 -0
- package/src/components/ChatRevamp/RecentChats.tsx +250 -0
- package/src/components/ChatRevamp/SearchCharacter.tsx +17 -20
- package/src/components/ChatRevamp/types.ts +41 -0
- package/src/hooks/useChat.ts +62 -0
- package/src/stories/Chat.stories.tsx +1 -0
- package/src/stories/ChatRevamp.stories.tsx +56 -99
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { ChatMessageType } from '@rpg-engine/shared';
|
|
2
2
|
import { Meta, Story } from '@storybook/react';
|
|
3
3
|
import React from 'react';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
} from '../components/ChatRevamp/ChatRevamp';
|
|
4
|
+
|
|
5
|
+
import { ChatRevamp } from '../components/ChatRevamp/ChatRevamp';
|
|
6
|
+
import { IChatRevampProps } from '../components/ChatRevamp/types';
|
|
8
7
|
import { RPGUIRoot } from '../components/RPGUI/RPGUIRoot';
|
|
9
8
|
|
|
10
9
|
const meta: Meta = {
|
|
@@ -33,7 +32,7 @@ const chatMessagesMock = [
|
|
|
33
32
|
_id: 'test-id-1',
|
|
34
33
|
message: 'test message',
|
|
35
34
|
emitter: {
|
|
36
|
-
_id: '
|
|
35
|
+
_id: 'someid1',
|
|
37
36
|
name: 'Guilherme',
|
|
38
37
|
},
|
|
39
38
|
type: ChatMessageType.Global,
|
|
@@ -47,7 +46,7 @@ const chatMessagesMock = [
|
|
|
47
46
|
_id: 'test-id-2',
|
|
48
47
|
message: 'Good morning!',
|
|
49
48
|
emitter: {
|
|
50
|
-
_id: '
|
|
49
|
+
_id: 'someid2',
|
|
51
50
|
name: 'Guilherme',
|
|
52
51
|
},
|
|
53
52
|
type: ChatMessageType.Global,
|
|
@@ -61,7 +60,7 @@ const chatMessagesMock = [
|
|
|
61
60
|
_id: 'test-id-3',
|
|
62
61
|
message: 'How are you doing?',
|
|
63
62
|
emitter: {
|
|
64
|
-
_id: '
|
|
63
|
+
_id: 'someid3',
|
|
65
64
|
name: 'Guilherme',
|
|
66
65
|
},
|
|
67
66
|
type: ChatMessageType.Global,
|
|
@@ -75,7 +74,7 @@ const chatMessagesMock = [
|
|
|
75
74
|
_id: 'test-id-4',
|
|
76
75
|
message: 'Hey hey hey!!!',
|
|
77
76
|
emitter: {
|
|
78
|
-
_id: '
|
|
77
|
+
_id: 'someid4',
|
|
79
78
|
name: 'Guilherme',
|
|
80
79
|
},
|
|
81
80
|
type: ChatMessageType.Global,
|
|
@@ -89,7 +88,7 @@ const chatMessagesMock = [
|
|
|
89
88
|
_id: 'test-id-5',
|
|
90
89
|
message: 'BITCONNEEEEEEEEECT!',
|
|
91
90
|
emitter: {
|
|
92
|
-
_id: '
|
|
91
|
+
_id: 'someid5',
|
|
93
92
|
name: 'Guilherme',
|
|
94
93
|
},
|
|
95
94
|
type: ChatMessageType.Global,
|
|
@@ -103,7 +102,7 @@ const chatMessagesMock = [
|
|
|
103
102
|
_id: 'test-id-6',
|
|
104
103
|
message: 'BITCONNEEEEEEEEECT!',
|
|
105
104
|
emitter: {
|
|
106
|
-
_id: '
|
|
105
|
+
_id: 'someid6',
|
|
107
106
|
name: 'Guilherme',
|
|
108
107
|
},
|
|
109
108
|
type: ChatMessageType.Global,
|
|
@@ -117,77 +116,7 @@ const chatMessagesMock = [
|
|
|
117
116
|
_id: 'test-id-7',
|
|
118
117
|
message: 'BITCONNEEEEEEEEECT!',
|
|
119
118
|
emitter: {
|
|
120
|
-
_id: '
|
|
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',
|
|
119
|
+
_id: 'someid7',
|
|
191
120
|
name: 'Guilherme',
|
|
192
121
|
},
|
|
193
122
|
type: ChatMessageType.Global,
|
|
@@ -208,14 +137,14 @@ const tabsMock = [
|
|
|
208
137
|
const recentPrivateChatCharactersMock = [
|
|
209
138
|
{ _id: 'someid', name: 'Guilhermexxxxxxxxxxxx' },
|
|
210
139
|
{ _id: 'someid2', name: 'Guilherme2' },
|
|
211
|
-
{ _id: '
|
|
212
|
-
{ _id: '
|
|
213
|
-
{ _id: '
|
|
214
|
-
{ _id: '
|
|
215
|
-
{ _id: '
|
|
216
|
-
{ _id: '
|
|
217
|
-
{ _id: '
|
|
218
|
-
{ _id: '
|
|
140
|
+
{ _id: 'someid3', name: 'Guilherme2' },
|
|
141
|
+
{ _id: 'someid4', name: 'Guilherme2' },
|
|
142
|
+
{ _id: 'someid5', name: 'Guilherme2' },
|
|
143
|
+
{ _id: 'someid6', name: 'Guilherme2' },
|
|
144
|
+
{ _id: 'someid7', name: 'Guilherme2' },
|
|
145
|
+
{ _id: 'someid8', name: 'Guilherme2' },
|
|
146
|
+
{ _id: 'someid9', name: 'Guilherme2' },
|
|
147
|
+
{ _id: 'someid10', name: 'Guilherme2' },
|
|
219
148
|
];
|
|
220
149
|
|
|
221
150
|
const Template: Story<IChatRevampProps> = args => (
|
|
@@ -227,23 +156,43 @@ const Template: Story<IChatRevampProps> = args => (
|
|
|
227
156
|
export const Default = Template.bind({});
|
|
228
157
|
|
|
229
158
|
Default.args = {
|
|
230
|
-
onSendGlobalChatMessage:
|
|
231
|
-
|
|
159
|
+
onSendGlobalChatMessage: value => {
|
|
160
|
+
console.log('Sending global chat message:', value);
|
|
161
|
+
},
|
|
162
|
+
onChangeCharacterName: value => {
|
|
163
|
+
console.log('Changing character name to:', value);
|
|
164
|
+
},
|
|
232
165
|
chatMessages: chatMessagesMock,
|
|
233
166
|
styles: { width: `calc(100% - 0.5rem * 2)`, height: '200px' },
|
|
234
|
-
onCloseButton: () =>
|
|
167
|
+
onCloseButton: () => {
|
|
168
|
+
console.log('Closing chat...');
|
|
169
|
+
},
|
|
235
170
|
tabs: tabsMock,
|
|
236
171
|
privateChatCharacters: recentPrivateChatCharactersMock,
|
|
237
172
|
activeTab: 'global',
|
|
238
|
-
onChangeTab:
|
|
239
|
-
|
|
240
|
-
|
|
173
|
+
onChangeTab: tab => {
|
|
174
|
+
console.log('Changing tab to:', tab);
|
|
175
|
+
},
|
|
176
|
+
onSendPrivateChatMessage: value => {
|
|
177
|
+
console.log('Sending private chat message:', value);
|
|
178
|
+
},
|
|
179
|
+
onSendTradeMessage: value => {
|
|
180
|
+
console.log('Sending trade message:', value);
|
|
181
|
+
},
|
|
182
|
+
hideSearchCharacterUI: () => {
|
|
183
|
+
console.log('Hiding search character UI...');
|
|
184
|
+
},
|
|
241
185
|
};
|
|
242
186
|
|
|
243
187
|
export const Private = Template.bind({});
|
|
244
188
|
|
|
245
189
|
Private.args = {
|
|
246
|
-
onSendGlobalChatMessage: () => {
|
|
190
|
+
onSendGlobalChatMessage: () => {
|
|
191
|
+
console.log('Sending private chat message...');
|
|
192
|
+
},
|
|
193
|
+
onSendPrivateChatMessage: () => {
|
|
194
|
+
console.log('Sending private message...');
|
|
195
|
+
},
|
|
247
196
|
onChangeCharacterName: () => {},
|
|
248
197
|
chatMessages: chatMessagesMock,
|
|
249
198
|
styles: { width: `calc(100% - 0.5rem * 2)`, height: '200px' },
|
|
@@ -251,18 +200,26 @@ Private.args = {
|
|
|
251
200
|
tabs: tabsMock,
|
|
252
201
|
privateChatCharacters: recentPrivateChatCharactersMock,
|
|
253
202
|
activeTab: 'private',
|
|
254
|
-
onChangeTab: () => {
|
|
255
|
-
|
|
203
|
+
onChangeTab: () => {
|
|
204
|
+
console.log('Changing tab...');
|
|
205
|
+
},
|
|
256
206
|
recentChatCharacters: recentPrivateChatCharactersMock,
|
|
257
207
|
recentSelectedChatCharacterId: recentPrivateChatCharactersMock[0]._id,
|
|
258
208
|
unseenMessageCharacterIds: [recentPrivateChatCharactersMock[0]._id],
|
|
259
209
|
onSendTradeMessage: () => {},
|
|
210
|
+
searchCharacterUI: false,
|
|
211
|
+
hideSearchCharacterUI: () => {},
|
|
260
212
|
};
|
|
261
213
|
|
|
262
214
|
export const Trade = Template.bind({});
|
|
263
215
|
|
|
264
216
|
Trade.args = {
|
|
265
|
-
onSendGlobalChatMessage: () => {
|
|
217
|
+
onSendGlobalChatMessage: () => {
|
|
218
|
+
console.log('Sending global message...');
|
|
219
|
+
},
|
|
220
|
+
onSendPrivateChatMessage: () => {
|
|
221
|
+
console.log('Sending private message...');
|
|
222
|
+
},
|
|
266
223
|
onChangeCharacterName: () => {},
|
|
267
224
|
chatMessages: chatMessagesMock,
|
|
268
225
|
styles: { width: `calc(100% - 0.5rem * 2)`, height: '200px' },
|