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 { useQuizViewStore } from "@stores/quizView";
|
||||
import { statusOfQuiz, useQuestionFlowControl } from "@utils/hooks/useQuestionFlowControl";
|
||||
import { QuizStep } from "@/model/settingsData";
|
||||
import { notReachable } from "@utils/notReachable";
|
||||
import { quizThemes } from "@utils/themes/Publication/themePublication";
|
||||
import { enqueueSnackbar } from "notistack";
|
||||
@ -27,7 +28,8 @@ export default function ViewPublicationPage() {
|
||||
const { settings, recentlyCompleted, quizId, preview, changeFaviconAndTitle } = useQuizStore();
|
||||
const answers = useQuizViewStore((state) => state.answers);
|
||||
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 {
|
||||
currentQuestion,
|
||||
currentQuestionStepNumber,
|
||||
@ -68,12 +70,18 @@ export default function ViewPublicationPage() {
|
||||
);
|
||||
|
||||
if (settings.cfg.antifraud && recentlyCompleted) throw new Error("Quiz already completed");
|
||||
if (currentQuizStep === "startpage" && settings.cfg.noStartPage) {
|
||||
// Обновляем состояние в store, а не только локальную переменную
|
||||
const setCurrentQuizStep = useQuizViewStore((state) => state.setCurrentQuizStep);
|
||||
setCurrentQuizStep("question");
|
||||
currentQuizStep = "question";
|
||||
}
|
||||
|
||||
// Обработка noStartPage - обновляем состояние в store
|
||||
useEffect(() => {
|
||||
if (currentQuizStep === "startpage" && settings.cfg.noStartPage) {
|
||||
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) {
|
||||
return (
|
||||
@ -91,7 +99,7 @@ export default function ViewPublicationPage() {
|
||||
const currentAnswer = answers.find(({ questionId }) => questionId === currentQuestion.id);
|
||||
|
||||
let quizStepElement: ReactElement;
|
||||
switch (currentQuizStep) {
|
||||
switch (displayQuizStep) {
|
||||
case "startpage": {
|
||||
quizStepElement = <StartPageViewPublication />;
|
||||
break;
|
||||
@ -148,7 +156,7 @@ export default function ViewPublicationPage() {
|
||||
break;
|
||||
}
|
||||
default:
|
||||
notReachable(currentQuizStep);
|
||||
notReachable(displayQuizStep);
|
||||
}
|
||||
|
||||
const preloadLinks = new Set([
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
"preview": "vite preview",
|
||||
"cypress:open": "cypress open",
|
||||
"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"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user