fix дефолт текст в варианте и картинке, картинка вариантов, чек на пустоту резулта

This commit is contained in:
Nastya 2024-01-06 23:02:37 +03:00
parent 379ace36e2
commit c43a12cd5d
5 changed files with 21 additions and 11 deletions

@ -92,6 +92,7 @@ export const Footer = ({ setCurrentQuestion, question, setShowContactForm, setSh
}
const isEmpty = checkEmptyData({ resultData: nextQuestion })
console.log("isEmpty", isEmpty)
if (nextQuestion) {
if (nextQuestion && settings?.cfg.resultInfo.when === "before") {

@ -52,6 +52,7 @@ export const ResultForm = ({
setShowResultForm(false);
setShowContactForm(true);
};
console.log(resultQuestion)
if (resultQuestion === null || resultQuestion === undefined) {
followNextForm()

@ -111,7 +111,7 @@ export const Variant = ({ currentQuestion }: VariantProps) => {
)}
</Box>
</Group>
{currentQuestion.content.back && (
{currentQuestion.content.back && currentQuestion.content.back !== " " && (
<Box sx={{ maxWidth: "400px", width: "100%", height: "300px" }}>
<img
src={currentQuestion.content.back}

@ -38,7 +38,6 @@ export const Varimg = ({ currentQuestion }: VarimgProps) => {
const variant = currentQuestion.content.variants.find(
({ id }) => answer === id
);
return (
<Box>
<Typography variant="h5" color={theme.palette.text.primary}>{currentQuestion.title}</Typography>
@ -149,7 +148,7 @@ export const Varimg = ({ currentQuestion }: VarimgProps) => {
style={{ width: "100%", height: "100%", objectFit: "cover" }}
alt=""
/>
) : variant?.extendedText || isMobile ? (
) : (currentQuestion.content.replText !== " " && currentQuestion.content.replText.length > 0) ? currentQuestion.content.replText : variant?.extendedText || isMobile ? (
"Выберите вариант ответа ниже"
) : (
"Выберите вариант ответа слева"

@ -2,15 +2,24 @@ import { QuizQuestionResult } from "@model/questionTypes/result"
export const checkEmptyData = ({ resultData }: { resultData: QuizQuestionResult }) => {
let check = true
console.log(resultData)
console.log(resultData.title.length,
resultData.description.length,
resultData.content.back.length,
resultData.content.originalBack.length,
resultData.content.innerName.length,
resultData.content.text.length,
resultData.content.video.length,
resultData.content.hint.text.length )
if (
resultData.title.length > 0 ||
resultData.description.length > 0 ||
resultData.content.back.length > 0 ||
resultData.content.originalBack.length > 0 ||
resultData.content.innerName.length > 0 ||
resultData.content.text.length > 0 ||
resultData.content.video.length > 0 ||
resultData.content.hint.text.length > 0
(resultData.title.length > 0 && resultData.title !== " ") ||
(resultData.description.length > 0 && resultData.description !== " ") ||
(resultData.content.back.length > 0 && resultData.content.back !== " ") ||
(resultData.content.originalBack.length > 0 && resultData.content.originalBack !== " ") ||
(resultData.content.innerName.length > 0 && resultData.content.innerName !== " ") ||
(resultData.content.text.length > 0 && resultData.content.text !== " ") ||
(resultData.content.video.length > 0 && resultData.content.video !== " ") ||
(resultData.content.hint.text.length > 0 && resultData.content.hint.text !== " " )
) check = false
return check
}