Skip to content
Extraits de code Groupes Projets

Comparer les révisions

Les modifications sont affichées comme si la révision source était fusionnée avec la révision cible. En savoir plus sur la comparaison des révisions.

Source

Sélectionner le projet cible
No results found

Cible

Sélectionner le projet cible
  • capytale/meta-player
  • romain.casati/meta-player
2 résultats
Afficher les modifications
Validations sur la source (2)
{
"name": "@capytale/meta-player",
"version": "0.5.6",
"version": "0.5.7",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@capytale/meta-player",
"version": "0.5.6",
"version": "0.5.7",
"dependencies": {
"@capytale/activity.js": "^3.1.14",
"@capytale/capytale-anti-triche": "^0.2.1",
......
{
"name": "@capytale/meta-player",
"version": "0.5.6",
"version": "0.5.7",
"type": "module",
"scripts": {
"dev": "vite",
......
......@@ -11,6 +11,7 @@ import { classNames } from "primereact/utils";
import {
selectIsPedagoVisible,
selectOrientation,
selectShowSaveForStudents,
toggleIsPedagoVisible,
} from "./features/layout/layoutSlice";
import { FC, KeyboardEvent, PropsWithChildren, useCallback } from "react";
......@@ -20,6 +21,7 @@ import {
selectHasInstructions,
selectIsDirty,
selectMode,
selectShowSaveButton,
} from "./features/activityData/activityDataSlice";
import settings from "./settings";
import ReviewNavbar from "./features/navbar/review-navbar";
......@@ -41,11 +43,16 @@ const App: FC<AppProps> = (props) => {
const isDirty = useAppSelector(selectIsDirty);
const save = useSave();
const showSaveButton = useAppSelector(selectShowSaveButton);
const showSaveForStudents = useAppSelector(selectShowSaveForStudents);
const hasSaveButton =
showSaveButton && !(mode === "assignment" && !showSaveForStudents);
const handleCtrlS = useCallback(
(e: KeyboardEvent<HTMLDivElement>) => {
if ((e.ctrlKey || e.metaKey) && e.key === "s") {
e.preventDefault();
save(); // Checks if can save inside of save()
if (hasSaveButton) save(); // Checks if can save inside of save()
}
},
[isDirty, save],
......
import { useCallback } from "react";
import { useAppDispatch, useAppSelector } from "../../app/hooks";
import { selectShowSaveForStudents } from "../layout/layoutSlice";
import { selectHasEvaluations, selectIsDirty, selectMode, selectPreventEditIfHasEvaluations, selectShowSaveButton, setIsPlayerDirty, setSaveState } from "./activityDataSlice";
import { selectHasEvaluations, selectIsDirty, selectMode, selectPreventEditIfHasEvaluations, setIsPlayerDirty, setSaveState } from "./activityDataSlice";
export const useNotifyIsDirty = () => {
const dispatch = useAppDispatch();
......@@ -16,14 +15,6 @@ export const useCanSave = () => {
const hasEvaluations = useAppSelector(selectHasEvaluations);
const mode = useAppSelector(selectMode);
const showSaveButton = useAppSelector(selectShowSaveButton);
const showSaveForStudents = useAppSelector(selectShowSaveForStudents);
const hasSaveButton =
showSaveButton && !(mode === "assignment" && !showSaveForStudents);
if (!hasSaveButton) {
return false;
}
if (mode === "create" && hasEvaluations && preventEditIfHasEvaluations) {
return false;
......