@capytale/meta-player 0.9.7 → 0.9.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/.prettierrc.json +4 -4
- package/LICENSE +674 -674
- package/README.md +12 -12
- package/eslint.config.js +28 -28
- package/index.html +15 -15
- package/package.json +60 -60
- package/public/themes/lara-dark-blue/theme.css +7015 -7015
- package/public/themes/lara-light-blue/theme.css +7005 -7005
- package/src/App.tsx +140 -140
- package/src/AppRedux.css +39 -39
- package/src/MetaPlayer.tsx +168 -168
- package/src/activityJs.ts +7 -7
- package/src/app/createAppSlice.ts +6 -6
- package/src/app/hooks.ts +12 -12
- package/src/app/store.ts +52 -52
- package/src/app.module.scss +80 -80
- package/src/demo.tsx +87 -87
- package/src/external/prime.ts +5 -5
- package/src/features/activityData/ExitWarning.ts +28 -28
- package/src/features/activityData/IsAntiCheatExitDetectionDisabledSetter.tsx +19 -19
- package/src/features/activityData/IsDirtySetter.tsx +17 -17
- package/src/features/activityData/MetaPlayerOptionsSetter.tsx +41 -41
- package/src/features/activityData/activityDataSlice.ts +255 -255
- package/src/features/activityData/activityJsData.ts +90 -90
- package/src/features/activityData/hooks.ts +39 -39
- package/src/features/activityData/metaPlayerOptions.ts +23 -23
- package/src/features/activityData/uiState.ts +20 -20
- package/src/features/activityJS/ActivityJSProvider.tsx +350 -350
- package/src/features/activityJS/AfterResetAction.tsx +23 -23
- package/src/features/activityJS/AfterSaveAction.tsx +23 -23
- package/src/features/activityJS/BeforeResetAction.tsx +23 -23
- package/src/features/activityJS/BeforeSaveAction.tsx +23 -23
- package/src/features/activityJS/Saver.tsx +167 -167
- package/src/features/activityJS/hooks.ts +85 -85
- package/src/features/activityJS/internal-hooks.ts +96 -96
- package/src/features/activityJS/saverSlice.ts +96 -96
- package/src/features/activitySettings/ActivitySettingsSetter.tsx +21 -21
- package/src/features/activitySettings/hooks.ts +12 -12
- package/src/features/activitySettings/index.tsx +43 -43
- package/src/features/activitySettings/store.ts +108 -108
- package/src/features/activitySettings/style.module.scss +8 -8
- package/src/features/activitySettings/types.ts +140 -140
- package/src/features/activitySettings/ui.tsx +299 -299
- package/src/features/functionalities/AttachedFilesFunctionality.ts +23 -23
- package/src/features/functionalities/PreviewDialog.tsx +83 -83
- package/src/features/functionalities/functionalitiesSlice.ts +98 -98
- package/src/features/functionalities/hooks.ts +70 -70
- package/src/features/layout/hooks.ts +7 -7
- package/src/features/layout/layoutSlice.ts +93 -93
- package/src/features/navbar/activity-info/index.tsx +54 -54
- package/src/features/navbar/activity-info/style.module.scss +38 -38
- package/src/features/navbar/activity-menu/ActivityQuickActions.tsx +57 -57
- package/src/features/navbar/activity-menu/index.tsx +154 -154
- package/src/features/navbar/activity-menu/style.module.scss +7 -7
- package/src/features/navbar/capytale-menu/CloneDialog.tsx +75 -75
- package/src/features/navbar/capytale-menu/Countdown.tsx +313 -312
- package/src/features/navbar/capytale-menu/CountdownAndSaveButton.tsx +124 -115
- package/src/features/navbar/capytale-menu/index.tsx +260 -260
- package/src/features/navbar/capytale-menu/style.module.scss +8 -8
- package/src/features/navbar/capytale-menu/useRemainingTimeMs.tsx +32 -0
- package/src/features/navbar/index.tsx +39 -39
- package/src/features/navbar/navbarSlice.ts +79 -79
- package/src/features/navbar/review-navbar/GradingNav.tsx +128 -128
- package/src/features/navbar/review-navbar/index.tsx +18 -18
- package/src/features/navbar/review-navbar/style.module.scss +22 -22
- package/src/features/navbar/sidebars/ActivitySidebarActions.tsx +57 -57
- package/src/features/navbar/sidebars/AttachedFilesSidebarContent.module.scss +43 -43
- package/src/features/navbar/sidebars/AttachedFilesSidebarContent.tsx +181 -181
- package/src/features/navbar/sidebars/SettingsSidebarContent.tsx +192 -192
- package/src/features/navbar/sidebars/style.module.scss +15 -15
- package/src/features/navbar/student-utils.ts +11 -11
- package/src/features/navbar/style.module.scss +65 -65
- package/src/features/pedago/InstructionsEditor.tsx +102 -102
- package/src/features/pedago/PdfEditor.tsx +91 -91
- package/src/features/pedago/PedagoCommands.tsx +378 -368
- package/src/features/pedago/SharedNotesEditor.tsx +144 -144
- package/src/features/pedago/hooks.ts +108 -108
- package/src/features/pedago/index.tsx +205 -205
- package/src/features/pedago/style.module.scss +233 -233
- package/src/features/theming/ThemeSwitcher.tsx +51 -51
- package/src/features/theming/hooks.ts +6 -6
- package/src/features/theming/themingSlice.ts +93 -93
- package/src/features/toast.tsx +38 -38
- package/src/hooks/index.ts +16 -16
- package/src/index.css +132 -132
- package/src/index.ts +92 -92
- package/src/logo.svg +1 -1
- package/src/my_json_data.js +4146 -4146
- package/src/settings.ts +6 -6
- package/src/types.ts +8 -8
- package/src/utils/ButtonDoubleIcon.tsx +35 -35
- package/src/utils/CardSelector.tsx +41 -41
- package/src/utils/ErrorBoundary.tsx +41 -41
- package/src/utils/PopupButton.tsx +134 -134
- package/src/utils/activity.ts +8 -8
- package/src/utils/breakpoints.ts +4 -4
- package/src/utils/capytale.ts +10 -10
- package/src/utils/clipboard.ts +11 -11
- package/src/utils/download.ts +7 -7
- package/src/utils/equality.ts +32 -32
- package/src/utils/server-clock.ts +42 -42
- package/src/utils/style.module.scss +45 -45
- package/src/utils/useFullscreen.ts +65 -65
- package/src/vite-env.d.ts +1 -1
- package/tsconfig.json +28 -28
- package/tsconfig.node.json +9 -9
- package/vite.config.ts +11 -11
|
@@ -1,368 +1,378 @@
|
|
|
1
|
-
import { useAppDispatch, useAppSelector } from "../../app/hooks";
|
|
2
|
-
import {
|
|
3
|
-
selectHasGradingOrComments,
|
|
4
|
-
selectInstructionsType,
|
|
5
|
-
selectMode,
|
|
6
|
-
selectPdfInstructions,
|
|
7
|
-
selectSharedNotesType,
|
|
8
|
-
setInstructionsType,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
import
|
|
22
|
-
import
|
|
23
|
-
import
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
const
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
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
|
-
const
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
const
|
|
119
|
-
const
|
|
120
|
-
const
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
{
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
1
|
+
import { useAppDispatch, useAppSelector } from "../../app/hooks";
|
|
2
|
+
import {
|
|
3
|
+
selectHasGradingOrComments,
|
|
4
|
+
selectInstructionsType,
|
|
5
|
+
selectMode,
|
|
6
|
+
selectPdfInstructions,
|
|
7
|
+
selectSharedNotesType,
|
|
8
|
+
setInstructionsType,
|
|
9
|
+
setIsMPDirty,
|
|
10
|
+
setSharedNotesType,
|
|
11
|
+
} from "../activityData/activityDataSlice";
|
|
12
|
+
import {
|
|
13
|
+
PedagoTab,
|
|
14
|
+
selectIsGradingVisible,
|
|
15
|
+
selectOrientation,
|
|
16
|
+
selectPedagoTab,
|
|
17
|
+
setPedagoTab,
|
|
18
|
+
toggleIsGradingVisible,
|
|
19
|
+
setIsPedagoVisible,
|
|
20
|
+
} from "../layout/layoutSlice";
|
|
21
|
+
import styles from "./style.module.scss";
|
|
22
|
+
import { Button } from "primereact/button";
|
|
23
|
+
import settings from "../../settings";
|
|
24
|
+
import { SelectButton } from "primereact/selectbutton";
|
|
25
|
+
import { FC, useCallback, useEffect, useMemo, useRef } from "react";
|
|
26
|
+
import { TabMenu } from "primereact/tabmenu";
|
|
27
|
+
import { classNames } from "primereact/utils";
|
|
28
|
+
import { usePedagoOptions } from "./hooks";
|
|
29
|
+
|
|
30
|
+
export const PedagoCommands = () => {
|
|
31
|
+
const isHorizontal = useAppSelector(selectOrientation) === "horizontal";
|
|
32
|
+
return isHorizontal ? (
|
|
33
|
+
<HorizontalPedagoCommands />
|
|
34
|
+
) : (
|
|
35
|
+
<VerticalPedagoCommands />
|
|
36
|
+
);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export const CloseOnlyPedagoCommands: FC = () => {
|
|
40
|
+
const dispatch = useAppDispatch();
|
|
41
|
+
return (
|
|
42
|
+
<div className={styles.closeOnlyPedagoCommands}>
|
|
43
|
+
<Button
|
|
44
|
+
severity="secondary"
|
|
45
|
+
icon="pi pi-times"
|
|
46
|
+
rounded
|
|
47
|
+
text
|
|
48
|
+
aria-label="Masquer consignes et évaluation"
|
|
49
|
+
tooltip="Masquer l'évaluation"
|
|
50
|
+
tooltipOptions={{
|
|
51
|
+
position: "left",
|
|
52
|
+
showDelay: settings.TOOLTIP_SHOW_DELAY,
|
|
53
|
+
}}
|
|
54
|
+
onClick={() => dispatch(setIsPedagoVisible(false))}
|
|
55
|
+
style={{ flexShrink: 0 }}
|
|
56
|
+
/>
|
|
57
|
+
</div>
|
|
58
|
+
);
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
type DocumentSelectorHzItem = {
|
|
62
|
+
name: string;
|
|
63
|
+
value: PedagoTab;
|
|
64
|
+
tooltip: string;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
type DocumentSelectorItem = DocumentSelectorHzItem & {
|
|
68
|
+
template: (item: any) => JSX.Element;
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
const HorizontalPedagoCommands = () => {
|
|
72
|
+
const mode = useAppSelector(selectMode);
|
|
73
|
+
const dispatch = useAppDispatch();
|
|
74
|
+
return (
|
|
75
|
+
<div className={styles.pedagoCommands}>
|
|
76
|
+
<div
|
|
77
|
+
style={{
|
|
78
|
+
display: "flex",
|
|
79
|
+
flexDirection: "row",
|
|
80
|
+
justifyContent: "space-between",
|
|
81
|
+
alignItems: "center",
|
|
82
|
+
width: "100%",
|
|
83
|
+
paddingLeft: "4px",
|
|
84
|
+
}}
|
|
85
|
+
>
|
|
86
|
+
{(mode === "assignment" || mode === "review") && (
|
|
87
|
+
<ShowHideGradingButton />
|
|
88
|
+
)}
|
|
89
|
+
<div></div>
|
|
90
|
+
<Button
|
|
91
|
+
severity="secondary"
|
|
92
|
+
icon="pi pi-times"
|
|
93
|
+
rounded
|
|
94
|
+
text
|
|
95
|
+
aria-label="Masquer consignes et évaluation"
|
|
96
|
+
tooltip="Masquer les consignes"
|
|
97
|
+
tooltipOptions={{
|
|
98
|
+
position: "left",
|
|
99
|
+
showDelay: settings.TOOLTIP_SHOW_DELAY,
|
|
100
|
+
}}
|
|
101
|
+
onClick={() => dispatch(setIsPedagoVisible(false))}
|
|
102
|
+
style={{ flexShrink: 0 }}
|
|
103
|
+
/>
|
|
104
|
+
</div>
|
|
105
|
+
<HorizontalDocumentSelector />
|
|
106
|
+
</div>
|
|
107
|
+
);
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
const DocumentSelectorItemActions: FC<{
|
|
111
|
+
item: DocumentSelectorHzItem;
|
|
112
|
+
}> = ({ item }) => {
|
|
113
|
+
const mode = useAppSelector(selectMode);
|
|
114
|
+
const itemTemplate = useCallback((option: any) => {
|
|
115
|
+
return <i className={option.icon}></i>;
|
|
116
|
+
}, []);
|
|
117
|
+
|
|
118
|
+
const instructionsType = useAppSelector(selectInstructionsType);
|
|
119
|
+
const sharedNotesType = useAppSelector(selectSharedNotesType);
|
|
120
|
+
const pdfInstructions = useAppSelector(selectPdfInstructions);
|
|
121
|
+
const dispatch = useAppDispatch();
|
|
122
|
+
|
|
123
|
+
const initTypes = useRef(true);
|
|
124
|
+
useEffect(() => {
|
|
125
|
+
if (initTypes.current) {
|
|
126
|
+
initTypes.current = false;
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
dispatch(setIsMPDirty(true));
|
|
130
|
+
}, [instructionsType, sharedNotesType]);
|
|
131
|
+
|
|
132
|
+
return (
|
|
133
|
+
<>
|
|
134
|
+
{mode === "create" && (
|
|
135
|
+
<>
|
|
136
|
+
<div className={styles.pdfActions}>
|
|
137
|
+
{item.value === "pdf" && !pdfInstructions && (
|
|
138
|
+
<i className="pi pi-eye-slash"></i>
|
|
139
|
+
)}
|
|
140
|
+
{item.value === "pdf" && pdfInstructions && (
|
|
141
|
+
<i className="pi pi-file-pdf"></i>
|
|
142
|
+
)}
|
|
143
|
+
</div>
|
|
144
|
+
{item.value !== "pdf" && (
|
|
145
|
+
<SelectButton
|
|
146
|
+
aria-label={`Sélectionner le type de ${item.name}`}
|
|
147
|
+
className={styles.smallSelectButton}
|
|
148
|
+
value={
|
|
149
|
+
item.value === "instructions"
|
|
150
|
+
? instructionsType
|
|
151
|
+
: sharedNotesType
|
|
152
|
+
}
|
|
153
|
+
onChange={(e) => {
|
|
154
|
+
if (item.value === "instructions") {
|
|
155
|
+
dispatch(setInstructionsType(e.value));
|
|
156
|
+
} else {
|
|
157
|
+
dispatch(setSharedNotesType(e.value));
|
|
158
|
+
}
|
|
159
|
+
}}
|
|
160
|
+
itemTemplate={itemTemplate}
|
|
161
|
+
optionLabel="value"
|
|
162
|
+
allowEmpty={false}
|
|
163
|
+
options={[
|
|
164
|
+
{
|
|
165
|
+
label: "Éditeur riche",
|
|
166
|
+
value: "rich",
|
|
167
|
+
icon: "pi pi-pen-to-square",
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
label: "Pas de consigne",
|
|
171
|
+
value: "none",
|
|
172
|
+
icon: "pi pi-eye-slash",
|
|
173
|
+
},
|
|
174
|
+
]}
|
|
175
|
+
tooltip={item.tooltip}
|
|
176
|
+
tooltipOptions={{
|
|
177
|
+
position: "left",
|
|
178
|
+
showDelay: settings.TOOLTIP_SHOW_DELAY,
|
|
179
|
+
}}
|
|
180
|
+
/>
|
|
181
|
+
)}
|
|
182
|
+
</>
|
|
183
|
+
)}
|
|
184
|
+
</>
|
|
185
|
+
);
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
const HorizontalDocumentSelector = () => {
|
|
189
|
+
const pedagoTab = useAppSelector(selectPedagoTab);
|
|
190
|
+
const mode = useAppSelector(selectMode);
|
|
191
|
+
// const pdfInstructions = useAppSelector(selectPdfInstructions);
|
|
192
|
+
const dispatch = useAppDispatch();
|
|
193
|
+
const { hasNonEmptyInstructions, hasSharedNotes } = usePedagoOptions();
|
|
194
|
+
|
|
195
|
+
const items: DocumentSelectorHzItem[] = useMemo(() => {
|
|
196
|
+
const allItems: DocumentSelectorHzItem[] = [];
|
|
197
|
+
if (mode === "create" || hasNonEmptyInstructions) {
|
|
198
|
+
allItems.push({
|
|
199
|
+
name: "Consignes",
|
|
200
|
+
value: "instructions",
|
|
201
|
+
tooltip: "Activer/désactiver les consignes",
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
/* // Removed PDF for now
|
|
205
|
+
if (mode === "create" || pdfInstructions) {
|
|
206
|
+
allItems.push({
|
|
207
|
+
name: "PDF",
|
|
208
|
+
value: "pdf",
|
|
209
|
+
tooltip: "Activer/désactiver le PDF",
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
*/
|
|
213
|
+
if (mode === "create" || hasSharedNotes) {
|
|
214
|
+
allItems.push({
|
|
215
|
+
name: "Notes partagées",
|
|
216
|
+
value: "sharedNotes",
|
|
217
|
+
tooltip: "Activer/désactiver les notes partagées",
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
return allItems;
|
|
221
|
+
}, [mode, hasNonEmptyInstructions, hasSharedNotes]);
|
|
222
|
+
|
|
223
|
+
useEffect(() => {
|
|
224
|
+
if (pedagoTab === null && items.length > 0) {
|
|
225
|
+
dispatch(setPedagoTab(items[0].value));
|
|
226
|
+
}
|
|
227
|
+
}, [pedagoTab, items, dispatch]);
|
|
228
|
+
|
|
229
|
+
return (
|
|
230
|
+
<div className={styles.pedagoHorizontalTabMenu}>
|
|
231
|
+
{items.map((item) => (
|
|
232
|
+
<div
|
|
233
|
+
className={styles.pedagoHorizontalTab}
|
|
234
|
+
role="button"
|
|
235
|
+
aria-label={`Basculer vers l'onglet ${item.name}`}
|
|
236
|
+
onClick={() => dispatch(setPedagoTab(item.value))}
|
|
237
|
+
data-selected={item.value === pedagoTab}
|
|
238
|
+
key={item.value}
|
|
239
|
+
>
|
|
240
|
+
<span>{item.name}</span>
|
|
241
|
+
<DocumentSelectorItemActions item={item} />
|
|
242
|
+
</div>
|
|
243
|
+
))}
|
|
244
|
+
</div>
|
|
245
|
+
);
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
const VerticalPedagoCommands = () => {
|
|
249
|
+
const mode = useAppSelector(selectMode);
|
|
250
|
+
const dispatch = useAppDispatch();
|
|
251
|
+
return (
|
|
252
|
+
<div className={styles.pedagoCommands}>
|
|
253
|
+
<VerticalDocumentSelector />
|
|
254
|
+
<div className={styles.pedagoSeparator}></div>
|
|
255
|
+
{(mode === "assignment" || mode === "review") && (
|
|
256
|
+
<ShowHideGradingButton />
|
|
257
|
+
)}
|
|
258
|
+
<Button
|
|
259
|
+
severity="secondary"
|
|
260
|
+
icon="pi pi-times"
|
|
261
|
+
rounded
|
|
262
|
+
text
|
|
263
|
+
aria-label="Masquer consignes et évaluation"
|
|
264
|
+
tooltip="Masquer les consignes"
|
|
265
|
+
tooltipOptions={{
|
|
266
|
+
position: "left",
|
|
267
|
+
showDelay: settings.TOOLTIP_SHOW_DELAY,
|
|
268
|
+
}}
|
|
269
|
+
onClick={() => dispatch(setIsPedagoVisible(false))}
|
|
270
|
+
style={{ flexShrink: 0 }}
|
|
271
|
+
/>
|
|
272
|
+
</div>
|
|
273
|
+
);
|
|
274
|
+
};
|
|
275
|
+
|
|
276
|
+
const VerticalDocumentSelector = () => {
|
|
277
|
+
const pedagoTab = useAppSelector(selectPedagoTab);
|
|
278
|
+
const mode = useAppSelector(selectMode);
|
|
279
|
+
// const pdfInstructions = useAppSelector(selectPdfInstructions);
|
|
280
|
+
const { hasNonEmptyInstructions, hasSharedNotes } = usePedagoOptions();
|
|
281
|
+
const dispatch = useAppDispatch();
|
|
282
|
+
|
|
283
|
+
const itemRenderer = useCallback(
|
|
284
|
+
(item: DocumentSelectorItem) => (
|
|
285
|
+
<a
|
|
286
|
+
className={classNames("p-menuitem-link", styles.pedagoTab)}
|
|
287
|
+
onClick={() => dispatch(setPedagoTab(item.value))}
|
|
288
|
+
>
|
|
289
|
+
<span>{item.name}</span>
|
|
290
|
+
<DocumentSelectorItemActions item={item} />
|
|
291
|
+
</a>
|
|
292
|
+
),
|
|
293
|
+
[dispatch],
|
|
294
|
+
);
|
|
295
|
+
|
|
296
|
+
const items: DocumentSelectorItem[] = useMemo(() => {
|
|
297
|
+
const allItems: DocumentSelectorItem[] = [];
|
|
298
|
+
if (mode === "create" || hasNonEmptyInstructions) {
|
|
299
|
+
allItems.push({
|
|
300
|
+
name: "Consignes",
|
|
301
|
+
value: "instructions",
|
|
302
|
+
tooltip: "Activer/désactiver les consignes",
|
|
303
|
+
template: (item: any) => itemRenderer(item),
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
/* // Removed PDF for now
|
|
307
|
+
if (mode === "create" || pdfInstructions) {
|
|
308
|
+
allItems.push({
|
|
309
|
+
name: "PDF",
|
|
310
|
+
value: "pdf",
|
|
311
|
+
tooltip: "Activer/désactiver le PDF",
|
|
312
|
+
template: (item: any) => itemRenderer(item),
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
*/
|
|
316
|
+
if (mode === "create" || hasSharedNotes) {
|
|
317
|
+
allItems.push({
|
|
318
|
+
name: "Notes partagées",
|
|
319
|
+
value: "sharedNotes",
|
|
320
|
+
tooltip: "Activer/désactiver les notes partagées",
|
|
321
|
+
template: (item: any) => itemRenderer(item),
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
return allItems;
|
|
325
|
+
}, [mode, hasNonEmptyInstructions, hasSharedNotes]);
|
|
326
|
+
|
|
327
|
+
useEffect(() => {
|
|
328
|
+
if (pedagoTab === null && items.length > 0) {
|
|
329
|
+
dispatch(setPedagoTab(items[0].value));
|
|
330
|
+
}
|
|
331
|
+
}, [pedagoTab, items, dispatch]);
|
|
332
|
+
|
|
333
|
+
const activeIndex = useMemo(() => {
|
|
334
|
+
const index = items.findIndex((item) => item.value === pedagoTab);
|
|
335
|
+
if (index === -1) {
|
|
336
|
+
return undefined;
|
|
337
|
+
}
|
|
338
|
+
return index;
|
|
339
|
+
}, [items, pedagoTab]);
|
|
340
|
+
|
|
341
|
+
return (
|
|
342
|
+
<TabMenu
|
|
343
|
+
className={styles.pedagoTabMenu}
|
|
344
|
+
model={items}
|
|
345
|
+
activeIndex={activeIndex}
|
|
346
|
+
onTabChange={(e) => {
|
|
347
|
+
dispatch(setPedagoTab(items[e.index].value));
|
|
348
|
+
}}
|
|
349
|
+
/>
|
|
350
|
+
);
|
|
351
|
+
};
|
|
352
|
+
|
|
353
|
+
const ShowHideGradingButton: React.FC = () => {
|
|
354
|
+
const dispatch = useAppDispatch();
|
|
355
|
+
const mode = useAppSelector(selectMode);
|
|
356
|
+
const hasGradingOrComments = useAppSelector(selectHasGradingOrComments);
|
|
357
|
+
const isGradingVisible = useAppSelector(selectIsGradingVisible);
|
|
358
|
+
const canShowGrading = hasGradingOrComments || mode === "review";
|
|
359
|
+
|
|
360
|
+
return (
|
|
361
|
+
<Button
|
|
362
|
+
size="small"
|
|
363
|
+
icon="pi pi-graduation-cap"
|
|
364
|
+
disabled={!canShowGrading}
|
|
365
|
+
severity={canShowGrading ? "info" : "secondary"}
|
|
366
|
+
aria-label="Afficher/Masquer la notation"
|
|
367
|
+
tooltip={canShowGrading ? "Afficher/Masquer la notation" : "Pas de note"}
|
|
368
|
+
tooltipOptions={{
|
|
369
|
+
position: "left",
|
|
370
|
+
showDelay: settings.TOOLTIP_SHOW_DELAY,
|
|
371
|
+
showOnDisabled: true,
|
|
372
|
+
}}
|
|
373
|
+
onClick={() => dispatch(toggleIsGradingVisible())}
|
|
374
|
+
style={{ flexShrink: 0 }}
|
|
375
|
+
outlined={!isGradingVisible || !canShowGrading}
|
|
376
|
+
/>
|
|
377
|
+
);
|
|
378
|
+
};
|