если потомков 0 - делать резулт, кнопка выбора поля в ФК открывает правильную страницу

This commit is contained in:
Nastya 2023-12-16 08:04:51 +03:00
parent a30f36176a
commit 47808b382b
5 changed files with 26 additions and 10 deletions

@ -59,6 +59,8 @@ export interface QuizConfig {
};
};
formContact: {
title: string;
desc: string;
name: FCField;
email: FCField;
phone: FCField;
@ -123,6 +125,8 @@ export const defaultQuizConfig: QuizConfig = {
law: "",
},
formContact: {
title: "",
desc: "",
name: {
text: "",
innerText: "",

@ -115,8 +115,8 @@ export default function ContactFormPage() {
<Box sx={{ display: "flex", justifyContent: "space-between", maxWidth: "796px" }}>
<Box sx={{ display: "flex", gap: "8px" }}>
<Button
onClick={decrementCurrentStep}
variant="outlined">
onClick={decrementCurrentStep}
variant="outlined">
<ArrowLeft />
</Button>
<Button variant="contained" sx={{ padding: "10px 20px" }} onClick={incrementCurrentStep}>
@ -142,6 +142,7 @@ interface Props {
function ContactFormParent({ outerContainerSx: sx, children }: Props) {
const theme = useTheme();
const isTablet = useMediaQuery(theme.breakpoints.down(1000))
const quiz = useCurrentQuiz()
return (
<Paper
sx={{
@ -164,8 +165,22 @@ function ContactFormParent({ outerContainerSx: sx, children }: Props) {
gap: "20px",
}}
>
<CustomTextField placeholder="Заголовок формы" text={""} />
<CustomTextField
onChange={({ target }) => {
updateQuiz(quiz.id, (quiz) => {
quiz.config.formContact.title = target.value
})
}}
value={quiz.config.formContact.title}
placeholder="Заголовок формы" text={""} />
<TextField
onChange={({ target }) => {
updateQuiz(quiz.id, (quiz) => {
quiz.config.formContact.desc = target.value
})
}}
value={quiz.config.formContact.desc}
id="outlined-multiline-static"
multiline
rows={8}
@ -177,6 +192,7 @@ function ContactFormParent({ outerContainerSx: sx, children }: Props) {
borderRadius: "10px",
alignItems: "start",
color: theme.palette.grey2.main,
color:"black",
},
}}
/>

@ -14,6 +14,7 @@ interface Props {
export default function SwitchNewField({switchState ='name', drawerNewFieldHC}: Props) {
const [SwitchMask, setSwitchMask] = React.useState(false);
console.log(switchState)
const SwitchMaskHC = (bool:boolean) => {
setSwitchMask(bool)
}

@ -14,10 +14,7 @@ export default function WindowNewField({ type, drawerNewFieldHC }: { type: strin
const [switchState, setSwitchState] = React.useState("");
React.useEffect(() => {
for (let val in quiz?.config.formContact) {
console.log(quiz?.config.formContact)
console.log(quiz?.config.formContact[val])
console.log(quiz?.config.formContact[val].used)
if (!quiz?.config.formContact[val].used) {
if (!quiz?.config.formContact[val]?.used && (val !== "title" && val !== "desc" && val !== "button")) {
setSwitchState(val)
return
}
@ -28,8 +25,6 @@ export default function WindowNewField({ type, drawerNewFieldHC }: { type: strin
setSwitchState(data)
}
console.log(switchState)
return (
<>
<Box sx={{ padding: '10px 10px 10px 20px', display: 'flex', justifyContent: 'space-between', alignItems: 'center', background: theme.palette.background.default }}>

@ -274,7 +274,7 @@ console.log('AN2', parentNodeContentId,parentNodeChildren,targetQuestion)
const parentQuestionContentId = cy?.$('edge[target = "' + targetNodeContentId + '"]')?.toArray()?.[0]?.data()?.source
if (targetNodeContentId && parentQuestionContentId) {
if (cy?.edges(`[source="${parentQuestionContentId}"]`).length <= 1)
if (cy?.edges(`[source="${parentQuestionContentId}"]`).length === 0)
createFrontResult(quiz.backendId, parentQuestionContentId)
clearDataAfterRemoveNode({ targetQuestionContentId: targetNodeContentId, parentQuestionContentId })
cy?.remove(cy?.$('#' + targetNodeContentId)).layout(lyopts).run()