feat: design logic

This commit is contained in:
IlyaDoronin 2024-03-04 19:40:53 +03:00
parent 284472c5bb
commit 69ea201ddc
14 changed files with 1719 additions and 1328 deletions

@ -1,6 +1,9 @@
import { useQuizData } from "@contexts/QuizDataContext";
import { Box, Typography, useTheme } from "@mui/material";
import { ReactNode } from "react"; import { ReactNode } from "react";
import { Box, Typography, useTheme } from "@mui/material";
import { useQuizData } from "@contexts/QuizDataContext";
import Stepper from "@ui_kit/Stepper";
type FooterProps = { type FooterProps = {
stepNumber: number | null; stepNumber: number | null;
@ -10,8 +13,10 @@ type FooterProps = {
export const Footer = ({ stepNumber, nextButton, prevButton }: FooterProps) => { export const Footer = ({ stepNumber, nextButton, prevButton }: FooterProps) => {
const theme = useTheme(); const theme = useTheme();
const { questions } = useQuizData(); const { questions, settings } = useQuizData();
console.log(questions); const questionsAmount = questions.filter(
({ type }) => type !== "result"
).length;
return ( return (
<Box <Box
@ -21,13 +26,16 @@ export const Footer = ({ stepNumber, nextButton, prevButton }: FooterProps) => {
borderTop: `1px solid ${theme.palette.grey[400]}`, borderTop: `1px solid ${theme.palette.grey[400]}`,
height: "75px", height: "75px",
display: "flex", display: "flex",
background: settings.cfg.design
? "rgba(154,154,175, 0.2)"
: "transparent",
}} }}
> >
<Box <Box
sx={{ sx={{
width: "100%", width: "100%",
maxWidth: "1000px", maxWidth: "1410px",
padding: "0 10px", padding: "10px",
margin: "0 auto", margin: "0 auto",
display: "flex", display: "flex",
alignItems: "center", alignItems: "center",
@ -40,35 +48,11 @@ export const Footer = ({ stepNumber, nextButton, prevButton }: FooterProps) => {
{/* <NameplateLogoFQDark style={{ fontSize: "34px", width:"200px", height:"auto" }} />*/} {/* <NameplateLogoFQDark style={{ fontSize: "34px", width:"200px", height:"auto" }} />*/}
{/*)}*/} {/*)}*/}
{stepNumber !== null && ( {stepNumber !== null && (
<Box <Box sx={{ flexGrow: 1 }}>
sx={{ <Typography sx={{ color: theme.palette.text.primary }}>
display: "flex", Вопрос {stepNumber} из {questionsAmount}
alignItems: "center",
gap: "10px",
marginRight: "auto",
color: theme.palette.text.primary,
}}
>
<Typography>Шаг</Typography>
<Typography
sx={{
display: "flex",
justifyContent: "center",
alignItems: "center",
fontWeight: "bold",
borderRadius: "50%",
width: "30px",
height: "30px",
color: "#FFF",
background: theme.palette.primary.main,
}}
>
{stepNumber}
</Typography>
<Typography>Из</Typography>
<Typography sx={{ fontWeight: "bold" }}>
{questions.filter((q) => q.type !== "result").length}
</Typography> </Typography>
<Stepper activeStep={stepNumber} steps={questionsAmount} />
</Box> </Box>
)} )}

@ -33,7 +33,7 @@ import Desgin9 from "@icons/designs/design9.jpg";
import Desgin10 from "@icons/designs/design10.jpg"; import Desgin10 from "@icons/designs/design10.jpg";
import type { ReactNode } from "react"; import type { ReactNode } from "react";
import type { Design } from "@model/settingsData"; import type { QuizTheme } from "@model/settingsData";
type Props = { type Props = {
currentQuestion: RealTypedQuizQuestion; currentQuestion: RealTypedQuizQuestion;
@ -42,18 +42,28 @@ type Props = {
prevButton: ReactNode; prevButton: ReactNode;
}; };
export const DESIGN_LIST: Record<Design, string> = { export const DESIGN_LIST: Record<QuizTheme, string> = {
"": "", Design1: Desgin1,
design1: Desgin1, Design2: Desgin2,
design2: Desgin2, Design3: Desgin3,
design3: Desgin3, Design4: Desgin4,
design4: Desgin4, Design5: Desgin5,
design5: Desgin5, Design6: Desgin6,
design6: Desgin6, Design7: Desgin7,
design7: Desgin7, Design8: Desgin8,
design8: Desgin8, Design9: Desgin9,
design9: Desgin9, Design10: Desgin10,
design10: Desgin10, StandardTheme: "",
StandardDarkTheme: "",
PinkTheme: "",
PinkDarkTheme: "",
BlackWhiteTheme: "",
OliveTheme: "",
YellowTheme: "",
GoldDarkTheme: "",
PurpleTheme: "",
BlueTheme: "",
BlueDarkTheme: "",
}; };
export const Question = ({ export const Question = ({
@ -64,19 +74,20 @@ export const Question = ({
}: Props) => { }: Props) => {
const theme = useTheme(); const theme = useTheme();
const { settings } = useQuizData(); const { settings } = useQuizData();
const design = DESIGN_LIST[settings.cfg.design];
return ( return (
<Box <Box
sx={{ sx={{
backgroundPosition: "center", backgroundPosition: "center",
backgroundSize: "cover", backgroundSize: "cover",
backgroundImage: `url(${design})`, backgroundImage: settings.cfg.design
? `url(${DESIGN_LIST[settings.cfg.theme]})`
: null,
}} }}
> >
<Box <Box
sx={{ sx={{
background: design background: settings.cfg.design
? "linear-gradient(90deg,#272626, transparent)" ? "linear-gradient(90deg,#272626, transparent)"
: theme.palette.background.default, : theme.palette.background.default,
}} }}
@ -100,6 +111,7 @@ export const Question = ({
question={currentQuestion} question={currentQuestion}
stepNumber={currentQuestionStepNumber} stepNumber={currentQuestionStepNumber}
/> />
<Box sx={{ marginLeft: "auto" }}>
{quizThemes[settings.cfg.theme].isLight ? ( {quizThemes[settings.cfg.theme].isLight ? (
<Link target={"_blank"} href={"https://quiz.pena.digital"}> <Link target={"_blank"} href={"https://quiz.pena.digital"}>
<NameplateLogoFQ <NameplateLogoFQ
@ -114,6 +126,7 @@ export const Question = ({
</Link> </Link>
)} )}
</Box> </Box>
</Box>
<Footer <Footer
stepNumber={currentQuestionStepNumber} stepNumber={currentQuestionStepNumber}
prevButton={prevButton} prevButton={prevButton}

@ -44,11 +44,13 @@ export const StartPageViewPublication = () => {
} }
alt="" alt=""
style={{ style={{
display: "block",
width: width:
isMobile || settings.cfg.startpageType === "expanded" isMobile || settings.cfg.startpageType === "expanded"
? "100%" ? "100%"
: undefined, : undefined,
height: "100%", height: "100%",
maxHeight: "100vh",
objectFit: "cover", objectFit: "cover",
overflow: "hidden", overflow: "hidden",
}} }}
@ -214,7 +216,7 @@ export const StartPageViewPublication = () => {
fontSize: "18px", fontSize: "18px",
padding: "10px 30px", padding: "10px 30px",
width: "auto", width: "auto",
background: "#7E2AEA", background: theme.palette.primary.main,
}} }}
onClick={() => setCurrentQuizStep("question")} onClick={() => setCurrentQuizStep("question")}
> >
@ -248,7 +250,7 @@ export const StartPageViewPublication = () => {
<Typography <Typography
sx={{ sx={{
fontSize: "16px", fontSize: "16px",
color: "#7E2AEA", color: theme.palette.primary.main,
overflow: "hidden", overflow: "hidden",
textOverflow: "ellipsis", textOverflow: "ellipsis",
whiteSpace: "nowrap", whiteSpace: "nowrap",
@ -262,19 +264,35 @@ export const StartPageViewPublication = () => {
{settings.cfg.info.clickable ? ( {settings.cfg.info.clickable ? (
isMobileDevice ? ( isMobileDevice ? (
<Link href={`tel:${settings.cfg.info.phonenumber}`}> <Link href={`tel:${settings.cfg.info.phonenumber}`}>
<Typography sx={{ fontSize: "16px" }}> <Typography
sx={{
fontSize: "16px",
color: theme.palette.text.primary,
}}
>
{settings.cfg.info.phonenumber} {settings.cfg.info.phonenumber}
</Typography> </Typography>
</Link> </Link>
) : ( ) : (
<ButtonBase onClick={handleCopyNumber}> <ButtonBase onClick={handleCopyNumber}>
<Typography sx={{ fontSize: "16px" }}> <Typography
sx={{
fontSize: "16px",
color: theme.palette.text.primary,
}}
>
{settings.cfg.info.phonenumber} {settings.cfg.info.phonenumber}
</Typography> </Typography>
</ButtonBase> </ButtonBase>
) )
) : ( ) : (
<Typography sx={{ fontSize: "16px", marginTop: "5px" }}> <Typography
sx={{
fontSize: "16px",
marginTop: "5px",
color: theme.palette.text.primary,
}}
>
{settings.cfg.info.phonenumber} {settings.cfg.info.phonenumber}
</Typography> </Typography>
)} )}

@ -61,7 +61,16 @@ export default function ViewPublicationPage() {
<Button <Button
disabled={!isPreviousButtonEnabled} disabled={!isPreviousButtonEnabled}
variant="contained" variant="contained"
sx={{ fontSize: "16px", padding: "10px 15px" }} sx={{
fontSize: "16px",
padding: "10px 15px",
color: "#FFFFFF",
border: "1px solid #9A9AAF",
background: "rgba(154,154,175, 0.2)",
"&:disabled": {
color: "#9A9AAF",
},
}}
onClick={moveToPrevQuestion} onClick={moveToPrevQuestion}
> >
{isMobileMini ? "←" : "← Назад"} {isMobileMini ? "←" : "← Назад"}

@ -29,7 +29,11 @@ export const Date = ({ currentQuestion }: DateProps) => {
return ( return (
<Box> <Box>
<Typography variant="h5" color={theme.palette.text.primary} sx={{ wordBreak: "break-word" }}> <Typography
variant="h5"
color={theme.palette.text.primary}
sx={{ wordBreak: "break-word" }}
>
{currentQuestion.title} {currentQuestion.title}
</Typography> </Typography>
<Box <Box
@ -63,11 +67,7 @@ export const Date = ({ currentQuestion }: DateProps) => {
qid: quizId, qid: quizId,
}); });
updateAnswer( updateAnswer(currentQuestion.id, date, 0);
currentQuestion.id,
date,
0
);
} catch (e) { } catch (e) {
enqueueSnackbar("ответ не был засчитан"); enqueueSnackbar("ответ не был засчитан");
} }
@ -87,7 +87,9 @@ export const Date = ({ currentQuestion }: DateProps) => {
}} }}
sx={{ sx={{
"& .MuiInputBase-root": { "& .MuiInputBase-root": {
backgroundColor: quizThemes[settings.cfg.theme].isLight backgroundColor: settings.cfg.design
? "rgba(154,154,175, 0.2)"
: quizThemes[settings.cfg.theme].isLight
? "white" ? "white"
: theme.palette.background.default, : theme.palette.background.default,
borderRadius: "10px", borderRadius: "10px",

@ -189,7 +189,7 @@ export const File = ({ currentQuestion }: FileProps) => {
justifyContent: "flex-start", justifyContent: "flex-start",
alignItems: "center", alignItems: "center",
padding: "33px 44px 33px 55px", padding: "33px 44px 33px 55px",
backgroundColor: theme.palette.background.default, backgroundColor: "#F2F3F7",
border: `1px solid ${isDropzoneHighlighted ? "red" : "#9A9AAF"}`, border: `1px solid ${isDropzoneHighlighted ? "red" : "#9A9AAF"}`,
borderRadius: "8px", borderRadius: "8px",
}} }}

@ -43,8 +43,8 @@ export const Number = ({ currentQuestion }: NumberProps) => {
const reversed = minBorder > maxBorder; const reversed = minBorder > maxBorder;
useEffect(() => { useEffect(() => {
console.log("reversed:", reversed) console.log("reversed:", reversed);
}, [reversed]) }, [reversed]);
const sendAnswerToBackend = async (value: string, noUpdate = false) => { const sendAnswerToBackend = async (value: string, noUpdate = false) => {
setIsSending(true); setIsSending(true);
@ -361,7 +361,11 @@ export const Number = ({ currentQuestion }: NumberProps) => {
return ( return (
<Box> <Box>
<Typography variant="h5" color={theme.palette.text.primary} sx={{ wordBreak: "break-word" }}> <Typography
variant="h5"
color={theme.palette.text.primary}
sx={{ wordBreak: "break-word" }}
>
{currentQuestion.title} {currentQuestion.title}
</Typography> </Typography>
<Box <Box
@ -404,9 +408,12 @@ export const Number = ({ currentQuestion }: NumberProps) => {
sx={{ sx={{
maxWidth: "80px", maxWidth: "80px",
borderColor: theme.palette.text.primary, borderColor: theme.palette.text.primary,
"& .MuiInputBase-input": { "& .MuiOutlinedInput-root": { background: "transparent" },
textAlign: "center", "& .MuiInputBase-input": { textAlign: "center", zIndex: 1 },
backgroundColor: quizThemes[settings.cfg.theme].isLight "& .MuiOutlinedInput-notchedOutline": {
backgroundColor: settings.cfg.design
? "rgba(154,154,175, 0.2)"
: quizThemes[settings.cfg.theme].isLight
? "white" ? "white"
: theme.palette.background.default, : theme.palette.background.default,
}, },
@ -430,9 +437,12 @@ export const Number = ({ currentQuestion }: NumberProps) => {
sx={{ sx={{
maxWidth: "80px", maxWidth: "80px",
borderColor: theme.palette.text.primary, borderColor: theme.palette.text.primary,
"& .MuiInputBase-input": { "& .MuiOutlinedInput-root": { background: "transparent" },
textAlign: "center", "& .MuiInputBase-input": { textAlign: "center", zIndex: 1 },
backgroundColor: quizThemes[settings.cfg.theme].isLight "& .MuiOutlinedInput-notchedOutline": {
backgroundColor: settings.cfg.design
? "rgba(154,154,175, 0.2)"
: quizThemes[settings.cfg.theme].isLight
? "white" ? "white"
: theme.palette.background.default, : theme.palette.background.default,
}, },
@ -446,9 +456,12 @@ export const Number = ({ currentQuestion }: NumberProps) => {
sx={{ sx={{
maxWidth: "80px", maxWidth: "80px",
borderColor: theme.palette.text.primary, borderColor: theme.palette.text.primary,
"& .MuiInputBase-input": { "& .MuiOutlinedInput-root": { background: "transparent" },
textAlign: "center", "& .MuiInputBase-input": { textAlign: "center", zIndex: 1 },
backgroundColor: quizThemes[settings.cfg.theme].isLight "& .MuiOutlinedInput-notchedOutline": {
backgroundColor: settings.cfg.design
? "rgba(154,154,175, 0.2)"
: quizThemes[settings.cfg.theme].isLight
? "white" ? "white"
: theme.palette.background.default, : theme.palette.background.default,
}, },

@ -1,4 +1,10 @@
import {Box, TextField as MuiTextField, TextFieldProps, Typography, useTheme} from "@mui/material"; import {
Box,
TextField as MuiTextField,
TextFieldProps,
Typography,
useTheme,
} from "@mui/material";
import CustomTextField from "@ui_kit/CustomTextField"; import CustomTextField from "@ui_kit/CustomTextField";
@ -8,7 +14,7 @@ import { sendAnswer } from "@api/quizRelase";
import { useQuizData } from "@contexts/QuizDataContext"; import { useQuizData } from "@contexts/QuizDataContext";
import { useRootContainerSize } from "@contexts/RootContainerWidthContext"; import { useRootContainerSize } from "@contexts/RootContainerWidthContext";
import { enqueueSnackbar } from "notistack"; import { enqueueSnackbar } from "notistack";
import {ChangeEvent, FC, useEffect, useState} from "react"; import { ChangeEvent, FC, useEffect, useState } from "react";
import { useDebouncedCallback } from "use-debounce"; import { useDebouncedCallback } from "use-debounce";
import type { QuizQuestionText } from "../../../model/questionTypes/text"; import type { QuizQuestionText } from "../../../model/questionTypes/text";
@ -20,40 +26,41 @@ type TextProps = {
}; };
const Orientation = [ const Orientation = [
{horizontal: true}, { horizontal: true },
{horizontal: false}, { horizontal: false },
{horizontal: true}, { horizontal: true },
{horizontal: true}, { horizontal: true },
{horizontal: false}, { horizontal: false },
{horizontal: true}, { horizontal: true },
{horizontal: true}, { horizontal: true },
{horizontal: true}, { horizontal: true },
{horizontal: true}, { horizontal: true },
{horizontal: true}, { horizontal: true },
{horizontal: true}, { horizontal: true },
{horizontal: false}, { horizontal: false },
{horizontal: true}, { horizontal: true },
{horizontal: false}, { horizontal: false },
{horizontal: true}, { horizontal: true },
{horizontal: true}, { horizontal: true },
{horizontal: true}, { horizontal: true },
{horizontal: true}, { horizontal: true },
{horizontal: false}, { horizontal: false },
{horizontal: false}, { horizontal: false },
{horizontal: true}, { horizontal: true },
{horizontal: true}, { horizontal: true },
{horizontal: true}, { horizontal: true },
{horizontal: true}, { horizontal: true },
] ];
export const Text = ({ currentQuestion, stepNumber }: TextProps) => { export const Text = ({ currentQuestion, stepNumber }: TextProps) => {
const theme = useTheme(); const theme = useTheme();
const { settings } = useQuizData(); const { settings } = useQuizData();
const spec = settings.cfg.spec const spec = settings.cfg.spec;
const { quizId } = useQuizData(); const { quizId } = useQuizData();
const { answers } = useQuizViewStore(); const { answers } = useQuizViewStore();
const isMobile = useRootContainerSize() < 650; const isMobile = useRootContainerSize() < 650;
const { answer } = answers.find(({ questionId }) => questionId === currentQuestion.id) ?? {}; const { answer } =
answers.find(({ questionId }) => questionId === currentQuestion.id) ?? {};
const [isSending, setIsSending] = useState<boolean>(false); const [isSending, setIsSending] = useState<boolean>(false);
const inputHC = useDebouncedCallback(async (text) => { const inputHC = useDebouncedCallback(async (text) => {
@ -78,34 +85,61 @@ export const Text = ({ currentQuestion, stepNumber }: TextProps) => {
); );
switch (spec) { switch (spec) {
case true: case true:
return <TextSpecial currentQuestion={currentQuestion} answer={answer} inputHC={inputHC} stepNumber={stepNumber}/>; return (
<TextSpecial
currentQuestion={currentQuestion}
answer={answer}
inputHC={inputHC}
stepNumber={stepNumber}
/>
);
case undefined: case undefined:
return <TextNormal currentQuestion={currentQuestion} answer={answer} inputHC={inputHC} />; return (
<TextNormal
currentQuestion={currentQuestion}
answer={answer}
inputHC={inputHC}
/>
);
default: default:
return <TextNormal currentQuestion={currentQuestion} answer={answer} inputHC={inputHC} />; return (
<TextNormal
currentQuestion={currentQuestion}
answer={answer}
inputHC={inputHC}
/>
);
} }
}; };
interface Props { interface Props {
currentQuestion: QuizQuestionText; currentQuestion: QuizQuestionText;
answer: any, answer: any;
inputHC: (a: string) => void; inputHC: (a: string) => void;
stepNumber?: number | null; stepNumber?: number | null;
} }
const TextNormal = ({currentQuestion, answer, inputHC}: Props) => { const TextNormal = ({ currentQuestion, answer, inputHC }: Props) => {
const isMobile = useRootContainerSize() < 650; const isMobile = useRootContainerSize() < 650;
const theme = useTheme(); const theme = useTheme();
return( const { settings } = useQuizData();
return (
<Box> <Box>
<Typography variant="h5" color={theme.palette.text.primary} sx={{ wordBreak: "break-word" }}>{currentQuestion.title}</Typography> <Typography
variant="h5"
color={theme.palette.text.primary}
sx={{ wordBreak: "break-word" }}
>
{currentQuestion.title}
</Typography>
<Box <Box
sx={{ sx={{
display: "flex", display: "flex",
width: "100%", width: "100%",
marginTop: "20px", marginTop: "20px",
flexDirection: isMobile ? "column-reverse" : undefined, flexDirection: isMobile ? "column-reverse" : undefined,
alignItems: "center" alignItems: "center",
}} }}
> >
<CustomTextField <CustomTextField
@ -116,13 +150,24 @@ const TextNormal = ({currentQuestion, answer, inputHC}: Props) => {
inputHC(target.value); inputHC(target.value);
}} }}
sx={{ sx={{
"&:focus-visible": { "& .MuiOutlinedInput-root": {
borderColor: theme.palette.primary.main backgroundColor: settings.cfg.design
} ? "rgba(154,154,175, 0.2)"
: "#FFFFFF",
},
"&:focus-visible": { borderColor: theme.palette.primary.main },
}} }}
/> />
{currentQuestion.content.back && currentQuestion.content.back !== " " && ( {currentQuestion.content.back &&
<Box sx={{ maxWidth: "400px", width: "100%", height: "300px", margin: "15px" }}> currentQuestion.content.back !== " " && (
<Box
sx={{
maxWidth: "400px",
width: "100%",
height: "300px",
margin: "15px",
}}
>
<img <img
key={currentQuestion.id} key={currentQuestion.id}
src={currentQuestion.content.back} src={currentQuestion.content.back}
@ -133,15 +178,28 @@ const TextNormal = ({currentQuestion, answer, inputHC}: Props) => {
)} )}
</Box> </Box>
</Box> </Box>
) );
}; };
const TextSpecial = ({currentQuestion, answer, inputHC, stepNumber}: Props) => { const TextSpecial = ({
currentQuestion,
answer,
inputHC,
stepNumber,
}: Props) => {
const theme = useTheme(); const theme = useTheme();
const isMobile = useRootContainerSize() < 650; const isMobile = useRootContainerSize() < 650;
const isHorizontal = Orientation[Number(stepNumber) -1].horizontal const isHorizontal = Orientation[Number(stepNumber) - 1].horizontal;
return( const { settings } = useQuizData();
<Box sx={{display: "flex", flexDirection: isMobile? "column" : undefined, alignItems: isMobile ? "center" : undefined,}}>
return (
<Box
sx={{
display: "flex",
flexDirection: isMobile ? "column" : undefined,
alignItems: isMobile ? "center" : undefined,
}}
>
<Box <Box
sx={{ sx={{
display: "flex", display: "flex",
@ -149,12 +207,20 @@ const TextNormal = ({currentQuestion, answer, inputHC}: Props) => {
marginTop: "20px", marginTop: "20px",
flexDirection: "column", flexDirection: "column",
alignItems: "center", alignItems: "center",
gap: "20px" gap: "20px",
}} }}
> >
<Typography variant="h5" color={theme.palette.text.primary} sx={{ wordBreak: "break-word" }}>{currentQuestion.title}</Typography> <Typography
{isHorizontal && currentQuestion.content.back && currentQuestion.content.back !== " " && ( variant="h5"
<Box sx={{margin: "30px", width: "50vw", maxHeight: "550px" }}> color={theme.palette.text.primary}
sx={{ wordBreak: "break-word" }}
>
{currentQuestion.title}
</Typography>
{isHorizontal &&
currentQuestion.content.back &&
currentQuestion.content.back !== " " && (
<Box sx={{ margin: "30px", width: "50vw", maxHeight: "550px" }}>
<img <img
key={currentQuestion.id} key={currentQuestion.id}
src={currentQuestion.content.back} src={currentQuestion.content.back}
@ -164,30 +230,35 @@ const TextNormal = ({currentQuestion, answer, inputHC}: Props) => {
</Box> </Box>
)} )}
{ {
(<TextField <TextField
autoFocus={true} autoFocus={true}
multiline multiline
maxRows={4} maxRows={4}
placeholder={currentQuestion.content.placeholder} placeholder={currentQuestion.content.placeholder}
value={answer || ""} value={answer || ""}
onChange={async ({ target }:ChangeEvent<HTMLInputElement>) => { onChange={async ({ target }: ChangeEvent<HTMLInputElement>) => {
updateAnswer(currentQuestion.id, target.value, 0); updateAnswer(currentQuestion.id, target.value, 0);
inputHC(target.value); inputHC(target.value);
} }}
} inputProps={{ maxLength: 400 }}
inputProps={{maxLength:400}}
sx={{ sx={{
width: "100%", width: "100%",
"& .MuiOutlinedInput-root": {
backgroundColor: settings.cfg.design
? "rgba(154,154,175, 0.2)"
: "#FFFFFF",
},
"&:focus-visible": { "&:focus-visible": {
borderColor: theme.palette.primary.main borderColor: theme.palette.primary.main,
} },
}} }}
/>) />
} }
</Box> </Box>
{!isHorizontal && currentQuestion.content.back && currentQuestion.content.back !== " " && ( {!isHorizontal &&
<Box sx={{margin: "15px", width: "40vw" }}> currentQuestion.content.back &&
currentQuestion.content.back !== " " && (
<Box sx={{ margin: "15px", width: "40vw" }}>
<img <img
key={currentQuestion.id} key={currentQuestion.id}
src={currentQuestion.content.back} src={currentQuestion.content.back}
@ -197,5 +268,5 @@ const TextNormal = ({currentQuestion, answer, inputHC}: Props) => {
</Box> </Box>
)} )}
</Box> </Box>
) );
} };

@ -8,7 +8,7 @@ import {
RadioGroup, RadioGroup,
TextFieldProps, TextFieldProps,
Typography, Typography,
useTheme useTheme,
} from "@mui/material"; } from "@mui/material";
import { FC, useEffect, useState } from "react"; import { FC, useEffect, useState } from "react";
@ -16,7 +16,7 @@ import {
deleteAnswer, deleteAnswer,
updateAnswer, updateAnswer,
updateOwnVariant, updateOwnVariant,
useQuizViewStore useQuizViewStore,
} from "@stores/quizView"; } from "@stores/quizView";
import { CheckboxIcon } from "@icons/Checkbox"; import { CheckboxIcon } from "@icons/Checkbox";
@ -44,9 +44,7 @@ export const Variant = ({ currentQuestion }: VariantProps) => {
const isMobile = useRootContainerSize() < 650; const isMobile = useRootContainerSize() < 650;
const { answers, ownVariants } = useQuizViewStore(); const { answers, ownVariants } = useQuizViewStore();
const { answer } = const { answer } =
answers.find( answers.find(({ questionId }) => questionId === currentQuestion.id) ?? {};
({ questionId }) => questionId === currentQuestion.id
) ?? {};
const ownVariant = ownVariants.find( const ownVariant = ownVariants.find(
(variant) => variant.id === currentQuestion.id (variant) => variant.id === currentQuestion.id
); );
@ -61,15 +59,26 @@ export const Variant = ({ currentQuestion }: VariantProps) => {
} }
}, []); }, []);
if (moment.isMoment(answer)) throw new Error("Answer is Moment in Variant question"); if (moment.isMoment(answer))
throw new Error("Answer is Moment in Variant question");
return ( return (
<Box> <Box>
<Typography variant="h5" color={theme.palette.text.primary} sx={{ wordBreak: "break-word" }}>{currentQuestion.title}</Typography> <Typography
<Box sx={{ variant="h5"
display: "flex", gap: "20px", color={theme.palette.text.primary}
flexDirection: isMobile ? "column-reverse" : undefined, alignItems: isMobile ? "center" : undefined sx={{ wordBreak: "break-word" }}
}}> >
{currentQuestion.title}
</Typography>
<Box
sx={{
display: "flex",
gap: "20px",
flexDirection: isMobile ? "column-reverse" : undefined,
alignItems: isMobile ? "center" : undefined,
}}
>
<Group <Group
name={currentQuestion.id.toString()} name={currentQuestion.id.toString()}
value={currentQuestion.content.variants.findIndex( value={currentQuestion.content.variants.findIndex(
@ -82,7 +91,7 @@ export const Variant = ({ currentQuestion }: VariantProps) => {
justifyContent: "space-between", justifyContent: "space-between",
flexBasis: "100%", flexBasis: "100%",
marginTop: "20px", marginTop: "20px",
width: isMobile ? "100%" : undefined width: isMobile ? "100%" : undefined,
}} }}
> >
<Box <Box
@ -118,7 +127,8 @@ export const Variant = ({ currentQuestion }: VariantProps) => {
)} )}
</Box> </Box>
</Group> </Group>
{currentQuestion.content.back && currentQuestion.content.back !== " " && ( {currentQuestion.content.back &&
currentQuestion.content.back !== " " && (
<Box sx={{ maxWidth: "400px", width: "100%", height: "300px" }}> <Box sx={{ maxWidth: "400px", width: "100%", height: "300px" }}>
<img <img
key={currentQuestion.id} key={currentQuestion.id}
@ -163,10 +173,11 @@ const VariantItem = ({
color: theme.palette.text.primary, color: theme.palette.text.primary,
padding: "15px", padding: "15px",
border: `1px solid`, border: `1px solid`,
borderColor: answer === variant.id borderColor:
? theme.palette.primary.main answer === variant.id ? theme.palette.primary.main : "#9A9AAF",
: "#9A9AAF", backgroundColor: settings.cfg.design
backgroundColor: quizThemes[settings.cfg.theme].isLight ? "rgba(154,154,175, 0.2)"
: quizThemes[settings.cfg.theme].isLight
? "white" ? "white"
: theme.palette.background.default, : theme.palette.background.default,
display: "flex", display: "flex",
@ -187,20 +198,26 @@ const VariantItem = ({
}, },
"&::-webkit-scrollbar-thumb": { "&::-webkit-scrollbar-thumb": {
backgroundColor: "#b8babf", backgroundColor: "#b8babf",
} },
} },
}} }}
value={index} value={index}
labelPlacement="start" labelPlacement="start"
control={ control={
currentQuestion.content.multi ? currentQuestion.content.multi ? (
<Checkbox <Checkbox
checked={!!answer?.includes(variant.id)} checked={!!answer?.includes(variant.id)}
checkedIcon={<CheckboxIcon checked color={theme.palette.primary.main} />} checkedIcon={
<CheckboxIcon checked color={theme.palette.primary.main} />
}
icon={<CheckboxIcon />} icon={<CheckboxIcon />}
/> />
: ) : (
<Radio checkedIcon={<RadioCheck color={theme.palette.primary.main} />} icon={<RadioIcon />} /> <Radio
checkedIcon={<RadioCheck color={theme.palette.primary.main} />}
icon={<RadioIcon />}
/>
)
} }
label={own ? <TextField label="Другое..." /> : variant.answer} label={own ? <TextField label="Другое..." /> : variant.answer}
onClick={async (event) => { onClick={async (event) => {
@ -246,12 +263,13 @@ const VariantItem = ({
qid: quizId, qid: quizId,
}); });
updateAnswer(currentQuestion.id, variantId, updateAnswer(
answer === variantId ? 0 currentQuestion.id,
: variantId,
currentQuestion.content.variants[index].points || 0 answer === variantId
? 0
: currentQuestion.content.variants[index].points || 0
); );
} catch (e) { } catch (e) {
console.log(e); console.log(e);
enqueueSnackbar("ответ не был засчитан"); enqueueSnackbar("ответ не был засчитан");
@ -259,13 +277,11 @@ const VariantItem = ({
if (answer === variantId) { if (answer === variantId) {
try { try {
await sendAnswer({ await sendAnswer({
questionId: currentQuestion.id, questionId: currentQuestion.id,
body: "", body: "",
qid: quizId, qid: quizId,
}); });
} catch (e) { } catch (e) {
console.log(e); console.log(e);
enqueueSnackbar("ответ не был засчитан"); enqueueSnackbar("ответ не был засчитан");

@ -4,7 +4,7 @@ import {
Radio, Radio,
RadioGroup, RadioGroup,
Typography, Typography,
useTheme useTheme,
} from "@mui/material"; } from "@mui/material";
import { deleteAnswer, updateAnswer, useQuizViewStore } from "@stores/quizView"; import { deleteAnswer, updateAnswer, useQuizViewStore } from "@stores/quizView";
@ -32,24 +32,29 @@ export const Varimg = ({ currentQuestion }: VarimgProps) => {
const [isSending, setIsSending] = useState<boolean>(false); const [isSending, setIsSending] = useState<boolean>(false);
const { answer } = const { answer } =
answers.find( answers.find(({ questionId }) => questionId === currentQuestion.id) ?? {};
({ questionId }) => questionId === currentQuestion.id
) ?? {};
const variant = currentQuestion.content.variants.find( const variant = currentQuestion.content.variants.find(
({ id }) => answer === id ({ id }) => answer === id
); );
return ( return (
<Box> <Box>
<Typography variant="h5" color={theme.palette.text.primary} sx={{ wordBreak: "break-word" }}>{currentQuestion.title}</Typography> <Typography
<Box sx={{ variant="h5"
color={theme.palette.text.primary}
sx={{ wordBreak: "break-word" }}
>
{currentQuestion.title}
</Typography>
<Box
sx={{
display: "flex", display: "flex",
marginTop: "20px", marginTop: "20px",
flexDirection: isMobile ? "column-reverse" : undefined, flexDirection: isMobile ? "column-reverse" : undefined,
gap: isMobile ? "30px" : undefined, gap: isMobile ? "30px" : undefined,
alignItems: isMobile ? "center" : undefined alignItems: isMobile ? "center" : undefined,
}}
}}> >
<RadioGroup <RadioGroup
name={currentQuestion.id} name={currentQuestion.id}
value={currentQuestion.content.variants.findIndex( value={currentQuestion.content.variants.findIndex(
@ -61,10 +66,17 @@ export const Varimg = ({ currentQuestion }: VarimgProps) => {
flexDirection: "row", flexDirection: "row",
justifyContent: "space-between", justifyContent: "space-between",
flexBasis: "100%", flexBasis: "100%",
width: isMobile ? "100%" : undefined width: isMobile ? "100%" : undefined,
}}
>
<Box
sx={{
display: "flex",
flexDirection: "column",
width: "100%",
gap: isMobile ? "20px" : undefined,
}} }}
> >
<Box sx={{ display: "flex", flexDirection: "column", width: "100%", gap: isMobile ? "20px" : undefined }}>
{currentQuestion.content.variants.map((variant, index) => ( {currentQuestion.content.variants.map((variant, index) => (
<FormControlLabel <FormControlLabel
key={variant.id} key={variant.id}
@ -74,9 +86,16 @@ export const Varimg = ({ currentQuestion }: VarimgProps) => {
borderRadius: "5px", borderRadius: "5px",
padding: "15px", padding: "15px",
color: theme.palette.text.primary, color: theme.palette.text.primary,
backgroundColor: quizThemes[settings.cfg.theme].isLight ? "white" : theme.palette.background.default, backgroundColor: settings.cfg.design
? "rgba(154,154,175, 0.2)"
: quizThemes[settings.cfg.theme].isLight
? "white"
: theme.palette.background.default,
border: `1px solid`, border: `1px solid`,
borderColor: answer === variant.id ? theme.palette.primary.main : "#9A9AAF", borderColor:
answer === variant.id
? theme.palette.primary.main
: "#9A9AAF",
display: "flex", display: "flex",
margin: isMobile ? 0 : undefined, margin: isMobile ? 0 : undefined,
"& .MuiFormControlLabel-label": { "& .MuiFormControlLabel-label": {
@ -90,7 +109,7 @@ export const Varimg = ({ currentQuestion }: VarimgProps) => {
}, },
"&::-webkit-scrollbar-thumb": { "&::-webkit-scrollbar-thumb": {
backgroundColor: "#b8babf", backgroundColor: "#b8babf",
} },
}, },
}} }}
value={index} value={index}
@ -99,7 +118,6 @@ export const Varimg = ({ currentQuestion }: VarimgProps) => {
setIsSending(true); setIsSending(true);
try { try {
await sendAnswer({ await sendAnswer({
questionId: currentQuestion.id, questionId: currentQuestion.id,
body: `${currentQuestion.content.variants[index].answer} <img style="width:100%; max-width:250px; max-height:250px" src="${currentQuestion.content.variants[index].extendedText}"/>`, body: `${currentQuestion.content.variants[index].answer} <img style="width:100%; max-width:250px; max-height:250px" src="${currentQuestion.content.variants[index].extendedText}"/>`,
@ -111,21 +129,17 @@ export const Varimg = ({ currentQuestion }: VarimgProps) => {
currentQuestion.content.variants[index].id, currentQuestion.content.variants[index].id,
currentQuestion.content.variants[index].points || 0 currentQuestion.content.variants[index].points || 0
); );
} catch (e) { } catch (e) {
enqueueSnackbar("ответ не был засчитан"); enqueueSnackbar("ответ не был засчитан");
} }
if (answer === currentQuestion.content.variants[index].id) { if (answer === currentQuestion.content.variants[index].id) {
try { try {
await sendAnswer({ await sendAnswer({
questionId: currentQuestion.id, questionId: currentQuestion.id,
body: "", body: "",
qid: quizId, qid: quizId,
}); });
} catch (e) { } catch (e) {
enqueueSnackbar("ответ не был засчитан"); enqueueSnackbar("ответ не был засчитан");
} }
@ -135,7 +149,12 @@ export const Varimg = ({ currentQuestion }: VarimgProps) => {
setIsSending(false); setIsSending(false);
}} }}
control={ control={
<Radio checkedIcon={<RadioCheck color={theme.palette.primary.main} />} icon={<RadioIcon />} /> <Radio
checkedIcon={
<RadioCheck color={theme.palette.primary.main} />
}
icon={<RadioIcon />}
/>
} }
label={variant.answer} label={variant.answer}
/> />
@ -156,7 +175,7 @@ export const Varimg = ({ currentQuestion }: VarimgProps) => {
justifyContent: "center", justifyContent: "center",
backgroundColor: "#9A9AAF12", backgroundColor: "#9A9AAF12",
color: "#9A9AAF", color: "#9A9AAF",
textAlign: "center" textAlign: "center",
}} }}
> >
{answer ? ( {answer ? (
@ -169,25 +188,25 @@ export const Varimg = ({ currentQuestion }: VarimgProps) => {
) : ( ) : (
<BlankImage /> <BlankImage />
) )
) : currentQuestion.content.back !== " " ) : currentQuestion.content.back !== " " &&
&& currentQuestion.content.back !== null currentQuestion.content.back !== null &&
&& currentQuestion.content.back.length > 0 currentQuestion.content.back.length > 0 ? (
? (
<img <img
src={currentQuestion.content.back} src={currentQuestion.content.back}
style={{ width: "100%", height: "100%", objectFit: "cover" }} style={{ width: "100%", height: "100%", objectFit: "cover" }}
alt="" alt=""
/> />
) : (currentQuestion.content.replText !== " " && currentQuestion.content.replText.length > 0) ? currentQuestion.content.replText : variant?.extendedText || isMobile ? ( ) : currentQuestion.content.replText !== " " &&
currentQuestion.content.replText.length > 0 ? (
currentQuestion.content.replText
) : variant?.extendedText || isMobile ? (
"Выберите вариант ответа ниже" "Выберите вариант ответа ниже"
) : ( ) : (
"Выберите вариант ответа слева" "Выберите вариант ответа слева"
)} )}
</Box> </Box>
{/* )} */} {/* )} */}
</Box> </Box>
</Box> </Box>
); );
}; };

@ -121,8 +121,7 @@ export const Select = ({
"& .MuiTypography-root": { "& .MuiTypography-root": {
overflow: "hidden", overflow: "hidden",
textOverflow: "ellipsis", textOverflow: "ellipsis",
} },
}, },
}} }}
IconComponent={(props) => <ArrowDown {...props} />} IconComponent={(props) => <ArrowDown {...props} />}
@ -139,7 +138,7 @@ export const Select = ({
borderRadius: "5px", borderRadius: "5px",
color: colorPlaceholder, color: colorPlaceholder,
whiteSpace: "normal", whiteSpace: "normal",
wordBreak: "break-word" wordBreak: "break-word",
}} }}
> >
{item} {item}

@ -21,7 +21,17 @@ export type QuizTheme =
| "GoldDarkTheme" | "GoldDarkTheme"
| "PurpleTheme" | "PurpleTheme"
| "BlueTheme" | "BlueTheme"
| "BlueDarkTheme"; | "BlueDarkTheme"
| "Design1"
| "Design2"
| "Design3"
| "Design4"
| "Design5"
| "Design6"
| "Design7"
| "Design8"
| "Design9"
| "Design10";
export type FCField = { export type FCField = {
text: string; text: string;
@ -47,18 +57,6 @@ export type QuizSettings = {
recentlyCompleted: boolean; recentlyCompleted: boolean;
}; };
export type Design =
| ""
| "design1"
| "design2"
| "design3"
| "design4"
| "design5"
| "design6"
| "design7"
| "design8"
| "design9"
| "design10";
export interface QuizConfig { export interface QuizConfig {
spec: undefined | true; spec: undefined | true;
@ -69,7 +67,7 @@ export interface QuizConfig {
results: QuizResultsType; results: QuizResultsType;
haveRoot: string | null; haveRoot: string | null;
theme: QuizTheme; theme: QuizTheme;
design: Design; design: boolean;
resultInfo: { resultInfo: {
when: "email" | ""; when: "email" | "";
share: boolean; share: boolean;

37
lib/ui_kit/Stepper.tsx Normal file

@ -0,0 +1,37 @@
import { useTheme } from "@mui/material";
import MobileStepper from "@mui/material/MobileStepper";
interface Props {
activeStep: number;
steps: number;
}
export default function ProgressMobileStepper({ activeStep, steps }: Props) {
const theme = useTheme();
return (
<MobileStepper
variant="progress"
steps={steps + 1}
position="static"
activeStep={activeStep}
sx={{
width: "100%",
padding: "10px 0 0",
background: "transparent",
"& .MuiLinearProgress-root": {
height: "4px",
background: theme.palette.primary.light,
width: "100%",
opacity: 0.5,
},
"& .MuiLinearProgress-bar": {
background: theme.palette.primary.main,
opacity: 1,
},
}}
nextButton={<></>}
backButton={<></>}
/>
);
}

@ -1,7 +1,8 @@
import { QuizTheme } from "@model/settingsData"; import { createTheme } from "@mui/material";
import { Theme, createTheme } from "@mui/material";
import themePublic from "./genericPublication"; import themePublic from "./genericPublication";
import type { Theme } from "@mui/material";
import type { QuizTheme } from "@model/settingsData";
const StandardTheme = createTheme({ const StandardTheme = createTheme({
...themePublic, ...themePublic,
@ -10,7 +11,7 @@ const StandardTheme = createTheme({
main: "#7E2AEA", main: "#7E2AEA",
}, },
secondary: { secondary: {
main: "#252734" main: "#252734",
}, },
text: { text: {
primary: "#333647", primary: "#333647",
@ -20,8 +21,8 @@ const StandardTheme = createTheme({
background: { background: {
default: "#FFFFFF", default: "#FFFFFF",
}, },
} },
}) });
const StandardDarkTheme = createTheme({ const StandardDarkTheme = createTheme({
...themePublic, ...themePublic,
@ -30,7 +31,7 @@ const StandardDarkTheme = createTheme({
main: "#7E2AEA", main: "#7E2AEA",
}, },
secondary: { secondary: {
main: "#252734" main: "#252734",
}, },
text: { text: {
primary: "#FFFFFF", primary: "#FFFFFF",
@ -40,8 +41,8 @@ const StandardDarkTheme = createTheme({
background: { background: {
default: "#333647", default: "#333647",
}, },
} },
}) });
const PinkTheme = createTheme({ const PinkTheme = createTheme({
...themePublic, ...themePublic,
@ -50,7 +51,7 @@ const PinkTheme = createTheme({
main: "#D34085", main: "#D34085",
}, },
secondary: { secondary: {
main: "#252734" main: "#252734",
}, },
text: { text: {
primary: "#333647", primary: "#333647",
@ -60,8 +61,8 @@ const PinkTheme = createTheme({
background: { background: {
default: "#FFF9FC", default: "#FFF9FC",
}, },
} },
}) });
const PinkDarkTheme = createTheme({ const PinkDarkTheme = createTheme({
...themePublic, ...themePublic,
@ -70,7 +71,7 @@ const PinkDarkTheme = createTheme({
main: "#D34085", main: "#D34085",
}, },
secondary: { secondary: {
main: "#252734" main: "#252734",
}, },
text: { text: {
primary: "#FFFFFF", primary: "#FFFFFF",
@ -80,8 +81,8 @@ const PinkDarkTheme = createTheme({
background: { background: {
default: "#333647", default: "#333647",
}, },
} },
}) });
const BlackWhiteTheme = createTheme({ const BlackWhiteTheme = createTheme({
...themePublic, ...themePublic,
@ -90,7 +91,7 @@ const BlackWhiteTheme = createTheme({
main: "#4E4D51", main: "#4E4D51",
}, },
secondary: { secondary: {
main: "#252734" main: "#252734",
}, },
text: { text: {
primary: "#333647", primary: "#333647",
@ -100,8 +101,8 @@ const BlackWhiteTheme = createTheme({
background: { background: {
default: "#FFFFFF", default: "#FFFFFF",
}, },
} },
}) });
const OliveTheme = createTheme({ const OliveTheme = createTheme({
...themePublic, ...themePublic,
@ -110,7 +111,7 @@ const OliveTheme = createTheme({
main: "#758E4F", main: "#758E4F",
}, },
secondary: { secondary: {
main: "#252734" main: "#252734",
}, },
text: { text: {
primary: "#333647", primary: "#333647",
@ -120,8 +121,8 @@ const OliveTheme = createTheme({
background: { background: {
default: "#F9FBF1", default: "#F9FBF1",
}, },
} },
}) });
const PurpleTheme = createTheme({ const PurpleTheme = createTheme({
...themePublic, ...themePublic,
@ -130,7 +131,7 @@ const PurpleTheme = createTheme({
main: "#7E2AEA", main: "#7E2AEA",
}, },
secondary: { secondary: {
main: "#252734" main: "#252734",
}, },
text: { text: {
primary: "#333647", primary: "#333647",
@ -140,8 +141,8 @@ const PurpleTheme = createTheme({
background: { background: {
default: "#FBF8FF", default: "#FBF8FF",
}, },
} },
}) });
const YellowTheme = createTheme({ const YellowTheme = createTheme({
...themePublic, ...themePublic,
@ -150,7 +151,7 @@ const YellowTheme = createTheme({
main: "#F2B133", main: "#F2B133",
}, },
secondary: { secondary: {
main: "#252734" main: "#252734",
}, },
text: { text: {
primary: "#333647", primary: "#333647",
@ -160,8 +161,8 @@ const YellowTheme = createTheme({
background: { background: {
default: "#FFFCF6", default: "#FFFCF6",
}, },
} },
}) });
const GoldDarkTheme = createTheme({ const GoldDarkTheme = createTheme({
...themePublic, ...themePublic,
@ -180,8 +181,8 @@ const GoldDarkTheme = createTheme({
background: { background: {
default: "#333647", default: "#333647",
}, },
} },
}) });
const BlueTheme = createTheme({ const BlueTheme = createTheme({
...themePublic, ...themePublic,
@ -190,7 +191,7 @@ const BlueTheme = createTheme({
main: "#4964ED", main: "#4964ED",
}, },
secondary: { secondary: {
main: "#252734" main: "#252734",
}, },
text: { text: {
primary: "#333647", primary: "#333647",
@ -200,8 +201,8 @@ const BlueTheme = createTheme({
background: { background: {
default: "#F5F7FF", default: "#F5F7FF",
}, },
} },
}) });
const BlueDarkTheme = createTheme({ const BlueDarkTheme = createTheme({
...themePublic, ...themePublic,
@ -210,7 +211,7 @@ const BlueDarkTheme = createTheme({
main: "#07A0C3", main: "#07A0C3",
}, },
secondary: { secondary: {
main: "#252734" main: "#252734",
}, },
text: { text: {
primary: "#FFFFFF", primary: "#FFFFFF",
@ -220,10 +221,211 @@ const BlueDarkTheme = createTheme({
background: { background: {
default: "#333647", default: "#333647",
}, },
} },
}) });
export const quizThemes: Record<QuizTheme, { theme: Theme; isLight: boolean; }> = { const Design1 = createTheme({
...themePublic,
palette: {
primary: {
main: "#F2B133",
},
secondary: {
main: "#252734",
},
text: {
primary: "#333647",
secondary: "#F2B133",
},
background: {
default: "#FFFCF6",
},
},
});
const Design2 = createTheme({
...themePublic,
palette: {
primary: {
main: "#758E4F",
},
secondary: {
main: "#252734",
},
text: {
primary: "#333647",
secondary: "#758E4F",
},
background: {
default: "#F9FBF1",
},
},
});
const Design3 = createTheme({
...themePublic,
palette: {
primary: {
main: "#07A0C3",
},
secondary: {
main: "#252734",
},
text: {
primary: "#FFFFFF",
secondary: "#07A0C3",
},
background: {
default: "#333647",
},
},
});
const Design4 = createTheme({
...themePublic,
palette: {
primary: {
main: "#F2B133",
},
secondary: {
main: "#252734",
},
text: {
primary: "#333647",
secondary: "#F2B133",
},
background: {
default: "#FFFCF6",
},
},
});
const Design5 = createTheme({
...themePublic,
palette: {
primary: {
main: "#07A0C3",
},
secondary: {
main: "#252734",
},
text: {
primary: "#FFFFFF",
secondary: "#07A0C3",
},
background: {
default: "#333647",
},
},
});
const Design6 = createTheme({
...themePublic,
palette: {
primary: {
main: "#D34085",
},
secondary: {
main: "#252734",
},
text: {
primary: "#FFFFFF",
secondary: "#D34085",
},
background: {
default: "#333647",
},
},
});
const Design8 = createTheme({
...themePublic,
palette: {
primary: {
main: "#D34085",
},
secondary: {
main: "#252734",
},
text: {
primary: "#FFFFFF",
secondary: "#D34085",
},
background: {
default: "#333647",
},
},
});
const Design7 = createTheme({
...themePublic,
palette: {
primary: {
main: "#F2B133",
},
secondary: {
main: "#252734",
},
text: {
primary: "#333647",
secondary: "#F2B133",
},
background: {
default: "#FFFCF6",
},
},
});
const Design9 = createTheme({
...themePublic,
palette: {
primary: {
main: "#758E4F",
},
secondary: {
main: "#252734",
},
text: {
primary: "#333647",
secondary: "#758E4F",
},
background: {
default: "#F9FBF1",
},
},
});
const Design10 = createTheme({
...themePublic,
palette: {
primary: {
main: "#07A0C3",
},
secondary: {
main: "#252734",
},
text: {
primary: "#FFFFFF",
secondary: "#07A0C3",
},
background: {
default: "#333647",
},
},
});
export const quizThemes: Record<QuizTheme, { theme: Theme; isLight: boolean }> =
{
StandardTheme: { theme: StandardTheme, isLight: true }, StandardTheme: { theme: StandardTheme, isLight: true },
StandardDarkTheme: { theme: StandardDarkTheme, isLight: false }, StandardDarkTheme: { theme: StandardDarkTheme, isLight: false },
PinkTheme: { theme: PinkTheme, isLight: true }, PinkTheme: { theme: PinkTheme, isLight: true },
@ -235,4 +437,14 @@ export const quizThemes: Record<QuizTheme, { theme: Theme; isLight: boolean; }>
PurpleTheme: { theme: PurpleTheme, isLight: true }, PurpleTheme: { theme: PurpleTheme, isLight: true },
BlueTheme: { theme: BlueTheme, isLight: true }, BlueTheme: { theme: BlueTheme, isLight: true },
BlueDarkTheme: { theme: BlueDarkTheme, isLight: false }, BlueDarkTheme: { theme: BlueDarkTheme, isLight: false },
}; Design1: { theme: Design1, isLight: false },
Design2: { theme: Design2, isLight: false },
Design3: { theme: Design3, isLight: true },
Design4: { theme: Design4, isLight: false },
Design5: { theme: Design5, isLight: false },
Design6: { theme: Design6, isLight: false },
Design7: { theme: Design7, isLight: false },
Design8: { theme: Design8, isLight: false },
Design9: { theme: Design9, isLight: false },
Design10: { theme: Design10, isLight: false },
};