diff --git a/src/pages/Questions/ButtonsOptions.tsx b/src/pages/Questions/ButtonsOptions.tsx index 4a3f3dc2..dd91ec0d 100644 --- a/src/pages/Questions/ButtonsOptions.tsx +++ b/src/pages/Questions/ButtonsOptions.tsx @@ -295,27 +295,26 @@ export default function ButtonsOptions({ > - { - if (question.type === null) { - deleteQuestion(question.id); - } - if (question.content.rule.parentId.length !== 0) { - setOpenDelete(true); - } else { - deleteQuestionWithTimeout(question.id, () => - DeleteFunction(questions, question, quiz), - ); - } - }} - data-cy="delete-question" - > - {(quiz?.config.type !== "form" || - question.id !== questions[0].id) && ( + {(quiz?.config.type !== "form" || question.id !== questions[0].id) && ( + { + if (question.type === null) { + deleteQuestion(question.id); + } + if (question.content.rule.parentId.length !== 0) { + setOpenDelete(true); + } else { + deleteQuestionWithTimeout(question.id, () => + DeleteFunction(questions, question, quiz), + ); + } + }} + data-cy="delete-question" + > - )} - + + )} setOpenDelete(false)}> - { - if (question.type === null) { - deleteQuestion(question.id); - } - if (question.content.rule.parentId.length !== 0) { - setOpenDelete(true); - } else { - deleteQuestionWithTimeout(question.id, () => - DeleteFunction(questions, question, quiz), - ); - } - }} - data-cy="delete-question" - > - - + {(quiz?.config.type !== "form" || question.id !== questions[0].id) && ( + { + if (question.type === null) { + deleteQuestion(question.id); + } + if (question.content.rule.parentId.length !== 0) { + setOpenDelete(true); + } else { + deleteQuestionWithTimeout(question.id, () => + DeleteFunction(questions, question, quiz), + ); + } + }} + data-cy="delete-question" + > + + + )} setOpenDelete(false)}> ( - + {(provided) => ( { const questions = useQuestions().questions.filter((q) => q.type !== "result"); const onDragEnd = ({ destination, source }: DropResult) => { - if (destination) reorderQuestions(source.index, destination.index); + if (destination) { + reorderQuestions(source.index, destination.index); + } }; return (