@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.
- 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 +139 -139
- package/src/AppRedux.css +39 -39
- package/src/MetaPlayer.tsx +170 -170
- 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 +256 -256
- package/src/features/activityData/activityJsData.ts +82 -82
- package/src/features/activityData/hooks.ts +34 -34
- package/src/features/activityData/metaPlayerOptions.ts +23 -23
- package/src/features/activityData/uiState.ts +20 -20
- package/src/features/activityJS/ActivityJSProvider.tsx +339 -339
- 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 +90 -90
- 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 -153
- 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 +312 -312
- package/src/features/navbar/capytale-menu/CountdownAndSaveButton.tsx +115 -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/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 +353 -353
- package/src/features/pedago/SharedNotesEditor.tsx +144 -144
- package/src/features/pedago/index.tsx +207 -204
- 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 +90 -90
- package/src/logo.svg +1 -1
- package/src/my_json_data.js +4146 -4146
- package/src/settings.ts +6 -6
- package/src/types.ts +9 -9
- 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,256 +1,256 @@
|
|
|
1
|
-
import type { PayloadAction } from "@reduxjs/toolkit";
|
|
2
|
-
import { createAppSlice } from "../../app/createAppSlice";
|
|
3
|
-
import { InitialEditorStateType } from "@capytale/capytale-rich-text-editor";
|
|
4
|
-
import {
|
|
5
|
-
MetaPlayerOptions,
|
|
6
|
-
defaultMetaPlayerOptions,
|
|
7
|
-
} from "./metaPlayerOptions";
|
|
8
|
-
import { wf } from "@capytale/activity.js/activity/field/workflow";
|
|
9
|
-
import {
|
|
10
|
-
ActivityJSData,
|
|
11
|
-
defaultActivityJSData,
|
|
12
|
-
EditorType,
|
|
13
|
-
} from "./activityJsData";
|
|
14
|
-
import { defaultUIState, SaveState, UIState } from "./uiState";
|
|
15
|
-
|
|
16
|
-
export type ActivityDataState = ActivityJSData & MetaPlayerOptions & UIState;
|
|
17
|
-
|
|
18
|
-
const initialState: ActivityDataState = {
|
|
19
|
-
...defaultActivityJSData,
|
|
20
|
-
...defaultMetaPlayerOptions,
|
|
21
|
-
...defaultUIState,
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
// If you are not using async thunks you can use the standalone `createSlice`.
|
|
25
|
-
export const activityDataSlice = createAppSlice({
|
|
26
|
-
name: "activityData",
|
|
27
|
-
// `createSlice` will infer the state type from the `initialState` argument
|
|
28
|
-
initialState,
|
|
29
|
-
// The `reducers` field lets us define reducers and generate associated actions
|
|
30
|
-
reducers: (create) => ({
|
|
31
|
-
toRemove: create.reducer((state) => {
|
|
32
|
-
state.hasInstructions = false;
|
|
33
|
-
}),
|
|
34
|
-
// Use the `PayloadAction` type to declare the contents of `action.payload`
|
|
35
|
-
setActivityJSData: create.reducer(
|
|
36
|
-
(state, action: PayloadAction<ActivityJSData>) => {
|
|
37
|
-
state.title = action.payload.title;
|
|
38
|
-
state.mode = action.payload.mode;
|
|
39
|
-
state.returnUrl = action.payload.returnUrl;
|
|
40
|
-
state.helpUrl = action.payload.helpUrl;
|
|
41
|
-
state.code = action.payload.code;
|
|
42
|
-
state.accessTrMode = action.payload.accessTrMode;
|
|
43
|
-
state.accessTimerange = action.payload.accessTimerange;
|
|
44
|
-
state.studentInfo = action.payload.studentInfo;
|
|
45
|
-
state.instructions = action.payload.instructions;
|
|
46
|
-
state.instructionsType = action.payload.instructionsType;
|
|
47
|
-
state.sharedNotesContent = action.payload.sharedNotesContent;
|
|
48
|
-
state.sharedNotesType = action.payload.sharedNotesType;
|
|
49
|
-
state.codeLink = action.payload.codeLink;
|
|
50
|
-
state.icon = action.payload.icon;
|
|
51
|
-
state.friendlyType = action.payload.friendlyType;
|
|
52
|
-
state.comments = action.payload.comments;
|
|
53
|
-
state.grading = action.payload.grading;
|
|
54
|
-
state.nid = action.payload.nid;
|
|
55
|
-
state.activityNid = action.payload.activityNid;
|
|
56
|
-
state.workflow = action.payload.workflow;
|
|
57
|
-
state.antiCheat = action.payload.antiCheat;
|
|
58
|
-
state.hasEvaluations = action.payload.hasEvaluations;
|
|
59
|
-
},
|
|
60
|
-
),
|
|
61
|
-
setPlayerSettings: create.reducer(
|
|
62
|
-
(state, action: PayloadAction<MetaPlayerOptions>) => {
|
|
63
|
-
state.hasInstructions = action.payload.hasInstructions;
|
|
64
|
-
state.canReset = action.payload.canReset;
|
|
65
|
-
state.pedagoLayout = action.payload.pedagoLayout;
|
|
66
|
-
state.supportsLightTheme = action.payload.supportsLightTheme;
|
|
67
|
-
state.supportsDarkTheme = action.payload.supportsDarkTheme;
|
|
68
|
-
state.preventEditIfHasEvaluations =
|
|
69
|
-
action.payload.preventEditIfHasEvaluations;
|
|
70
|
-
state.hideSaveButton = action.payload.hideSaveButton;
|
|
71
|
-
},
|
|
72
|
-
),
|
|
73
|
-
setCanSaveInstructions: create.reducer(
|
|
74
|
-
(state, action: PayloadAction<boolean>) => {
|
|
75
|
-
state.canSaveInstructions = action.payload;
|
|
76
|
-
},
|
|
77
|
-
),
|
|
78
|
-
setCanSaveSharedNotes: create.reducer(
|
|
79
|
-
(state, action: PayloadAction<boolean>) => {
|
|
80
|
-
state.canSaveSharedNotes = action.payload;
|
|
81
|
-
},
|
|
82
|
-
),
|
|
83
|
-
setLexicalInstructionsState: create.reducer(
|
|
84
|
-
(state, action: PayloadAction<InitialEditorStateType>) => {
|
|
85
|
-
state.instructions = {
|
|
86
|
-
format: "lexical",
|
|
87
|
-
value: action.payload,
|
|
88
|
-
htmlValue: null,
|
|
89
|
-
};
|
|
90
|
-
},
|
|
91
|
-
),
|
|
92
|
-
setLexicalSharedNotesState: create.reducer(
|
|
93
|
-
(state, action: PayloadAction<InitialEditorStateType>) => {
|
|
94
|
-
state.sharedNotesContent = action.payload;
|
|
95
|
-
},
|
|
96
|
-
),
|
|
97
|
-
setPdfInstructions: create.reducer(
|
|
98
|
-
(state, action: PayloadAction<Blob | null>) => {
|
|
99
|
-
state.pdfInstructions = action.payload;
|
|
100
|
-
},
|
|
101
|
-
),
|
|
102
|
-
setInstructionsType: create.reducer(
|
|
103
|
-
(state, action: PayloadAction<EditorType>) => {
|
|
104
|
-
state.instructionsType = action.payload;
|
|
105
|
-
},
|
|
106
|
-
),
|
|
107
|
-
setSharedNotesType: create.reducer(
|
|
108
|
-
(state, action: PayloadAction<EditorType>) => {
|
|
109
|
-
state.sharedNotesType = action.payload;
|
|
110
|
-
},
|
|
111
|
-
),
|
|
112
|
-
setSaveState: create.reducer((state, action: PayloadAction<SaveState>) => {
|
|
113
|
-
state.saveState = action.payload;
|
|
114
|
-
}),
|
|
115
|
-
setGrading: create.reducer((state, action: PayloadAction<string>) => {
|
|
116
|
-
state.grading = action.payload;
|
|
117
|
-
}),
|
|
118
|
-
setComments: create.reducer((state, action: PayloadAction<string>) => {
|
|
119
|
-
state.comments = action.payload;
|
|
120
|
-
}),
|
|
121
|
-
setWorkflow: create.reducer((state, action: PayloadAction<wf>) => {
|
|
122
|
-
state.workflow = action.payload;
|
|
123
|
-
}),
|
|
124
|
-
setIsPlayerDirty: create.reducer(
|
|
125
|
-
(state, action: PayloadAction<boolean>) => {
|
|
126
|
-
state.isPlayerDirty = action.payload;
|
|
127
|
-
},
|
|
128
|
-
),
|
|
129
|
-
setIsMPDirty: create.reducer((state, action: PayloadAction<boolean>) => {
|
|
130
|
-
state.isMPDirty = action.payload;
|
|
131
|
-
}),
|
|
132
|
-
setIsAntiCheatExitDetectionDisabled: create.reducer(
|
|
133
|
-
(state, action: PayloadAction<boolean>) => {
|
|
134
|
-
state.isAntiCheatExitDetectionDisabled = action.payload;
|
|
135
|
-
},
|
|
136
|
-
),
|
|
137
|
-
}),
|
|
138
|
-
// You can define your selectors here. These selectors receive the slice
|
|
139
|
-
// state as their first argument.
|
|
140
|
-
selectors: {
|
|
141
|
-
selectMode: (data) => data.mode,
|
|
142
|
-
selectActivityInfo: (data) => ({
|
|
143
|
-
title: data.title,
|
|
144
|
-
studentInfo: data.studentInfo,
|
|
145
|
-
}),
|
|
146
|
-
selectSharingInfo: (data) => ({
|
|
147
|
-
code: data.code,
|
|
148
|
-
codeLink: data.codeLink,
|
|
149
|
-
}),
|
|
150
|
-
selectInstructions: (data) => data.instructions,
|
|
151
|
-
selectInstructionsType: (data) => data.instructionsType,
|
|
152
|
-
selectPdfInstructions: (data) => data.pdfInstructions,
|
|
153
|
-
selectSharedNotesContent: (data) => data.sharedNotesContent,
|
|
154
|
-
selectSharedNotesType: (data) => data.sharedNotesType,
|
|
155
|
-
selectComments: (data) => data.comments,
|
|
156
|
-
selectGrading: (data) => data.grading,
|
|
157
|
-
selectHasInstructions: (data) => data.hasInstructions,
|
|
158
|
-
selectCanReset: (data) => data.canReset,
|
|
159
|
-
selectPedagoLayout: (data) => data.pedagoLayout,
|
|
160
|
-
selectHasGradingOrComments: (data) => !!(data.grading || data.comments),
|
|
161
|
-
selectPreventEditIfHasEvaluations: (data) =>
|
|
162
|
-
data.preventEditIfHasEvaluations,
|
|
163
|
-
selectSaveState: (data) => data.saveState,
|
|
164
|
-
selectReturnUrl: (data) => data.returnUrl,
|
|
165
|
-
selectNid: (data) => data.nid,
|
|
166
|
-
selectActivityNid: (data) => data.activityNid,
|
|
167
|
-
selectIcon: (data) => data.icon,
|
|
168
|
-
selectWorkflow: (data) => data.workflow,
|
|
169
|
-
selectIsPlayerDirty: (data) => data.isPlayerDirty,
|
|
170
|
-
selectIsMPDirty: (data) => data.isMPDirty,
|
|
171
|
-
selectIsDirty: (data) => data.isPlayerDirty || data.isMPDirty,
|
|
172
|
-
|
|
173
|
-
selectCanChoosePedagoLayout: (data) =>
|
|
174
|
-
data.pedagoLayout === "default-horizontal" ||
|
|
175
|
-
data.pedagoLayout === "default-vertical",
|
|
176
|
-
|
|
177
|
-
selectCanChooseTheme: (data) =>
|
|
178
|
-
data.supportsDarkTheme && data.supportsLightTheme,
|
|
179
|
-
|
|
180
|
-
selectShowSaveButton: (data) =>
|
|
181
|
-
!data.hideSaveButton &&
|
|
182
|
-
(data.mode === "create" ||
|
|
183
|
-
data.mode === "review" ||
|
|
184
|
-
(data.mode === "assignment" && data.workflow === "current")),
|
|
185
|
-
|
|
186
|
-
selectAntiCheat: (data) => data.antiCheat,
|
|
187
|
-
selectHasAntiCheat: (data) =>
|
|
188
|
-
!!(
|
|
189
|
-
data.antiCheat &&
|
|
190
|
-
data.antiCheat.passwordHash &&
|
|
191
|
-
data.mode === "assignment" &&
|
|
192
|
-
data.workflow === "current"
|
|
193
|
-
),
|
|
194
|
-
selectIsAntiCheatExitDetectionDisabled: (data) =>
|
|
195
|
-
data.isAntiCheatExitDetectionDisabled,
|
|
196
|
-
selectHasEvaluations: (data) => data.hasEvaluations,
|
|
197
|
-
},
|
|
198
|
-
});
|
|
199
|
-
|
|
200
|
-
// Action creators are generated for each case reducer function.
|
|
201
|
-
export const {
|
|
202
|
-
toRemove,
|
|
203
|
-
setActivityJSData,
|
|
204
|
-
setPlayerSettings,
|
|
205
|
-
setCanSaveInstructions,
|
|
206
|
-
setCanSaveSharedNotes,
|
|
207
|
-
setLexicalInstructionsState,
|
|
208
|
-
setLexicalSharedNotesState,
|
|
209
|
-
setPdfInstructions,
|
|
210
|
-
setInstructionsType,
|
|
211
|
-
setSharedNotesType,
|
|
212
|
-
setSaveState,
|
|
213
|
-
setGrading,
|
|
214
|
-
setComments,
|
|
215
|
-
setWorkflow,
|
|
216
|
-
setIsPlayerDirty,
|
|
217
|
-
setIsMPDirty,
|
|
218
|
-
setIsAntiCheatExitDetectionDisabled,
|
|
219
|
-
} = activityDataSlice.actions;
|
|
220
|
-
|
|
221
|
-
// Selectors returned by `slice.selectors` take the root state as their first argument.
|
|
222
|
-
export const {
|
|
223
|
-
selectMode,
|
|
224
|
-
selectActivityInfo,
|
|
225
|
-
selectSharingInfo,
|
|
226
|
-
selectInstructions,
|
|
227
|
-
selectInstructionsType,
|
|
228
|
-
selectPdfInstructions,
|
|
229
|
-
selectSharedNotesContent,
|
|
230
|
-
selectSharedNotesType,
|
|
231
|
-
selectComments,
|
|
232
|
-
selectGrading,
|
|
233
|
-
selectHasInstructions,
|
|
234
|
-
selectCanReset,
|
|
235
|
-
selectPedagoLayout,
|
|
236
|
-
selectHasGradingOrComments,
|
|
237
|
-
selectPreventEditIfHasEvaluations,
|
|
238
|
-
selectSaveState,
|
|
239
|
-
selectReturnUrl,
|
|
240
|
-
selectNid,
|
|
241
|
-
selectActivityNid,
|
|
242
|
-
selectIcon,
|
|
243
|
-
selectWorkflow,
|
|
244
|
-
selectIsPlayerDirty,
|
|
245
|
-
selectIsMPDirty,
|
|
246
|
-
selectIsDirty,
|
|
247
|
-
|
|
248
|
-
selectCanChoosePedagoLayout,
|
|
249
|
-
selectCanChooseTheme,
|
|
250
|
-
selectShowSaveButton,
|
|
251
|
-
|
|
252
|
-
selectAntiCheat,
|
|
253
|
-
selectHasAntiCheat,
|
|
254
|
-
selectIsAntiCheatExitDetectionDisabled,
|
|
255
|
-
selectHasEvaluations,
|
|
256
|
-
} = activityDataSlice.selectors;
|
|
1
|
+
import type { PayloadAction } from "@reduxjs/toolkit";
|
|
2
|
+
import { createAppSlice } from "../../app/createAppSlice";
|
|
3
|
+
import { InitialEditorStateType } from "@capytale/capytale-rich-text-editor";
|
|
4
|
+
import {
|
|
5
|
+
MetaPlayerOptions,
|
|
6
|
+
defaultMetaPlayerOptions,
|
|
7
|
+
} from "./metaPlayerOptions";
|
|
8
|
+
import { wf } from "@capytale/activity.js/activity/field/workflow";
|
|
9
|
+
import {
|
|
10
|
+
ActivityJSData,
|
|
11
|
+
defaultActivityJSData,
|
|
12
|
+
EditorType,
|
|
13
|
+
} from "./activityJsData";
|
|
14
|
+
import { defaultUIState, SaveState, UIState } from "./uiState";
|
|
15
|
+
|
|
16
|
+
export type ActivityDataState = ActivityJSData & MetaPlayerOptions & UIState;
|
|
17
|
+
|
|
18
|
+
const initialState: ActivityDataState = {
|
|
19
|
+
...defaultActivityJSData,
|
|
20
|
+
...defaultMetaPlayerOptions,
|
|
21
|
+
...defaultUIState,
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
// If you are not using async thunks you can use the standalone `createSlice`.
|
|
25
|
+
export const activityDataSlice = createAppSlice({
|
|
26
|
+
name: "activityData",
|
|
27
|
+
// `createSlice` will infer the state type from the `initialState` argument
|
|
28
|
+
initialState,
|
|
29
|
+
// The `reducers` field lets us define reducers and generate associated actions
|
|
30
|
+
reducers: (create) => ({
|
|
31
|
+
toRemove: create.reducer((state) => {
|
|
32
|
+
state.hasInstructions = false;
|
|
33
|
+
}),
|
|
34
|
+
// Use the `PayloadAction` type to declare the contents of `action.payload`
|
|
35
|
+
setActivityJSData: create.reducer(
|
|
36
|
+
(state, action: PayloadAction<ActivityJSData>) => {
|
|
37
|
+
state.title = action.payload.title;
|
|
38
|
+
state.mode = action.payload.mode;
|
|
39
|
+
state.returnUrl = action.payload.returnUrl;
|
|
40
|
+
state.helpUrl = action.payload.helpUrl;
|
|
41
|
+
state.code = action.payload.code;
|
|
42
|
+
state.accessTrMode = action.payload.accessTrMode;
|
|
43
|
+
state.accessTimerange = action.payload.accessTimerange;
|
|
44
|
+
state.studentInfo = action.payload.studentInfo;
|
|
45
|
+
state.instructions = action.payload.instructions;
|
|
46
|
+
state.instructionsType = action.payload.instructionsType;
|
|
47
|
+
state.sharedNotesContent = action.payload.sharedNotesContent;
|
|
48
|
+
state.sharedNotesType = action.payload.sharedNotesType;
|
|
49
|
+
state.codeLink = action.payload.codeLink;
|
|
50
|
+
state.icon = action.payload.icon;
|
|
51
|
+
state.friendlyType = action.payload.friendlyType;
|
|
52
|
+
state.comments = action.payload.comments;
|
|
53
|
+
state.grading = action.payload.grading;
|
|
54
|
+
state.nid = action.payload.nid;
|
|
55
|
+
state.activityNid = action.payload.activityNid;
|
|
56
|
+
state.workflow = action.payload.workflow;
|
|
57
|
+
state.antiCheat = action.payload.antiCheat;
|
|
58
|
+
state.hasEvaluations = action.payload.hasEvaluations;
|
|
59
|
+
},
|
|
60
|
+
),
|
|
61
|
+
setPlayerSettings: create.reducer(
|
|
62
|
+
(state, action: PayloadAction<MetaPlayerOptions>) => {
|
|
63
|
+
state.hasInstructions = action.payload.hasInstructions;
|
|
64
|
+
state.canReset = action.payload.canReset;
|
|
65
|
+
state.pedagoLayout = action.payload.pedagoLayout;
|
|
66
|
+
state.supportsLightTheme = action.payload.supportsLightTheme;
|
|
67
|
+
state.supportsDarkTheme = action.payload.supportsDarkTheme;
|
|
68
|
+
state.preventEditIfHasEvaluations =
|
|
69
|
+
action.payload.preventEditIfHasEvaluations;
|
|
70
|
+
state.hideSaveButton = action.payload.hideSaveButton;
|
|
71
|
+
},
|
|
72
|
+
),
|
|
73
|
+
setCanSaveInstructions: create.reducer(
|
|
74
|
+
(state, action: PayloadAction<boolean>) => {
|
|
75
|
+
state.canSaveInstructions = action.payload;
|
|
76
|
+
},
|
|
77
|
+
),
|
|
78
|
+
setCanSaveSharedNotes: create.reducer(
|
|
79
|
+
(state, action: PayloadAction<boolean>) => {
|
|
80
|
+
state.canSaveSharedNotes = action.payload;
|
|
81
|
+
},
|
|
82
|
+
),
|
|
83
|
+
setLexicalInstructionsState: create.reducer(
|
|
84
|
+
(state, action: PayloadAction<InitialEditorStateType>) => {
|
|
85
|
+
state.instructions = {
|
|
86
|
+
format: "lexical",
|
|
87
|
+
value: action.payload,
|
|
88
|
+
htmlValue: null,
|
|
89
|
+
};
|
|
90
|
+
},
|
|
91
|
+
),
|
|
92
|
+
setLexicalSharedNotesState: create.reducer(
|
|
93
|
+
(state, action: PayloadAction<InitialEditorStateType>) => {
|
|
94
|
+
state.sharedNotesContent = action.payload;
|
|
95
|
+
},
|
|
96
|
+
),
|
|
97
|
+
setPdfInstructions: create.reducer(
|
|
98
|
+
(state, action: PayloadAction<Blob | null>) => {
|
|
99
|
+
state.pdfInstructions = action.payload;
|
|
100
|
+
},
|
|
101
|
+
),
|
|
102
|
+
setInstructionsType: create.reducer(
|
|
103
|
+
(state, action: PayloadAction<EditorType>) => {
|
|
104
|
+
state.instructionsType = action.payload;
|
|
105
|
+
},
|
|
106
|
+
),
|
|
107
|
+
setSharedNotesType: create.reducer(
|
|
108
|
+
(state, action: PayloadAction<EditorType>) => {
|
|
109
|
+
state.sharedNotesType = action.payload;
|
|
110
|
+
},
|
|
111
|
+
),
|
|
112
|
+
setSaveState: create.reducer((state, action: PayloadAction<SaveState>) => {
|
|
113
|
+
state.saveState = action.payload;
|
|
114
|
+
}),
|
|
115
|
+
setGrading: create.reducer((state, action: PayloadAction<string>) => {
|
|
116
|
+
state.grading = action.payload;
|
|
117
|
+
}),
|
|
118
|
+
setComments: create.reducer((state, action: PayloadAction<string>) => {
|
|
119
|
+
state.comments = action.payload;
|
|
120
|
+
}),
|
|
121
|
+
setWorkflow: create.reducer((state, action: PayloadAction<wf>) => {
|
|
122
|
+
state.workflow = action.payload;
|
|
123
|
+
}),
|
|
124
|
+
setIsPlayerDirty: create.reducer(
|
|
125
|
+
(state, action: PayloadAction<boolean>) => {
|
|
126
|
+
state.isPlayerDirty = action.payload;
|
|
127
|
+
},
|
|
128
|
+
),
|
|
129
|
+
setIsMPDirty: create.reducer((state, action: PayloadAction<boolean>) => {
|
|
130
|
+
state.isMPDirty = action.payload;
|
|
131
|
+
}),
|
|
132
|
+
setIsAntiCheatExitDetectionDisabled: create.reducer(
|
|
133
|
+
(state, action: PayloadAction<boolean>) => {
|
|
134
|
+
state.isAntiCheatExitDetectionDisabled = action.payload;
|
|
135
|
+
},
|
|
136
|
+
),
|
|
137
|
+
}),
|
|
138
|
+
// You can define your selectors here. These selectors receive the slice
|
|
139
|
+
// state as their first argument.
|
|
140
|
+
selectors: {
|
|
141
|
+
selectMode: (data) => data.mode,
|
|
142
|
+
selectActivityInfo: (data) => ({
|
|
143
|
+
title: data.title,
|
|
144
|
+
studentInfo: data.studentInfo,
|
|
145
|
+
}),
|
|
146
|
+
selectSharingInfo: (data) => ({
|
|
147
|
+
code: data.code,
|
|
148
|
+
codeLink: data.codeLink,
|
|
149
|
+
}),
|
|
150
|
+
selectInstructions: (data) => data.instructions,
|
|
151
|
+
selectInstructionsType: (data) => data.instructionsType,
|
|
152
|
+
selectPdfInstructions: (data) => data.pdfInstructions,
|
|
153
|
+
selectSharedNotesContent: (data) => data.sharedNotesContent,
|
|
154
|
+
selectSharedNotesType: (data) => data.sharedNotesType,
|
|
155
|
+
selectComments: (data) => data.comments,
|
|
156
|
+
selectGrading: (data) => data.grading,
|
|
157
|
+
selectHasInstructions: (data) => data.hasInstructions,
|
|
158
|
+
selectCanReset: (data) => data.canReset,
|
|
159
|
+
selectPedagoLayout: (data) => data.pedagoLayout,
|
|
160
|
+
selectHasGradingOrComments: (data) => !!(data.grading || data.comments),
|
|
161
|
+
selectPreventEditIfHasEvaluations: (data) =>
|
|
162
|
+
data.preventEditIfHasEvaluations,
|
|
163
|
+
selectSaveState: (data) => data.saveState,
|
|
164
|
+
selectReturnUrl: (data) => data.returnUrl,
|
|
165
|
+
selectNid: (data) => data.nid,
|
|
166
|
+
selectActivityNid: (data) => data.activityNid,
|
|
167
|
+
selectIcon: (data) => data.icon,
|
|
168
|
+
selectWorkflow: (data) => data.workflow,
|
|
169
|
+
selectIsPlayerDirty: (data) => data.isPlayerDirty,
|
|
170
|
+
selectIsMPDirty: (data) => data.isMPDirty,
|
|
171
|
+
selectIsDirty: (data) => data.isPlayerDirty || data.isMPDirty,
|
|
172
|
+
|
|
173
|
+
selectCanChoosePedagoLayout: (data) =>
|
|
174
|
+
data.pedagoLayout === "default-horizontal" ||
|
|
175
|
+
data.pedagoLayout === "default-vertical",
|
|
176
|
+
|
|
177
|
+
selectCanChooseTheme: (data) =>
|
|
178
|
+
data.supportsDarkTheme && data.supportsLightTheme,
|
|
179
|
+
|
|
180
|
+
selectShowSaveButton: (data) =>
|
|
181
|
+
!data.hideSaveButton &&
|
|
182
|
+
(data.mode === "create" ||
|
|
183
|
+
data.mode === "review" ||
|
|
184
|
+
(data.mode === "assignment" && data.workflow === "current")),
|
|
185
|
+
|
|
186
|
+
selectAntiCheat: (data) => data.antiCheat,
|
|
187
|
+
selectHasAntiCheat: (data) =>
|
|
188
|
+
!!(
|
|
189
|
+
data.antiCheat &&
|
|
190
|
+
data.antiCheat.passwordHash &&
|
|
191
|
+
data.mode === "assignment" &&
|
|
192
|
+
data.workflow === "current"
|
|
193
|
+
),
|
|
194
|
+
selectIsAntiCheatExitDetectionDisabled: (data) =>
|
|
195
|
+
data.isAntiCheatExitDetectionDisabled,
|
|
196
|
+
selectHasEvaluations: (data) => data.hasEvaluations,
|
|
197
|
+
},
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
// Action creators are generated for each case reducer function.
|
|
201
|
+
export const {
|
|
202
|
+
toRemove,
|
|
203
|
+
setActivityJSData,
|
|
204
|
+
setPlayerSettings,
|
|
205
|
+
setCanSaveInstructions,
|
|
206
|
+
setCanSaveSharedNotes,
|
|
207
|
+
setLexicalInstructionsState,
|
|
208
|
+
setLexicalSharedNotesState,
|
|
209
|
+
setPdfInstructions,
|
|
210
|
+
setInstructionsType,
|
|
211
|
+
setSharedNotesType,
|
|
212
|
+
setSaveState,
|
|
213
|
+
setGrading,
|
|
214
|
+
setComments,
|
|
215
|
+
setWorkflow,
|
|
216
|
+
setIsPlayerDirty,
|
|
217
|
+
setIsMPDirty,
|
|
218
|
+
setIsAntiCheatExitDetectionDisabled,
|
|
219
|
+
} = activityDataSlice.actions;
|
|
220
|
+
|
|
221
|
+
// Selectors returned by `slice.selectors` take the root state as their first argument.
|
|
222
|
+
export const {
|
|
223
|
+
selectMode,
|
|
224
|
+
selectActivityInfo,
|
|
225
|
+
selectSharingInfo,
|
|
226
|
+
selectInstructions,
|
|
227
|
+
selectInstructionsType,
|
|
228
|
+
selectPdfInstructions,
|
|
229
|
+
selectSharedNotesContent,
|
|
230
|
+
selectSharedNotesType,
|
|
231
|
+
selectComments,
|
|
232
|
+
selectGrading,
|
|
233
|
+
selectHasInstructions,
|
|
234
|
+
selectCanReset,
|
|
235
|
+
selectPedagoLayout,
|
|
236
|
+
selectHasGradingOrComments,
|
|
237
|
+
selectPreventEditIfHasEvaluations,
|
|
238
|
+
selectSaveState,
|
|
239
|
+
selectReturnUrl,
|
|
240
|
+
selectNid,
|
|
241
|
+
selectActivityNid,
|
|
242
|
+
selectIcon,
|
|
243
|
+
selectWorkflow,
|
|
244
|
+
selectIsPlayerDirty,
|
|
245
|
+
selectIsMPDirty,
|
|
246
|
+
selectIsDirty,
|
|
247
|
+
|
|
248
|
+
selectCanChoosePedagoLayout,
|
|
249
|
+
selectCanChooseTheme,
|
|
250
|
+
selectShowSaveButton,
|
|
251
|
+
|
|
252
|
+
selectAntiCheat,
|
|
253
|
+
selectHasAntiCheat,
|
|
254
|
+
selectIsAntiCheatExitDetectionDisabled,
|
|
255
|
+
selectHasEvaluations,
|
|
256
|
+
} = activityDataSlice.selectors;
|
|
@@ -1,83 +1,83 @@
|
|
|
1
|
-
import { ActivityMode } from "@capytale/activity.js/activity/activitySession";
|
|
2
|
-
import { TimeRange } from "@capytale/activity.js/common/field";
|
|
3
|
-
import { InitialEditorStateType } from "@capytale/capytale-rich-text-editor";
|
|
4
|
-
import { wf } from "@capytale/activity.js/activity/field/workflow";
|
|
5
|
-
|
|
6
|
-
export type Workflow = wf | null | undefined;
|
|
7
|
-
|
|
8
|
-
export type StudentInfo = {
|
|
9
|
-
firstName: string;
|
|
10
|
-
lastName: string;
|
|
11
|
-
class: string;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export type Instructions = {
|
|
15
|
-
value: InitialEditorStateType | null;
|
|
16
|
-
htmlValue: string | null;
|
|
17
|
-
format: "html" | "markdown" | "lexical";
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export type Icon = {
|
|
21
|
-
path: string;
|
|
22
|
-
style?: any;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export type EditorType = "rich" | "none";
|
|
26
|
-
|
|
27
|
-
export type ActivityJSData = {
|
|
28
|
-
title: string;
|
|
29
|
-
mode: ActivityMode;
|
|
30
|
-
returnUrl: string;
|
|
31
|
-
helpUrl: string;
|
|
32
|
-
code: string | null;
|
|
33
|
-
nid: number;
|
|
34
|
-
activityNid: number;
|
|
35
|
-
accessTrMode: string;
|
|
36
|
-
accessTimerange: TimeRange | null;
|
|
37
|
-
studentInfo: StudentInfo | null;
|
|
38
|
-
instructions: Instructions | null;
|
|
39
|
-
instructionsType: EditorType;
|
|
40
|
-
pdfInstructions: Blob | null;
|
|
41
|
-
sharedNotesContent: InitialEditorStateType | null;
|
|
42
|
-
sharedNotesType: EditorType;
|
|
43
|
-
codeLink: string | null;
|
|
44
|
-
icon: Icon | null;
|
|
45
|
-
friendlyType: string;
|
|
46
|
-
comments: string | null;
|
|
47
|
-
grading: string | null;
|
|
48
|
-
workflow: Workflow | null | undefined;
|
|
49
|
-
antiCheat?: null | {
|
|
50
|
-
passwordHash?: string | null;
|
|
51
|
-
startLocked: boolean;
|
|
52
|
-
};
|
|
53
|
-
hasEvaluations: boolean | null;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export const defaultActivityJSData: ActivityJSData = {
|
|
57
|
-
title: "",
|
|
58
|
-
mode: "view",
|
|
59
|
-
returnUrl: "",
|
|
60
|
-
helpUrl: "",
|
|
61
|
-
code: null,
|
|
62
|
-
nid: 0,
|
|
63
|
-
activityNid: 0,
|
|
64
|
-
accessTrMode: "",
|
|
65
|
-
accessTimerange: null,
|
|
66
|
-
studentInfo: {
|
|
67
|
-
firstName: "",
|
|
68
|
-
lastName: "",
|
|
69
|
-
class: "",
|
|
70
|
-
},
|
|
71
|
-
instructions: null,
|
|
72
|
-
instructionsType: "rich",
|
|
73
|
-
pdfInstructions: null,
|
|
74
|
-
sharedNotesContent: null,
|
|
75
|
-
sharedNotesType: "none",
|
|
76
|
-
codeLink: null,
|
|
77
|
-
icon: null,
|
|
78
|
-
friendlyType: "",
|
|
79
|
-
comments: null,
|
|
80
|
-
grading: null,
|
|
81
|
-
workflow: null,
|
|
82
|
-
hasEvaluations: null,
|
|
1
|
+
import { ActivityMode } from "@capytale/activity.js/activity/activitySession";
|
|
2
|
+
import { TimeRange } from "@capytale/activity.js/common/field";
|
|
3
|
+
import { InitialEditorStateType } from "@capytale/capytale-rich-text-editor";
|
|
4
|
+
import { wf } from "@capytale/activity.js/activity/field/workflow";
|
|
5
|
+
|
|
6
|
+
export type Workflow = wf | null | undefined;
|
|
7
|
+
|
|
8
|
+
export type StudentInfo = {
|
|
9
|
+
firstName: string;
|
|
10
|
+
lastName: string;
|
|
11
|
+
class: string;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export type Instructions = {
|
|
15
|
+
value: InitialEditorStateType | null;
|
|
16
|
+
htmlValue: string | null;
|
|
17
|
+
format: "html" | "markdown" | "lexical";
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export type Icon = {
|
|
21
|
+
path: string;
|
|
22
|
+
style?: any;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export type EditorType = "rich" | "none";
|
|
26
|
+
|
|
27
|
+
export type ActivityJSData = {
|
|
28
|
+
title: string;
|
|
29
|
+
mode: ActivityMode;
|
|
30
|
+
returnUrl: string;
|
|
31
|
+
helpUrl: string;
|
|
32
|
+
code: string | null;
|
|
33
|
+
nid: number;
|
|
34
|
+
activityNid: number;
|
|
35
|
+
accessTrMode: string;
|
|
36
|
+
accessTimerange: TimeRange | null;
|
|
37
|
+
studentInfo: StudentInfo | null;
|
|
38
|
+
instructions: Instructions | null;
|
|
39
|
+
instructionsType: EditorType;
|
|
40
|
+
pdfInstructions: Blob | null;
|
|
41
|
+
sharedNotesContent: InitialEditorStateType | null;
|
|
42
|
+
sharedNotesType: EditorType;
|
|
43
|
+
codeLink: string | null;
|
|
44
|
+
icon: Icon | null;
|
|
45
|
+
friendlyType: string;
|
|
46
|
+
comments: string | null;
|
|
47
|
+
grading: string | null;
|
|
48
|
+
workflow: Workflow | null | undefined;
|
|
49
|
+
antiCheat?: null | {
|
|
50
|
+
passwordHash?: string | null;
|
|
51
|
+
startLocked: boolean;
|
|
52
|
+
};
|
|
53
|
+
hasEvaluations: boolean | null;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export const defaultActivityJSData: ActivityJSData = {
|
|
57
|
+
title: "",
|
|
58
|
+
mode: "view",
|
|
59
|
+
returnUrl: "",
|
|
60
|
+
helpUrl: "",
|
|
61
|
+
code: null,
|
|
62
|
+
nid: 0,
|
|
63
|
+
activityNid: 0,
|
|
64
|
+
accessTrMode: "",
|
|
65
|
+
accessTimerange: null,
|
|
66
|
+
studentInfo: {
|
|
67
|
+
firstName: "",
|
|
68
|
+
lastName: "",
|
|
69
|
+
class: "",
|
|
70
|
+
},
|
|
71
|
+
instructions: null,
|
|
72
|
+
instructionsType: "rich",
|
|
73
|
+
pdfInstructions: null,
|
|
74
|
+
sharedNotesContent: null,
|
|
75
|
+
sharedNotesType: "none",
|
|
76
|
+
codeLink: null,
|
|
77
|
+
icon: null,
|
|
78
|
+
friendlyType: "",
|
|
79
|
+
comments: null,
|
|
80
|
+
grading: null,
|
|
81
|
+
workflow: null,
|
|
82
|
+
hasEvaluations: null,
|
|
83
83
|
};
|