Merge branch 'dev' into 'main'
Dev See merge request frontend/squiz!109
This commit is contained in:
commit
17272807ea
@ -43,7 +43,6 @@ async function getQuestionList(body?: Partial<GetQuestionListRequest>) {
|
|||||||
body: { ...defaultGetQuestionListBody, ...body },
|
body: { ...defaultGetQuestionListBody, ...body },
|
||||||
method: "POST",
|
method: "POST",
|
||||||
});
|
});
|
||||||
console.log(response.items);
|
|
||||||
const clearArrayFromEmptySpaceBlaBlaValue = response.items?.map(
|
const clearArrayFromEmptySpaceBlaBlaValue = response.items?.map(
|
||||||
(question) => {
|
(question) => {
|
||||||
let data = question;
|
let data = question;
|
||||||
|
@ -190,7 +190,10 @@ function ContactFormParent({ outerContainerSx: sx, children }: Props) {
|
|||||||
rows={8}
|
rows={8}
|
||||||
placeholder="Дополнительный текст формы"
|
placeholder="Дополнительный текст формы"
|
||||||
sxForm={{
|
sxForm={{
|
||||||
height: "287px",
|
height: "197px",
|
||||||
|
}}
|
||||||
|
sx={{
|
||||||
|
height: "197px",
|
||||||
}}
|
}}
|
||||||
maxLength={300}
|
maxLength={300}
|
||||||
/>
|
/>
|
||||||
|
@ -122,6 +122,7 @@ export default function WindowNewField({ drawerState, closeDrawer }: Props) {
|
|||||||
padding: "20px",
|
padding: "20px",
|
||||||
display: "flex",
|
display: "flex",
|
||||||
gap: "10px",
|
gap: "10px",
|
||||||
|
flexWrap: "wrap",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{buttonSetting.flatMap((e, i) =>
|
{buttonSetting.flatMap((e, i) =>
|
||||||
|
@ -212,7 +212,7 @@ function CsComponent({
|
|||||||
cy?.layout(layoutOptions).run();
|
cy?.layout(layoutOptions).run();
|
||||||
cy?.center(es);
|
cy?.center(es);
|
||||||
} else {
|
} else {
|
||||||
enqueueSnackbar("Добавляемый вопрос не найден");
|
enqueueSnackbar("Перетащите на плюсик вопрос");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
enqueueSnackbar("Quiz не найден");
|
enqueueSnackbar("Quiz не найден");
|
||||||
@ -270,7 +270,6 @@ function CsComponent({
|
|||||||
|
|
||||||
if (!noChild) {
|
if (!noChild) {
|
||||||
//детей больше 1
|
//детей больше 1
|
||||||
console.log("детей ", noChild, " открываем модалку ветвления");
|
|
||||||
//- предупреждаем стор вопросов об открытии модалки ветвления
|
//- предупреждаем стор вопросов об открытии модалки ветвления
|
||||||
updateOpenedModalSettingsId(targetQuestion.content.id);
|
updateOpenedModalSettingsId(targetQuestion.content.id);
|
||||||
}
|
}
|
||||||
@ -294,19 +293,12 @@ function CsComponent({
|
|||||||
//Отработка первичного рендера странички графика
|
//Отработка первичного рендера странички графика
|
||||||
const firstRender = useRef(true);
|
const firstRender = useRef(true);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
console.log("____________ПЕРВЧИНЫЙ РЕНДЕР____________");
|
|
||||||
console.log("______someWorkBackend______", someWorkBackend);
|
|
||||||
|
|
||||||
if (!someWorkBackend && firstRender.current) {
|
if (!someWorkBackend && firstRender.current) {
|
||||||
console.log("цс первично отрабатывает");
|
|
||||||
document
|
document
|
||||||
.querySelector("#root")
|
.querySelector("#root")
|
||||||
?.addEventListener("mouseup", cleardragQuestionContentId);
|
?.addEventListener("mouseup", cleardragQuestionContentId);
|
||||||
const cy = cyRef.current;
|
const cy = cyRef.current;
|
||||||
|
|
||||||
console.log("СПИСОК ЭЛЕМЕНТОВ ЦИТОСКЕЙПА В ПЕРВЧИНЫЙ РЕНДЕР");
|
|
||||||
console.log(cy?.elements());
|
|
||||||
|
|
||||||
const eles = cy?.add(
|
const eles = cy?.add(
|
||||||
storeToNodes(
|
storeToNodes(
|
||||||
questions.filter(
|
questions.filter(
|
||||||
@ -324,7 +316,6 @@ function CsComponent({
|
|||||||
}
|
}
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
console.log("разрендер");
|
|
||||||
document
|
document
|
||||||
.querySelector("#root")
|
.querySelector("#root")
|
||||||
?.removeEventListener("mouseup", cleardragQuestionContentId);
|
?.removeEventListener("mouseup", cleardragQuestionContentId);
|
||||||
|
@ -24,7 +24,6 @@ export const FirstNodeField = ({
|
|||||||
const quiz = useCurrentQuiz();
|
const quiz = useCurrentQuiz();
|
||||||
|
|
||||||
useLayoutEffect(() => {
|
useLayoutEffect(() => {
|
||||||
console.log("компонент с плюсом");
|
|
||||||
updateOpenedModalSettingsId();
|
updateOpenedModalSettingsId();
|
||||||
updateRootContentId(quiz.id, "");
|
updateRootContentId(quiz.id, "");
|
||||||
clearRuleForAll();
|
clearRuleForAll();
|
||||||
|
@ -208,7 +208,6 @@ export const usePopper = ({
|
|||||||
});
|
});
|
||||||
let gearsPopper: Popper | null = null;
|
let gearsPopper: Popper | null = null;
|
||||||
if (node.data().root !== true) {
|
if (node.data().root !== true) {
|
||||||
console.log(node.data("parentType"));
|
|
||||||
const parentQuestion = getQuestionByContentId(
|
const parentQuestion = getQuestionByContentId(
|
||||||
node.data("parentType"),
|
node.data("parentType"),
|
||||||
);
|
);
|
||||||
@ -240,16 +239,12 @@ export const usePopper = ({
|
|||||||
updateOpenedModalSettingsId(item.id());
|
updateOpenedModalSettingsId(item.id());
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log("собираюсь анализировать папашу");
|
|
||||||
console.log("Тип папаши ", parentQuestion.type);
|
|
||||||
if (
|
if (
|
||||||
parentQuestion?.type === "date" ||
|
parentQuestion?.type === "date" ||
|
||||||
parentQuestion?.type === "text" ||
|
parentQuestion?.type === "text" ||
|
||||||
parentQuestion?.type === "number" ||
|
parentQuestion?.type === "number" ||
|
||||||
parentQuestion?.type === "page"
|
parentQuestion?.type === "page"
|
||||||
) {
|
) {
|
||||||
console.log("Шестерня должна быть невидимая");
|
|
||||||
console.log("Тип папаши ", parentQuestion.type);
|
|
||||||
gearElement.classList.add("popper-gear-none");
|
gearElement.classList.add("popper-gear-none");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -173,7 +173,6 @@ export const useRemoveNode = ({
|
|||||||
quiz &&
|
quiz &&
|
||||||
cy?.edges(`[source="${parentQuestionContentId}"]`).length === 0
|
cy?.edges(`[source="${parentQuestionContentId}"]`).length === 0
|
||||||
) {
|
) {
|
||||||
console.log(parentQuestionContentId);
|
|
||||||
//createFrontResult(quiz.backendId, parentQuestionContentId);
|
//createFrontResult(quiz.backendId, parentQuestionContentId);
|
||||||
}
|
}
|
||||||
clearDataAfterRemoveNode({
|
clearDataAfterRemoveNode({
|
||||||
|
@ -8,7 +8,6 @@ import { useUiTools } from "@root/uiTools/store";
|
|||||||
|
|
||||||
export const BranchingMap = () => {
|
export const BranchingMap = () => {
|
||||||
const quiz = useCurrentQuiz();
|
const quiz = useCurrentQuiz();
|
||||||
console.log("рендер странички ветвления");
|
|
||||||
const { dragQuestionContentId } = useUiTools();
|
const { dragQuestionContentId } = useUiTools();
|
||||||
const [modalQuestionParentContentId, setModalQuestionParentContentId] =
|
const [modalQuestionParentContentId, setModalQuestionParentContentId] =
|
||||||
useState<string>("");
|
useState<string>("");
|
||||||
|
@ -44,9 +44,17 @@ interface Props {
|
|||||||
SSHC: (data: string) => void;
|
SSHC: (data: string) => void;
|
||||||
question: AnyTypedQuizQuestion;
|
question: AnyTypedQuizQuestion;
|
||||||
sx?: SxProps;
|
sx?: SxProps;
|
||||||
|
openBranchingPage: boolean;
|
||||||
|
setOpenBranchingPage: (a: boolean) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function ButtonsOptions({ SSHC, switchState, question }: Props) {
|
export default function ButtonsOptions({
|
||||||
|
SSHC,
|
||||||
|
switchState,
|
||||||
|
question,
|
||||||
|
openBranchingPage,
|
||||||
|
setOpenBranchingPage,
|
||||||
|
}: Props) {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const isMobile = useMediaQuery(theme.breakpoints.down(790));
|
const isMobile = useMediaQuery(theme.breakpoints.down(790));
|
||||||
const isWrappMiniButtonSetting = useMediaQuery(theme.breakpoints.down(920));
|
const isWrappMiniButtonSetting = useMediaQuery(theme.breakpoints.down(920));
|
||||||
@ -55,6 +63,7 @@ export default function ButtonsOptions({ SSHC, switchState, question }: Props) {
|
|||||||
const [openDelete, setOpenDelete] = useState<boolean>(false);
|
const [openDelete, setOpenDelete] = useState<boolean>(false);
|
||||||
|
|
||||||
const openedModal = () => {
|
const openedModal = () => {
|
||||||
|
setOpenBranchingPage(true);
|
||||||
updateDesireToOpenABranchingModal(question.content.id);
|
updateDesireToOpenABranchingModal(question.content.id);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -95,6 +104,7 @@ export default function ButtonsOptions({ SSHC, switchState, question }: Props) {
|
|||||||
title: "Ветвление",
|
title: "Ветвление",
|
||||||
value: "branching",
|
value: "branching",
|
||||||
myFunc: (question) => {
|
myFunc: (question) => {
|
||||||
|
setOpenBranchingPage(true);
|
||||||
updateDesireToOpenABranchingModal(question.content.id);
|
updateDesireToOpenABranchingModal(question.content.id);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -45,13 +45,18 @@ interface Props {
|
|||||||
switchState: string;
|
switchState: string;
|
||||||
SSHC: (data: string) => void;
|
SSHC: (data: string) => void;
|
||||||
question: QuizQuestionVariant | QuizQuestionVarImg;
|
question: QuizQuestionVariant | QuizQuestionVarImg;
|
||||||
|
openBranchingPage: boolean;
|
||||||
|
setOpenBranchingPage: (a: boolean) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function ButtonsOptionsAndPict({
|
export default function ButtonsOptionsAndPict({
|
||||||
SSHC,
|
SSHC,
|
||||||
switchState,
|
switchState,
|
||||||
question,
|
question,
|
||||||
|
openBranchingPage,
|
||||||
|
setOpenBranchingPage,
|
||||||
}: Props) {
|
}: Props) {
|
||||||
|
console.log(setOpenBranchingPage);
|
||||||
const [buttonHover, setButtonHover] = useState<string>("");
|
const [buttonHover, setButtonHover] = useState<string>("");
|
||||||
const [openedReallyChangingModal, setOpenedReallyChangingModal] =
|
const [openedReallyChangingModal, setOpenedReallyChangingModal] =
|
||||||
useState<boolean>(false);
|
useState<boolean>(false);
|
||||||
@ -205,6 +210,7 @@ export default function ButtonsOptionsAndPict({
|
|||||||
onMouseEnter={() => setButtonHover("branching")}
|
onMouseEnter={() => setButtonHover("branching")}
|
||||||
onMouseLeave={() => setButtonHover("")}
|
onMouseLeave={() => setButtonHover("")}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
setOpenBranchingPage(true);
|
||||||
updateDesireToOpenABranchingModal(question.content.id);
|
updateDesireToOpenABranchingModal(question.content.id);
|
||||||
}}
|
}}
|
||||||
sx={{
|
sx={{
|
||||||
|
@ -14,9 +14,15 @@ import TooltipClickInfo from "@ui_kit/Toolbars/TooltipClickInfo";
|
|||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
question: QuizQuestionDate;
|
question: QuizQuestionDate;
|
||||||
|
openBranchingPage: boolean;
|
||||||
|
setOpenBranchingPage: (a: boolean) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function DataOptions({ question }: Props) {
|
export default function DataOptions({
|
||||||
|
question,
|
||||||
|
openBranchingPage,
|
||||||
|
setOpenBranchingPage,
|
||||||
|
}: Props) {
|
||||||
const [switchState, setSwitchState] = useState("setting");
|
const [switchState, setSwitchState] = useState("setting");
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const isMobile = useMediaQuery(theme.breakpoints.down(790));
|
const isMobile = useMediaQuery(theme.breakpoints.down(790));
|
||||||
@ -71,6 +77,8 @@ export default function DataOptions({ question }: Props) {
|
|||||||
switchState={switchState}
|
switchState={switchState}
|
||||||
SSHC={SSHC}
|
SSHC={SSHC}
|
||||||
question={question}
|
question={question}
|
||||||
|
openBranchingPage={openBranchingPage}
|
||||||
|
setOpenBranchingPage={setOpenBranchingPage}
|
||||||
/>
|
/>
|
||||||
<SwitchData switchState={switchState} question={question} />
|
<SwitchData switchState={switchState} question={question} />
|
||||||
</>
|
</>
|
||||||
|
@ -15,9 +15,17 @@ type Props = {
|
|||||||
question: AnyTypedQuizQuestion | UntypedQuizQuestion;
|
question: AnyTypedQuizQuestion | UntypedQuizQuestion;
|
||||||
isDragging: boolean;
|
isDragging: boolean;
|
||||||
index: number;
|
index: number;
|
||||||
|
openBranchingPage: boolean;
|
||||||
|
setOpenBranchingPage: (a: boolean) => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
function DraggableListItem({ question, isDragging, index }: Props) {
|
function DraggableListItem({
|
||||||
|
question,
|
||||||
|
isDragging,
|
||||||
|
index,
|
||||||
|
openBranchingPage,
|
||||||
|
setOpenBranchingPage,
|
||||||
|
}: Props) {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const { editSomeQuestion } = useUiTools();
|
const { editSomeQuestion } = useUiTools();
|
||||||
|
|
||||||
@ -87,6 +95,8 @@ function DraggableListItem({ question, isDragging, index }: Props) {
|
|||||||
) : (
|
) : (
|
||||||
<Box sx={{ width: "100%", position: "relative" }}>
|
<Box sx={{ width: "100%", position: "relative" }}>
|
||||||
<QuestionsPageCard
|
<QuestionsPageCard
|
||||||
|
openBranchingPage={openBranchingPage}
|
||||||
|
setOpenBranchingPage={setOpenBranchingPage}
|
||||||
question={question}
|
question={question}
|
||||||
draggableProps={provided.dragHandleProps}
|
draggableProps={provided.dragHandleProps}
|
||||||
isDragging={isDragging}
|
isDragging={isDragging}
|
||||||
|
@ -57,6 +57,8 @@ interface Props {
|
|||||||
draggableProps: DraggableProvidedDragHandleProps | null | undefined;
|
draggableProps: DraggableProvidedDragHandleProps | null | undefined;
|
||||||
isDragging: boolean;
|
isDragging: boolean;
|
||||||
index: number;
|
index: number;
|
||||||
|
openBranchingPage: boolean;
|
||||||
|
setOpenBranchingPage: (a: boolean) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function QuestionsPageCard({
|
export default function QuestionsPageCard({
|
||||||
@ -64,6 +66,8 @@ export default function QuestionsPageCard({
|
|||||||
draggableProps,
|
draggableProps,
|
||||||
isDragging,
|
isDragging,
|
||||||
index,
|
index,
|
||||||
|
openBranchingPage,
|
||||||
|
setOpenBranchingPage,
|
||||||
}: Props) {
|
}: Props) {
|
||||||
const maxLengthTextField = 225;
|
const maxLengthTextField = 225;
|
||||||
|
|
||||||
@ -292,6 +296,7 @@ export default function QuestionsPageCard({
|
|||||||
onClick={() => {
|
onClick={() => {
|
||||||
if (question.type === null) {
|
if (question.type === null) {
|
||||||
deleteQuestion(question.id);
|
deleteQuestion(question.id);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
if (question.content.rule.parentId.length !== 0) {
|
if (question.content.rule.parentId.length !== 0) {
|
||||||
setOpenDelete(true);
|
setOpenDelete(true);
|
||||||
@ -402,7 +407,11 @@ export default function QuestionsPageCard({
|
|||||||
{question.type === null ? (
|
{question.type === null ? (
|
||||||
<TypeQuestions question={question} />
|
<TypeQuestions question={question} />
|
||||||
) : (
|
) : (
|
||||||
<SwitchQuestionsPage question={question} />
|
<SwitchQuestionsPage
|
||||||
|
question={question}
|
||||||
|
openBranchingPage={openBranchingPage}
|
||||||
|
setOpenBranchingPage={setOpenBranchingPage}
|
||||||
|
/>
|
||||||
)}
|
)}
|
||||||
</Box>
|
</Box>
|
||||||
)}
|
)}
|
||||||
|
@ -4,8 +4,14 @@ import type { DropResult } from "react-beautiful-dnd";
|
|||||||
import { DragDropContext, Droppable } from "react-beautiful-dnd";
|
import { DragDropContext, Droppable } from "react-beautiful-dnd";
|
||||||
import DraggableListItem from "./DraggableListItem";
|
import DraggableListItem from "./DraggableListItem";
|
||||||
import { useQuestionsStore } from "@root/questions/store";
|
import { useQuestionsStore } from "@root/questions/store";
|
||||||
|
interface Props {
|
||||||
export const DraggableList = () => {
|
openBranchingPage: boolean;
|
||||||
|
setOpenBranchingPage: (a: boolean) => void;
|
||||||
|
}
|
||||||
|
export const DraggableList = ({
|
||||||
|
openBranchingPage,
|
||||||
|
setOpenBranchingPage,
|
||||||
|
}: Props) => {
|
||||||
const { questions } = useQuestionsStore();
|
const { questions } = useQuestionsStore();
|
||||||
const filteredQuestions = questions.filter(
|
const filteredQuestions = questions.filter(
|
||||||
(question) => question.type !== "result",
|
(question) => question.type !== "result",
|
||||||
@ -21,6 +27,8 @@ export const DraggableList = () => {
|
|||||||
<Box ref={provided.innerRef} {...provided.droppableProps}>
|
<Box ref={provided.innerRef} {...provided.droppableProps}>
|
||||||
{filteredQuestions.map((question, index) => (
|
{filteredQuestions.map((question, index) => (
|
||||||
<DraggableListItem
|
<DraggableListItem
|
||||||
|
openBranchingPage={openBranchingPage}
|
||||||
|
setOpenBranchingPage={setOpenBranchingPage}
|
||||||
key={question.id}
|
key={question.id}
|
||||||
question={question}
|
question={question}
|
||||||
isDragging={snapshot.isDraggingOver}
|
isDragging={snapshot.isDraggingOver}
|
||||||
|
@ -10,9 +10,15 @@ import { useAddAnswer } from "../../../utils/hooks/useAddAnswer";
|
|||||||
import type { QuizQuestionSelect } from "../../../model/questionTypes/select";
|
import type { QuizQuestionSelect } from "../../../model/questionTypes/select";
|
||||||
interface Props {
|
interface Props {
|
||||||
question: QuizQuestionSelect;
|
question: QuizQuestionSelect;
|
||||||
|
openBranchingPage: boolean;
|
||||||
|
setOpenBranchingPage: (a: boolean) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function DropDown({ question }: Props) {
|
export default function DropDown({
|
||||||
|
question,
|
||||||
|
openBranchingPage,
|
||||||
|
setOpenBranchingPage,
|
||||||
|
}: Props) {
|
||||||
const onClickAddAnAnswer = useAddAnswer();
|
const onClickAddAnAnswer = useAddAnswer();
|
||||||
const [switchState, setSwitchState] = useState("setting");
|
const [switchState, setSwitchState] = useState("setting");
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
@ -92,6 +98,8 @@ export default function DropDown({ question }: Props) {
|
|||||||
switchState={switchState}
|
switchState={switchState}
|
||||||
SSHC={SSHC}
|
SSHC={SSHC}
|
||||||
question={question}
|
question={question}
|
||||||
|
openBranchingPage={openBranchingPage}
|
||||||
|
setOpenBranchingPage={setOpenBranchingPage}
|
||||||
/>
|
/>
|
||||||
<SwitchDropDown switchState={switchState} question={question} />
|
<SwitchDropDown switchState={switchState} question={question} />
|
||||||
</>
|
</>
|
||||||
|
@ -21,9 +21,15 @@ import { useAddAnswer } from "../../../utils/hooks/useAddAnswer";
|
|||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
question: QuizQuestionEmoji;
|
question: QuizQuestionEmoji;
|
||||||
|
openBranchingPage: boolean;
|
||||||
|
setOpenBranchingPage: (a: boolean) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function Emoji({ question }: Props) {
|
export default function Emoji({
|
||||||
|
question,
|
||||||
|
openBranchingPage,
|
||||||
|
setOpenBranchingPage,
|
||||||
|
}: Props) {
|
||||||
const [switchState, setSwitchState] = useState<string>("setting");
|
const [switchState, setSwitchState] = useState<string>("setting");
|
||||||
const onClickAddAnAnswer = useAddAnswer();
|
const onClickAddAnAnswer = useAddAnswer();
|
||||||
const [open, setOpen] = useState<boolean>(false);
|
const [open, setOpen] = useState<boolean>(false);
|
||||||
@ -237,6 +243,8 @@ export default function Emoji({ question }: Props) {
|
|||||||
switchState={switchState}
|
switchState={switchState}
|
||||||
SSHC={SSHC}
|
SSHC={SSHC}
|
||||||
question={question}
|
question={question}
|
||||||
|
openBranchingPage={openBranchingPage}
|
||||||
|
setOpenBranchingPage={setOpenBranchingPage}
|
||||||
/>
|
/>
|
||||||
<SwitchEmoji switchState={switchState} question={question} />
|
<SwitchEmoji switchState={switchState} question={question} />
|
||||||
</>
|
</>
|
||||||
|
@ -32,9 +32,14 @@ import SwitchOptionsAndPict from "./switchOptionsAndPict";
|
|||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
question: QuizQuestionVarImg;
|
question: QuizQuestionVarImg;
|
||||||
|
openBranchingPage: boolean;
|
||||||
|
setOpenBranchingPage: (a: boolean) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function OptionsAndPicture({ question }: Props) {
|
export default function OptionsAndPicture({
|
||||||
|
question,
|
||||||
|
setOpenBranchingPage,
|
||||||
|
}: Props) {
|
||||||
const [switchState, setSwitchState] = useState("setting");
|
const [switchState, setSwitchState] = useState("setting");
|
||||||
const [selectedVariantId, setSelectedVariantId] = useState<string | null>(
|
const [selectedVariantId, setSelectedVariantId] = useState<string | null>(
|
||||||
null,
|
null,
|
||||||
@ -390,6 +395,7 @@ export default function OptionsAndPicture({ question }: Props) {
|
|||||||
switchState={switchState}
|
switchState={switchState}
|
||||||
SSHC={SSHC}
|
SSHC={SSHC}
|
||||||
question={question}
|
question={question}
|
||||||
|
setOpenBranchingPage={setOpenBranchingPage}
|
||||||
/>
|
/>
|
||||||
<SwitchOptionsAndPict switchState={switchState} question={question} />
|
<SwitchOptionsAndPict switchState={switchState} question={question} />
|
||||||
</>
|
</>
|
||||||
|
@ -18,9 +18,15 @@ import { useAddAnswer } from "../../../utils/hooks/useAddAnswer";
|
|||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
question: QuizQuestionImages;
|
question: QuizQuestionImages;
|
||||||
|
openBranchingPage: boolean;
|
||||||
|
setOpenBranchingPage: (a: boolean) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function OptionsPicture({ question }: Props) {
|
export default function OptionsPicture({
|
||||||
|
question,
|
||||||
|
openBranchingPage,
|
||||||
|
setOpenBranchingPage,
|
||||||
|
}: Props) {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const onClickAddAnAnswer = useAddAnswer();
|
const onClickAddAnAnswer = useAddAnswer();
|
||||||
const quizQid = useCurrentQuiz()?.qid;
|
const quizQid = useCurrentQuiz()?.qid;
|
||||||
@ -187,6 +193,8 @@ export default function OptionsPicture({ question }: Props) {
|
|||||||
switchState={switchState}
|
switchState={switchState}
|
||||||
SSHC={SSHC}
|
SSHC={SSHC}
|
||||||
question={question}
|
question={question}
|
||||||
|
openBranchingPage={openBranchingPage}
|
||||||
|
setOpenBranchingPage={setOpenBranchingPage}
|
||||||
/>
|
/>
|
||||||
<SwitchAnswerOptionsPict switchState={switchState} question={question} />
|
<SwitchAnswerOptionsPict switchState={switchState} question={question} />
|
||||||
</>
|
</>
|
||||||
|
@ -17,9 +17,15 @@ import TooltipClickInfo from "@ui_kit/Toolbars/TooltipClickInfo";
|
|||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
question: QuizQuestionText;
|
question: QuizQuestionText;
|
||||||
|
openBranchingPage: boolean;
|
||||||
|
setOpenBranchingPage: (a: boolean) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function OwnTextField({ question }: Props) {
|
export default function OwnTextField({
|
||||||
|
question,
|
||||||
|
openBranchingPage,
|
||||||
|
setOpenBranchingPage,
|
||||||
|
}: Props) {
|
||||||
const [switchState, setSwitchState] = useState("setting");
|
const [switchState, setSwitchState] = useState("setting");
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const isMobile = useMediaQuery(theme.breakpoints.down(790));
|
const isMobile = useMediaQuery(theme.breakpoints.down(790));
|
||||||
@ -98,6 +104,8 @@ export default function OwnTextField({ question }: Props) {
|
|||||||
switchState={switchState}
|
switchState={switchState}
|
||||||
SSHC={SSHC}
|
SSHC={SSHC}
|
||||||
question={question}
|
question={question}
|
||||||
|
openBranchingPage={openBranchingPage}
|
||||||
|
setOpenBranchingPage={setOpenBranchingPage}
|
||||||
/>
|
/>
|
||||||
<SwitchTextField switchState={switchState} question={question} />
|
<SwitchTextField switchState={switchState} question={question} />
|
||||||
</>
|
</>
|
||||||
|
@ -31,6 +31,8 @@ import { updateDesireToOpenABranchingModal } from "@root/uiTools/actions";
|
|||||||
type Props = {
|
type Props = {
|
||||||
disableInput?: boolean;
|
disableInput?: boolean;
|
||||||
question: QuizQuestionPage;
|
question: QuizQuestionPage;
|
||||||
|
openBranchingPage: boolean;
|
||||||
|
setOpenBranchingPage: (a: boolean) => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function PageOptions({ disableInput, question }: Props) {
|
export default function PageOptions({ disableInput, question }: Props) {
|
||||||
|
@ -41,7 +41,14 @@ export const QuestionSwitchWindowTool = ({
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Box sx={{ flexBasis: "796px" }}>
|
<Box sx={{ flexBasis: "796px" }}>
|
||||||
{openBranchingPage ? <BranchingMap /> : <DraggableList />}
|
{openBranchingPage ? (
|
||||||
|
<BranchingMap />
|
||||||
|
) : (
|
||||||
|
<DraggableList
|
||||||
|
openBranchingPage={openBranchingPage}
|
||||||
|
setOpenBranchingPage={openBranchingPageHC}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
</Box>
|
</Box>
|
||||||
{openBranchingPage && (
|
{openBranchingPage && (
|
||||||
<SwitchBranchingPanel
|
<SwitchBranchingPanel
|
||||||
|
@ -22,6 +22,8 @@ import { updateQuestion } from "@root/questions/actions";
|
|||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
question: QuizQuestionRating;
|
question: QuizQuestionRating;
|
||||||
|
openBranchingPage: boolean;
|
||||||
|
setOpenBranchingPage: (a: boolean) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type ButtonRatingFrom = {
|
export type ButtonRatingFrom = {
|
||||||
@ -29,7 +31,11 @@ export type ButtonRatingFrom = {
|
|||||||
icon: JSX.Element;
|
icon: JSX.Element;
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function RatingOptions({ question }: Props) {
|
export default function RatingOptions({
|
||||||
|
question,
|
||||||
|
openBranchingPage,
|
||||||
|
setOpenBranchingPage,
|
||||||
|
}: Props) {
|
||||||
const [switchState, setSwitchState] = useState("setting");
|
const [switchState, setSwitchState] = useState("setting");
|
||||||
const [negativeText, setNegativeText] = useState<string>("");
|
const [negativeText, setNegativeText] = useState<string>("");
|
||||||
const [positiveText, setPositiveText] = useState<string>("");
|
const [positiveText, setPositiveText] = useState<string>("");
|
||||||
@ -270,6 +276,8 @@ export default function RatingOptions({ question }: Props) {
|
|||||||
switchState={switchState}
|
switchState={switchState}
|
||||||
SSHC={SSHC}
|
SSHC={SSHC}
|
||||||
question={question}
|
question={question}
|
||||||
|
openBranchingPage={openBranchingPage}
|
||||||
|
setOpenBranchingPage={setOpenBranchingPage}
|
||||||
/>
|
/>
|
||||||
<SwitchRating switchState={switchState} question={question} />
|
<SwitchRating switchState={switchState} question={question} />
|
||||||
</>
|
</>
|
||||||
|
@ -13,9 +13,15 @@ import type { QuizQuestionNumber } from "../../../model/questionTypes/number";
|
|||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
question: QuizQuestionNumber;
|
question: QuizQuestionNumber;
|
||||||
|
openBranchingPage: boolean;
|
||||||
|
setOpenBranchingPage: (a: boolean) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function SliderOptions({ question }: Props) {
|
export default function SliderOptions({
|
||||||
|
question,
|
||||||
|
openBranchingPage,
|
||||||
|
setOpenBranchingPage,
|
||||||
|
}: Props) {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const isTablet = useMediaQuery(theme.breakpoints.down(980));
|
const isTablet = useMediaQuery(theme.breakpoints.down(980));
|
||||||
const isMobile = useMediaQuery(theme.breakpoints.down(790));
|
const isMobile = useMediaQuery(theme.breakpoints.down(790));
|
||||||
@ -274,6 +280,8 @@ export default function SliderOptions({ question }: Props) {
|
|||||||
switchState={switchState}
|
switchState={switchState}
|
||||||
SSHC={SSHC}
|
SSHC={SSHC}
|
||||||
question={question}
|
question={question}
|
||||||
|
openBranchingPage={openBranchingPage}
|
||||||
|
setOpenBranchingPage={setOpenBranchingPage}
|
||||||
/>
|
/>
|
||||||
<SwitchSlider switchState={switchState} question={question} />
|
<SwitchSlider switchState={switchState} question={question} />
|
||||||
</>
|
</>
|
||||||
|
@ -39,6 +39,13 @@ export const QuestionsList = ({ setOpenBranchingPage = () => {} }: Props) => {
|
|||||||
(question) => question.type !== "result",
|
(question) => question.type !== "result",
|
||||||
);
|
);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (desireToOpenABranchingModal) {
|
||||||
|
const element = document.getElementById(desireToOpenABranchingModal);
|
||||||
|
if (element !== null) element.scrollIntoView();
|
||||||
|
}
|
||||||
|
}, [desireToOpenABranchingModal]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box sx={{ padding: "15px" }}>
|
<Box sx={{ padding: "15px" }}>
|
||||||
<Box
|
<Box
|
||||||
@ -62,9 +69,11 @@ export const QuestionsList = ({ setOpenBranchingPage = () => {} }: Props) => {
|
|||||||
>
|
>
|
||||||
{/* тут нужно будет фильтровать с проверкой, что вопрос имеет тип*/}
|
{/* тут нужно будет фильтровать с проверкой, что вопрос имеет тип*/}
|
||||||
{questions
|
{questions
|
||||||
.filter((q: AnyQuestion) => q.type)
|
.filter((q: AnyQuestion) => q.type && q.type !== "result")
|
||||||
.map(({ title, content }, index) => (
|
.map(({ title, content }, index) => {
|
||||||
|
return (
|
||||||
<Button
|
<Button
|
||||||
|
id={content.id}
|
||||||
onMouseDown={() => {
|
onMouseDown={() => {
|
||||||
//Разрешаем добавить этот вопрос если у него нет родителя (не добавляли ещё в дерево)
|
//Разрешаем добавить этот вопрос если у него нет родителя (не добавляли ещё в дерево)
|
||||||
if (!content.rule.parentId)
|
if (!content.rule.parentId)
|
||||||
@ -109,7 +118,8 @@ export const QuestionsList = ({ setOpenBranchingPage = () => {} }: Props) => {
|
|||||||
</IconButton>
|
</IconButton>
|
||||||
{content.rule.parentId && <CheckedIcon />}
|
{content.rule.parentId && <CheckedIcon />}
|
||||||
</Button>
|
</Button>
|
||||||
))}
|
);
|
||||||
|
})}
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
|
@ -14,42 +14,114 @@ import { notReachable } from "../../utils/notReachable";
|
|||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
question: AnyTypedQuizQuestion;
|
question: AnyTypedQuizQuestion;
|
||||||
|
openBranchingPage: boolean;
|
||||||
|
setOpenBranchingPage: (a: boolean) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function SwitchQuestionsPage({ question }: Props) {
|
export default function SwitchQuestionsPage({
|
||||||
|
question,
|
||||||
|
openBranchingPage,
|
||||||
|
setOpenBranchingPage,
|
||||||
|
}: Props) {
|
||||||
switch (question.type) {
|
switch (question.type) {
|
||||||
case "variant":
|
case "variant":
|
||||||
return <AnswerOptions question={question} />;
|
return (
|
||||||
|
<AnswerOptions
|
||||||
|
question={question}
|
||||||
|
openBranchingPage={openBranchingPage}
|
||||||
|
setOpenBranchingPage={setOpenBranchingPage}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
|
||||||
case "images":
|
case "images":
|
||||||
return <OptionsPicture question={question} />;
|
return (
|
||||||
|
<OptionsPicture
|
||||||
|
question={question}
|
||||||
|
openBranchingPage={openBranchingPage}
|
||||||
|
setOpenBranchingPage={setOpenBranchingPage}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
|
||||||
case "varimg":
|
case "varimg":
|
||||||
return <OptionsAndPicture question={question} />;
|
return (
|
||||||
|
<OptionsAndPicture
|
||||||
|
question={question}
|
||||||
|
openBranchingPage={openBranchingPage}
|
||||||
|
setOpenBranchingPage={setOpenBranchingPage}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
|
||||||
case "emoji":
|
case "emoji":
|
||||||
return <Emoji question={question} />;
|
return (
|
||||||
|
<Emoji
|
||||||
|
question={question}
|
||||||
|
openBranchingPage={openBranchingPage}
|
||||||
|
setOpenBranchingPage={setOpenBranchingPage}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
|
||||||
case "text":
|
case "text":
|
||||||
return <OwnTextField question={question} />;
|
return (
|
||||||
|
<OwnTextField
|
||||||
|
question={question}
|
||||||
|
openBranchingPage={openBranchingPage}
|
||||||
|
setOpenBranchingPage={setOpenBranchingPage}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
|
||||||
case "select":
|
case "select":
|
||||||
return <DropDown question={question} />;
|
return (
|
||||||
|
<DropDown
|
||||||
|
question={question}
|
||||||
|
openBranchingPage={openBranchingPage}
|
||||||
|
setOpenBranchingPage={setOpenBranchingPage}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
|
||||||
case "date":
|
case "date":
|
||||||
return <DataOptions question={question} />;
|
return (
|
||||||
|
<DataOptions
|
||||||
|
question={question}
|
||||||
|
openBranchingPage={openBranchingPage}
|
||||||
|
setOpenBranchingPage={setOpenBranchingPage}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
|
||||||
case "number":
|
case "number":
|
||||||
return <SliderOptions question={question} />;
|
return (
|
||||||
|
<SliderOptions
|
||||||
|
question={question}
|
||||||
|
openBranchingPage={openBranchingPage}
|
||||||
|
setOpenBranchingPage={setOpenBranchingPage}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
|
||||||
case "file":
|
case "file":
|
||||||
return <UploadFile question={question} />;
|
return (
|
||||||
|
<UploadFile
|
||||||
|
question={question}
|
||||||
|
openBranchingPage={openBranchingPage}
|
||||||
|
setOpenBranchingPage={setOpenBranchingPage}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
|
||||||
case "page":
|
case "page":
|
||||||
return <PageOptions question={question} />;
|
return (
|
||||||
|
<PageOptions
|
||||||
|
question={question}
|
||||||
|
openBranchingPage={openBranchingPage}
|
||||||
|
setOpenBranchingPage={setOpenBranchingPage}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
|
||||||
case "rating":
|
case "rating":
|
||||||
return <RatingOptions question={question} />;
|
return (
|
||||||
|
<RatingOptions
|
||||||
|
question={question}
|
||||||
|
openBranchingPage={openBranchingPage}
|
||||||
|
setOpenBranchingPage={setOpenBranchingPage}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
notReachable(question);
|
notReachable(question);
|
||||||
|
@ -36,9 +36,15 @@ const DESIGN_TYPES: DesignItem[] = [
|
|||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
question: QuizQuestionFile;
|
question: QuizQuestionFile;
|
||||||
|
openBranchingPage: boolean;
|
||||||
|
setOpenBranchingPage: (a: boolean) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function UploadFile({ question }: Props) {
|
export default function UploadFile({
|
||||||
|
question,
|
||||||
|
openBranchingPage,
|
||||||
|
setOpenBranchingPage,
|
||||||
|
}: Props) {
|
||||||
const [switchState, setSwitchState] = useState("setting");
|
const [switchState, setSwitchState] = useState("setting");
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const isTablet = useMediaQuery(theme.breakpoints.down(980));
|
const isTablet = useMediaQuery(theme.breakpoints.down(980));
|
||||||
@ -201,6 +207,8 @@ export default function UploadFile({ question }: Props) {
|
|||||||
switchState={switchState}
|
switchState={switchState}
|
||||||
SSHC={SSHC}
|
SSHC={SSHC}
|
||||||
question={question}
|
question={question}
|
||||||
|
openBranchingPage={openBranchingPage}
|
||||||
|
setOpenBranchingPage={setOpenBranchingPage}
|
||||||
/>
|
/>
|
||||||
<SwitchUpload switchState={switchState} question={question} />
|
<SwitchUpload switchState={switchState} question={question} />
|
||||||
</>
|
</>
|
||||||
|
@ -10,9 +10,16 @@ import { useAddAnswer } from "../../../utils/hooks/useAddAnswer";
|
|||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
question: QuizQuestionVariant;
|
question: QuizQuestionVariant;
|
||||||
|
openBranchingPage: boolean;
|
||||||
|
setOpenBranchingPage: (a: boolean) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function AnswerOptions({ question }: Props) {
|
export default function AnswerOptions({
|
||||||
|
question,
|
||||||
|
openBranchingPage,
|
||||||
|
setOpenBranchingPage,
|
||||||
|
}: Props) {
|
||||||
|
console.log(setOpenBranchingPage);
|
||||||
const onClickAddAnAnswer = useAddAnswer();
|
const onClickAddAnAnswer = useAddAnswer();
|
||||||
const [switchState, setSwitchState] = useState("setting");
|
const [switchState, setSwitchState] = useState("setting");
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
@ -89,6 +96,8 @@ export default function AnswerOptions({ question }: Props) {
|
|||||||
switchState={switchState}
|
switchState={switchState}
|
||||||
SSHC={SSHC}
|
SSHC={SSHC}
|
||||||
question={question}
|
question={question}
|
||||||
|
openBranchingPage={openBranchingPage}
|
||||||
|
setOpenBranchingPage={setOpenBranchingPage}
|
||||||
/>
|
/>
|
||||||
<SwitchAnswerOptions switchState={switchState} question={question} />
|
<SwitchAnswerOptions switchState={switchState} question={question} />
|
||||||
</>
|
</>
|
||||||
|
@ -76,7 +76,6 @@ export const ResultSettings = () => {
|
|||||||
|
|
||||||
const leavePage = (leave: boolean) => {
|
const leavePage = (leave: boolean) => {
|
||||||
if (leave) {
|
if (leave) {
|
||||||
console.log("ливаем");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
setOpenNotificationModal(false);
|
setOpenNotificationModal(false);
|
||||||
|
@ -1,22 +1,32 @@
|
|||||||
import { useLocation, useNavigate } from "react-router-dom";
|
import { Link, useLocation, useNavigate } from "react-router-dom";
|
||||||
import { makeRequest } from "@frontend/kitui";
|
import { makeRequest } from "@frontend/kitui";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import type { GetTariffsResponse } from "@model/tariff";
|
import type { GetTariffsResponse } from "@model/tariff";
|
||||||
|
import { clearAuthToken } from "@frontend/kitui";
|
||||||
|
import { logout } from "@api/auth";
|
||||||
|
import ArrowDown from "../../assets/icons/ArrowDownIcon";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Box,
|
Box,
|
||||||
Button,
|
Button,
|
||||||
|
Container,
|
||||||
Modal,
|
Modal,
|
||||||
Paper,
|
Paper,
|
||||||
Typography,
|
Typography,
|
||||||
useMediaQuery,
|
useMediaQuery,
|
||||||
useTheme,
|
useTheme,
|
||||||
|
IconButton
|
||||||
} from "@mui/material";
|
} from "@mui/material";
|
||||||
import { enqueueSnackbar } from "notistack";
|
import { enqueueSnackbar } from "notistack";
|
||||||
import { Tariff, getMessageFromFetchError } from "@frontend/kitui";
|
import { Tariff, getMessageFromFetchError } from "@frontend/kitui";
|
||||||
import { withErrorBoundary } from "react-error-boundary";
|
import { withErrorBoundary } from "react-error-boundary";
|
||||||
import { createTariffElements } from "./tariffsUtils/createTariffElements";
|
import { createTariffElements } from "./tariffsUtils/createTariffElements";
|
||||||
import HeaderFull from "@ui_kit/Header/HeaderFull";
|
import HeaderFull from "@ui_kit/Header/HeaderFull";
|
||||||
|
import Logotip from "../../pages/Landing/images/icons/QuizLogo";
|
||||||
|
import { LogoutButton } from "@ui_kit/LogoutButton";
|
||||||
|
import { clearUserData } from "@root/user";
|
||||||
|
import ArrowLeft from "@icons/questionsPage/arrowLeft";
|
||||||
|
import { currencyFormatter } from "./tariffsUtils/currencyFormatter";
|
||||||
|
|
||||||
function TariffPage() {
|
function TariffPage() {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
@ -29,6 +39,7 @@ function TariffPage() {
|
|||||||
const [discounts, setDiscounts] = useState();
|
const [discounts, setDiscounts] = useState();
|
||||||
const [cartTariffMap, setCartTariffMap] = useState();
|
const [cartTariffMap, setCartTariffMap] = useState();
|
||||||
const [openModal, setOpenModal] = useState({});
|
const [openModal, setOpenModal] = useState({});
|
||||||
|
const [cash, setCash] = useState("0");
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const get = async () => {
|
const get = async () => {
|
||||||
@ -47,16 +58,14 @@ function TariffPage() {
|
|||||||
setUser(user);
|
setUser(user);
|
||||||
setTariffs(tariffs);
|
setTariffs(tariffs);
|
||||||
setDiscounts(discounts.Discounts);
|
setDiscounts(discounts.Discounts);
|
||||||
|
let c = currencyFormatter.format(Number(user.wallet.cash) / 100)
|
||||||
|
setCash(c)
|
||||||
};
|
};
|
||||||
get();
|
get();
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
if (!user || !tariffs || !discounts) return <LoadingPage />;
|
if (!user || !tariffs || !discounts) return <LoadingPage />;
|
||||||
|
|
||||||
console.log("user ", user);
|
|
||||||
console.log("tariffs ", tariffs);
|
|
||||||
console.log("discounts ", discounts);
|
|
||||||
|
|
||||||
const openModalHC = (tariffInfo: any) => setOpenModal(tariffInfo);
|
const openModalHC = (tariffInfo: any) => setOpenModal(tariffInfo);
|
||||||
const tryBuy = async ({ id, price }: { id: string; price: number }) => {
|
const tryBuy = async ({ id, price }: { id: string; price: number }) => {
|
||||||
openModalHC({});
|
openModalHC({});
|
||||||
@ -72,10 +81,13 @@ function TariffPage() {
|
|||||||
//Если нам хватает денежек - покупаем тариф
|
//Если нам хватает денежек - покупаем тариф
|
||||||
if (price <= user.wallet.cash) {
|
if (price <= user.wallet.cash) {
|
||||||
try {
|
try {
|
||||||
await makeRequest({
|
const data = await makeRequest({
|
||||||
method: "POST",
|
method: "POST",
|
||||||
url: "https://suiz.pena.digital/customer/cart/pay",
|
url: "https://squiz.pena.digital/customer/cart/pay",
|
||||||
});
|
});
|
||||||
|
setCash(currencyFormatter.format(Number(data.wallet.cash) / 100))
|
||||||
|
enqueueSnackbar("Тариф успешно приобретён");
|
||||||
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
enqueueSnackbar("Произошла ошибка. Попробуйте позже");
|
enqueueSnackbar("Произошла ошибка. Попробуйте позже");
|
||||||
}
|
}
|
||||||
@ -86,8 +98,7 @@ function TariffPage() {
|
|||||||
// history.pushState({}, null, "https://hub.pena.digital/wallet?action=squizpay");
|
// history.pushState({}, null, "https://hub.pena.digital/wallet?action=squizpay");
|
||||||
|
|
||||||
var link = document.createElement("a");
|
var link = document.createElement("a");
|
||||||
link.href = `https://hub.pena.digital/payment?action=squizpay&dif=${
|
link.href = `https://hub.pena.digital/payment?action=squizpay&dif=${(price - Number(user.wallet.cash)) * 100
|
||||||
(price - Number(user.wallet.cash)) * 100
|
|
||||||
}`;
|
}`;
|
||||||
document.body.appendChild(link);
|
document.body.appendChild(link);
|
||||||
// link.click();
|
// link.click();
|
||||||
@ -104,18 +115,71 @@ function TariffPage() {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
async function handleLogoutClick() {
|
||||||
|
const [, logoutError] = await logout();
|
||||||
|
|
||||||
|
if (logoutError) {
|
||||||
|
return enqueueSnackbar(logoutError);
|
||||||
|
}
|
||||||
|
|
||||||
|
clearAuthToken();
|
||||||
|
clearUserData();
|
||||||
|
navigate("/");
|
||||||
|
}
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<HeaderFull />
|
<Container
|
||||||
|
component="nav"
|
||||||
|
disableGutters
|
||||||
|
maxWidth={false}
|
||||||
|
sx={{
|
||||||
|
px: "16px",
|
||||||
|
display: "flex",
|
||||||
|
height: "80px",
|
||||||
|
alignItems: "center",
|
||||||
|
gap: isTablet ? "20px" : "60px",
|
||||||
|
flexDirection: "row",
|
||||||
|
justifyContent: "space-between",
|
||||||
|
bgcolor: "white",
|
||||||
|
borderBottom: "1px solid #E3E3E3",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Link to="/">
|
||||||
|
<Logotip width={124} />
|
||||||
|
</Link>
|
||||||
|
<IconButton onClick={() => navigate("/list")}>
|
||||||
|
<ArrowLeft color="black" />
|
||||||
|
</IconButton>
|
||||||
|
<Box sx={{ display: "flex", ml: "auto" }}>
|
||||||
|
<Box sx={{ ml: "8px", whiteSpace: "nowrap" }}>
|
||||||
|
<Typography
|
||||||
|
sx={{
|
||||||
|
fontSize: "12px",
|
||||||
|
lineHeight: "14px",
|
||||||
|
color: "gray",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Мой баланс
|
||||||
|
</Typography>
|
||||||
|
<Typography variant="body2" color={"#7e2aea"}>
|
||||||
|
{cash}
|
||||||
|
</Typography>
|
||||||
|
</Box>
|
||||||
|
<LogoutButton
|
||||||
|
onClick={handleLogoutClick}
|
||||||
|
sx={{
|
||||||
|
ml: "20px",
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Box>
|
||||||
|
</Container>
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
justifyContent: "left",
|
justifyContent: "left",
|
||||||
mt: "40px",
|
|
||||||
mb: "30px",
|
|
||||||
display: "grid",
|
display: "grid",
|
||||||
gap: "40px",
|
gap: "40px",
|
||||||
gridTemplateColumns: `repeat(auto-fit, minmax(300px, ${
|
p: "20px",
|
||||||
isTablet ? "436px" : "360px"
|
gridTemplateColumns: `repeat(auto-fit, minmax(300px, ${isTablet ? "436px" : "360px"
|
||||||
}))`,
|
}))`,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
@ -187,6 +251,7 @@ const LoadingPage = () => (
|
|||||||
|
|
||||||
export const inCart = () => {
|
export const inCart = () => {
|
||||||
let saveCart = JSON.parse(localStorage.getItem("saveCart") || "[]");
|
let saveCart = JSON.parse(localStorage.getItem("saveCart") || "[]");
|
||||||
|
if (Array.isArray(saveCart)) {
|
||||||
saveCart.forEach(async (id: string) => {
|
saveCart.forEach(async (id: string) => {
|
||||||
try {
|
try {
|
||||||
await makeRequest({
|
await makeRequest({
|
||||||
@ -203,6 +268,9 @@ export const inCart = () => {
|
|||||||
console.log("Я не смог добавить тариф в корзину :( " + id);
|
console.log("Я не смог добавить тариф в корзину :( " + id);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
localStorage.setItem("saveCart", "[]")
|
||||||
|
}
|
||||||
};
|
};
|
||||||
const outCart = (cart: string[]) => {
|
const outCart = (cart: string[]) => {
|
||||||
//Сделаем муторно и подольше, зато при прерывании сессии данные потеряются минимально
|
//Сделаем муторно и подольше, зато при прерывании сессии данные потеряются минимально
|
||||||
@ -210,7 +278,7 @@ const outCart = (cart: string[]) => {
|
|||||||
try {
|
try {
|
||||||
await makeRequest({
|
await makeRequest({
|
||||||
method: "DELETE",
|
method: "DELETE",
|
||||||
url: `https://suiz.pena.digital/customer/cart?id=${id}`,
|
url: `https://squiz.pena.digital/customer/cart?id=${id}`,
|
||||||
});
|
});
|
||||||
let saveCart = JSON.parse(localStorage.getItem("saveCart") || "[]");
|
let saveCart = JSON.parse(localStorage.getItem("saveCart") || "[]");
|
||||||
saveCart = saveCart.push(id);
|
saveCart = saveCart.push(id);
|
||||||
|
@ -78,7 +78,6 @@ function findCartDiscount(
|
|||||||
cartPurchasesAmount >= Number(discount.Condition.CartPurchasesAmount)
|
cartPurchasesAmount >= Number(discount.Condition.CartPurchasesAmount)
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
console.log("FCD", applicableDiscounts);
|
|
||||||
|
|
||||||
if (!applicableDiscounts.length) return null;
|
if (!applicableDiscounts.length) return null;
|
||||||
|
|
||||||
|
@ -249,7 +249,6 @@ const Inputs = (currentQuestion: any) => {
|
|||||||
|
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
const FC: any = quiz?.config.formContact.fields;
|
const FC: any = quiz?.config.formContact.fields;
|
||||||
console.log(FC);
|
|
||||||
|
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
const Name = (
|
const Name = (
|
||||||
|
@ -115,15 +115,12 @@ export const Footer = ({
|
|||||||
}
|
}
|
||||||
|
|
||||||
const isEmpty = checkEmptyData({ resultData: nextQuestion });
|
const isEmpty = checkEmptyData({ resultData: nextQuestion });
|
||||||
console.log("пустой результат? ", isEmpty);
|
|
||||||
if (nextQuestion) {
|
if (nextQuestion) {
|
||||||
if (nextQuestion && quiz?.config.resultInfo.when === "before") {
|
if (nextQuestion && quiz?.config.resultInfo.when === "before") {
|
||||||
if (isEmpty) {
|
if (isEmpty) {
|
||||||
setShowContactForm(true); //до+пустая = кидать на ФК
|
setShowContactForm(true); //до+пустая = кидать на ФК
|
||||||
console.log("до+пустая = кидать на ФК");
|
|
||||||
} else {
|
} else {
|
||||||
setShowResultForm(true); //до+заполнена = показать
|
setShowResultForm(true); //до+заполнена = показать
|
||||||
console.log("до+заполнена = показать");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
@ -133,10 +130,8 @@ export const Footer = ({
|
|||||||
) {
|
) {
|
||||||
if (isEmpty) {
|
if (isEmpty) {
|
||||||
setShowContactForm(true); //после+пустая
|
setShowContactForm(true); //после+пустая
|
||||||
console.log("после+пустая");
|
|
||||||
} else {
|
} else {
|
||||||
setShowContactForm(true); //после+заполнена = показать ФК
|
setShowContactForm(true); //после+заполнена = показать ФК
|
||||||
console.log("после+заполнена = показать");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -93,13 +93,15 @@ export const ResultForm = ({
|
|||||||
</Typography>
|
</Typography>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
{resultQuestion.title && (
|
||||||
<Typography
|
<Typography
|
||||||
sx={{
|
sx={{
|
||||||
m: "20px 0",
|
m: "20px 0",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{resultQuestion.title || "Форма результатов"}
|
{resultQuestion.title}
|
||||||
</Typography>
|
</Typography>
|
||||||
|
)}
|
||||||
|
|
||||||
{resultQuestion.content.text !== "" &&
|
{resultQuestion.content.text !== "" &&
|
||||||
resultQuestion.content.text !== " " && (
|
resultQuestion.content.text !== " " && (
|
||||||
|
@ -149,6 +149,7 @@ const VariantItem = ({
|
|||||||
: theme.palette.background.default,
|
: theme.palette.background.default,
|
||||||
display: "flex",
|
display: "flex",
|
||||||
maxWidth: "685px",
|
maxWidth: "685px",
|
||||||
|
maxHeight: "85px",
|
||||||
justifyContent: "space-between",
|
justifyContent: "space-between",
|
||||||
width: "100%",
|
width: "100%",
|
||||||
"&.MuiFormControl-root": {
|
"&.MuiFormControl-root": {
|
||||||
|
@ -50,7 +50,7 @@ export default function QuizCard({
|
|||||||
try {
|
try {
|
||||||
await makeRequest({
|
await makeRequest({
|
||||||
method: "POST",
|
method: "POST",
|
||||||
url: "https://suiz.pena.digital/customer/cart/pay",
|
url: "https://squiz.pena.digital/customer/cart/pay",
|
||||||
});
|
});
|
||||||
inCart();
|
inCart();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@ -128,7 +128,7 @@ export default function Main({ sidebar, header, footer, Page }: Props) {
|
|||||||
sx={{
|
sx={{
|
||||||
background: theme.palette.background.default,
|
background: theme.palette.background.default,
|
||||||
width: "100%",
|
width: "100%",
|
||||||
overflow: "auto",
|
// overflow: "auto",
|
||||||
boxSizing: "border-box",
|
boxSizing: "border-box",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
@ -8,9 +8,7 @@ export const ModalInfoWhyCantCreate = () => {
|
|||||||
const { whyCantCreatePublic, openModalInfoWhyCantCreate } = useUiTools();
|
const { whyCantCreatePublic, openModalInfoWhyCantCreate } = useUiTools();
|
||||||
|
|
||||||
useLayoutEffect(() => {
|
useLayoutEffect(() => {
|
||||||
console.log(whyCantCreatePublic);
|
|
||||||
if (Object.values(whyCantCreatePublic).length === 0) {
|
if (Object.values(whyCantCreatePublic).length === 0) {
|
||||||
console.log("нет проблем");
|
|
||||||
updateModalInfoWhyCantCreate(false);
|
updateModalInfoWhyCantCreate(false);
|
||||||
}
|
}
|
||||||
}, [openModalInfoWhyCantCreate]);
|
}, [openModalInfoWhyCantCreate]);
|
||||||
|
@ -439,7 +439,9 @@ export const changeQuestionType = (questionId: string, type: QuestionType) => {
|
|||||||
const oldRule = question.content.rule;
|
const oldRule = question.content.rule;
|
||||||
oldRule.main = [];
|
oldRule.main = [];
|
||||||
question.type = type;
|
question.type = type;
|
||||||
question.content = defaultQuestionByType[type].content;
|
question.content = JSON.parse(
|
||||||
|
JSON.stringify(defaultQuestionByType[type].content),
|
||||||
|
);
|
||||||
question.content.id = oldId;
|
question.content.id = oldId;
|
||||||
question.content.rule = oldRule;
|
question.content.rule = oldRule;
|
||||||
});
|
});
|
||||||
|
@ -1,5 +1,12 @@
|
|||||||
import { FC } from "react";
|
import { FC } from "react";
|
||||||
import { Box, Button, ButtonBase, Tooltip, Typography, useTheme } from "@mui/material";
|
import {
|
||||||
|
Box,
|
||||||
|
Button,
|
||||||
|
ButtonBase,
|
||||||
|
Tooltip,
|
||||||
|
Typography,
|
||||||
|
useTheme,
|
||||||
|
} from "@mui/material";
|
||||||
import CustomTextField from "./CustomTextField";
|
import CustomTextField from "./CustomTextField";
|
||||||
import { updateQuestion, uploadQuestionImage } from "@root/questions/actions";
|
import { updateQuestion, uploadQuestionImage } from "@root/questions/actions";
|
||||||
import { CropModal, useCropModalState } from "@ui_kit/Modal/CropModal";
|
import { CropModal, useCropModalState } from "@ui_kit/Modal/CropModal";
|
||||||
@ -19,7 +26,7 @@ interface Iprops {
|
|||||||
|
|
||||||
export const MediaSelectionAndDisplay: FC<Iprops> = ({ resultData }) => {
|
export const MediaSelectionAndDisplay: FC<Iprops> = ({ resultData }) => {
|
||||||
const quizQid = useCurrentQuiz()?.qid;
|
const quizQid = useCurrentQuiz()?.qid;
|
||||||
const theme = useTheme()
|
const theme = useTheme();
|
||||||
const {
|
const {
|
||||||
isCropModalOpen,
|
isCropModalOpen,
|
||||||
openCropModal,
|
openCropModal,
|
||||||
@ -30,7 +37,6 @@ export const MediaSelectionAndDisplay: FC<Iprops> = ({ resultData }) => {
|
|||||||
} = useCropModalState();
|
} = useCropModalState();
|
||||||
const [isImageUploadOpen, openImageUploadModal, closeImageUploadModal] =
|
const [isImageUploadOpen, openImageUploadModal, closeImageUploadModal] =
|
||||||
useDisclosure();
|
useDisclosure();
|
||||||
console.log(resultData)
|
|
||||||
async function handleImageUpload(file: File) {
|
async function handleImageUpload(file: File) {
|
||||||
const url = await uploadQuestionImage(
|
const url = await uploadQuestionImage(
|
||||||
resultData.id,
|
resultData.id,
|
||||||
@ -182,7 +188,7 @@ export const MediaSelectionAndDisplay: FC<Iprops> = ({ resultData }) => {
|
|||||||
width: "48px",
|
width: "48px",
|
||||||
display: "flex",
|
display: "flex",
|
||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
my: "20px"
|
my: "20px",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<input
|
<input
|
||||||
@ -198,7 +204,6 @@ export const MediaSelectionAndDisplay: FC<Iprops> = ({ resultData }) => {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}}
|
}}
|
||||||
hidden
|
hidden
|
||||||
accept=".mp4"
|
accept=".mp4"
|
||||||
@ -213,7 +218,9 @@ export const MediaSelectionAndDisplay: FC<Iprops> = ({ resultData }) => {
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</ButtonBase>
|
</ButtonBase>
|
||||||
{resultData.content.video ? <video src={resultData.content.video} width="400" controls /> : null}
|
{resultData.content.video ? (
|
||||||
|
<video src={resultData.content.video} width="400" controls />
|
||||||
|
) : null}
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</Box>
|
</Box>
|
||||||
|
@ -74,7 +74,6 @@ export default function QuizPreviewLayout() {
|
|||||||
observer.current.observe(PreviewWin.current);
|
observer.current.observe(PreviewWin.current);
|
||||||
}, [PreviewWin, observer]);
|
}, [PreviewWin, observer]);
|
||||||
|
|
||||||
console.log("current width state: ", widthPreview);
|
|
||||||
return (
|
return (
|
||||||
<Paper
|
<Paper
|
||||||
ref={PreviewWin}
|
ref={PreviewWin}
|
||||||
|
@ -14,7 +14,6 @@ export default function YoutubeEmbedIframe({ videoUrl, containerSX }: Props) {
|
|||||||
const embedUrl = `https://www.youtube.com/embed/${videoId}?controls=0&autoplay=1&modestbranding=0&showinfo=0&disablekb=1&mute=1&loop=1`;
|
const embedUrl = `https://www.youtube.com/embed/${videoId}?controls=0&autoplay=1&modestbranding=0&showinfo=0&disablekb=1&mute=1&loop=1`;
|
||||||
// https://www.youtube.com/shorts/9VgqBPd6RPA
|
// https://www.youtube.com/shorts/9VgqBPd6RPA
|
||||||
// https://www.youtube.com/watch?v=I2N8hTHhvGY
|
// https://www.youtube.com/watch?v=I2N8hTHhvGY
|
||||||
console.log();
|
|
||||||
return (
|
return (
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
|
@ -10,7 +10,6 @@ export const ButtonRecallQuiz = () => {
|
|||||||
const quiz = useCurrentQuiz();
|
const quiz = useCurrentQuiz();
|
||||||
const { whyCantCreatePublic, canCreatePublic } = useUiTools();
|
const { whyCantCreatePublic, canCreatePublic } = useUiTools();
|
||||||
|
|
||||||
console.log(quiz?.status);
|
|
||||||
const [buttonText, setButtonText] = useState(
|
const [buttonText, setButtonText] = useState(
|
||||||
quiz?.status === "stop" ? "Опубликовать" : "Отозвать",
|
quiz?.status === "stop" ? "Опубликовать" : "Отозвать",
|
||||||
);
|
);
|
||||||
|
@ -66,21 +66,12 @@ export const DeleteFunction = async (
|
|||||||
const newRule = {};
|
const newRule = {};
|
||||||
const parentChildren = [...parentQuestion.content.rule.children];
|
const parentChildren = [...parentQuestion.content.rule.children];
|
||||||
|
|
||||||
console.log(
|
|
||||||
"_________________УДАЛЯЕМЫЙ ВОПРОС_________________",
|
|
||||||
question.content.id,
|
|
||||||
);
|
|
||||||
console.log(parentChildren);
|
|
||||||
console.log(question.content.id);
|
|
||||||
console.log(parentChildren.includes(question.content.id));
|
|
||||||
|
|
||||||
if (parentChildren.includes(question.content.id))
|
if (parentChildren.includes(question.content.id))
|
||||||
parentChildren.splice(
|
parentChildren.splice(
|
||||||
parentQuestion.content.rule.children.indexOf(question.content.id),
|
parentQuestion.content.rule.children.indexOf(question.content.id),
|
||||||
1,
|
1,
|
||||||
);
|
);
|
||||||
|
|
||||||
console.log("получившийся массив ", parentChildren);
|
|
||||||
newRule.main = parentQuestion.content.rule.main.filter(
|
newRule.main = parentQuestion.content.rule.main.filter(
|
||||||
(data) => data.next !== question.content.id,
|
(data) => data.next !== question.content.id,
|
||||||
); //удаляем условия перехода от родителя к этому вопросу
|
); //удаляем условия перехода от родителя к этому вопросу
|
||||||
@ -103,20 +94,14 @@ export const DeleteFunction = async (
|
|||||||
);
|
);
|
||||||
|
|
||||||
//сделать результ родителя видимым если у него не осталось потомков
|
//сделать результ родителя видимым если у него не осталось потомков
|
||||||
console.log(
|
|
||||||
"пришло время анализировать сделать ли результат родителя видимым",
|
|
||||||
);
|
|
||||||
console.log("количество детей ", startCountParentChildren.length);
|
|
||||||
|
|
||||||
if (startCountParentChildren.length === 1) {
|
if (startCountParentChildren.length === 1) {
|
||||||
if (parentResult) {
|
if (parentResult) {
|
||||||
console.log("я нашел результат родителя");
|
|
||||||
await updateQuestion(parentResult.content.id, (q) => {
|
await updateQuestion(parentResult.content.id, (q) => {
|
||||||
q.content.usage = true;
|
q.content.usage = true;
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
//почему-то не существует результа у родителя. Создаём. Новосозданные результы видны сразу
|
//почему-то не существует результа у родителя. Создаём. Новосозданные результы видны сразу
|
||||||
console.log("я не нашел результат родителя");
|
|
||||||
await createResult(quiz.backendId, parentQuestion.content.id);
|
await createResult(quiz.backendId, parentQuestion.content.id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user