линейное отображение корректно, + шильдики

This commit is contained in:
Nastya 2023-12-21 22:22:06 +03:00
parent 7df3bc3b31
commit 6417e70736
6 changed files with 108 additions and 68 deletions

File diff suppressed because one or more lines are too long

@ -13,6 +13,7 @@ import { useQuestionsStore } from "@root/quizData/store";
import type { AnyTypedQuizQuestion } from "../../model/questionTypes/shared"; import type { AnyTypedQuizQuestion } from "../../model/questionTypes/shared";
import { enqueueSnackbar } from "notistack"; import { enqueueSnackbar } from "notistack";
import { sendFC } from "@api/quizRelase"; import { sendFC } from "@api/quizRelase";
import { NameplateLogo } from "@icons/NameplateLogo";
type ContactFormProps = { type ContactFormProps = {
currentQuestion: AnyTypedQuizQuestion; currentQuestion: AnyTypedQuizQuestion;
@ -133,6 +134,18 @@ export const ContactForm = ({
</Typography> </Typography>
</Box> </Box>
<Box
sx={{
display: "flex",
alignItems: "center",
mt: "20px"
}}
>
<NameplateLogo style={{ fontSize: "34px" }} />
<Typography sx={{ fontSize: "20px", color: "#4D4D4D", whiteSpace: "nowrap" }}>Сделано на PenaQuiz</Typography>
</Box>
</Paper> </Paper>
</Box > </Box >
</Box > </Box >
@ -221,8 +234,10 @@ const Inputs = (currentQuestion: any) => {
} }
const CustomInput = ({ title, desc, Icon, onChange }: any) => { const CustomInput = ({ title, desc, Icon, onChange }: any) => {
//@ts-ignore
return <Box m="15px 0"> return <Box m="15px 0">
<Typography mb="7px">{title}</Typography> <Typography mb="7px">{title}</Typography>
<TextField <TextField
onChange={onChange} onChange={onChange}
sx={{ sx={{

@ -6,7 +6,7 @@ import { useQuestionsStore } from "@root/quizData/store";
import { getQuestionById } from "@root/quizData/actions"; import { getQuestionById } from "@root/quizData/actions";
import { useQuizViewStore } from "@root/quizView/store"; import { useQuizViewStore } from "@root/quizView/store";
import { enqueueSnackbar } from "notistack"; import { enqueueSnackbar } from "notistack";
import { NameplateLogo } from "@icons/NameplateLogo"; import { NameplateLogoFQ } from "@icons/NameplateLogoFQ";
type FooterProps = { type FooterProps = {
setCurrentQuestion: (step: AnyTypedQuizQuestion) => void; setCurrentQuestion: (step: AnyTypedQuizQuestion) => void;
@ -25,6 +25,7 @@ export const Footer = ({ setCurrentQuestion, question, setShowContactForm, setSh
const [disableNextButton, setDisableNextButton] = useState<boolean>(false); const [disableNextButton, setDisableNextButton] = useState<boolean>(false);
const linear = !items.find(({ content }) => content.rule.parentId === "root"); const linear = !items.find(({ content }) => content.rule.parentId === "root");
console.log("linear ", linear)
useEffect(() => { useEffect(() => {
// Логика для аргумента disabled у кнопки "Назад" // Логика для аргумента disabled у кнопки "Назад"
@ -189,22 +190,10 @@ export const Footer = ({ setCurrentQuestion, question, setShowContactForm, setSh
position: "relative", position: "relative",
padding: "15px 0", padding: "15px 0",
borderTop: `1px solid ${theme.palette.grey[400]}`, borderTop: `1px solid ${theme.palette.grey[400]}`,
height: '75px',
display: "flex"
}} }}
> >
<Box
sx={{
display: "flex",
alignItems: "center",
position: "absolute",
top: "-45px",
left: "50%",
transform: "translateX(-50%)",
gap: "8px",
}}
>
<NameplateLogo style={{ fontSize: "34px" }} />
<Typography sx={{ fontSize: "20px", color: "#4D4D4D", whiteSpace: "nowrap" }}>Сделано на PenaQuiz</Typography>
</Box>
<Box <Box
sx={{ sx={{
width: "100%", width: "100%",
@ -216,6 +205,7 @@ export const Footer = ({ setCurrentQuestion, question, setShowContactForm, setSh
gap: "10px", gap: "10px",
}} }}
> >
<NameplateLogoFQ style={{ fontSize: "34px", width: "200px", height: "auto" }} />
<Box <Box
sx={{ sx={{
display: "flex", display: "flex",
@ -225,26 +215,6 @@ export const Footer = ({ setCurrentQuestion, question, setShowContactForm, setSh
color: theme.palette.grey1.main, color: theme.palette.grey1.main,
}} }}
> >
{/* <Typography>Шаг</Typography>
<Typography
sx={{
display: "flex",
justifyContent: "center",
alignItems: "center",
fontWeight: "bold",
borderRadius: "50%",
width: "30px",
height: "30px",
color: "#FFF",
background: theme.palette.brightPurple.main,
}}
>
{stepNumber} */}
{/* </Typography> */}
{/* <Typography>Из</Typography>
<Typography sx={{ fontWeight: "bold" }}>
{items.length}
</Typography> */}
</Box> </Box>
<Button <Button
disabled={disablePreviousButton} disabled={disablePreviousButton}

@ -42,23 +42,27 @@ const QUESTIONS_MAP: any = {
export const Question = ({ questions }: QuestionProps) => { export const Question = ({ questions }: QuestionProps) => {
const { settings, cnt, items } = useQuestionsStore() const { settings, cnt, items } = useQuestionsStore()
const [currentQuestion, setCurrentQuestion] = const [currentQuestion, setCurrentQuestion] = useState<AnyTypedQuizQuestion>();
useState<AnyTypedQuizQuestion>();
const [showContactForm, setShowContactForm] = useState<boolean>(false); const [showContactForm, setShowContactForm] = useState<boolean>(false);
const [showResultForm, setShowResultForm] = useState<boolean>(false); const [showResultForm, setShowResultForm] = useState<boolean>(false);
useEffect(() => { useEffect(() => {
const nextQuestion = getQuestionById(settings?.cfg.haveRoot || "");
if (nextQuestion?.type) { if (settings?.cfg.haveRoot) {//ветвимся
setCurrentQuestion(nextQuestion); const nextQuestion = getQuestionById(settings?.cfg.haveRoot || "");
return; if (nextQuestion?.type) {
setCurrentQuestion(nextQuestion);
console.log("я нашёл вопрос вперёд всех")
console.log(nextQuestion)
return;
}
} else {//идём прямо
setCurrentQuestion(questions[0]);
} }
setCurrentQuestion(questions[0]); console.log("нулевой элемент списка вопросов ", questions[0])
console.log(currentQuestion)
console.log(questions[0])
}, []); }, []);
if (!currentQuestion) return <>не смог отобразить вопрос</>; if (!currentQuestion) return <>не смог отобразить вопрос</>;
@ -66,9 +70,12 @@ export const Question = ({ questions }: QuestionProps) => {
const QuestionComponent = const QuestionComponent =
QUESTIONS_MAP[currentQuestion.type as Exclude<QuestionType, "nonselected">]; QUESTIONS_MAP[currentQuestion.type as Exclude<QuestionType, "nonselected">];
console.log("showResultForm " , showResultForm) console.log("showResultForm ", showResultForm)
console.log("currentQuestion ", currentQuestion)
return ( return (
<Box> <Box
height="100vh"
>
{!showContactForm && !showResultForm && ( {!showContactForm && !showResultForm && (
<Box <Box
sx={{ sx={{

@ -4,6 +4,7 @@ import { useQuestionsStore } from "@root/quizData/store"
import type { QuizQuestionResult } from "@model/questionTypes/result"; import type { QuizQuestionResult } from "@model/questionTypes/result";
import YoutubeEmbedIframe from "./tools/YoutubeEmbedIframe" import YoutubeEmbedIframe from "./tools/YoutubeEmbedIframe"
import { NameplateLogo } from "@icons/NameplateLogo";
type ResultFormProps = { type ResultFormProps = {
currentQuestion: any; currentQuestion: any;
@ -60,12 +61,12 @@ export const ResultForm = ({
}} }}
> >
{ {
//@ts-ignore //@ts-ignore
!resultQuestion?.content.useImage && !resultQuestion?.content.useImage &&
//@ts-ignore //@ts-ignore
resultQuestion.content.video && resultQuestion.content.video &&
<YoutubeEmbedIframe <YoutubeEmbedIframe
//@ts-ignore //@ts-ignore
videoUrl={resultQuestion.content.video} videoUrl={resultQuestion.content.video}
containerSX={{ containerSX={{
width: "490px", width: "490px",
@ -74,7 +75,7 @@ export const ResultForm = ({
/> />
} }
{ {
//@ts-ignore //@ts-ignore
resultQuestion?.content.useImage && resultQuestion?.content.useImage &&
resultQuestion.content.back && resultQuestion.content.back &&
<Box <Box
@ -104,31 +105,55 @@ export const ResultForm = ({
</Box> </Box>
{ <Box width="100%">
settings?.cfg.resultInfo.when === "before" &&
<Box <Box
sx={{ sx={{
height: "100px",
boxShadow: "0 0 15px 0 rgba(0,0,0,.08)",
width: "100%",
display: "flex", display: "flex",
justifyContent: "center", width: "100%",
alignItems: "center" justifyContent: "end",
px: "20px"
}} }}
> >
<Button <Box
onClick={followNextForm}
variant="contained"
sx={{ sx={{
p: "10px 20px", display: "flex",
width: "210px", alignItems: "center",
height: "50px" mt: "15px"
}} }}
> >
{resultQuestion.content.hint.text || "Узнать подробнее"} <NameplateLogo style={{ fontSize: "34px" }} />
</Button> <Typography sx={{ fontSize: "20px", color: "#4D4D4D", whiteSpace: "nowrap" }}>Сделано на PenaQuiz</Typography>
</Box>
</Box> </Box>
}
{
settings?.cfg.resultInfo.when === "before" &&
<Box
sx={{
height: "100px",
boxShadow: "0 0 15px 0 rgba(0,0,0,.08)",
width: "100%",
display: "flex",
justifyContent: "center",
alignItems: "center"
}}
>
<Button
onClick={followNextForm}
variant="contained"
sx={{
p: "10px 20px",
width: "210px",
height: "50px"
}}
>
{resultQuestion.content.hint.text || "Узнать подробнее"}
</Button>
</Box>
}
</Box>
</Box> </Box>
); );
} }

@ -16,7 +16,7 @@ const QID =
process.env.NODE_ENV === "production" ? process.env.NODE_ENV === "production" ?
window.location.pathname.replace(/\//g, '') window.location.pathname.replace(/\//g, '')
: :
"e593a043-8ad2-4e16-9bf2-afb4f28385eb" "e0857d80-2cdb-43cc-bc00-04c0af725da1"
export const ViewPage = () => { export const ViewPage = () => {
@ -36,7 +36,7 @@ export const ViewPage = () => {
const parseData = { const parseData = {
settings: { settings: {
//@ts-ignore //@ts-ignore
qid: window.location.pathname.replace(/\//g, '') || "e593a043-8ad2-4e16-9bf2-afb4f28385eb", qid: window.location.pathname.replace(/\//g, '') || "e0857d80-2cdb-43cc-bc00-04c0af725da1",
fp: settings.fp, fp: settings.fp,
rep: settings.rep, rep: settings.rep,
name: settings.name, name: settings.name,
@ -75,7 +75,7 @@ export const ViewPage = () => {
},[]) },[])
useEffect(() => { useEffect(() => {//установка фавиконки
if (Object.values(settings).length > 0) { if (Object.values(settings).length > 0) {
console.log(settings) console.log(settings)