Merge branch 'dev' of penahub.gitlab.yandexcloud.net:frontend/squiz into answers-settings
This commit is contained in:
commit
d2070c4569
@ -157,6 +157,12 @@ function CsComponent({
|
|||||||
}, [modalQuestionTargetContentId])
|
}, [modalQuestionTargetContentId])
|
||||||
|
|
||||||
const addNode = ({ parentNodeContentId, targetNodeContentId }: { parentNodeContentId: string, targetNodeContentId?: string }) => {
|
const addNode = ({ parentNodeContentId, targetNodeContentId }: { parentNodeContentId: string, targetNodeContentId?: string }) => {
|
||||||
|
|
||||||
|
|
||||||
|
//запрещаем работу родителя-ребенка если это один и тот же вопрос
|
||||||
|
if (parentNodeContentId === targetNodeContentId) return
|
||||||
|
|
||||||
|
|
||||||
const cy = cyRef?.current
|
const cy = cyRef?.current
|
||||||
const parentNodeChildren = cy?.$('edge[source = "' + parentNodeContentId + '"]')?.length
|
const parentNodeChildren = cy?.$('edge[source = "' + parentNodeContentId + '"]')?.length
|
||||||
//если есть инфо о выбранном вопросе из модалки - берём родителя из инфо модалки. Иначе из значения дропа
|
//если есть инфо о выбранном вопросе из модалки - берём родителя из инфо модалки. Иначе из значения дропа
|
||||||
|
@ -26,7 +26,7 @@ export const BranchingPanel = (sx?: SxProps<Theme>) => {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Switch
|
<Switch
|
||||||
value={openBranchingPanel}
|
clicked={openBranchingPanel}
|
||||||
onChange={(_, value) => {
|
onChange={(_, value) => {
|
||||||
updateOpenBranchingPanel(value)
|
updateOpenBranchingPanel(value)
|
||||||
}}
|
}}
|
||||||
|
@ -85,11 +85,12 @@ export default function SettingEmoji({ question }: SettingEmojiProps) {
|
|||||||
<CustomCheckbox
|
<CustomCheckbox
|
||||||
sx={{ mr: isMobile ? "0px" : "16px" }}
|
sx={{ mr: isMobile ? "0px" : "16px" }}
|
||||||
label={"Необязательный вопрос"}
|
label={"Необязательный вопрос"}
|
||||||
checked={!question.required}
|
checked={question.content.required}
|
||||||
handleChange={(e) => updateQuestion(question.id, question => {
|
handleChange={({ target }) => updateQuestion(question.id, question => {
|
||||||
if (question.type !== "emoji") return;
|
if (question.type !== "emoji") return;
|
||||||
|
|
||||||
question.content.required = !e.target.checked;
|
console.log(target.checked)
|
||||||
|
question.content.required = target.checked;
|
||||||
})}
|
})}
|
||||||
/>
|
/>
|
||||||
<Box
|
<Box
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
import {
|
import {
|
||||||
Box,
|
Box, useMediaQuery, useTheme,
|
||||||
} from "@mui/material";
|
} from "@mui/material";
|
||||||
import { DraggableList } from "./DraggableList";
|
import { DraggableList } from "./DraggableList";
|
||||||
import { SwitchBranchingPanel } from "./SwitchBranchingPanel";
|
import { SwitchBranchingPanel } from "./SwitchBranchingPanel";
|
||||||
import { BranchingMap } from "./BranchingMap";
|
import { BranchingMap } from "./BranchingMap";
|
||||||
@ -10,9 +10,11 @@ import {useQuestionsStore} from "@root/questions/store";
|
|||||||
|
|
||||||
export const QuestionSwitchWindowTool = () => {
|
export const QuestionSwitchWindowTool = () => {
|
||||||
const {openBranchingPanel, questions} = useQuestionsStore.getState()
|
const {openBranchingPanel, questions} = useQuestionsStore.getState()
|
||||||
|
const theme = useTheme();
|
||||||
|
const isMobile = useMediaQuery(theme.breakpoints.down(600));
|
||||||
console.log("questions ", questions)
|
console.log("questions ", questions)
|
||||||
return (
|
return (
|
||||||
<Box sx={{ display: "flex", gap: "20px", flexWrap: "wrap" }}>
|
<Box sx={{ display: "flex", gap: "20px", flexWrap: "wrap", marginBottom: isMobile ? "20px" : undefined }}>
|
||||||
<Box sx={{ flexBasis: "796px" }}>
|
<Box sx={{ flexBasis: "796px" }}>
|
||||||
{openBranchingPanel? <BranchingMap /> : <DraggableList />}
|
{openBranchingPanel? <BranchingMap /> : <DraggableList />}
|
||||||
</Box>
|
</Box>
|
||||||
|
@ -25,7 +25,7 @@ export const SwitchBranchingPanel = () => {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Switch
|
<Switch
|
||||||
value={openBranchingPanel}
|
clicked={openBranchingPanel}
|
||||||
onChange={(_, value) => {
|
onChange={(_, value) => {
|
||||||
updateOpenBranchingPanel(value)
|
updateOpenBranchingPanel(value)
|
||||||
}}
|
}}
|
||||||
|
@ -41,17 +41,77 @@ export const File = ({ currentQuestion }: FileProps) => {
|
|||||||
maxWidth: answer?.split("|")[0] ? "640px" : "550px"
|
maxWidth: answer?.split("|")[0] ? "640px" : "550px"
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<ButtonBase component="label" sx={{ justifyContent: "flex-start" }}>
|
{answer?.split("|")[0] && (
|
||||||
<input
|
<Box sx={{display: "flex", alignItems: "center", gap: "15px"}}>
|
||||||
onChange={uploadFile}
|
<Typography>Вы загрузили:</Typography>
|
||||||
hidden
|
<Box sx={{padding: "5px 5px 5px 16px", backgroundColor: theme.palette.brightPurple.main,
|
||||||
accept={UPLOAD_FILE_TYPES_MAP[currentQuestion.content.type]}
|
borderRadius: "8px",
|
||||||
multiple
|
color: "#FFFFFF",
|
||||||
type="file"
|
display: "flex",
|
||||||
/>
|
alignItems: "center",
|
||||||
<UploadBox icon={<UploadIcon />} text="5 MB максимум" />
|
gap: "15px"
|
||||||
</ButtonBase>
|
}}>
|
||||||
{answer && currentQuestion.content.type === "picture" && (
|
<Typography>
|
||||||
|
{answer?.split("|")[0]}
|
||||||
|
</Typography>
|
||||||
|
<IconButton
|
||||||
|
sx={{p: 0}}
|
||||||
|
onClick={() => {updateAnswer(currentQuestion.content.id, "");}}
|
||||||
|
>
|
||||||
|
<X/>
|
||||||
|
</IconButton>
|
||||||
|
</Box>
|
||||||
|
|
||||||
|
</Box>
|
||||||
|
|
||||||
|
)}
|
||||||
|
|
||||||
|
{!answer?.split("|")[0] && (
|
||||||
|
<ButtonBase component="label" sx={{ justifyContent: "flex-start" }}>
|
||||||
|
<input
|
||||||
|
onChange={uploadFile}
|
||||||
|
hidden
|
||||||
|
accept={UPLOAD_FILE_TYPES_MAP[currentQuestion.content.type]}
|
||||||
|
multiple
|
||||||
|
type="file"
|
||||||
|
/>
|
||||||
|
<Box
|
||||||
|
onDragOver={(event: DragEvent<HTMLDivElement>) => event.preventDefault()}
|
||||||
|
sx={{
|
||||||
|
width: "100%",
|
||||||
|
height: "120px",
|
||||||
|
display: "flex",
|
||||||
|
justifyContent: "space-between",
|
||||||
|
alignItems: "center",
|
||||||
|
padding: "33px 44px 33px 55px",
|
||||||
|
backgroundColor: theme.palette.background.default,
|
||||||
|
border: `1px solid ${theme.palette.grey2.main}`,
|
||||||
|
borderRadius: "8px",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<UploadIcon />
|
||||||
|
<Box>
|
||||||
|
<Typography
|
||||||
|
sx={{
|
||||||
|
color: theme.palette.grey2.main,
|
||||||
|
fontWeight: 500
|
||||||
|
}}
|
||||||
|
>Добавить видео</Typography>
|
||||||
|
<Typography
|
||||||
|
sx={{
|
||||||
|
color: theme.palette.grey2.main,
|
||||||
|
fontSize: "16px",
|
||||||
|
lineHeight: "19px",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Принимает .mp4 и .mov формат — максимум 100мб
|
||||||
|
</Typography>
|
||||||
|
</Box>
|
||||||
|
|
||||||
|
</Box>
|
||||||
|
</ButtonBase>
|
||||||
|
)}
|
||||||
|
{answer && currentQuestion.content.type === "picture" && (
|
||||||
<img
|
<img
|
||||||
src={answer.split("|")[1]}
|
src={answer.split("|")[1]}
|
||||||
alt=""
|
alt=""
|
||||||
@ -73,11 +133,6 @@ export const File = ({ currentQuestion }: FileProps) => {
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{answer?.split("|")[0] && (
|
|
||||||
<Typography sx={{ marginTop: "15px" }}>
|
|
||||||
{answer?.split("|")[0]}
|
|
||||||
</Typography>
|
|
||||||
)}
|
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
|
@ -7,6 +7,7 @@ import CustomTextField from "@ui_kit/CustomTextField";
|
|||||||
import { useQuizViewStore, updateAnswer } from "@root/quizView";
|
import { useQuizViewStore, updateAnswer } from "@root/quizView";
|
||||||
|
|
||||||
import type { QuizQuestionNumber } from "../../../model/questionTypes/number";
|
import type { QuizQuestionNumber } from "../../../model/questionTypes/number";
|
||||||
|
import {CustomSlider} from "@ui_kit/CustomSlider";
|
||||||
|
|
||||||
type NumberProps = {
|
type NumberProps = {
|
||||||
currentQuestion: QuizQuestionNumber;
|
currentQuestion: QuizQuestionNumber;
|
||||||
|
@ -213,7 +213,7 @@ export default function EditPage() {
|
|||||||
sx={{
|
sx={{
|
||||||
background: theme.palette.background.default,
|
background: theme.palette.background.default,
|
||||||
width: "100%",
|
width: "100%",
|
||||||
padding: isMobile ? "16px" : "25px",
|
padding: isMobile ? "16px 16px 140px 16px" : "25px",
|
||||||
height: "calc(100vh - 80px)",
|
height: "calc(100vh - 80px)",
|
||||||
overflow: "auto",
|
overflow: "auto",
|
||||||
boxSizing: "border-box",
|
boxSizing: "border-box",
|
||||||
@ -258,7 +258,7 @@ export default function EditPage() {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Switch
|
<Switch
|
||||||
value={openBranchingPanel}
|
clicked={openBranchingPanel}
|
||||||
onChange={(_, value) => {
|
onChange={(_, value) => {
|
||||||
updateOpenBranchingPanel(value)
|
updateOpenBranchingPanel(value)
|
||||||
}}
|
}}
|
||||||
@ -310,9 +310,6 @@ export default function EditPage() {
|
|||||||
<Typography sx={{ fontWeight: "bold", color: "#4D4D4D" }}>
|
<Typography sx={{ fontWeight: "bold", color: "#4D4D4D" }}>
|
||||||
Логика ветвления
|
Логика ветвления
|
||||||
</Typography>
|
</Typography>
|
||||||
<Typography sx={{ color: "#4D4D4D", fontSize: "12px" }}>
|
|
||||||
Настройте связи между вопросами
|
|
||||||
</Typography>
|
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
<Button
|
<Button
|
||||||
|
Loading…
Reference in New Issue
Block a user