Merge branch 'fixes' into 'main'
200~touchstart See merge request frontend/squiz!107
This commit is contained in:
commit
0bf15043cb
@ -135,7 +135,7 @@ export const usePopper = ({
|
|||||||
setModalQuestionParentContentId(item.id());
|
setModalQuestionParentContentId(item.id());
|
||||||
setOpenedModalQuestions(true);
|
setOpenedModalQuestions(true);
|
||||||
});
|
});
|
||||||
layoutElement.addEventListener("ontouchend", () => {
|
layoutElement.addEventListener("touchstart", () => {
|
||||||
//Узнаём грани, идущие от этой ноды
|
//Узнаём грани, идущие от этой ноды
|
||||||
setModalQuestionParentContentId(item.id());
|
setModalQuestionParentContentId(item.id());
|
||||||
setOpenedModalQuestions(true);
|
setOpenedModalQuestions(true);
|
||||||
@ -167,7 +167,7 @@ export const usePopper = ({
|
|||||||
plusElement.addEventListener("mouseup", () => {
|
plusElement.addEventListener("mouseup", () => {
|
||||||
setStartCreate(node.id());
|
setStartCreate(node.id());
|
||||||
});
|
});
|
||||||
plusElement.addEventListener("ontouchend", () => {
|
plusElement.addEventListener("touchstart", () => {
|
||||||
setStartCreate(node.id());
|
setStartCreate(node.id());
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -199,7 +199,7 @@ export const usePopper = ({
|
|||||||
crossElement.addEventListener("mouseup", () => {
|
crossElement.addEventListener("mouseup", () => {
|
||||||
setStartRemove(node.id());
|
setStartRemove(node.id());
|
||||||
});
|
});
|
||||||
crossElement.addEventListener("ontouchend", () => {
|
crossElement.addEventListener("touchstart", () => {
|
||||||
setStartRemove(node.id());
|
setStartRemove(node.id());
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -236,7 +236,7 @@ export const usePopper = ({
|
|||||||
gearElement.addEventListener("mouseup", () => {
|
gearElement.addEventListener("mouseup", () => {
|
||||||
updateOpenedModalSettingsId(item.id());
|
updateOpenedModalSettingsId(item.id());
|
||||||
});
|
});
|
||||||
gearElement.addEventListener("ontouchend", () => {
|
gearElement.addEventListener("touchstart", () => {
|
||||||
updateOpenedModalSettingsId(item.id());
|
updateOpenedModalSettingsId(item.id());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -360,7 +360,7 @@ export const ResultCard = ({ resultContract, resultData }: Props) => {
|
|||||||
border: "1px solid #9A9AAF",
|
border: "1px solid #9A9AAF",
|
||||||
background: " #F2F3F7",
|
background: " #F2F3F7",
|
||||||
color: "#9A9AAF",
|
color: "#9A9AAF",
|
||||||
mb: "30px",
|
my: "30px",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Кнопка +
|
Кнопка +
|
||||||
@ -368,7 +368,7 @@ export const ResultCard = ({ resultContract, resultData }: Props) => {
|
|||||||
) : (
|
) : (
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
mb: "30px",
|
my: "30px",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Box>
|
<Box>
|
||||||
|
@ -6,13 +6,13 @@ import ArrowLeft from "@icons/ArrowLeftSP";
|
|||||||
import LayoutCenteredIcon from "@icons/LayoutCenteredIcon";
|
import LayoutCenteredIcon from "@icons/LayoutCenteredIcon";
|
||||||
import LayoutExpandedIcon from "@icons/LayoutExpandedIcon";
|
import LayoutExpandedIcon from "@icons/LayoutExpandedIcon";
|
||||||
import LayoutStandartIcon from "@icons/LayoutStandartIcon";
|
import LayoutStandartIcon from "@icons/LayoutStandartIcon";
|
||||||
import UploadIcon from "../../assets/icons/UploadIcon";
|
|
||||||
|
|
||||||
import MobilePhoneIcon from "@icons/MobilePhoneIcon";
|
import MobilePhoneIcon from "@icons/MobilePhoneIcon";
|
||||||
import { QuizStartpageType } from "@model/quizSettings";
|
import { QuizStartpageType } from "@model/quizSettings";
|
||||||
import InfoIcon from "@icons/InfoIcon";
|
import InfoIcon from "@icons/InfoIcon";
|
||||||
|
|
||||||
import UploadBox from "@ui_kit/UploadBox";
|
import UploadBox from "@ui_kit/UploadBox";
|
||||||
|
import UploadIcon from "../../assets/icons/UploadIcon";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Box,
|
Box,
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { FC } from "react";
|
import { FC } from "react";
|
||||||
import { Box, Button } 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";
|
||||||
@ -9,6 +9,9 @@ import { UploadImageModal } from "../pages/Questions/UploadImage/UploadImageModa
|
|||||||
import { useDisclosure } from "../utils/useDisclosure";
|
import { useDisclosure } from "../utils/useDisclosure";
|
||||||
import { useCurrentQuiz } from "../stores/quizes/hooks";
|
import { useCurrentQuiz } from "../stores/quizes/hooks";
|
||||||
import { AnyTypedQuizQuestion } from "@model/questionTypes/shared";
|
import { AnyTypedQuizQuestion } from "@model/questionTypes/shared";
|
||||||
|
import UploadBox from "@ui_kit/UploadBox";
|
||||||
|
import UploadIcon from "@icons/UploadIcon";
|
||||||
|
import InfoIcon from "@icons/InfoIcon";
|
||||||
|
|
||||||
interface Iprops {
|
interface Iprops {
|
||||||
resultData: AnyTypedQuizQuestion;
|
resultData: AnyTypedQuizQuestion;
|
||||||
@ -16,6 +19,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 {
|
const {
|
||||||
isCropModalOpen,
|
isCropModalOpen,
|
||||||
openCropModal,
|
openCropModal,
|
||||||
@ -26,7 +30,7 @@ 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,
|
||||||
@ -149,25 +153,68 @@ export const MediaSelectionAndDisplay: FC<Iprops> = ({ resultData }) => {
|
|||||||
</Box>
|
</Box>
|
||||||
)}
|
)}
|
||||||
{!resultData.content.useImage && (
|
{!resultData.content.useImage && (
|
||||||
<Box
|
<>
|
||||||
sx={{
|
<Box
|
||||||
cursor: "pointer",
|
sx={{
|
||||||
display: "flex",
|
display: "flex",
|
||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
gap: "20px",
|
gap: "7px",
|
||||||
mb: "30px",
|
mt: "20px",
|
||||||
}}
|
mb: "14px",
|
||||||
>
|
}}
|
||||||
<CustomTextField
|
>
|
||||||
placeholder="URL видео"
|
<Typography
|
||||||
text={resultData.content.video ?? ""}
|
sx={{ fontWeight: 500, color: theme.palette.grey3.main }}
|
||||||
onChange={(e) =>
|
>
|
||||||
updateQuestion(resultData.id, (q) => {
|
Добавить видео
|
||||||
q.content.video = e.target.value;
|
</Typography>
|
||||||
})
|
<Tooltip title="Можно загрузить видео." placement="top">
|
||||||
}
|
<Box>
|
||||||
/>
|
<InfoIcon />
|
||||||
</Box>
|
</Box>
|
||||||
|
</Tooltip>
|
||||||
|
</Box>
|
||||||
|
<ButtonBase
|
||||||
|
component="label"
|
||||||
|
sx={{
|
||||||
|
justifyContent: "center",
|
||||||
|
height: "48px",
|
||||||
|
width: "48px",
|
||||||
|
display: "flex",
|
||||||
|
alignItems: "center",
|
||||||
|
my: "20px"
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<input
|
||||||
|
onChange={(event) => {
|
||||||
|
const file = event.target.files?.[0];
|
||||||
|
if (file) {
|
||||||
|
uploadQuestionImage(
|
||||||
|
resultData.id,
|
||||||
|
quizQid,
|
||||||
|
file,
|
||||||
|
(question, url) => {
|
||||||
|
question.content.video = url;
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}}
|
||||||
|
hidden
|
||||||
|
accept=".mp4"
|
||||||
|
multiple
|
||||||
|
type="file"
|
||||||
|
/>
|
||||||
|
<UploadBox
|
||||||
|
icon={<UploadIcon />}
|
||||||
|
sx={{
|
||||||
|
height: "48px",
|
||||||
|
width: "48px",
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</ButtonBase>
|
||||||
|
{resultData.content.video ? <video src={resultData.content.video} width="400" controls /> : null}
|
||||||
|
</>
|
||||||
)}
|
)}
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user