если в публикации единственный вопрос - результат - не выводить публикацию

This commit is contained in:
Nastya 2023-12-19 23:51:13 +03:00
parent 5f191a258d
commit 60d196fcf5
5 changed files with 10 additions and 5 deletions

@ -51,6 +51,7 @@ export default function QuestionsPageCard({ question, questionIndex, draggablePr
});
}, 200);
console.log(question)
return (
<>
<Paper
@ -85,7 +86,7 @@ export default function QuestionsPageCard({ question, questionIndex, draggablePr
>
<CustomTextField
placeholder={`Заголовок ${questionIndex + 1} вопроса`}
text={question.title}
value={question.title}
onChange={({ target }) => setTitle(target.value)}
sx={{ width: "100%" }}
InputProps={{
@ -224,4 +225,4 @@ const IconAndrom = (questionType: QuestionType | null) => {
default:
return <AnswerGroup color="#9A9AAF" sx={{ height: "22px", width: "20px" }} />;
}
};
};

@ -36,6 +36,7 @@ export const ResultForm = ({
setShowResultForm(false);
setShowContactForm(true);
};
if (resultQuestion === undefined) return <></>
return (
<Box

@ -52,8 +52,11 @@ export const ViewPage = () => {
questions.filter(({ type }) => type) as AnyTypedQuizQuestion[]
).sort((previousItem, item) => previousItem.page - item.page);
console.log(questions)
if (visualStartPage === undefined) return <></>;
if (questions.length === 0) return <ApologyPage message="Нет созданных вопросов"/>
if (questions.length === 0 || (questions.length === 1 && questions[0].type === "result")) return <ApologyPage message="Нет созданных вопросов"/>
return (
<Box>
{!visualStartPage ? (

@ -366,7 +366,7 @@ export default function EditPage() {
</Box>
)}
{quiz.status === "stop" ?
{!canCreatePublic && quiz.config.type !== "form" ?
<Button
variant="contained"
// disabled

@ -30,7 +30,7 @@ export default function CustomTextField({
}: CustomTextFieldProps) {
const theme = useTheme();
const [inputValue, setInputValue] = useState(value || "");
const [inputValue, setInputValue] = useState(value || text || "");
const [isInputActive, setIsInputActive] = useState(false);
const handleInputChange = (event: React.ChangeEvent<HTMLInputElement>) => {