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

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

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

@ -52,8 +52,11 @@ export const ViewPage = () => {
questions.filter(({ type }) => type) as AnyTypedQuizQuestion[] questions.filter(({ type }) => type) as AnyTypedQuizQuestion[]
).sort((previousItem, item) => previousItem.page - item.page); ).sort((previousItem, item) => previousItem.page - item.page);
console.log(questions)
if (visualStartPage === undefined) return <></>; 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 ( return (
<Box> <Box>
{!visualStartPage ? ( {!visualStartPage ? (

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

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