fix
This commit is contained in:
parent
0d57508966
commit
ac85eb5e19
@ -6,6 +6,7 @@ import { sendQuestionAnswer } from "@/utils/sendQuestionAnswer";
|
|||||||
import { ThemeProvider, Typography } from "@mui/material";
|
import { ThemeProvider, Typography } from "@mui/material";
|
||||||
import { useQuizViewStore } from "@stores/quizView";
|
import { useQuizViewStore } from "@stores/quizView";
|
||||||
import { statusOfQuiz, useQuestionFlowControl } from "@utils/hooks/useQuestionFlowControl";
|
import { statusOfQuiz, useQuestionFlowControl } from "@utils/hooks/useQuestionFlowControl";
|
||||||
|
import { QuizStep } from "@/model/settingsData";
|
||||||
import { notReachable } from "@utils/notReachable";
|
import { notReachable } from "@utils/notReachable";
|
||||||
import { quizThemes } from "@utils/themes/Publication/themePublication";
|
import { quizThemes } from "@utils/themes/Publication/themePublication";
|
||||||
import { enqueueSnackbar } from "notistack";
|
import { enqueueSnackbar } from "notistack";
|
||||||
@ -27,7 +28,8 @@ export default function ViewPublicationPage() {
|
|||||||
const { settings, recentlyCompleted, quizId, preview, changeFaviconAndTitle } = useQuizStore();
|
const { settings, recentlyCompleted, quizId, preview, changeFaviconAndTitle } = useQuizStore();
|
||||||
const answers = useQuizViewStore((state) => state.answers);
|
const answers = useQuizViewStore((state) => state.answers);
|
||||||
const ownVariants = useQuizViewStore((state) => state.ownVariants);
|
const ownVariants = useQuizViewStore((state) => state.ownVariants);
|
||||||
let currentQuizStep = useQuizViewStore((state) => state.currentQuizStep);
|
const currentQuizStep = useQuizViewStore((state) => state.currentQuizStep);
|
||||||
|
const setCurrentQuizStep = useQuizViewStore((state) => state.setCurrentQuizStep);
|
||||||
const {
|
const {
|
||||||
currentQuestion,
|
currentQuestion,
|
||||||
currentQuestionStepNumber,
|
currentQuestionStepNumber,
|
||||||
@ -68,12 +70,18 @@ export default function ViewPublicationPage() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (settings.cfg.antifraud && recentlyCompleted) throw new Error("Quiz already completed");
|
if (settings.cfg.antifraud && recentlyCompleted) throw new Error("Quiz already completed");
|
||||||
if (currentQuizStep === "startpage" && settings.cfg.noStartPage) {
|
|
||||||
// Обновляем состояние в store, а не только локальную переменную
|
// Обработка noStartPage - обновляем состояние в store
|
||||||
const setCurrentQuizStep = useQuizViewStore((state) => state.setCurrentQuizStep);
|
useEffect(() => {
|
||||||
setCurrentQuizStep("question");
|
if (currentQuizStep === "startpage" && settings.cfg.noStartPage) {
|
||||||
currentQuizStep = "question";
|
console.log("🔄 noStartPage: Setting currentQuizStep to 'question'");
|
||||||
}
|
setCurrentQuizStep("question");
|
||||||
|
}
|
||||||
|
}, [currentQuizStep, settings.cfg.noStartPage, setCurrentQuizStep]);
|
||||||
|
|
||||||
|
// Определяем текущий шаг для рендеринга
|
||||||
|
const displayQuizStep: QuizStep =
|
||||||
|
currentQuizStep === "startpage" && settings.cfg.noStartPage ? "question" : currentQuizStep;
|
||||||
|
|
||||||
if (!currentQuestion) {
|
if (!currentQuestion) {
|
||||||
return (
|
return (
|
||||||
@ -91,7 +99,7 @@ export default function ViewPublicationPage() {
|
|||||||
const currentAnswer = answers.find(({ questionId }) => questionId === currentQuestion.id);
|
const currentAnswer = answers.find(({ questionId }) => questionId === currentQuestion.id);
|
||||||
|
|
||||||
let quizStepElement: ReactElement;
|
let quizStepElement: ReactElement;
|
||||||
switch (currentQuizStep) {
|
switch (displayQuizStep) {
|
||||||
case "startpage": {
|
case "startpage": {
|
||||||
quizStepElement = <StartPageViewPublication />;
|
quizStepElement = <StartPageViewPublication />;
|
||||||
break;
|
break;
|
||||||
@ -148,7 +156,7 @@ export default function ViewPublicationPage() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
notReachable(currentQuizStep);
|
notReachable(displayQuizStep);
|
||||||
}
|
}
|
||||||
|
|
||||||
const preloadLinks = new Set([
|
const preloadLinks = new Set([
|
||||||
|
|||||||
@ -26,7 +26,7 @@
|
|||||||
"preview": "vite preview",
|
"preview": "vite preview",
|
||||||
"cypress:open": "cypress open",
|
"cypress:open": "cypress open",
|
||||||
"prepublishOnly": "npm run build:package",
|
"prepublishOnly": "npm run build:package",
|
||||||
"deploy": "docker login gitea.pena && docker build -t gitea.pena/squiz/frontanswerer/$(git branch --show-current):latest . && docker push gitea.pena/squiz/frontanswerer/$(git branch --show-current):latest",
|
"deploy": "echo '🚀 Начало процесса деплоя...' && docker login gitea.pena && if [ $? -eq 0 ]; then echo '✅ Успешный логин в Docker registry'; else echo '❌ Ошибка логина в Docker registry'; exit 1; fi && echo '🏗️ Сборка Docker образа...' && docker build -t gitea.pena/squiz/frontanswerer/$(git branch --show-current):latest . && if [ $? -eq 0 ]; then echo '✅ Docker образ успешно собран'; else echo '❌ Ошибка сборки Docker образа'; exit 1; fi && echo '📤 Пуш образа в registry...' && docker push gitea.pena/squiz/frontanswerer/$(git branch --show-current):latest && if [ $? -eq 0 ]; then echo '✅ Образ успешно загружен в registry'; echo '🎉 Деплой завершен успешно!'; else echo '❌ Ошибка загрузки образа в registry'; exit 1; fi",
|
||||||
"prepare": "husky"
|
"prepare": "husky"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user