improve quiz config types

This commit is contained in:
nflnkr 2023-11-14 16:09:55 +03:00
parent 812b58c4d2
commit a3b2adf0c6

@ -11,23 +11,27 @@ export const quizSetupSteps = {
10: { displayStep: 7, text: "Запустите рекламу" }, 10: { displayStep: 7, text: "Запустите рекламу" },
} as const; } as const;
export const maxQuizSetupSteps = Math.max(...Object.keys(quizSetupSteps).map(parseInt)); export const maxQuizSetupSteps = Math.max(...Object.keys(quizSetupSteps).map(n => parseInt(n)));
export const maxDisplayQuizSetupSteps = Math.max(...Object.values(quizSetupSteps).map(v => v.displayStep)); export const maxDisplayQuizSetupSteps = Math.max(...Object.values(quizSetupSteps).map(v => v.displayStep));
export type QuizSetupStep = keyof typeof quizSetupSteps; export type QuizSetupStep = keyof typeof quizSetupSteps;
export type QuizStartpageType = "standard" | "expanded" | "centered";
export type QuizStartpageAlignType = "left" | "right" | "center";
export interface QuizConfig { export interface QuizConfig {
type: "quiz" | "form"; type: "quiz" | "form";
logo: string; logo: string;
noStartPage: boolean; noStartPage: boolean;
startpageType: "standard" | "expanded" | "centered"; startpageType: QuizStartpageType;
startpage: { startpage: {
description: string; description: string;
button: string; button: string;
position: string; position: QuizStartpageAlignType;
background: { background: {
type: string; type: null | "image" | "video";
desktop: string; desktop: string;
mobile: string; mobile: string;
video: string; video: string;
@ -54,7 +58,7 @@ export const defaultQuizConfig: QuizConfig = {
button: "", button: "",
position: "left", position: "left",
background: { background: {
type: "none", type: null,
desktop: "", desktop: "",
mobile: "", mobile: "",
video: "", video: "",