@capytale/meta-player 0.9.10 → 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,125 +1,129 @@
1
- import { FC, useMemo, useState } from "react";
2
- import Countdown from "./Countdown";
3
- import { Button } from "primereact/button";
4
- import { Dialog } from "primereact/dialog";
5
- import { ML } from "../../../utils/breakpoints";
6
- import { useAppDispatch, useAppSelector } from "../../../app/hooks";
7
- import {
8
- selectHasEvaluations,
9
- selectIsDirty,
10
- selectMode,
11
- selectPreventEditIfHasEvaluations,
12
- selectSaveState,
13
- selectShowSaveButton,
14
- setSaveState,
15
- } from "../../activityData/activityDataSlice";
16
- import { useWindowSize } from "@uidotdev/usehooks";
17
- import { selectShowSaveForStudents } from "../../layout/layoutSlice";
18
- import settings from "../../../settings";
19
- import useRemainingTimeMs from "./useRemainingTimeMs";
20
-
21
- const CountdownAndSaveButton: FC = () => {
22
- const dispatch = useAppDispatch();
23
- const saveState = useAppSelector(selectSaveState);
24
- const windowsSize = useWindowSize();
25
- const isQuiteSmall = useMemo(
26
- () => windowsSize.width && windowsSize.width < ML,
27
- [windowsSize.width],
28
- );
29
- const isDirty = useAppSelector(selectIsDirty);
30
- const preventEditIfHasEvaluations = useAppSelector(
31
- selectPreventEditIfHasEvaluations,
32
- );
33
- const hasEvaluations = useAppSelector(selectHasEvaluations);
34
-
35
- const remainingTimeMs = useRemainingTimeMs();
36
- const timeOver = useMemo(
37
- () => remainingTimeMs !== null && remainingTimeMs <= 0,
38
- [remainingTimeMs],
39
- );
40
-
41
- const mode = useAppSelector(selectMode);
42
- const showSaveButton = useAppSelector(selectShowSaveButton);
43
- const showSaveForStudents = useAppSelector(selectShowSaveForStudents);
44
- const hasSaveButton = useMemo(
45
- () =>
46
- showSaveButton &&
47
- !(mode === "assignment" && !showSaveForStudents) &&
48
- !timeOver,
49
- [showSaveButton, mode, showSaveForStudents, timeOver],
50
- );
51
-
52
- const [editForbiddenDialogVisible, setEditForbiddenDialogVisible] =
53
- useState(false);
54
-
55
- if (mode === "create" && hasEvaluations && preventEditIfHasEvaluations) {
56
- return (
57
- <>
58
- <Button
59
- label={isQuiteSmall ? undefined : "Modification interdite"}
60
- aria-label="Modification interdite"
61
- severity="danger"
62
- size="small"
63
- icon="pi pi-save"
64
- loading={saveState !== "idle"}
65
- onClick={() => {
66
- setEditForbiddenDialogVisible(true);
67
- }}
68
- tooltip={"Évaluations déjà attribuées"}
69
- tooltipOptions={{
70
- position: "bottom",
71
- showDelay: settings.TOOLTIP_SHOW_DELAY,
72
- showOnDisabled: true,
73
- }}
74
- />
75
- <Dialog
76
- header="Modification interdite"
77
- visible={editForbiddenDialogVisible}
78
- onHide={() => {
79
- if (!editForbiddenDialogVisible) return;
80
- setEditForbiddenDialogVisible(false);
81
- }}
82
- style={{ maxWidth: "35rem" }}
83
- >
84
- <p className="m-0">
85
- Vous avez déjà donné des évaluations à vos élèves. Ce type
86
- d'activité ne supporte pas la modification dans ce cas car cela
87
- rendrait les résultats des élèves incohérents.
88
- </p>
89
- <p className="m-0 mt-1">
90
- Si vous souhaitez modifier cette activité, vous pouvez la clôner et
91
- modifier la copie, que vous pouvez ensuite proposer à vos élèves.
92
- </p>
93
- </Dialog>
94
- </>
95
- );
96
- }
97
-
98
- return (
99
- <>
100
- <Countdown />
101
- {hasSaveButton && (
102
- <Button
103
- label={isQuiteSmall ? undefined : "Enregistrer"}
104
- aria-label="Enregistrer"
105
- disabled={!isDirty}
106
- severity={"warning"}
107
- size="small"
108
- icon="pi pi-save"
109
- loading={saveState !== "idle"}
110
- onClick={() => {
111
- dispatch(setSaveState("should-save"));
112
- }} /**
113
- tooltip={isDirty ? "Enregistrer l'activité" : "Rien à enregistrer"}
114
- tooltipOptions={{
115
- position: "bottom",
116
- showDelay: settings.TOOLTIP_SHOW_DELAY,
117
- showOnDisabled: true,
118
- }} */
119
- />
120
- )}
121
- </>
122
- );
123
- };
124
-
125
- export default CountdownAndSaveButton;
1
+ import { FC, useMemo, useState } from "react";
2
+ import Countdown from "./Countdown";
3
+ import { Button } from "primereact/button";
4
+ import { Dialog } from "primereact/dialog";
5
+ import { ML } from "../../../utils/breakpoints";
6
+ import { useAppDispatch, useAppSelector } from "../../../app/hooks";
7
+ import {
8
+ selectHasEvaluations,
9
+ selectIsDirty,
10
+ selectMode,
11
+ selectPreventEditIfHasEvaluations,
12
+ selectSaveState,
13
+ selectShowSaveButton,
14
+ setSaveState,
15
+ } from "../../activityData/activityDataSlice";
16
+ import { useWindowSize } from "@uidotdev/usehooks";
17
+ import { selectShowSaveForStudents } from "../../layout/layoutSlice";
18
+ import settings from "../../../settings";
19
+ import useRemainingTimeMs from "./useRemainingTimeMs";
20
+ import { useZustandStore } from "../../../zustandStore";
21
+
22
+ const CountdownAndSaveButton: FC = () => {
23
+ const dispatch = useAppDispatch();
24
+ const saveState = useAppSelector(selectSaveState);
25
+ const windowsSize = useWindowSize();
26
+ const isQuiteSmall = useMemo(
27
+ () => windowsSize.width && windowsSize.width < ML,
28
+ [windowsSize.width],
29
+ );
30
+ const isDirty = useAppSelector(selectIsDirty);
31
+ const preventEditIfHasEvaluations = useAppSelector(
32
+ selectPreventEditIfHasEvaluations,
33
+ );
34
+ const hasEvaluations = useAppSelector(selectHasEvaluations);
35
+
36
+ const remainingTimeMs = useRemainingTimeMs();
37
+ const timeOver = useMemo(
38
+ () => remainingTimeMs !== null && remainingTimeMs <= 0,
39
+ [remainingTimeMs],
40
+ );
41
+
42
+ const mode = useAppSelector(selectMode);
43
+ const isPreviewing = useZustandStore((state) => state.isPreviewing);
44
+ const showSaveButton = useAppSelector(selectShowSaveButton);
45
+ const showSaveForStudents = useAppSelector(selectShowSaveForStudents);
46
+ const hasSaveButton = useMemo(
47
+ () =>
48
+ showSaveButton &&
49
+ !(mode === "assignment" && !showSaveForStudents) &&
50
+ !timeOver &&
51
+ !isPreviewing &&
52
+ mode === "create",
53
+ [showSaveButton, mode, showSaveForStudents, timeOver, isPreviewing],
54
+ );
55
+
56
+ const [editForbiddenDialogVisible, setEditForbiddenDialogVisible] =
57
+ useState(false);
58
+
59
+ if (mode === "create" && hasEvaluations && preventEditIfHasEvaluations) {
60
+ return (
61
+ <>
62
+ <Button
63
+ label={isQuiteSmall ? undefined : "Modification interdite"}
64
+ aria-label="Modification interdite"
65
+ severity="danger"
66
+ size="small"
67
+ icon="pi pi-save"
68
+ loading={saveState !== "idle"}
69
+ onClick={() => {
70
+ setEditForbiddenDialogVisible(true);
71
+ }}
72
+ tooltip={"Évaluations déjà attribuées"}
73
+ tooltipOptions={{
74
+ position: "bottom",
75
+ showDelay: settings.TOOLTIP_SHOW_DELAY,
76
+ showOnDisabled: true,
77
+ }}
78
+ />
79
+ <Dialog
80
+ header="Modification interdite"
81
+ visible={editForbiddenDialogVisible}
82
+ onHide={() => {
83
+ if (!editForbiddenDialogVisible) return;
84
+ setEditForbiddenDialogVisible(false);
85
+ }}
86
+ style={{ maxWidth: "35rem" }}
87
+ >
88
+ <p className="m-0">
89
+ Vous avez déjà donné des évaluations à vos élèves. Ce type
90
+ d'activité ne supporte pas la modification dans ce cas car cela
91
+ rendrait les résultats des élèves incohérents.
92
+ </p>
93
+ <p className="m-0 mt-1">
94
+ Si vous souhaitez modifier cette activité, vous pouvez la clôner et
95
+ modifier la copie, que vous pouvez ensuite proposer à vos élèves.
96
+ </p>
97
+ </Dialog>
98
+ </>
99
+ );
100
+ }
101
+
102
+ return (
103
+ <>
104
+ <Countdown />
105
+ {hasSaveButton && (
106
+ <Button
107
+ label={isQuiteSmall ? undefined : "Enregistrer"}
108
+ aria-label="Enregistrer"
109
+ disabled={!isDirty}
110
+ severity={"warning"}
111
+ size="small"
112
+ icon="pi pi-save"
113
+ loading={saveState !== "idle"}
114
+ onClick={() => {
115
+ dispatch(setSaveState("should-save"));
116
+ }} /**
117
+ tooltip={isDirty ? "Enregistrer l'activité" : "Rien à enregistrer"}
118
+ tooltipOptions={{
119
+ position: "bottom",
120
+ showDelay: settings.TOOLTIP_SHOW_DELAY,
121
+ showOnDisabled: true,
122
+ }} */
123
+ />
124
+ )}
125
+ </>
126
+ );
127
+ };
128
+
129
+ export default CountdownAndSaveButton;