feat: Backgrounds

This commit is contained in:
IlyaDoronin 2024-03-01 17:08:09 +03:00
parent 394c47a938
commit 284472c5bb
13 changed files with 186 additions and 130 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 692 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 488 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 719 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 256 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

@ -20,7 +20,20 @@ import { NameplateLogoFQ } from "@icons/NameplateLogoFQ";
import { NameplateLogoFQDark } from "@icons/NameplateLogoFQDark";
import { notReachable } from "@utils/notReachable";
import { quizThemes } from "@utils/themes/Publication/themePublication";
import { ReactNode } from "react";
import Desgin1 from "@icons/designs/design1.jpg";
import Desgin2 from "@icons/designs/design2.jpg";
import Desgin3 from "@icons/designs/design3.jpg";
import Desgin4 from "@icons/designs/design4.jpg";
import Desgin5 from "@icons/designs/design5.jpg";
import Desgin6 from "@icons/designs/design6.jpg";
import Desgin7 from "@icons/designs/design7.jpg";
import Desgin8 from "@icons/designs/design8.jpg";
import Desgin9 from "@icons/designs/design9.jpg";
import Desgin10 from "@icons/designs/design10.jpg";
import type { ReactNode } from "react";
import type { Design } from "@model/settingsData";
type Props = {
currentQuestion: RealTypedQuizQuestion;
@ -29,6 +42,20 @@ type Props = {
prevButton: ReactNode;
};
export const DESIGN_LIST: Record<Design, string> = {
"": "",
design1: Desgin1,
design2: Desgin2,
design3: Desgin3,
design4: Desgin4,
design5: Desgin5,
design6: Desgin6,
design7: Desgin7,
design8: Desgin8,
design9: Desgin9,
design10: Desgin10,
};
export const Question = ({
currentQuestion,
currentQuestionStepNumber,
@ -37,52 +64,62 @@ export const Question = ({
}: Props) => {
const theme = useTheme();
const { settings } = useQuizData();
console.log(currentQuestionStepNumber);
const design = DESIGN_LIST[settings.cfg.design];
return (
<Box
sx={{
backgroundColor: theme.palette.background.default,
height: "100%",
backgroundPosition: "center",
backgroundSize: "cover",
backgroundImage: `url(${design})`,
}}
>
<Box
sx={{
height: "calc(100% - 75px)",
width: "100%",
minHeight: "calc(100vh - 75px)",
maxWidth: "1440px",
padding: "40px 25px 20px",
margin: "0 auto",
overflow: "auto",
display: "flex",
flexDirection: "column",
justifyContent: "space-between",
background: design
? "linear-gradient(90deg,#272626, transparent)"
: theme.palette.background.default,
}}
>
<QuestionByType
key={currentQuestion.id}
question={currentQuestion}
<Box
sx={{
height: "calc(100% - 75px)",
width: "100%",
minHeight: "calc(100vh - 75px)",
maxWidth: "1440px",
padding: "40px 25px 20px",
margin: "0 auto",
overflow: "auto",
display: "flex",
flexDirection: "column",
justifyContent: "space-between",
}}
>
<QuestionByType
key={currentQuestion.id}
question={currentQuestion}
stepNumber={currentQuestionStepNumber}
/>
{quizThemes[settings.cfg.theme].isLight ? (
<Link target={"_blank"} href={"https://quiz.pena.digital"}>
<NameplateLogoFQ
style={{ fontSize: "34px", width: "200px", height: "auto" }}
/>
</Link>
) : (
<Link target={"_blank"} href={"https://quiz.pena.digital"}>
<NameplateLogoFQDark
style={{ fontSize: "34px", width: "200px", height: "auto" }}
/>
</Link>
)}
</Box>
<Footer
stepNumber={currentQuestionStepNumber}
prevButton={prevButton}
nextButton={nextButton}
/>
{quizThemes[settings.cfg.theme].isLight ? (
<Link target={"_blank"} href={"https://quiz.pena.digital"}>
<NameplateLogoFQ
style={{ fontSize: "34px", width: "200px", height: "auto" }}
/>
</Link>
) : (
<Link target={"_blank"} href={"https://quiz.pena.digital"}>
<NameplateLogoFQDark
style={{ fontSize: "34px", width: "200px", height: "auto" }}
/>
</Link>
)}
</Box>
<Footer
stepNumber={currentQuestionStepNumber}
prevButton={prevButton}
nextButton={nextButton}
/>
</Box>
);
};

@ -18,6 +18,8 @@ import { setCurrentQuizStep } from "@stores/quizView";
import { useUADevice } from "@utils/hooks/useUADevice";
import { quizThemes } from "@utils/themes/Publication/themePublication";
import { DESIGN_LIST } from "../Question";
import { NameplateLogo } from "@icons/NameplateLogo";
import PenaLogo from "@icons/PenaLogo.png";
@ -36,7 +38,10 @@ export const StartPageViewPublication = () => {
settings.cfg.startpage.background.type === "image" ? (
settings.cfg.startpage.background.desktop ? (
<img
src={settings.cfg.startpage.background.desktop}
src={
DESIGN_LIST[settings.cfg.design] ||
settings.cfg.startpage.background.desktop
}
alt=""
style={{
width:

@ -11,114 +11,128 @@ export type QuizResultsType = true | null;
export type QuizStep = "startpage" | "question" | "contactform";
export type QuizTheme =
| "StandardTheme"
| "StandardDarkTheme"
| "PinkTheme"
| "PinkDarkTheme"
| "BlackWhiteTheme"
| "OliveTheme"
| "YellowTheme"
| "GoldDarkTheme"
| "PurpleTheme"
| "BlueTheme"
| "BlueDarkTheme";
| "StandardTheme"
| "StandardDarkTheme"
| "PinkTheme"
| "PinkDarkTheme"
| "BlackWhiteTheme"
| "OliveTheme"
| "YellowTheme"
| "GoldDarkTheme"
| "PurpleTheme"
| "BlueTheme"
| "BlueDarkTheme";
export type FCField = {
text: string;
innerText: string;
key: string;
required: boolean;
used: boolean;
text: string;
innerText: string;
key: string;
required: boolean;
used: boolean;
};
export type QuizSettings = {
questions: AnyTypedQuizQuestion[];
settings: {
fp: boolean;
rep: boolean;
name: string;
lim: number;
due: number;
delay: number;
pausable: boolean;
cfg: QuizConfig;
};
cnt: number;
recentlyCompleted: boolean;
questions: AnyTypedQuizQuestion[];
settings: {
fp: boolean;
rep: boolean;
name: string;
lim: number;
due: number;
delay: number;
pausable: boolean;
cfg: QuizConfig;
};
cnt: number;
recentlyCompleted: boolean;
};
export type Design =
| ""
| "design1"
| "design2"
| "design3"
| "design4"
| "design5"
| "design6"
| "design7"
| "design8"
| "design9"
| "design10";
export interface QuizConfig {
spec: undefined | true,
type: QuizType;
noStartPage: boolean;
startpageType: QuizStartpageType;
score?: boolean;
results: QuizResultsType;
haveRoot: string | null;
theme: QuizTheme;
resultInfo: {
when: "email" | "";
share: boolean;
replay: boolean;
theme: string;
reply: string;
replname: string;
showResultForm: "before" | "after";
spec: undefined | true;
type: QuizType;
noStartPage: boolean;
startpageType: QuizStartpageType;
score?: boolean;
results: QuizResultsType;
haveRoot: string | null;
theme: QuizTheme;
design: Design;
resultInfo: {
when: "email" | "";
share: boolean;
replay: boolean;
theme: string;
reply: string;
replname: string;
showResultForm: "before" | "after";
};
startpage: {
description: string;
button: string;
position: QuizStartpageAlignType;
favIcon: string | null;
logo: string | null;
originalLogo: string | null;
background: {
type: null | "image" | "video";
desktop: string | null;
originalDesktop: string | null;
mobile: string | null;
originalMobile: string | null;
video: string | null;
cycle: boolean;
};
startpage: {
description: string;
button: string;
position: QuizStartpageAlignType;
favIcon: string | null;
logo: string | null;
originalLogo: string | null;
background: {
type: null | "image" | "video";
desktop: string | null;
originalDesktop: string | null;
mobile: string | null;
originalMobile: string | null;
video: string | null;
cycle: boolean;
};
};
formContact: {
title: string;
desc: string;
fields: Record<FormContactFieldName, FormContactFieldData>;
button: string;
};
info: {
phonenumber: string;
clickable: boolean;
orgname: string;
site: string;
law?: string;
};
meta: string;
};
formContact: {
title: string;
desc: string;
fields: Record<FormContactFieldName, FormContactFieldData>;
button: string;
};
info: {
phonenumber: string;
clickable: boolean;
orgname: string;
site: string;
law?: string;
};
meta: string;
}
export type FormContactFieldName =
| "name"
| "email"
| "phone"
| "text"
| "address";
| "name"
| "email"
| "phone"
| "text"
| "address";
type FormContactFieldData = {
text: string;
innerText: string;
key: string;
required: boolean;
used: boolean;
text: string;
innerText: string;
key: string;
required: boolean;
used: boolean;
};
export interface QuizItems {
description: string;
id: number;
page: number;
required: boolean;
title: string;
type: string;
content: unknown;
}
description: string;
id: number;
page: number;
required: boolean;
title: string;
type: string;
content: unknown;
}