@capytale/meta-player 0.9.11 → 0.10.0

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.
Files changed (110) hide show
  1. package/.prettierrc.json +4 -4
  2. package/LICENSE +674 -674
  3. package/README.md +12 -12
  4. package/eslint.config.js +28 -28
  5. package/index.html +15 -15
  6. package/package.json +60 -60
  7. package/public/themes/lara-dark-blue/theme.css +7015 -7015
  8. package/public/themes/lara-light-blue/theme.css +7005 -7005
  9. package/src/App.tsx +145 -140
  10. package/src/AppRedux.css +39 -39
  11. package/src/MetaPlayer.tsx +168 -168
  12. package/src/activityJs.ts +7 -7
  13. package/src/app/createAppSlice.ts +6 -6
  14. package/src/app/hooks.ts +12 -12
  15. package/src/app/store.ts +52 -52
  16. package/src/app.module.scss +80 -80
  17. package/src/demo.tsx +87 -87
  18. package/src/external/prime.ts +5 -5
  19. package/src/features/activityData/ExitWarning.ts +28 -28
  20. package/src/features/activityData/IsAntiCheatExitDetectionDisabledSetter.tsx +19 -19
  21. package/src/features/activityData/IsDirtySetter.tsx +17 -17
  22. package/src/features/activityData/MetaPlayerOptionsSetter.tsx +41 -41
  23. package/src/features/activityData/activityDataSlice.ts +255 -255
  24. package/src/features/activityData/activityJsData.ts +90 -90
  25. package/src/features/activityData/hooks.ts +39 -39
  26. package/src/features/activityData/metaPlayerOptions.ts +23 -23
  27. package/src/features/activityData/uiState.ts +20 -20
  28. package/src/features/activityJS/ActivityJSProvider.tsx +362 -350
  29. package/src/features/activityJS/AfterResetAction.tsx +23 -23
  30. package/src/features/activityJS/AfterSaveAction.tsx +23 -23
  31. package/src/features/activityJS/BeforeResetAction.tsx +23 -23
  32. package/src/features/activityJS/BeforeSaveAction.tsx +23 -23
  33. package/src/features/activityJS/Saver.tsx +167 -167
  34. package/src/features/activityJS/hooks.ts +85 -85
  35. package/src/features/activityJS/internal-hooks.ts +96 -96
  36. package/src/features/activityJS/saverSlice.ts +96 -96
  37. package/src/features/activitySettings/ActivitySettingsSetter.tsx +21 -21
  38. package/src/features/activitySettings/hooks.ts +12 -12
  39. package/src/features/activitySettings/index.tsx +43 -43
  40. package/src/features/activitySettings/store.ts +108 -108
  41. package/src/features/activitySettings/style.module.scss +8 -8
  42. package/src/features/activitySettings/types.ts +140 -140
  43. package/src/features/activitySettings/ui.tsx +299 -299
  44. package/src/features/functionalities/AttachedFilesFunctionality.ts +23 -23
  45. package/src/features/functionalities/PreviewDialog.tsx +83 -83
  46. package/src/features/functionalities/functionalitiesSlice.ts +98 -98
  47. package/src/features/functionalities/hooks.ts +70 -70
  48. package/src/features/layout/hooks.ts +7 -7
  49. package/src/features/layout/layoutSlice.ts +93 -93
  50. package/src/features/navbar/activity-info/index.tsx +54 -54
  51. package/src/features/navbar/activity-info/style.module.scss +38 -38
  52. package/src/features/navbar/activity-menu/ActivityQuickActions.tsx +89 -57
  53. package/src/features/navbar/activity-menu/index.tsx +154 -154
  54. package/src/features/navbar/activity-menu/style.module.scss +7 -7
  55. package/src/features/navbar/capytale-menu/CloneDialog.tsx +75 -75
  56. package/src/features/navbar/capytale-menu/Countdown.tsx +313 -313
  57. package/src/features/navbar/capytale-menu/CountdownAndSaveButton.tsx +129 -125
  58. package/src/features/navbar/capytale-menu/index.tsx +260 -260
  59. package/src/features/navbar/capytale-menu/style.module.scss +8 -8
  60. package/src/features/navbar/capytale-menu/useRemainingTimeMs.tsx +32 -32
  61. package/src/features/navbar/index.tsx +39 -39
  62. package/src/features/navbar/navbarSlice.ts +79 -79
  63. package/src/features/navbar/preview-navbar/index.tsx +18 -0
  64. package/src/features/navbar/preview-navbar/style.module.scss +17 -0
  65. package/src/features/navbar/review-navbar/GradingNav.tsx +128 -128
  66. package/src/features/navbar/review-navbar/index.tsx +18 -18
  67. package/src/features/navbar/review-navbar/style.module.scss +22 -22
  68. package/src/features/navbar/sidebars/ActivitySidebarActions.tsx +57 -57
  69. package/src/features/navbar/sidebars/AttachedFilesSidebarContent.module.scss +43 -43
  70. package/src/features/navbar/sidebars/AttachedFilesSidebarContent.tsx +181 -181
  71. package/src/features/navbar/sidebars/SettingsSidebarContent.tsx +192 -192
  72. package/src/features/navbar/sidebars/style.module.scss +15 -15
  73. package/src/features/navbar/student-utils.ts +11 -11
  74. package/src/features/navbar/style.module.scss +65 -65
  75. package/src/features/pedago/InstructionsEditor.tsx +104 -102
  76. package/src/features/pedago/PdfEditor.tsx +91 -91
  77. package/src/features/pedago/PedagoCommands.tsx +378 -378
  78. package/src/features/pedago/SharedNotesEditor.tsx +144 -144
  79. package/src/features/pedago/hooks.ts +108 -108
  80. package/src/features/pedago/index.tsx +205 -205
  81. package/src/features/pedago/style.module.scss +233 -233
  82. package/src/features/theming/ThemeSwitcher.tsx +51 -51
  83. package/src/features/theming/hooks.ts +6 -6
  84. package/src/features/theming/themingSlice.ts +93 -93
  85. package/src/features/toast.tsx +38 -38
  86. package/src/hooks/index.ts +55 -16
  87. package/src/index.css +132 -132
  88. package/src/index.ts +93 -92
  89. package/src/logo.svg +1 -1
  90. package/src/my_json_data.js +4146 -4146
  91. package/src/settings.ts +6 -6
  92. package/src/types.ts +8 -8
  93. package/src/utils/ButtonDoubleIcon.tsx +35 -35
  94. package/src/utils/CardSelector.tsx +41 -41
  95. package/src/utils/ErrorBoundary.tsx +41 -41
  96. package/src/utils/PopupButton.tsx +134 -134
  97. package/src/utils/activity.ts +8 -8
  98. package/src/utils/breakpoints.ts +4 -4
  99. package/src/utils/capytale.ts +10 -10
  100. package/src/utils/clipboard.ts +11 -11
  101. package/src/utils/download.ts +7 -7
  102. package/src/utils/equality.ts +32 -32
  103. package/src/utils/server-clock.ts +42 -42
  104. package/src/utils/style.module.scss +45 -45
  105. package/src/utils/useFullscreen.ts +65 -65
  106. package/src/vite-env.d.ts +1 -1
  107. package/src/zustandStore.ts +66 -0
  108. package/tsconfig.json +28 -28
  109. package/tsconfig.node.json +9 -9
  110. package/vite.config.ts +11 -11
@@ -1,260 +1,260 @@
1
- import { Button } from "primereact/button";
2
- import { ButtonGroup } from "primereact/buttongroup";
3
- import { ConfirmDialog, confirmDialog } from "primereact/confirmdialog";
4
- import { OverlayPanel } from "primereact/overlaypanel";
5
-
6
- import styles from "./style.module.scss";
7
- import { useCallback, useMemo, useRef, useState } from "react";
8
- import { useWindowSize } from "@uidotdev/usehooks";
9
- import { XL } from "../../../utils/breakpoints";
10
- import { useAppDispatch, useAppSelector } from "../../../app/hooks";
11
- import {
12
- selectMode,
13
- selectSharingInfo,
14
- selectWorkflow,
15
- setSaveState,
16
- } from "../../activityData/activityDataSlice";
17
- import { copyToClipboard } from "../../../utils/clipboard";
18
- import settings from "../../../settings";
19
- import { wf } from "@capytale/activity.js/activity/field/workflow";
20
- import capytaleUI from "@capytale/activity.js/backend/capytale/ui";
21
- import ButtonDoubleIcon from "../../../utils/ButtonDoubleIcon";
22
- import CardSelector from "../../../utils/CardSelector";
23
- import { useActivityJS } from "../../activityJS/ActivityJSProvider";
24
- import { selectShowWorkflow } from "../../layout/layoutSlice";
25
- import CountdownAndSaveButton from "./CountdownAndSaveButton";
26
- import CloneDialog from "./CloneDialog";
27
- import { useToast } from "../../toast";
28
-
29
- const CapytaleMenu: React.FC = () => {
30
- const dispatch = useAppDispatch();
31
- const activityJS = useActivityJS();
32
- const [cloneDialogVisible, setCloneDialogVisible] = useState(false);
33
- const sharingInfo = useAppSelector(selectSharingInfo);
34
- const windowsSize = useWindowSize();
35
- const mode = useAppSelector(selectMode);
36
- const workflow = useAppSelector(selectWorkflow);
37
- const showWorkflow = useAppSelector(selectShowWorkflow);
38
- const isLarge = useMemo(
39
- () => windowsSize.width && windowsSize.width >= XL,
40
- [windowsSize.width],
41
- );
42
- const isInIframe = useMemo(() => capytaleUI.isInCapytaletIframe(), []);
43
- const toast = useToast();
44
- const changeWorkflow = useCallback(
45
- (value: wf) => {
46
- activityJS.activitySession!.activityBunch.assignmentNode!.workflow =
47
- value;
48
- dispatch(setSaveState("should-save"));
49
- },
50
- [activityJS.activitySession, dispatch],
51
- );
52
- const confirmFinishAssignment = useCallback(() => {
53
- confirmDialog({
54
- message:
55
- "Votre copie va être rendue et vous ne pourrez plus sauvegarder les modifications ultérieures.",
56
- header: "Attention",
57
- icon: "pi pi-exclamation-triangle",
58
- defaultFocus: "accept",
59
- acceptLabel: "Confirmer",
60
- rejectLabel: "Annuler",
61
- accept: () => changeWorkflow("finished"),
62
- });
63
- }, [changeWorkflow]);
64
- const overlayPanelWorkflow = useRef<OverlayPanel>(null);
65
- return (
66
- <>
67
- <div className={styles.capytaleMenu}>
68
- {isInIframe && (
69
- <Button
70
- aria-label="Retour à la liste des activités (gauche)"
71
- label="Retour"
72
- icon="pi pi-chevron-left"
73
- size="small"
74
- outlined
75
- onClick={() => capytaleUI.closeCapytaleIframe()}
76
- tooltip="Retour à la liste des activités"
77
- tooltipOptions={{
78
- position: "right",
79
- showDelay: settings.TOOLTIP_SHOW_DELAY,
80
- }}
81
- />
82
- )}
83
- <CountdownAndSaveButton />
84
- {!isInIframe && mode === "view" && (
85
- <>
86
- <Button
87
- aria-label="Cloner l'activité"
88
- label="Cloner"
89
- icon="pi pi-clone"
90
- size="small"
91
- outlined
92
- onClick={() => setCloneDialogVisible(true)}
93
- tooltip="Cloner l'activité"
94
- tooltipOptions={{
95
- position: "bottom",
96
- showDelay: settings.TOOLTIP_SHOW_DELAY,
97
- }}
98
- />
99
- <CloneDialog
100
- visible={cloneDialogVisible}
101
- onHide={() => setCloneDialogVisible(false)}
102
- />
103
- </>
104
- )}
105
-
106
- {mode === "create" && sharingInfo.code && (
107
- <ButtonGroup>
108
- <Button
109
- label={isLarge ? sharingInfo.code : undefined}
110
- aria-label="Copier le code de partage"
111
- severity="secondary"
112
- size="small"
113
- icon="pi pi-share-alt"
114
- outlined
115
- tooltip="Copier le code de partage"
116
- tooltipOptions={{
117
- position: "bottom",
118
- showDelay: settings.TOOLTIP_SHOW_DELAY,
119
- }}
120
- onClick={async () => {
121
- await copyToClipboard(sharingInfo.code!);
122
- toast.show({
123
- summary: "Code copié",
124
- detail:
125
- "Le code de partage a été copié dans le presse-papier.",
126
- severity: "info",
127
- life: 2000,
128
- });
129
- }}
130
- />
131
- <Button
132
- aria-label="Copier l'URL de partage"
133
- icon="pi pi-link"
134
- severity="secondary"
135
- size="small"
136
- outlined
137
- tooltip="Copier l'URL de partage"
138
- tooltipOptions={{
139
- position: "bottom",
140
- showDelay: settings.TOOLTIP_SHOW_DELAY,
141
- }}
142
- onClick={() => {
143
- copyToClipboard(sharingInfo.codeLink!).then(() => {
144
- toast.show({
145
- summary: "URL copiée",
146
- detail:
147
- "L'URL de partage a été copiée dans le presse-papier.",
148
- severity: "info",
149
- life: 2000,
150
- });
151
- });
152
- }}
153
- />
154
- </ButtonGroup>
155
- )}
156
- {showWorkflow && (
157
- <>
158
- {mode === "assignment" && workflow === "current" && (
159
- <Button
160
- aria-label="Rendre la copie"
161
- size="small"
162
- outlined
163
- label="Rendre"
164
- icon="pi pi-envelope"
165
- onClick={() => {
166
- confirmFinishAssignment();
167
- }}
168
- />
169
- )}
170
- {mode === "assignment" && workflow !== "current" && (
171
- <Button
172
- aria-label={
173
- workflow === "finished"
174
- ? "Copie déjà rendue"
175
- : "Copie déjà rendue et corrigée"
176
- }
177
- outlined
178
- label={workflow === "finished" ? "Rendue" : "Corrigée"}
179
- disabled
180
- icon={
181
- workflow === "finished"
182
- ? "pi pi-envelope"
183
- : "pi pi-check-square"
184
- }
185
- tooltip="Copie déjà rendue"
186
- />
187
- )}
188
- {mode === "review" && (
189
- <div>
190
- <ButtonDoubleIcon
191
- aria-label="Changer l'état de la copie"
192
- severity="secondary"
193
- size="small"
194
- outlined
195
- onClick={(e) => {
196
- overlayPanelWorkflow.current!.toggle(e);
197
- }}
198
- label={
199
- workflow === "current"
200
- ? "En cours"
201
- : workflow === "finished"
202
- ? "Rendue"
203
- : "Corrigée"
204
- }
205
- leftIcon={
206
- "pi " +
207
- (workflow === "current"
208
- ? "pi pi-pencil"
209
- : workflow === "finished"
210
- ? "pi pi-envelope"
211
- : "pi pi-check-square")
212
- }
213
- rightIcon="pi pi-angle-down"
214
- />
215
- <OverlayPanel
216
- ref={overlayPanelWorkflow}
217
- aria-label="Panneau de changement d'état de la copie"
218
- >
219
- <h3 className={styles.overlayPanelWorkflowTitle}>
220
- État de la copie
221
- </h3>
222
- <CardSelector
223
- selected={workflow}
224
- onChange={(option: wf) => {
225
- changeWorkflow(option);
226
-
227
- overlayPanelWorkflow.current!.hide();
228
- }}
229
- options={[
230
- {
231
- value: "current",
232
- title: "En cours",
233
- description:
234
- "L'élève peut modifier sa copie à tout moment.",
235
- },
236
- {
237
- value: "finished",
238
- title: "Rendue",
239
- description: "L'élève ne peut plus modifier sa copie.",
240
- },
241
- {
242
- value: "corrected",
243
- title: "Corrigée",
244
- description:
245
- "L'élève ne peut plus modifier sa copie et a reçu une correction.",
246
- },
247
- ]}
248
- />
249
- </OverlayPanel>
250
- </div>
251
- )}
252
- </>
253
- )}
254
- <ConfirmDialog />
255
- </div>
256
- </>
257
- );
258
- };
259
-
260
- export default CapytaleMenu;
1
+ import { Button } from "primereact/button";
2
+ import { ButtonGroup } from "primereact/buttongroup";
3
+ import { ConfirmDialog, confirmDialog } from "primereact/confirmdialog";
4
+ import { OverlayPanel } from "primereact/overlaypanel";
5
+
6
+ import styles from "./style.module.scss";
7
+ import { useCallback, useMemo, useRef, useState } from "react";
8
+ import { useWindowSize } from "@uidotdev/usehooks";
9
+ import { XL } from "../../../utils/breakpoints";
10
+ import { useAppDispatch, useAppSelector } from "../../../app/hooks";
11
+ import {
12
+ selectMode,
13
+ selectSharingInfo,
14
+ selectWorkflow,
15
+ setSaveState,
16
+ } from "../../activityData/activityDataSlice";
17
+ import { copyToClipboard } from "../../../utils/clipboard";
18
+ import settings from "../../../settings";
19
+ import { wf } from "@capytale/activity.js/activity/field/workflow";
20
+ import capytaleUI from "@capytale/activity.js/backend/capytale/ui";
21
+ import ButtonDoubleIcon from "../../../utils/ButtonDoubleIcon";
22
+ import CardSelector from "../../../utils/CardSelector";
23
+ import { useActivityJS } from "../../activityJS/ActivityJSProvider";
24
+ import { selectShowWorkflow } from "../../layout/layoutSlice";
25
+ import CountdownAndSaveButton from "./CountdownAndSaveButton";
26
+ import CloneDialog from "./CloneDialog";
27
+ import { useToast } from "../../toast";
28
+
29
+ const CapytaleMenu: React.FC = () => {
30
+ const dispatch = useAppDispatch();
31
+ const activityJS = useActivityJS();
32
+ const [cloneDialogVisible, setCloneDialogVisible] = useState(false);
33
+ const sharingInfo = useAppSelector(selectSharingInfo);
34
+ const windowsSize = useWindowSize();
35
+ const mode = useAppSelector(selectMode);
36
+ const workflow = useAppSelector(selectWorkflow);
37
+ const showWorkflow = useAppSelector(selectShowWorkflow);
38
+ const isLarge = useMemo(
39
+ () => windowsSize.width && windowsSize.width >= XL,
40
+ [windowsSize.width],
41
+ );
42
+ const isInIframe = useMemo(() => capytaleUI.isInCapytaletIframe(), []);
43
+ const toast = useToast();
44
+ const changeWorkflow = useCallback(
45
+ (value: wf) => {
46
+ activityJS.activitySession!.activityBunch.assignmentNode!.workflow =
47
+ value;
48
+ dispatch(setSaveState("should-save"));
49
+ },
50
+ [activityJS.activitySession, dispatch],
51
+ );
52
+ const confirmFinishAssignment = useCallback(() => {
53
+ confirmDialog({
54
+ message:
55
+ "Votre copie va être rendue et vous ne pourrez plus sauvegarder les modifications ultérieures.",
56
+ header: "Attention",
57
+ icon: "pi pi-exclamation-triangle",
58
+ defaultFocus: "accept",
59
+ acceptLabel: "Confirmer",
60
+ rejectLabel: "Annuler",
61
+ accept: () => changeWorkflow("finished"),
62
+ });
63
+ }, [changeWorkflow]);
64
+ const overlayPanelWorkflow = useRef<OverlayPanel>(null);
65
+ return (
66
+ <>
67
+ <div className={styles.capytaleMenu}>
68
+ {isInIframe && (
69
+ <Button
70
+ aria-label="Retour à la liste des activités (gauche)"
71
+ label="Retour"
72
+ icon="pi pi-chevron-left"
73
+ size="small"
74
+ outlined
75
+ onClick={() => capytaleUI.closeCapytaleIframe()}
76
+ tooltip="Retour à la liste des activités"
77
+ tooltipOptions={{
78
+ position: "right",
79
+ showDelay: settings.TOOLTIP_SHOW_DELAY,
80
+ }}
81
+ />
82
+ )}
83
+ <CountdownAndSaveButton />
84
+ {!isInIframe && mode === "view" && (
85
+ <>
86
+ <Button
87
+ aria-label="Cloner l'activité"
88
+ label="Cloner"
89
+ icon="pi pi-clone"
90
+ size="small"
91
+ outlined
92
+ onClick={() => setCloneDialogVisible(true)}
93
+ tooltip="Cloner l'activité"
94
+ tooltipOptions={{
95
+ position: "bottom",
96
+ showDelay: settings.TOOLTIP_SHOW_DELAY,
97
+ }}
98
+ />
99
+ <CloneDialog
100
+ visible={cloneDialogVisible}
101
+ onHide={() => setCloneDialogVisible(false)}
102
+ />
103
+ </>
104
+ )}
105
+
106
+ {mode === "create" && sharingInfo.code && (
107
+ <ButtonGroup>
108
+ <Button
109
+ label={isLarge ? sharingInfo.code : undefined}
110
+ aria-label="Copier le code de partage"
111
+ severity="secondary"
112
+ size="small"
113
+ icon="pi pi-share-alt"
114
+ outlined
115
+ tooltip="Copier le code de partage"
116
+ tooltipOptions={{
117
+ position: "bottom",
118
+ showDelay: settings.TOOLTIP_SHOW_DELAY,
119
+ }}
120
+ onClick={async () => {
121
+ await copyToClipboard(sharingInfo.code!);
122
+ toast.show({
123
+ summary: "Code copié",
124
+ detail:
125
+ "Le code de partage a été copié dans le presse-papier.",
126
+ severity: "info",
127
+ life: 2000,
128
+ });
129
+ }}
130
+ />
131
+ <Button
132
+ aria-label="Copier l'URL de partage"
133
+ icon="pi pi-link"
134
+ severity="secondary"
135
+ size="small"
136
+ outlined
137
+ tooltip="Copier l'URL de partage"
138
+ tooltipOptions={{
139
+ position: "bottom",
140
+ showDelay: settings.TOOLTIP_SHOW_DELAY,
141
+ }}
142
+ onClick={() => {
143
+ copyToClipboard(sharingInfo.codeLink!).then(() => {
144
+ toast.show({
145
+ summary: "URL copiée",
146
+ detail:
147
+ "L'URL de partage a été copiée dans le presse-papier.",
148
+ severity: "info",
149
+ life: 2000,
150
+ });
151
+ });
152
+ }}
153
+ />
154
+ </ButtonGroup>
155
+ )}
156
+ {showWorkflow && (
157
+ <>
158
+ {mode === "assignment" && workflow === "current" && (
159
+ <Button
160
+ aria-label="Rendre la copie"
161
+ size="small"
162
+ outlined
163
+ label="Rendre"
164
+ icon="pi pi-envelope"
165
+ onClick={() => {
166
+ confirmFinishAssignment();
167
+ }}
168
+ />
169
+ )}
170
+ {mode === "assignment" && workflow !== "current" && (
171
+ <Button
172
+ aria-label={
173
+ workflow === "finished"
174
+ ? "Copie déjà rendue"
175
+ : "Copie déjà rendue et corrigée"
176
+ }
177
+ outlined
178
+ label={workflow === "finished" ? "Rendue" : "Corrigée"}
179
+ disabled
180
+ icon={
181
+ workflow === "finished"
182
+ ? "pi pi-envelope"
183
+ : "pi pi-check-square"
184
+ }
185
+ tooltip="Copie déjà rendue"
186
+ />
187
+ )}
188
+ {mode === "review" && (
189
+ <div>
190
+ <ButtonDoubleIcon
191
+ aria-label="Changer l'état de la copie"
192
+ severity="secondary"
193
+ size="small"
194
+ outlined
195
+ onClick={(e) => {
196
+ overlayPanelWorkflow.current!.toggle(e);
197
+ }}
198
+ label={
199
+ workflow === "current"
200
+ ? "En cours"
201
+ : workflow === "finished"
202
+ ? "Rendue"
203
+ : "Corrigée"
204
+ }
205
+ leftIcon={
206
+ "pi " +
207
+ (workflow === "current"
208
+ ? "pi pi-pencil"
209
+ : workflow === "finished"
210
+ ? "pi pi-envelope"
211
+ : "pi pi-check-square")
212
+ }
213
+ rightIcon="pi pi-angle-down"
214
+ />
215
+ <OverlayPanel
216
+ ref={overlayPanelWorkflow}
217
+ aria-label="Panneau de changement d'état de la copie"
218
+ >
219
+ <h3 className={styles.overlayPanelWorkflowTitle}>
220
+ État de la copie
221
+ </h3>
222
+ <CardSelector
223
+ selected={workflow}
224
+ onChange={(option: wf) => {
225
+ changeWorkflow(option);
226
+
227
+ overlayPanelWorkflow.current!.hide();
228
+ }}
229
+ options={[
230
+ {
231
+ value: "current",
232
+ title: "En cours",
233
+ description:
234
+ "L'élève peut modifier sa copie à tout moment.",
235
+ },
236
+ {
237
+ value: "finished",
238
+ title: "Rendue",
239
+ description: "L'élève ne peut plus modifier sa copie.",
240
+ },
241
+ {
242
+ value: "corrected",
243
+ title: "Corrigée",
244
+ description:
245
+ "L'élève ne peut plus modifier sa copie et a reçu une correction.",
246
+ },
247
+ ]}
248
+ />
249
+ </OverlayPanel>
250
+ </div>
251
+ )}
252
+ </>
253
+ )}
254
+ <ConfirmDialog />
255
+ </div>
256
+ </>
257
+ );
258
+ };
259
+
260
+ export default CapytaleMenu;
@@ -1,9 +1,9 @@
1
- .capytaleMenu {
2
- align-items: center;
3
- display: flex;
4
- gap: 8px;
5
- }
6
-
7
- .overlayPanelWorkflowTitle {
8
- margin-top: 0;
1
+ .capytaleMenu {
2
+ align-items: center;
3
+ display: flex;
4
+ gap: 8px;
5
+ }
6
+
7
+ .overlayPanelWorkflowTitle {
8
+ margin-top: 0;
9
9
  }
@@ -1,32 +1,32 @@
1
- import { useCallback, useState } from "react";
2
- import { useActivityJS } from "../../activityJS/ActivityJSProvider";
3
- import serverClock from "../../../utils/server-clock";
4
- import { useInterval } from "primereact/hooks";
5
-
6
- const useRemainingTimeMs = () => {
7
- const activityJS = useActivityJS();
8
- const deadlineMode =
9
- activityJS.activitySession?.activityBunch.access_tr_mode.value;
10
- const deadline =
11
- !deadlineMode || deadlineMode === "none"
12
- ? null
13
- : activityJS.activitySession?.activityBunch.access_timerange.value?.end;
14
-
15
- const [diffMs, setDiffMs] = useState<number | null>(null);
16
-
17
- const updateDiffMs = useCallback(() => {
18
- if (!deadline) {
19
- return;
20
- }
21
- const deadlineUTC = deadline.getTime();
22
- const nowUTC = serverClock.now();
23
- const newDiffMs = deadlineUTC - nowUTC;
24
- setDiffMs(newDiffMs);
25
- }, [deadline]);
26
-
27
- useInterval(updateDiffMs, 1000, !!deadline);
28
-
29
- return diffMs;
30
- };
31
-
32
- export default useRemainingTimeMs;
1
+ import { useCallback, useState } from "react";
2
+ import { useActivityJS } from "../../activityJS/ActivityJSProvider";
3
+ import serverClock from "../../../utils/server-clock";
4
+ import { useInterval } from "primereact/hooks";
5
+
6
+ const useRemainingTimeMs = () => {
7
+ const activityJS = useActivityJS();
8
+ const deadlineMode =
9
+ activityJS.activitySession?.activityBunch.access_tr_mode.value;
10
+ const deadline =
11
+ !deadlineMode || deadlineMode === "none"
12
+ ? null
13
+ : activityJS.activitySession?.activityBunch.access_timerange.value?.end;
14
+
15
+ const [diffMs, setDiffMs] = useState<number | null>(null);
16
+
17
+ const updateDiffMs = useCallback(() => {
18
+ if (!deadline) {
19
+ return;
20
+ }
21
+ const deadlineUTC = deadline.getTime();
22
+ const nowUTC = serverClock.now();
23
+ const newDiffMs = deadlineUTC - nowUTC;
24
+ setDiffMs(newDiffMs);
25
+ }, [deadline]);
26
+
27
+ useInterval(updateDiffMs, 1000, !!deadline);
28
+
29
+ return diffMs;
30
+ };
31
+
32
+ export default useRemainingTimeMs;