@capytale/meta-player 0.8.2 → 0.8.3

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 (105) 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 +139 -139
  10. package/src/AppRedux.css +39 -39
  11. package/src/MetaPlayer.tsx +170 -170
  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 +256 -256
  24. package/src/features/activityData/activityJsData.ts +82 -82
  25. package/src/features/activityData/hooks.ts +34 -34
  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 +339 -339
  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 +90 -90
  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 +57 -57
  53. package/src/features/navbar/activity-menu/index.tsx +154 -153
  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 +312 -312
  57. package/src/features/navbar/capytale-menu/CountdownAndSaveButton.tsx +115 -115
  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/index.tsx +39 -39
  61. package/src/features/navbar/navbarSlice.ts +79 -79
  62. package/src/features/navbar/review-navbar/GradingNav.tsx +128 -128
  63. package/src/features/navbar/review-navbar/index.tsx +18 -18
  64. package/src/features/navbar/review-navbar/style.module.scss +22 -22
  65. package/src/features/navbar/sidebars/ActivitySidebarActions.tsx +57 -57
  66. package/src/features/navbar/sidebars/AttachedFilesSidebarContent.module.scss +43 -43
  67. package/src/features/navbar/sidebars/AttachedFilesSidebarContent.tsx +181 -181
  68. package/src/features/navbar/sidebars/SettingsSidebarContent.tsx +192 -192
  69. package/src/features/navbar/sidebars/style.module.scss +15 -15
  70. package/src/features/navbar/student-utils.ts +11 -11
  71. package/src/features/navbar/style.module.scss +65 -65
  72. package/src/features/pedago/InstructionsEditor.tsx +102 -102
  73. package/src/features/pedago/PdfEditor.tsx +91 -91
  74. package/src/features/pedago/PedagoCommands.tsx +353 -353
  75. package/src/features/pedago/SharedNotesEditor.tsx +144 -144
  76. package/src/features/pedago/index.tsx +207 -204
  77. package/src/features/pedago/style.module.scss +233 -233
  78. package/src/features/theming/ThemeSwitcher.tsx +51 -51
  79. package/src/features/theming/hooks.ts +6 -6
  80. package/src/features/theming/themingSlice.ts +93 -93
  81. package/src/features/toast.tsx +38 -38
  82. package/src/hooks/index.ts +16 -16
  83. package/src/index.css +132 -132
  84. package/src/index.ts +90 -90
  85. package/src/logo.svg +1 -1
  86. package/src/my_json_data.js +4146 -4146
  87. package/src/settings.ts +6 -6
  88. package/src/types.ts +9 -9
  89. package/src/utils/ButtonDoubleIcon.tsx +35 -35
  90. package/src/utils/CardSelector.tsx +41 -41
  91. package/src/utils/ErrorBoundary.tsx +41 -41
  92. package/src/utils/PopupButton.tsx +134 -134
  93. package/src/utils/activity.ts +8 -8
  94. package/src/utils/breakpoints.ts +4 -4
  95. package/src/utils/capytale.ts +10 -10
  96. package/src/utils/clipboard.ts +11 -11
  97. package/src/utils/download.ts +7 -7
  98. package/src/utils/equality.ts +32 -32
  99. package/src/utils/server-clock.ts +42 -42
  100. package/src/utils/style.module.scss +45 -45
  101. package/src/utils/useFullscreen.ts +65 -65
  102. package/src/vite-env.d.ts +1 -1
  103. package/tsconfig.json +28 -28
  104. package/tsconfig.node.json +9 -9
  105. package/vite.config.ts +11 -11
@@ -1,204 +1,207 @@
1
- import { Panel } from "primereact/panel";
2
- import styles from "./style.module.scss";
3
- import { useAppDispatch, useAppSelector } from "../../app/hooks";
4
- import {
5
- selectIsGradingVisible,
6
- selectOrientation,
7
- selectPedagoTab,
8
- } from "../layout/layoutSlice";
9
-
10
- import "@capytale/capytale-rich-text-editor/style.css";
11
- import { Splitter, SplitterPanel } from "primereact/splitter";
12
- import { classNames } from "primereact/utils";
13
- import InstructionsEditor from "./InstructionsEditor";
14
- import {
15
- selectComments,
16
- selectGrading,
17
- selectHasGradingOrComments,
18
- selectHasInstructions,
19
- selectMode,
20
- setComments,
21
- setGrading,
22
- setIsMPDirty,
23
- } from "../activityData/activityDataSlice";
24
- import { ChangeEventHandler, FC } from "react";
25
- import { DivProps } from "react-html-props";
26
- import SharedNotesEditor from "./SharedNotesEditor";
27
- import { CloseOnlyPedagoCommands, PedagoCommands } from "./PedagoCommands";
28
- import { PdfEditor } from "./PdfEditor";
29
-
30
- const Pedago: React.FC<DivProps> = ({ className, ...props }) => {
31
- const mode = useAppSelector(selectMode);
32
- const pedagoTab = useAppSelector(selectPedagoTab);
33
- const hasInstructions = useAppSelector(selectHasInstructions);
34
- const hasGradingOrComments = useAppSelector(selectHasGradingOrComments);
35
- const isGradingVisible =
36
- useAppSelector(selectIsGradingVisible) &&
37
- (hasGradingOrComments || mode === "review");
38
- const isHorizontal = useAppSelector(selectOrientation) === "horizontal";
39
- const mayReverse = isHorizontal
40
- ? (tab: Array<any>) => {
41
- const reversed = [...tab];
42
- reversed.reverse();
43
- return reversed;
44
- }
45
- : (tab: Array<any>) => tab;
46
-
47
- if (!hasInstructions) {
48
- return (
49
- <div className={styles.onlyGradingPedago}>
50
- <CloseOnlyPedagoCommands />
51
- <div className={styles.gradingPanel}>
52
- <Grading />
53
- </div>
54
- </div>
55
- );
56
- }
57
-
58
- return (
59
- // @ts-ignore - Incompatibility for props in TS
60
- <div className={classNames(styles.pedago, className)} {...props}>
61
- <PedagoCommands />
62
- <div
63
- className={styles.pedagoContent}
64
- aria-label={
65
- pedagoTab === "instructions"
66
- ? "Consignes"
67
- : pedagoTab === "pdf"
68
- ? "PDF"
69
- : "Notes partagées"
70
- }
71
- data-grading-visible={isGradingVisible}
72
- >
73
- {!isGradingVisible && (
74
- <>
75
- {pedagoTab === "instructions" && <InstructionsEditor />}
76
- {pedagoTab === "sharedNotes" && <SharedNotesEditor />}
77
- {pedagoTab === "pdf" && <PdfEditor />}
78
- </>
79
- )}
80
- {isGradingVisible && (
81
- <Splitter
82
- layout={isHorizontal ? "horizontal" : "vertical"}
83
- className={styles.pedagoSplitter}
84
- >
85
- {mayReverse([
86
- <SplitterPanel
87
- aria-label="Panneau de notation"
88
- key="gradingPanel"
89
- minSize={30}
90
- size={40}
91
- className={styles.gradingPanel}
92
- >
93
- <Grading />
94
- </SplitterPanel>,
95
- <SplitterPanel
96
- aria-label="Panneau de consignes"
97
- key="pedagoPanel"
98
- minSize={50}
99
- size={60}
100
- className={styles.pedagoPanel}
101
- >
102
- <Panel
103
- className={styles.fullSizePanel}
104
- aria-label={
105
- pedagoTab === "instructions"
106
- ? "Consignes"
107
- : pedagoTab === "pdf"
108
- ? "PDF"
109
- : "Notes partagées"
110
- }
111
- header={
112
- pedagoTab === "instructions"
113
- ? "Consignes"
114
- : pedagoTab === "pdf"
115
- ? "PDF"
116
- : "Notes partagées"
117
- }
118
- >
119
- {pedagoTab === "instructions" && <InstructionsEditor />}
120
- {pedagoTab === "sharedNotes" && <SharedNotesEditor />}
121
- {pedagoTab === "pdf" && <PdfEditor />}
122
- </Panel>
123
- </SplitterPanel>,
124
- ])}
125
- </Splitter>
126
- )}
127
- </div>
128
- </div>
129
- );
130
- };
131
-
132
- const Grading: FC = () => {
133
- const mode = useAppSelector(selectMode);
134
- const comments = useAppSelector(selectComments);
135
- const grading = useAppSelector(selectGrading);
136
- const dispatch = useAppDispatch();
137
-
138
- const handleCommentsChange: ChangeEventHandler<HTMLTextAreaElement> = (
139
- event,
140
- ) => {
141
- dispatch(setComments(event.target.value));
142
- dispatch(setIsMPDirty(true));
143
- };
144
-
145
- const handleGradingChange: ChangeEventHandler<HTMLTextAreaElement> = (
146
- event,
147
- ) => {
148
- dispatch(setGrading(event.target.value));
149
- dispatch(setIsMPDirty(true));
150
- };
151
-
152
- return (
153
- <>
154
- <Panel
155
- className={classNames(styles.fullSizePanel, styles.pedagoFeedbackPanel)}
156
- header="Appréciation"
157
- >
158
- <div className={styles.pedagoFeedback}>
159
- {(comments || mode !== "assignment") && (
160
- <textarea
161
- aria-label="Saisie de l'appréciation"
162
- value={comments || ""}
163
- placeholder={
164
- mode !== "review" ? "" : "Rédigez ici l'appréciation."
165
- }
166
- id="comments"
167
- name="comments"
168
- rows={2}
169
- readOnly={mode !== "review"}
170
- onChange={handleCommentsChange}
171
- className={styles.fullTextarea}
172
- />
173
- )}
174
- </div>
175
- </Panel>
176
- <Panel
177
- className={classNames(styles.fullSizePanel, styles.pedagoGradePanel)}
178
- header="Évaluation"
179
- >
180
- <div className={styles.pedagoGrade}>
181
- {(grading || mode !== "assignment") && (
182
- <textarea
183
- aria-label="Saisie de l'évaluation"
184
- value={grading || ""}
185
- placeholder={
186
- mode !== "review"
187
- ? ""
188
- : "Écrivez ici l'évaluation libre (chiffrée ou non)."
189
- }
190
- id="grading"
191
- name="grading"
192
- rows={1}
193
- readOnly={mode !== "review"}
194
- onChange={handleGradingChange}
195
- className={styles.fullTextarea}
196
- />
197
- )}
198
- </div>
199
- </Panel>
200
- </>
201
- );
202
- };
203
-
204
- export default Pedago;
1
+ import { Panel } from "primereact/panel";
2
+ import styles from "./style.module.scss";
3
+ import { useAppDispatch, useAppSelector } from "../../app/hooks";
4
+ import {
5
+ selectIsGradingVisible,
6
+ selectOrientation,
7
+ selectPedagoTab,
8
+ } from "../layout/layoutSlice";
9
+
10
+ import "@capytale/capytale-rich-text-editor/style.css";
11
+ import { Splitter, SplitterPanel } from "primereact/splitter";
12
+ import { classNames } from "primereact/utils";
13
+ import InstructionsEditor from "./InstructionsEditor";
14
+ import {
15
+ selectComments,
16
+ selectGrading,
17
+ selectHasGradingOrComments,
18
+ selectHasInstructions,
19
+ selectMode,
20
+ setComments,
21
+ setGrading,
22
+ setIsMPDirty,
23
+ } from "../activityData/activityDataSlice";
24
+ import { ChangeEventHandler, FC, useCallback } from "react";
25
+ import { DivProps } from "react-html-props";
26
+ import SharedNotesEditor from "./SharedNotesEditor";
27
+ import { CloseOnlyPedagoCommands, PedagoCommands } from "./PedagoCommands";
28
+ import { PdfEditor } from "./PdfEditor";
29
+
30
+ const Pedago: React.FC<DivProps> = ({ className, ...props }) => {
31
+ const mode = useAppSelector(selectMode);
32
+ const pedagoTab = useAppSelector(selectPedagoTab);
33
+ const hasInstructions = useAppSelector(selectHasInstructions);
34
+ const hasGradingOrComments = useAppSelector(selectHasGradingOrComments);
35
+ const isGradingVisible =
36
+ useAppSelector(selectIsGradingVisible) &&
37
+ (hasGradingOrComments || mode === "review");
38
+ const isHorizontal = useAppSelector(selectOrientation) === "horizontal";
39
+ const mayReverse = useCallback(
40
+ isHorizontal
41
+ ? (tab: Array<any>) => {
42
+ const reversed = [...tab];
43
+ reversed.reverse();
44
+ return reversed;
45
+ }
46
+ : (tab: Array<any>) => tab,
47
+ [isHorizontal],
48
+ );
49
+
50
+ if (!hasInstructions) {
51
+ return (
52
+ <div className={styles.onlyGradingPedago}>
53
+ <CloseOnlyPedagoCommands />
54
+ <div className={styles.gradingPanel}>
55
+ <Grading />
56
+ </div>
57
+ </div>
58
+ );
59
+ }
60
+
61
+ return (
62
+ // @ts-ignore - Incompatibility for props in TS
63
+ <div className={classNames(styles.pedago, className)} {...props}>
64
+ <PedagoCommands />
65
+ <div
66
+ className={styles.pedagoContent}
67
+ aria-label={
68
+ pedagoTab === "instructions"
69
+ ? "Consignes"
70
+ : pedagoTab === "pdf"
71
+ ? "PDF"
72
+ : "Notes partagées"
73
+ }
74
+ data-grading-visible={isGradingVisible}
75
+ >
76
+ {!isGradingVisible && (
77
+ <>
78
+ {pedagoTab === "instructions" && <InstructionsEditor />}
79
+ {pedagoTab === "sharedNotes" && <SharedNotesEditor />}
80
+ {pedagoTab === "pdf" && <PdfEditor />}
81
+ </>
82
+ )}
83
+ {isGradingVisible && (
84
+ <Splitter
85
+ layout={isHorizontal ? "horizontal" : "vertical"}
86
+ className={styles.pedagoSplitter}
87
+ >
88
+ {mayReverse([
89
+ <SplitterPanel
90
+ aria-label="Panneau de notation"
91
+ key="gradingPanel"
92
+ minSize={30}
93
+ size={40}
94
+ className={styles.gradingPanel}
95
+ >
96
+ <Grading />
97
+ </SplitterPanel>,
98
+ <SplitterPanel
99
+ aria-label="Panneau de consignes"
100
+ key="pedagoPanel"
101
+ minSize={50}
102
+ size={60}
103
+ className={styles.pedagoPanel}
104
+ >
105
+ <Panel
106
+ className={styles.fullSizePanel}
107
+ aria-label={
108
+ pedagoTab === "instructions"
109
+ ? "Consignes"
110
+ : pedagoTab === "pdf"
111
+ ? "PDF"
112
+ : "Notes partagées"
113
+ }
114
+ header={
115
+ pedagoTab === "instructions"
116
+ ? "Consignes"
117
+ : pedagoTab === "pdf"
118
+ ? "PDF"
119
+ : "Notes partagées"
120
+ }
121
+ >
122
+ {pedagoTab === "instructions" && <InstructionsEditor />}
123
+ {pedagoTab === "sharedNotes" && <SharedNotesEditor />}
124
+ {pedagoTab === "pdf" && <PdfEditor />}
125
+ </Panel>
126
+ </SplitterPanel>,
127
+ ])}
128
+ </Splitter>
129
+ )}
130
+ </div>
131
+ </div>
132
+ );
133
+ };
134
+
135
+ const Grading: FC = () => {
136
+ const mode = useAppSelector(selectMode);
137
+ const comments = useAppSelector(selectComments);
138
+ const grading = useAppSelector(selectGrading);
139
+ const dispatch = useAppDispatch();
140
+
141
+ const handleCommentsChange: ChangeEventHandler<HTMLTextAreaElement> = (
142
+ event,
143
+ ) => {
144
+ dispatch(setComments(event.target.value));
145
+ dispatch(setIsMPDirty(true));
146
+ };
147
+
148
+ const handleGradingChange: ChangeEventHandler<HTMLTextAreaElement> = (
149
+ event,
150
+ ) => {
151
+ dispatch(setGrading(event.target.value));
152
+ dispatch(setIsMPDirty(true));
153
+ };
154
+
155
+ return (
156
+ <>
157
+ <Panel
158
+ className={classNames(styles.fullSizePanel, styles.pedagoFeedbackPanel)}
159
+ header="Appréciation"
160
+ >
161
+ <div className={styles.pedagoFeedback}>
162
+ {(comments || mode !== "assignment") && (
163
+ <textarea
164
+ aria-label="Saisie de l'appréciation"
165
+ value={comments || ""}
166
+ placeholder={
167
+ mode !== "review" ? "" : "Rédigez ici l'appréciation."
168
+ }
169
+ id="comments"
170
+ name="comments"
171
+ rows={2}
172
+ readOnly={mode !== "review"}
173
+ onChange={handleCommentsChange}
174
+ className={styles.fullTextarea}
175
+ />
176
+ )}
177
+ </div>
178
+ </Panel>
179
+ <Panel
180
+ className={classNames(styles.fullSizePanel, styles.pedagoGradePanel)}
181
+ header="Évaluation"
182
+ >
183
+ <div className={styles.pedagoGrade}>
184
+ {(grading || mode !== "assignment") && (
185
+ <textarea
186
+ aria-label="Saisie de l'évaluation"
187
+ value={grading || ""}
188
+ placeholder={
189
+ mode !== "review"
190
+ ? ""
191
+ : "Écrivez ici l'évaluation libre (chiffrée ou non)."
192
+ }
193
+ id="grading"
194
+ name="grading"
195
+ rows={1}
196
+ readOnly={mode !== "review"}
197
+ onChange={handleGradingChange}
198
+ className={styles.fullTextarea}
199
+ />
200
+ )}
201
+ </div>
202
+ </Panel>
203
+ </>
204
+ );
205
+ };
206
+
207
+ export default Pedago;