diff --git a/src/constants/result.ts b/src/constants/result.ts
index 668c0413..ab8fa049 100644
--- a/src/constants/result.ts
+++ b/src/constants/result.ts
@@ -17,5 +17,6 @@ export const QUIZ_QUESTION_RESULT: Omit<
price: [0],
useImage: true,
usage: true,
+ redirect: "",
},
};
diff --git a/src/model/questionTypes/result.ts b/src/model/questionTypes/result.ts
index 80ab935a..5b084765 100644
--- a/src/model/questionTypes/result.ts
+++ b/src/model/questionTypes/result.ts
@@ -19,5 +19,6 @@ export interface QuizQuestionResult extends QuizQuestionBase {
hint: QuestionHint;
autofill: boolean;
usage: boolean;
+ redirect: string;
};
}
diff --git a/src/model/quizSettings.ts b/src/model/quizSettings.ts
index cee0dbcc..fd3f6e82 100644
--- a/src/model/quizSettings.ts
+++ b/src/model/quizSettings.ts
@@ -65,12 +65,13 @@ export interface QuizConfig {
| "BlueTheme"
| "BlueDarkTheme";
resultInfo: {
- when: "before" | "after" | "email";
+ when: "email" | "";
share: true | false;
replay: true | false;
theme: string;
reply: string;
replname: string;
+ showResultForm: "before" | "after";
};
startpage: {
description: string;
@@ -133,12 +134,13 @@ export const defaultQuizConfig: QuizConfig = {
haveRoot: null,
theme: "StandardTheme",
resultInfo: {
- when: "after",
+ when: "",
share: false,
replay: false,
theme: "",
reply: "",
replname: "",
+ showResultForm: "after",
},
startpage: {
description: "",
diff --git a/src/pages/ContactFormPage/ContactFormPage.tsx b/src/pages/ContactFormPage/ContactFormPage.tsx
index 8b0f4ac0..d77e8b26 100644
--- a/src/pages/ContactFormPage/ContactFormPage.tsx
+++ b/src/pages/ContactFormPage/ContactFormPage.tsx
@@ -265,19 +265,21 @@ const SettingField = ({
-
- updateQuiz(quiz?.id, (quiz) => {
- quiz.config.formContact.fields[type].used = false;
- })
- }
- sx={{
- width: "48px",
- ml: "5px",
- }}
- >
-
-
+ {(type !== "email" || quiz?.config.resultInfo.when !== "email") && (
+
+ updateQuiz(quiz?.id, (quiz) => {
+ quiz.config.formContact.fields[type].used = false;
+ })
+ }
+ sx={{
+ width: "48px",
+ ml: "5px",
+ }}
+ >
+
+
+ )}
>
);
diff --git a/src/pages/ResultPage/ResultSettings.tsx b/src/pages/ResultPage/ResultSettings.tsx
index 97b598d8..14524fae 100644
--- a/src/pages/ResultPage/ResultSettings.tsx
+++ b/src/pages/ResultPage/ResultSettings.tsx
@@ -113,7 +113,7 @@ export const ResultSettings = () => {
- {quiz.config.resultInfo.when === "email" && (
+ {quiz?.config.resultInfo.when === "email" && (
)}
diff --git a/src/pages/ResultPage/cards/ResultCard.tsx b/src/pages/ResultPage/cards/ResultCard.tsx
index 1d75583b..8f325f70 100644
--- a/src/pages/ResultPage/cards/ResultCard.tsx
+++ b/src/pages/ResultPage/cards/ResultCard.tsx
@@ -1,9 +1,10 @@
-import * as React from "react";
+import { useState, useEffect } from "react";
import {
getQuestionByContentId,
updateQuestion,
} from "@root/questions/actions";
+import { useCurrentQuiz } from "@root/quizes/hooks";
import CustomTextField from "@ui_kit/CustomTextField";
@@ -26,9 +27,12 @@ import ExpandLessIcon from "@mui/icons-material/ExpandLess";
import Trash from "@icons/trash";
import Info from "@icons/Info";
import SettingIcon from "@icons/questionsPage/settingIcon";
-import { QuizQuestionResult } from "@model/questionTypes/result";
import { MediaSelectionAndDisplay } from "@ui_kit/MediaSelectionAndDisplay";
+import type { MouseEvent } from "react";
+
+import type { QuizQuestionResult } from "@model/questionTypes/result";
+
interface Props {
resultContract: boolean;
resultData: QuizQuestionResult;
@@ -57,11 +61,9 @@ export const checkEmptyData = ({
const InfoView = ({ resultData }: { resultData: QuizQuestionResult }) => {
const checkEmpty = checkEmptyData({ resultData });
const question = getQuestionByContentId(resultData.content.rule.parentId);
- const [anchorEl, setAnchorEl] = React.useState(
- null,
- );
+ const [anchorEl, setAnchorEl] = useState(null);
- const handleClick = (event: React.MouseEvent) => {
+ const handleClick = (event: MouseEvent) => {
setAnchorEl(event.currentTarget);
};
@@ -126,12 +128,23 @@ export const ResultCard = ({ resultContract, resultData }: Props) => {
const isMobile = useMediaQuery(theme.breakpoints.down(790));
const isTablet = useMediaQuery(theme.breakpoints.down(800));
- const [expand, setExpand] = React.useState(true);
- const [resultCardSettings, setResultCardSettings] = React.useState(false);
- const [buttonPlus, setButtonPlus] = React.useState(true);
+ const [expand, setExpand] = useState(true);
+ const [resultCardSettings, setResultCardSettings] = useState(false);
+ const [buttonPlus, setButtonPlus] = useState(true);
const question = getQuestionByContentId(resultData.content.rule.parentId);
+ const quiz = useCurrentQuiz();
- React.useEffect(() => {
+ useEffect(() => {
+ if (
+ resultData.content.hint.text ||
+ (quiz?.config.resultInfo.showResultForm === "after" &&
+ resultData.content.redirect)
+ ) {
+ setButtonPlus(false);
+ }
+ }, []);
+
+ useEffect(() => {
setExpand(true);
}, [resultContract]);
@@ -390,17 +403,13 @@ export const ResultCard = ({ resultContract, resultData }: Props) => {
-
- updateQuestion(
- resultData.id,
- (question) =>
- (question.content.hint.text = target.value),
- )
+ updateQuestion(resultData.id, (question) => {
+ question.content.hint.text = target.value;
+ })
}
- fullWidth
maxLength={19}
placeholder="Например: узнать подробнее"
sx={{
@@ -421,6 +430,49 @@ export const ResultCard = ({ resultContract, resultData }: Props) => {
},
}}
/>
+
+ {quiz?.config.resultInfo.showResultForm === "after" && (
+ <>
+
+ Cсылка для кнопки
+
+
+ updateQuestion(
+ resultData.id,
+ (question) => {
+ question.content.redirect = target.value;
+ },
+ )
+ }
+ placeholder="https://penahub.ru"
+ sx={{
+ "& .MuiInputBase-root": {
+ backgroundColor: "#F2F3F7",
+ width: isMobile ? undefined : "409px",
+ height: "48px",
+ borderRadius: "8px",
+ },
+ }}
+ inputProps={{
+ sx: {
+ height: "85px",
+ borderRadius: "10px",
+ fontSize: "18px",
+ lineHeight: "21px",
+ py: 0,
+ },
+ }}
+ />
+ >
+ )}
)}
diff --git a/src/pages/ResultPage/cards/WhenCard.tsx b/src/pages/ResultPage/cards/WhenCard.tsx
index a32b5ff8..8374c14e 100644
--- a/src/pages/ResultPage/cards/WhenCard.tsx
+++ b/src/pages/ResultPage/cards/WhenCard.tsx
@@ -22,7 +22,12 @@ import ExpandLessIcon from "@mui/icons-material/ExpandLess";
import ShareNetwork from "@icons/ShareNetwork.svg";
import ArrowCounterClockWise from "@icons/ArrowCounterClockWise.svg";
-const whenValues = [
+type WhenVariants = {
+ title: string;
+ value: "before" | "after";
+};
+
+const whenValues: WhenVariants[] = [
{
title: "До формы контактов",
value: "before",
@@ -31,10 +36,6 @@ const whenValues = [
title: "После формы контактов",
value: "after",
},
- {
- title: "Отправить на E-mail",
- value: "email",
- },
];
interface Props {
@@ -170,7 +171,7 @@ export const WhenCard = ({ quizExpand }: Props) => {
- {expand && (
+ {expand && quiz && (
<>
{
{whenValues.map(({ title, value }, index) => (
- {value === "email" && }
))}
+
+
+
+
{/* {
diff --git a/src/pages/ViewPublicationPage/ContactForm.tsx b/src/pages/ViewPublicationPage/ContactForm.tsx
index dd694179..efbe94b7 100644
--- a/src/pages/ViewPublicationPage/ContactForm.tsx
+++ b/src/pages/ViewPublicationPage/ContactForm.tsx
@@ -186,14 +186,14 @@ export const ContactForm = ({
{
// resultQuestion &&
- // quiz?.config.resultInfo.when === "after" &&
+ // quiz?.config.resultInfo.showResultForm === "after" &&