@dao42/d42paas-front 0.4.8 → 0.4.9
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/package.json +2 -3
- package/src/_bundle.tsx +0 -283
- package/src/app.tsx +0 -356
- package/src/assets/code-brackets.svg +0 -1
- package/src/assets/colors.svg +0 -1
- package/src/assets/comments.svg +0 -1
- package/src/assets/direction.svg +0 -1
- package/src/assets/flow.svg +0 -1
- package/src/assets/plugin.svg +0 -1
- package/src/assets/repo.svg +0 -1
- package/src/assets/stackalt.svg +0 -1
- package/src/components/Avatar/index.tsx +0 -27
- package/src/components/CanvasHelper/index.tsx +0 -89
- package/src/components/Console/index.tsx +0 -88
- package/src/components/Editor/index copy.tsx +0 -1010
- package/src/components/Editor/index.tsx +0 -1011
- package/src/components/FileTree/index.tsx +0 -478
- package/src/components/LiveContent/index.tsx +0 -221
- package/src/components/LiveContent/video.tsx +0 -213
- package/src/components/LottieAnim/index.tsx +0 -41
- package/src/components/Message/index.tsx +0 -64
- package/src/components/Model/index.tsx +0 -42
- package/src/components/OutputBrowser/index.tsx +0 -180
- package/src/components/Skeleton/index.tsx +0 -41
- package/src/components/Tabs/index.tsx +0 -23
- package/src/components/Terminal/index.tsx +0 -127
- package/src/components/ToolBar/index.tsx +0 -169
- package/src/components/XTerm/index.tsx +0 -113
- package/src/components/index.tsx +0 -4
- package/src/components/loading/index.tsx +0 -284
- package/src/enum/FExtension.ts +0 -168
- package/src/helpers/collections/IoClient.tsx +0 -314
- package/src/helpers/collections/errorCatcher.tsx +0 -0
- package/src/helpers/collections/idb.tsx +0 -186
- package/src/helpers/collections/localStorage.tsx +0 -13
- package/src/helpers/collections/mock.tsx +0 -30
- package/src/helpers/collections/playgroundInit.tsx +0 -316
- package/src/helpers/collections/replay.tsx +0 -168
- package/src/helpers/collections/socket.tsx +0 -6
- package/src/helpers/collections/toast.tsx +0 -19
- package/src/helpers/collections/userTool.tsx +0 -12
- package/src/helpers/collections/util.tsx +0 -4
- package/src/helpers/index.tsx +0 -6
- package/src/helpers/monaco/monaco-ot-adapter.tsx +0 -476
- package/src/hooks/collections/useOT.tsx +0 -39
- package/src/hooks/index.tsx +0 -1
- package/src/index.html +0 -49
- package/src/pages/index.tsx +0 -452
- package/src/public/dev.html +0 -35
- package/src/public/index.html +0 -50
- package/src/public/sdkserver.html +0 -36
- package/src/stores/index.tsx +0 -1
- package/src/stores/oTStore.tsx +0 -310
- package/src/stories/BrowserWindow.tsx +0 -30
- package/src/stories/Console.tsx +0 -46
- package/src/stories/Editor.tsx +0 -37
- package/src/stories/FileTree.tsx +0 -50
- package/src/stories/Shell.tsx +0 -53
- package/src/stories/introduction.stories.mdx +0 -193
- package/src/stories/page.tsx +0 -71
- package/src/styles/collections/iconfont.scss +0 -1
- package/src/styles/collections/tabs-costumers.scss +0 -20
- package/src/styles/collections/tailwind.scss +0 -3
- package/src/styles/collections/tree-costumers.scss +0 -53
- package/src/styles/collections/utility.scss +0 -10
- package/src/styles/collections/xterm-costumers.scss +0 -47
- package/src/styles/index.css +0 -21
- package/src/types/editor.d.ts +0 -31
- package/src/types/index.d.ts +0 -166
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
export const roleColors = (index: number) =>
|
|
2
|
-
[
|
|
3
|
-
'#d904c7',
|
|
4
|
-
'#49cf5b',
|
|
5
|
-
'#D9C589',
|
|
6
|
-
'#F27B13',
|
|
7
|
-
'#A0D9D9',
|
|
8
|
-
'#45858C',
|
|
9
|
-
'#8C311C',
|
|
10
|
-
'#4A5B8C',
|
|
11
|
-
'#8C4F2B',
|
|
12
|
-
'#34401A',
|
|
13
|
-
'#CAD959',
|
|
14
|
-
'#0476D9',
|
|
15
|
-
][index];
|
|
16
|
-
|
|
17
|
-
export const avatarGenerator = (value: number, name: string) => {
|
|
18
|
-
const avatarSeries = [
|
|
19
|
-
'initials',
|
|
20
|
-
'avataaars',
|
|
21
|
-
'big-ears',
|
|
22
|
-
'bottts',
|
|
23
|
-
'croodles',
|
|
24
|
-
'personas',
|
|
25
|
-
'micah',
|
|
26
|
-
];
|
|
27
|
-
// return `https://avatars.dicebear.com/api/avataaars/${name}.svg`;
|
|
28
|
-
return `https://avatars.dicebear.com/api/human/${name}.svg`;
|
|
29
|
-
// return `https://avatars.dicebear.com/api/${avatarSeries[value]}/${name}.svg`;
|
|
30
|
-
};
|
|
@@ -1,316 +0,0 @@
|
|
|
1
|
-
import { omit } from 'lodash';
|
|
2
|
-
import {
|
|
3
|
-
oTStore,
|
|
4
|
-
T_UserInfo,
|
|
5
|
-
userListStore,
|
|
6
|
-
userStore,
|
|
7
|
-
} from '~/stores/oTStore';
|
|
8
|
-
import { avatarGenerator, roleColors } from './mock';
|
|
9
|
-
import { random as _random } from 'lodash';
|
|
10
|
-
import { IsMe, IsSameFile } from './userTool';
|
|
11
|
-
import { unstable_batchedUpdates } from 'react-dom';
|
|
12
|
-
import {
|
|
13
|
-
daopaasDB,
|
|
14
|
-
getLocalReplayFile,
|
|
15
|
-
setLocalMedia,
|
|
16
|
-
setLocalReplayFile,
|
|
17
|
-
setReplaySource,
|
|
18
|
-
} from './idb';
|
|
19
|
-
import { replay } from './replay';
|
|
20
|
-
import { Toast } from './toast';
|
|
21
|
-
|
|
22
|
-
const heartbeatTime = 1000 * 60 * 10;
|
|
23
|
-
|
|
24
|
-
const PlaygroundInit = <T extends { [key: string]: string } & { io: D42_FrontType.SocketType}>(arg: T) => {
|
|
25
|
-
// const PlaygroundInit = <T, >(arg: T): T => {
|
|
26
|
-
const { ticket, playgroundId, userId, io } = arg;
|
|
27
|
-
unstable_batchedUpdates(() => {
|
|
28
|
-
// const io = useOT.getState().socket;
|
|
29
|
-
const setUserInfo = userStore.getState().setUserInfo;
|
|
30
|
-
const setUserList = userListStore.getState().setUserList;
|
|
31
|
-
|
|
32
|
-
// oTStore
|
|
33
|
-
const {
|
|
34
|
-
switchDoc,
|
|
35
|
-
setSenders,
|
|
36
|
-
setCRDTInfo,
|
|
37
|
-
setServerAck,
|
|
38
|
-
setCustomAck,
|
|
39
|
-
switchDocTree,
|
|
40
|
-
setPlaygroundInfo,
|
|
41
|
-
setDockerInfo,
|
|
42
|
-
setQueryObject,
|
|
43
|
-
setPlaygroundStatus,
|
|
44
|
-
setFromServer,
|
|
45
|
-
setDockerStatus,
|
|
46
|
-
appStatus,
|
|
47
|
-
setAppStatus,
|
|
48
|
-
setGlobalData,
|
|
49
|
-
} = oTStore.getState();
|
|
50
|
-
|
|
51
|
-
// setAppStatus('code');
|
|
52
|
-
// io.emit('appStatus', 'code');
|
|
53
|
-
window.clearCache = () => {
|
|
54
|
-
localStorage.clear();
|
|
55
|
-
indexedDB.deleteDatabase('daopaas').onsuccess = () => {
|
|
56
|
-
// console.log('daopaas Deleted !');
|
|
57
|
-
};
|
|
58
|
-
io.emit('clearCache');
|
|
59
|
-
};
|
|
60
|
-
window.Toast = Toast;
|
|
61
|
-
|
|
62
|
-
setDockerInfo({
|
|
63
|
-
...oTStore.getState().dockerInfo,
|
|
64
|
-
ticket,
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
// window.onerror = function (message, source, lineno, colno, error) {
|
|
68
|
-
// ;
|
|
69
|
-
// };
|
|
70
|
-
|
|
71
|
-
io.on('connect', () => {
|
|
72
|
-
// console.log('已连接');
|
|
73
|
-
io.emit('checkSign', ticket);
|
|
74
|
-
setInterval(() => {
|
|
75
|
-
io.emit('heartbeat', '💗');
|
|
76
|
-
}, heartbeatTime);
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
io.on('clearCache', () => {
|
|
80
|
-
window.location.reload();
|
|
81
|
-
// io.disconnect();
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
io.on('appStatus', (data) => {
|
|
85
|
-
setAppStatus(data);
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
io.on('globalData', (data) => {
|
|
89
|
-
setGlobalData(data);
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
io.on('welcome', (data) => {
|
|
93
|
-
let originUser = userStore.getState().userInfo;
|
|
94
|
-
const userData = JSON.parse(data);
|
|
95
|
-
// const { coUsers } = userData;
|
|
96
|
-
const color = roleColors(userData.onlineCount - 1);
|
|
97
|
-
if (originUser.uuid === userData.uuid) {
|
|
98
|
-
originUser = omit(
|
|
99
|
-
{
|
|
100
|
-
...userData,
|
|
101
|
-
color,
|
|
102
|
-
avatar: avatarGenerator(_random(0, 6), userData.uuid),
|
|
103
|
-
},
|
|
104
|
-
'coUsers',
|
|
105
|
-
);
|
|
106
|
-
setUserInfo(originUser);
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
const userInfoList = [
|
|
110
|
-
originUser,
|
|
111
|
-
...userData.coUsers
|
|
112
|
-
.filter((f) => f.uuid !== originUser.uuid)
|
|
113
|
-
.map((user) => {
|
|
114
|
-
return {
|
|
115
|
-
...user,
|
|
116
|
-
avatar: avatarGenerator(_random(0, 6), user.uuid),
|
|
117
|
-
color: roleColors(user.onlineCount - 1),
|
|
118
|
-
};
|
|
119
|
-
}),
|
|
120
|
-
];
|
|
121
|
-
setUserList(userInfoList);
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
io.on('playgroundInfo', (data) => {
|
|
125
|
-
const { playgroundInfo, crdt, dockerInfo } = JSON.parse(data);
|
|
126
|
-
setPlaygroundInfo(playgroundInfo);
|
|
127
|
-
setDockerInfo({
|
|
128
|
-
...oTStore.getState().dockerInfo,
|
|
129
|
-
...dockerInfo,
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
dockerInfo.fileTree &&
|
|
133
|
-
switchDocTree({
|
|
134
|
-
data: dockerInfo.fileTree,
|
|
135
|
-
});
|
|
136
|
-
setCRDTInfo(crdt);
|
|
137
|
-
// setReplaySource(crdt);
|
|
138
|
-
});
|
|
139
|
-
|
|
140
|
-
io.on('playgroundStatus', (data) => {
|
|
141
|
-
setPlaygroundStatus(data);
|
|
142
|
-
});
|
|
143
|
-
io.on('dockerStatus', (data) => {
|
|
144
|
-
setDockerStatus(data || 'STOP');
|
|
145
|
-
});
|
|
146
|
-
|
|
147
|
-
io.on('fileContent', async (d) => {
|
|
148
|
-
const _d = JSON.parse(d) as D42_FrontType.CRDT;
|
|
149
|
-
// const editor = _d;
|
|
150
|
-
|
|
151
|
-
setCRDTInfo(_d);
|
|
152
|
-
setReplaySource(_d);
|
|
153
|
-
if (IsMe(_d?.userInfo)) {
|
|
154
|
-
switchDoc(_d.file);
|
|
155
|
-
(await daopaasDB).put('files', _d.file.value, _d.file.path);
|
|
156
|
-
if (!(await getLocalReplayFile(_d.file.path))) {
|
|
157
|
-
setLocalReplayFile(_d.file.path, _d.file.value);
|
|
158
|
-
}
|
|
159
|
-
// (await daopaasDB).put(
|
|
160
|
-
// 'replayFiles',
|
|
161
|
-
// _d.editor.doc.value,
|
|
162
|
-
// _d.editor.doc.path,
|
|
163
|
-
// );
|
|
164
|
-
// console.log('serverRevision', _d.editor.revision);
|
|
165
|
-
}
|
|
166
|
-
});
|
|
167
|
-
io.on('terminal', (d) => {
|
|
168
|
-
const _d = JSON.parse(d) as D42_FrontType.CRDT;
|
|
169
|
-
setCRDTInfo(_d);
|
|
170
|
-
setReplaySource(_d);
|
|
171
|
-
});
|
|
172
|
-
io.on('editFile', (d) => {
|
|
173
|
-
const _d = JSON.parse(d);
|
|
174
|
-
setFromServer(true);
|
|
175
|
-
// setServerAck();
|
|
176
|
-
|
|
177
|
-
setCRDTInfo(_d);
|
|
178
|
-
setReplaySource(_d);
|
|
179
|
-
// console.log(_d.editor.revision);
|
|
180
|
-
});
|
|
181
|
-
|
|
182
|
-
io.on('saveFile', (d) => {
|
|
183
|
-
const _d = JSON.parse(d);
|
|
184
|
-
|
|
185
|
-
// setFileSaved(d);
|
|
186
|
-
// console.log(_d.editor.revision);
|
|
187
|
-
});
|
|
188
|
-
io.on('customAck', (d) => {
|
|
189
|
-
const _d = JSON.parse(d);
|
|
190
|
-
// console.log(_d);
|
|
191
|
-
setCRDTInfo(_d);
|
|
192
|
-
setReplaySource(_d);
|
|
193
|
-
setCustomAck();
|
|
194
|
-
});
|
|
195
|
-
io.on('serverAck', (d) => {
|
|
196
|
-
// 待确认逻辑
|
|
197
|
-
const _d = JSON.parse(d);
|
|
198
|
-
setReplaySource(_d);
|
|
199
|
-
setServerAck();
|
|
200
|
-
});
|
|
201
|
-
|
|
202
|
-
io.on('sender', (d) => {
|
|
203
|
-
setSenders([...oTStore.getState().senders, JSON.parse(d).sender]);
|
|
204
|
-
});
|
|
205
|
-
|
|
206
|
-
io.on('fileNode', (data) => {
|
|
207
|
-
const res = JSON.parse(data);
|
|
208
|
-
|
|
209
|
-
switchDocTree({
|
|
210
|
-
// data: res.data,
|
|
211
|
-
data: res,
|
|
212
|
-
});
|
|
213
|
-
});
|
|
214
|
-
|
|
215
|
-
io.on('console', (d) => {
|
|
216
|
-
const _d = JSON.parse(d) as D42_FrontType.CRDT;
|
|
217
|
-
setCRDTInfo(_d);
|
|
218
|
-
setReplaySource(_d);
|
|
219
|
-
});
|
|
220
|
-
|
|
221
|
-
io.on('mediaRecord', (d) => {
|
|
222
|
-
const _d = JSON.parse(d) as D42_FrontType.CRDT;
|
|
223
|
-
setLocalMedia(_d.timestamp, _d);
|
|
224
|
-
setCRDTInfo(_d);
|
|
225
|
-
setReplaySource(_d);
|
|
226
|
-
});
|
|
227
|
-
|
|
228
|
-
// 断联处理
|
|
229
|
-
io.on('disconnect', (reason) => {
|
|
230
|
-
// console.log(reason, '连接断开');
|
|
231
|
-
|
|
232
|
-
if (reason === 'io server disconnect') {
|
|
233
|
-
// the disconnection was initiated by the server, you need to reconnect manually
|
|
234
|
-
return;
|
|
235
|
-
}
|
|
236
|
-
io.connect();
|
|
237
|
-
});
|
|
238
|
-
|
|
239
|
-
io.on('authorized_error', (error) => {
|
|
240
|
-
setTimeout(() => {
|
|
241
|
-
Toast.message({
|
|
242
|
-
type: 'error',
|
|
243
|
-
content: error,
|
|
244
|
-
placement: 'bottomEnd',
|
|
245
|
-
});
|
|
246
|
-
}, 2000);
|
|
247
|
-
});
|
|
248
|
-
|
|
249
|
-
io.on('connect_error', (error) => {
|
|
250
|
-
setTimeout(() => {
|
|
251
|
-
Toast.message({
|
|
252
|
-
type: 'error',
|
|
253
|
-
content: '连接错误, 重新连接中~~~请稍后',
|
|
254
|
-
placement: 'bottomEnd',
|
|
255
|
-
});
|
|
256
|
-
}, 2000);
|
|
257
|
-
io.connect();
|
|
258
|
-
// throw error;
|
|
259
|
-
});
|
|
260
|
-
|
|
261
|
-
io.on('connect_timeout', (timeout) => {
|
|
262
|
-
// console.log(timeout, '连接超时');
|
|
263
|
-
io.connect();
|
|
264
|
-
// throw timeout + 'error';
|
|
265
|
-
});
|
|
266
|
-
|
|
267
|
-
io.on('error', (error) => {
|
|
268
|
-
setTimeout(() => {
|
|
269
|
-
Toast.message({
|
|
270
|
-
type: 'error',
|
|
271
|
-
content: '连接错误,重连中',
|
|
272
|
-
placement: 'bottomEnd',
|
|
273
|
-
});
|
|
274
|
-
}, 2000);
|
|
275
|
-
// console.log(error, '连接错误,重连中');
|
|
276
|
-
io.connect();
|
|
277
|
-
// throw error;
|
|
278
|
-
});
|
|
279
|
-
|
|
280
|
-
// io.on('reconnecting', (attemptNumber) => {
|
|
281
|
-
// // console.log('重连中', attemptNumber);
|
|
282
|
-
// io.connect();
|
|
283
|
-
// });
|
|
284
|
-
|
|
285
|
-
io.on('reconnect_attempt', (attemptNumber) => {
|
|
286
|
-
// console.log('重连中', '...', attemptNumber);
|
|
287
|
-
});
|
|
288
|
-
|
|
289
|
-
io.on('reconnect', (data) => {
|
|
290
|
-
// console.log('已重连~~');
|
|
291
|
-
Toast.message({
|
|
292
|
-
type: 'info',
|
|
293
|
-
content: '已成功重新连接!',
|
|
294
|
-
placement: 'topCenter',
|
|
295
|
-
});
|
|
296
|
-
// const userData = JSON.parse(data);
|
|
297
|
-
// const _u = {
|
|
298
|
-
// ...userData,
|
|
299
|
-
// color: roleColors(userData.onlineCount - 1),
|
|
300
|
-
// };
|
|
301
|
-
|
|
302
|
-
// // 进入房间user
|
|
303
|
-
// setUserStack(userData.coUsers);
|
|
304
|
-
// setUserInfo(_u);
|
|
305
|
-
// const co_user = {};
|
|
306
|
-
// Object.keys(userData.coUsers).forEach((user) => {
|
|
307
|
-
// // co_user[userData.coUsers[user['uuid']]] = userData.coUsers[user];
|
|
308
|
-
// co_user[userData.coUsers[user]['uuid']] = userData.coUsers[user];
|
|
309
|
-
// });
|
|
310
|
-
// localStorage.setItem('userStack', JSON.stringify(co_user));
|
|
311
|
-
// localStorage.setItem('userInfo', JSON.stringify(omit(_u, 'coUsers')));
|
|
312
|
-
});
|
|
313
|
-
});
|
|
314
|
-
};
|
|
315
|
-
|
|
316
|
-
export { PlaygroundInit };
|
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
import { oTStore } from '~/stores';
|
|
2
|
-
|
|
3
|
-
import { getLocalCRDTs, getLocalReplayFile } from './idb';
|
|
4
|
-
import { IsMe } from './userTool';
|
|
5
|
-
import { random } from 'lodash';
|
|
6
|
-
import { userStore } from '~/stores/oTStore';
|
|
7
|
-
import { useOT } from '~/hooks';
|
|
8
|
-
import { Toast } from './toast';
|
|
9
|
-
|
|
10
|
-
let index = 0;
|
|
11
|
-
const REPLAY_INTERVAL = 250;
|
|
12
|
-
let timer;
|
|
13
|
-
let timeOutT: NodeJS.Timeout;
|
|
14
|
-
const replayHandler = async () => {
|
|
15
|
-
const {
|
|
16
|
-
setAppStatus,
|
|
17
|
-
switchDoc,
|
|
18
|
-
switchDocTree,
|
|
19
|
-
setCRDTInfo,
|
|
20
|
-
dockerInfo,
|
|
21
|
-
doc,
|
|
22
|
-
} = oTStore.getState();
|
|
23
|
-
// const { userInfo } = userStore.getState();
|
|
24
|
-
// const { socket } = useOT.getState();
|
|
25
|
-
// const WHICH_ROLE = userInfo;
|
|
26
|
-
// switchDoc({
|
|
27
|
-
// value: '',
|
|
28
|
-
// path: '',
|
|
29
|
-
// });
|
|
30
|
-
|
|
31
|
-
switchDocTree({ data: dockerInfo.fileTree });
|
|
32
|
-
|
|
33
|
-
// setCRDTInfo({
|
|
34
|
-
// userInfo: {
|
|
35
|
-
// uuid: undefined,
|
|
36
|
-
// },
|
|
37
|
-
// timestamp: undefined,
|
|
38
|
-
// evtType: 'Terminal',
|
|
39
|
-
// doc: {
|
|
40
|
-
// action: 'Get',
|
|
41
|
-
// path: '',
|
|
42
|
-
// value: '',
|
|
43
|
-
// },
|
|
44
|
-
// });
|
|
45
|
-
|
|
46
|
-
// setAppStatus('replay');
|
|
47
|
-
// socket.emit('appStatus', 'replay');
|
|
48
|
-
|
|
49
|
-
// ;
|
|
50
|
-
const crdts: D42_FrontType.ReplaySource[] = await getLocalCRDTs();
|
|
51
|
-
// const filterData = crdts.filter((f) => IsMe(f.userInfo));
|
|
52
|
-
const filterData = crdts[index];
|
|
53
|
-
const cdata = ({ ...filterData } as unknown) as D42_FrontType.CRDT;
|
|
54
|
-
|
|
55
|
-
// for (const i in cdata) {
|
|
56
|
-
// if (i !== 'timestamp') {
|
|
57
|
-
// cdata[i] = cdata[i].get(WHICH_ROLE.uuid);
|
|
58
|
-
// }
|
|
59
|
-
// }
|
|
60
|
-
|
|
61
|
-
timeOutT = setTimeout(async () => {
|
|
62
|
-
if (!cdata.timestamp) {
|
|
63
|
-
clearTimeout(timeOutT);
|
|
64
|
-
// console.log(crdts);
|
|
65
|
-
// console.log(filterData);
|
|
66
|
-
replay('stop');
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
if (cdata.file) {
|
|
71
|
-
const file = await getLocalReplayFile(cdata.file.path);
|
|
72
|
-
|
|
73
|
-
cdata.file.value = file;
|
|
74
|
-
|
|
75
|
-
if (doc.path !== cdata.file.path) {
|
|
76
|
-
switchDoc({
|
|
77
|
-
value: file,
|
|
78
|
-
path: cdata.file.path as string,
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
// setTimeout(() => {
|
|
82
|
-
setCRDTInfo({
|
|
83
|
-
...cdata,
|
|
84
|
-
// userInfo: WHICH_ROLE,
|
|
85
|
-
});
|
|
86
|
-
// }, 0);
|
|
87
|
-
return;
|
|
88
|
-
}
|
|
89
|
-
// setTimeout(() => {
|
|
90
|
-
setCRDTInfo({
|
|
91
|
-
...cdata,
|
|
92
|
-
// userInfo: WHICH_ROLE,
|
|
93
|
-
});
|
|
94
|
-
// }, 0);
|
|
95
|
-
}, 0);
|
|
96
|
-
|
|
97
|
-
index++;
|
|
98
|
-
|
|
99
|
-
return {};
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
export const replay = async (status?: 'stop' | 'disabled' | 'pause') => {
|
|
103
|
-
const { setAppStatus, switchDoc, doc, globalData } = oTStore.getState();
|
|
104
|
-
const { socket } = useOT.getState();
|
|
105
|
-
|
|
106
|
-
switch (status) {
|
|
107
|
-
case 'stop':
|
|
108
|
-
clearInterval(timer);
|
|
109
|
-
// switchDoc(doc);
|
|
110
|
-
// switchDoc({
|
|
111
|
-
// value: '',
|
|
112
|
-
// path: '',
|
|
113
|
-
// });
|
|
114
|
-
setAppStatus('code');
|
|
115
|
-
|
|
116
|
-
Toast.message({
|
|
117
|
-
type: 'info',
|
|
118
|
-
content: '播放完毕',
|
|
119
|
-
placement: 'topCenter',
|
|
120
|
-
});
|
|
121
|
-
index = 0;
|
|
122
|
-
|
|
123
|
-
break;
|
|
124
|
-
|
|
125
|
-
case 'disabled':
|
|
126
|
-
clearInterval(timer);
|
|
127
|
-
switchDoc({
|
|
128
|
-
value: '',
|
|
129
|
-
path: '',
|
|
130
|
-
});
|
|
131
|
-
setAppStatus('code');
|
|
132
|
-
// socket.emit('appStatus', 'code');
|
|
133
|
-
index = 0;
|
|
134
|
-
|
|
135
|
-
break;
|
|
136
|
-
|
|
137
|
-
case 'pause':
|
|
138
|
-
clearInterval(timer);
|
|
139
|
-
setAppStatus('pause');
|
|
140
|
-
|
|
141
|
-
break;
|
|
142
|
-
|
|
143
|
-
default:
|
|
144
|
-
// switchDoc({
|
|
145
|
-
// value: '',
|
|
146
|
-
// path: '',
|
|
147
|
-
// });
|
|
148
|
-
switchDoc({
|
|
149
|
-
value: '',
|
|
150
|
-
path: '',
|
|
151
|
-
});
|
|
152
|
-
clearInterval(timer);
|
|
153
|
-
// setAppStatus('code');
|
|
154
|
-
replayHandler();
|
|
155
|
-
// setAppStatus('replay');
|
|
156
|
-
setAppStatus('replay');
|
|
157
|
-
// socket.emit('appStatus', 'replay');
|
|
158
|
-
|
|
159
|
-
timer = setInterval(() => {
|
|
160
|
-
if (globalData.isRecording) {
|
|
161
|
-
throw 'dError: 录制过程中无法回放!';
|
|
162
|
-
}
|
|
163
|
-
replayHandler();
|
|
164
|
-
}, REPLAY_INTERVAL);
|
|
165
|
-
|
|
166
|
-
break;
|
|
167
|
-
}
|
|
168
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
// import { Message, MsgType } from '~/components/Message';
|
|
2
|
-
import { toaster, Notification, Message } from 'rsuite';
|
|
3
|
-
import React from 'react';
|
|
4
|
-
|
|
5
|
-
export class Toast {
|
|
6
|
-
static message(props) {
|
|
7
|
-
// ;
|
|
8
|
-
toaster.push(
|
|
9
|
-
<Message showIcon {...props}>
|
|
10
|
-
{props.content}
|
|
11
|
-
</Message>,
|
|
12
|
-
{
|
|
13
|
-
placement: props.placement || 'topCenter',
|
|
14
|
-
// ...props,
|
|
15
|
-
// container:()=> document.body,
|
|
16
|
-
},
|
|
17
|
-
);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { oTStore } from '~/stores';
|
|
2
|
-
import { userStore } from '~/stores/oTStore';
|
|
3
|
-
|
|
4
|
-
export const IsMe = (userInfo) => {
|
|
5
|
-
const _u = userStore.getState().userInfo;
|
|
6
|
-
return _u.uuid === userInfo.uuid;
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
export const IsSameFile = (file) => {
|
|
10
|
-
const _f = oTStore.getState().doc;
|
|
11
|
-
return _f.path === file.path;
|
|
12
|
-
};
|
package/src/helpers/index.tsx
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export { socketHelper } from './collections/socket';
|
|
2
|
-
export { localStorageSpace } from './collections/localStorage';
|
|
3
|
-
export { avatarGenerator, roleColors } from './collections/mock';
|
|
4
|
-
export { globalVal } from './collections/util';
|
|
5
|
-
export { IsMe, IsSameFile } from './collections/userTool';
|
|
6
|
-
export { IoClient } from './collections/IoClient';
|