темы публикаций сохраняются на бек
This commit is contained in:
parent
bfe19091ac
commit
4cdd23d71f
@ -33,6 +33,7 @@ export interface QuizConfig {
|
||||
startpageType: QuizStartpageType;
|
||||
results: QuizResultsType;
|
||||
haveRoot: string | null;
|
||||
theme: string | "StandardTheme" | "PinkTheme";
|
||||
resultInfo: {
|
||||
when: 'before' | 'after' | 'email',
|
||||
share: true | false,
|
||||
@ -92,6 +93,7 @@ export const defaultQuizConfig: QuizConfig = {
|
||||
startpageType: null,
|
||||
results: null,
|
||||
haveRoot: null,
|
||||
theme: "StandardTheme",
|
||||
resultInfo: {
|
||||
when: 'after',
|
||||
share: false,
|
||||
|
||||
@ -7,7 +7,7 @@ import { useQuestions } from "@root/questions/hooks";
|
||||
import { useCurrentQuiz } from "@root/quizes/hooks";
|
||||
import useSWR from "swr";
|
||||
import { quizApi } from "@api/quiz";
|
||||
import { setQuizes } from "@root/quizes/actions";
|
||||
import { setQuizes, updateQuiz } from "@root/quizes/actions";
|
||||
import { isAxiosError } from "axios";
|
||||
import { devlog } from "@frontend/kitui";
|
||||
import { useQuizStore } from "@root/quizes/store";
|
||||
@ -63,7 +63,7 @@ export const ViewPage = () => {
|
||||
if (visualStartPage === undefined) return <></>;
|
||||
if (questions.length === 0 || (questions.length === 1 && questions[0].type === "result")) return <ApologyPage message="Нет созданных вопросов"/>
|
||||
return (
|
||||
<ThemeProvider theme={themesPublication?.[themeState]}>
|
||||
<ThemeProvider theme={themesPublication?.[quiz?.config.theme]}>
|
||||
<Box>
|
||||
{!visualStartPage ? (
|
||||
<StartPageViewPublication setVisualStartPage={setVisualStartPage} />
|
||||
@ -71,8 +71,12 @@ export const ViewPage = () => {
|
||||
<Question questions={filteredQuestions} />
|
||||
)}
|
||||
<Box>
|
||||
<Button onClick={() => {setThemeState("StandardTheme")}}>Standard</Button>
|
||||
<Button onClick={() => {setThemeState("PinkTheme")}}>Pink</Button>
|
||||
<Button onClick={() => updateQuiz(quiz.id, (quiz) => {
|
||||
quiz.config.theme = "StandardTheme"
|
||||
})}>Standard</Button>
|
||||
<Button onClick={() => updateQuiz(quiz.id, (quiz) => {
|
||||
quiz.config.theme = "PinkTheme"
|
||||
})}>Pink</Button>
|
||||
</Box>
|
||||
</Box>
|
||||
</ThemeProvider>
|
||||
|
||||
@ -52,6 +52,7 @@ export default function EditPage() {
|
||||
const { editQuizId } = useQuizStore();
|
||||
const { questions } = useQuestionsStore();
|
||||
|
||||
console.log(quiz)
|
||||
useEffect(() => {
|
||||
const getData = async () => {
|
||||
const quizes = await quizApi.getList();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user