diff --git a/src/pages/startPage/StartPageSettings.tsx b/src/pages/startPage/StartPageSettings.tsx
index 3af679b8..8d7ddfe1 100755
--- a/src/pages/startPage/StartPageSettings.tsx
+++ b/src/pages/startPage/StartPageSettings.tsx
@@ -20,9 +20,9 @@ import {
FormControlLabel,
MenuItem,
Select,
+ Skeleton,
Tooltip,
Typography,
- Skeleton,
useMediaQuery,
useTheme,
} from "@mui/material";
@@ -45,6 +45,7 @@ import SelectableIconButton from "./SelectableIconButton";
import { DropZone } from "./dropZone";
import Extra from "./extra";
import TooltipClickInfo from "@ui_kit/Toolbars/TooltipClickInfo";
+import { VideoElement } from "./VideoElement";
const designTypes = [
[
@@ -386,91 +387,103 @@ export default function StartPageSettings() {
{quiz.config.startpage.background.type === "video" && (
<>
-
-
- Добавить видео
-
- {isMobile ? (
-
- ) : (
-
-
-
-
-
- )}
-
- {backgroundUploding ? (
-
- ) : (
+ {!quiz.config.startpage.background.video ? (
<>
-
- {
- setBackgroundUploading(true);
- const file = event.target.files?.[0];
-
- if (file) {
- await uploadQuizImage(
- quiz.id,
- file,
- (quiz, url) => {
- quiz.config.startpage.background.video = url;
- },
- );
- // setVideo(URL.createObjectURL(file));
- }
-
- setBackgroundUploading(false);
- }}
- hidden
- accept=".mp4"
- multiple
- type="file"
- />
- }
+
+ Добавить видео
+
+ {isMobile ? (
+
+ ) : (
+
+
+
+
+
+ )}
+
+ {backgroundUploding ? (
+
-
- {quiz.config.startpage.background.video && (
-
+ ) : (
+ <>
+
+ {
+ setBackgroundUploading(true);
+ const file = event.target.files?.[0];
+
+ if (file) {
+ await uploadQuizImage(
+ quiz.id,
+ file,
+ (quiz, url) => {
+ quiz.config.startpage.background.video =
+ url;
+ },
+ );
+ }
+
+ setBackgroundUploading(false);
+ }}
+ hidden
+ accept=".mp4"
+ multiple
+ type="file"
+ />
+ }
+ sx={{
+ height: "48px",
+ width: "48px",
+ }}
+ />
+
+ >
)}
>
+ ) : (
+
+ {
+ updateQuiz(quiz.id, (quiz) => {
+ quiz.config.startpage.background.video = null;
+ });
+ }}
+ />
+
)}
>
)}
diff --git a/src/pages/startPage/VideoElement.tsx b/src/pages/startPage/VideoElement.tsx
new file mode 100644
index 00000000..cd3d8e8a
--- /dev/null
+++ b/src/pages/startPage/VideoElement.tsx
@@ -0,0 +1,46 @@
+import Box from "@mui/material/Box";
+import { FC } from "react";
+import DeleteIcon from "@mui/icons-material/Delete";
+import { IconButton, SxProps, Theme } from "@mui/material";
+
+type VideoElementProps = {
+ videoSrc: string;
+ width?: string;
+ theme: Theme;
+ onDeleteClick: () => void;
+ deleteIconSx?: SxProps;
+};
+
+export const VideoElement: FC = ({
+ videoSrc,
+ width = "300",
+ theme,
+ onDeleteClick,
+ deleteIconSx,
+}) => {
+ return (
+
+
+
+
+
+
+ );
+};
diff --git a/src/ui_kit/MediaSelectionAndDisplay.tsx b/src/ui_kit/MediaSelectionAndDisplay.tsx
index 511d3111..c789bd72 100644
--- a/src/ui_kit/MediaSelectionAndDisplay.tsx
+++ b/src/ui_kit/MediaSelectionAndDisplay.tsx
@@ -1,4 +1,4 @@
-import { useState, FC } from "react";
+import { FC, useState } from "react";
import {
Box,
Button,
@@ -7,7 +7,6 @@ import {
Typography,
useTheme,
} from "@mui/material";
-import CustomTextField from "./CustomTextField";
import { updateQuestion, uploadQuestionImage } from "@root/questions/actions";
import { CropModal, useCropModalState } from "@ui_kit/Modal/CropModal";
@@ -19,6 +18,7 @@ import { AnyTypedQuizQuestion } from "@model/questionTypes/shared";
import UploadBox from "@ui_kit/UploadBox";
import UploadIcon from "@icons/UploadIcon";
import InfoIcon from "@icons/InfoIcon";
+import { VideoElement } from "../pages/startPage/VideoElement";
interface Iprops {
resultData: AnyTypedQuizQuestion;
@@ -167,67 +167,78 @@ export const MediaSelectionAndDisplay: FC = ({ resultData }) => {
)}
{!resultData.content.useImage && (
<>
-
-
- Добавить видео
-
-
-
-
+ {!resultData.content.video ? (
+ <>
+
+
+ Добавить видео
+
+
+
+
+
+
-
-
-
- {
- 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"
- />
- }
- sx={{
- height: "48px",
- width: "48px",
+
+ {
+ 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"
+ />
+ }
+ sx={{
+ height: "48px",
+ width: "48px",
+ }}
+ />
+
+ >
+ ) : (
+ {
+ updateQuestion(resultData.id, (question) => {
+ question.content.video = null;
+ });
}}
/>
-
- {resultData.content.video ? (
-
- ) : null}
+ )}
>
)}