2023-08-15 09:51:18 +00:00
|
|
|
|
import {
|
|
|
|
|
Box,
|
|
|
|
|
Button,
|
|
|
|
|
ButtonBase,
|
|
|
|
|
Modal,
|
|
|
|
|
Typography,
|
|
|
|
|
useTheme,
|
|
|
|
|
} from "@mui/material";
|
2023-07-30 21:25:47 +00:00
|
|
|
|
import * as React from "react";
|
2023-05-10 17:35:30 +00:00
|
|
|
|
import SelectableButton from "@ui_kit/SelectableButton";
|
2023-03-15 22:56:53 +00:00
|
|
|
|
import CustomTextField from "@ui_kit/CustomTextField";
|
2023-07-30 21:25:47 +00:00
|
|
|
|
import { useState } from "react";
|
2023-05-03 19:21:00 +00:00
|
|
|
|
import UploadIcon from "../../assets/icons/UploadIcon";
|
2023-05-10 17:35:30 +00:00
|
|
|
|
import UploadBox from "@ui_kit/UploadBox";
|
2023-03-15 22:56:53 +00:00
|
|
|
|
|
|
|
|
|
type BackgroundType = "text" | "video";
|
2023-07-30 21:25:47 +00:00
|
|
|
|
type BackgroundTypeModal = "linkVideo" | "ownVideo";
|
2023-03-15 22:56:53 +00:00
|
|
|
|
|
2023-03-30 18:39:59 +00:00
|
|
|
|
export default function HelpQuestions() {
|
2023-07-30 21:25:47 +00:00
|
|
|
|
const [open, setOpen] = React.useState(false);
|
|
|
|
|
const handleOpen = () => setOpen(true);
|
|
|
|
|
const handleClose = () => setOpen(false);
|
|
|
|
|
const [backgroundType, setBackgroundType] = useState<BackgroundType>("text");
|
2023-08-15 09:51:18 +00:00
|
|
|
|
const [backgroundTypeModal, setBackgroundTypeModal] =
|
|
|
|
|
useState<BackgroundTypeModal>("linkVideo");
|
2023-07-30 21:25:47 +00:00
|
|
|
|
const theme = useTheme();
|
2023-03-18 23:42:47 +00:00
|
|
|
|
|
2023-07-30 21:25:47 +00:00
|
|
|
|
const videoHC = (videoInp: HTMLInputElement) => {
|
|
|
|
|
const fileList = videoInp.files;
|
|
|
|
|
if (fileList !== null) {
|
|
|
|
|
const file = fileList[0];
|
|
|
|
|
setVideo(URL.createObjectURL(file));
|
|
|
|
|
handleClose();
|
2023-03-18 23:42:47 +00:00
|
|
|
|
}
|
2023-07-30 21:25:47 +00:00
|
|
|
|
};
|
|
|
|
|
const [video, setVideo] = React.useState("");
|
|
|
|
|
|
|
|
|
|
return (
|
2023-08-15 09:51:18 +00:00
|
|
|
|
<Box
|
|
|
|
|
sx={{
|
|
|
|
|
padding: "20px",
|
|
|
|
|
display: "flex",
|
|
|
|
|
flexDirection: "column",
|
|
|
|
|
gap: "20px",
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<Typography sx={{ fontWeight: "500" }}>Подсказка консультанта</Typography>
|
2023-07-30 21:25:47 +00:00
|
|
|
|
<Box
|
|
|
|
|
sx={{
|
|
|
|
|
display: "flex",
|
|
|
|
|
gap: "10px",
|
|
|
|
|
}}
|
|
|
|
|
>
|
2023-08-15 09:51:18 +00:00
|
|
|
|
<SelectableButton
|
|
|
|
|
isSelected={backgroundType === "text"}
|
|
|
|
|
onClick={() => setBackgroundType("text")}
|
|
|
|
|
sx={{ maxWidth: "130px" }}
|
|
|
|
|
>
|
2023-07-30 21:25:47 +00:00
|
|
|
|
Текст
|
|
|
|
|
</SelectableButton>
|
2023-08-15 09:51:18 +00:00
|
|
|
|
<SelectableButton
|
|
|
|
|
isSelected={backgroundType === "video"}
|
|
|
|
|
onClick={() => setBackgroundType("video")}
|
|
|
|
|
sx={{ maxWidth: "130px" }}
|
|
|
|
|
>
|
2023-07-30 21:25:47 +00:00
|
|
|
|
Видео
|
|
|
|
|
</SelectableButton>
|
|
|
|
|
</Box>
|
|
|
|
|
{backgroundType === "text" ? (
|
|
|
|
|
<>
|
|
|
|
|
<CustomTextField placeholder={"Текст консультанта"} text={""} />
|
|
|
|
|
</>
|
|
|
|
|
) : (
|
|
|
|
|
<Box>
|
2023-08-15 09:51:18 +00:00
|
|
|
|
<Typography sx={{ paddingBottom: "15px", fontWeight: "500" }}>
|
|
|
|
|
Загрузите видео
|
|
|
|
|
</Typography>
|
|
|
|
|
<ButtonBase
|
|
|
|
|
onClick={handleOpen}
|
|
|
|
|
sx={{ justifyContent: "flex-start" }}
|
|
|
|
|
>
|
2023-07-30 21:25:47 +00:00
|
|
|
|
{video ? (
|
|
|
|
|
<video src={video} width="400" controls />
|
|
|
|
|
) : (
|
|
|
|
|
<>
|
|
|
|
|
<UploadBox
|
|
|
|
|
icon={<UploadIcon />}
|
|
|
|
|
sx={{
|
|
|
|
|
height: "48px",
|
|
|
|
|
width: "48px",
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
</>
|
|
|
|
|
)}
|
|
|
|
|
</ButtonBase>
|
|
|
|
|
<Modal
|
|
|
|
|
open={open}
|
|
|
|
|
onClose={handleClose}
|
|
|
|
|
aria-labelledby="modal-modal-title"
|
|
|
|
|
aria-describedby="modal-modal-description"
|
|
|
|
|
>
|
|
|
|
|
<Box
|
|
|
|
|
sx={{
|
|
|
|
|
position: "absolute",
|
|
|
|
|
top: "50%",
|
|
|
|
|
left: "50%",
|
|
|
|
|
transform: "translate(-50%, -50%)",
|
|
|
|
|
maxWidth: "690px",
|
|
|
|
|
bgcolor: "background.paper",
|
|
|
|
|
borderRadius: "12px",
|
|
|
|
|
boxShadow: 24,
|
|
|
|
|
p: 0,
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<Box
|
|
|
|
|
sx={{
|
|
|
|
|
display: "flex",
|
|
|
|
|
padding: "20px",
|
|
|
|
|
background: theme.palette.background.default,
|
|
|
|
|
}}
|
|
|
|
|
>
|
2023-08-15 09:51:18 +00:00
|
|
|
|
<Typography sx={{ color: "#9A9AAF" }}>
|
|
|
|
|
Видео можно вставить с любого хостинга: YouTube, Vimeo или
|
|
|
|
|
загрузить собственное
|
2023-07-30 21:25:47 +00:00
|
|
|
|
</Typography>
|
|
|
|
|
<Button variant="contained">Готово</Button>
|
|
|
|
|
</Box>
|
|
|
|
|
<Box sx={{ padding: "20px", gap: "10px", display: "flex" }}>
|
|
|
|
|
<SelectableButton
|
|
|
|
|
isSelected={backgroundTypeModal === "linkVideo"}
|
|
|
|
|
onClick={() => setBackgroundTypeModal("linkVideo")}
|
2023-08-15 09:51:18 +00:00
|
|
|
|
sx={{ maxWidth: "170px", padding: "10px" }}
|
2023-07-30 21:25:47 +00:00
|
|
|
|
>
|
|
|
|
|
Ссылка на видео
|
2023-03-15 22:56:53 +00:00
|
|
|
|
</SelectableButton>
|
2023-07-30 21:25:47 +00:00
|
|
|
|
<SelectableButton
|
|
|
|
|
isSelected={backgroundTypeModal === "ownVideo"}
|
|
|
|
|
onClick={() => setBackgroundTypeModal("ownVideo")}
|
2023-08-15 09:51:18 +00:00
|
|
|
|
sx={{ maxWidth: "170px", padding: "10px" }}
|
2023-07-30 21:25:47 +00:00
|
|
|
|
>
|
|
|
|
|
Загрузить свое
|
2023-03-15 22:56:53 +00:00
|
|
|
|
</SelectableButton>
|
2023-07-30 21:25:47 +00:00
|
|
|
|
</Box>
|
|
|
|
|
{backgroundTypeModal === "linkVideo" ? (
|
|
|
|
|
<Box sx={{ padding: "20px" }}>
|
2023-08-15 09:51:18 +00:00
|
|
|
|
<Typography sx={{ paddingBottom: "15px", fontWeight: "500" }}>
|
|
|
|
|
Ссылка на видео
|
|
|
|
|
</Typography>
|
|
|
|
|
<CustomTextField
|
|
|
|
|
placeholder={"http://example.com"}
|
|
|
|
|
text={""}
|
|
|
|
|
/>
|
2023-07-30 21:25:47 +00:00
|
|
|
|
</Box>
|
|
|
|
|
) : (
|
|
|
|
|
<Box sx={{ padding: "20px" }}>
|
2023-08-15 09:51:18 +00:00
|
|
|
|
<Typography sx={{ paddingBottom: "15px", fontWeight: "500" }}>
|
|
|
|
|
Загрузите видео
|
|
|
|
|
</Typography>
|
|
|
|
|
<ButtonBase
|
|
|
|
|
component="label"
|
|
|
|
|
sx={{ justifyContent: "flex-start", width: "100%" }}
|
|
|
|
|
>
|
|
|
|
|
<input
|
|
|
|
|
onChange={(event) => videoHC(event.target)}
|
|
|
|
|
hidden
|
|
|
|
|
accept="video/*"
|
|
|
|
|
multiple
|
|
|
|
|
type="file"
|
|
|
|
|
/>
|
2023-07-30 21:25:47 +00:00
|
|
|
|
<Box
|
|
|
|
|
sx={{
|
|
|
|
|
width: "580px",
|
2023-08-15 09:51:18 +00:00
|
|
|
|
padding: "33px 33px 33px 50px",
|
2023-07-30 21:25:47 +00:00
|
|
|
|
display: "flex",
|
|
|
|
|
alignItems: "center",
|
|
|
|
|
backgroundColor: theme.palette.background.default,
|
|
|
|
|
border: `1px solid ${theme.palette.grey2.main}`,
|
|
|
|
|
borderRadius: "8px",
|
2023-08-15 09:51:18 +00:00
|
|
|
|
gap: "50px",
|
2023-07-30 21:25:47 +00:00
|
|
|
|
}}
|
2023-03-18 21:35:09 +00:00
|
|
|
|
>
|
2023-07-30 21:25:47 +00:00
|
|
|
|
<UploadIcon />
|
2023-08-15 09:51:18 +00:00
|
|
|
|
<Box sx={{ color: "#9A9AAF" }}>
|
|
|
|
|
<Typography sx={{ fontWeight: "500" }}>
|
|
|
|
|
Добавить видео
|
|
|
|
|
</Typography>
|
|
|
|
|
<Typography sx={{ fontSize: "16px" }}>
|
|
|
|
|
Принимает .mp4 и .mov формат — максимум 100мб
|
|
|
|
|
</Typography>
|
2023-07-30 21:25:47 +00:00
|
|
|
|
</Box>
|
|
|
|
|
</Box>
|
|
|
|
|
</ButtonBase>
|
2023-03-18 21:35:09 +00:00
|
|
|
|
</Box>
|
2023-07-30 21:25:47 +00:00
|
|
|
|
)}
|
|
|
|
|
</Box>
|
|
|
|
|
</Modal>
|
2023-03-15 22:56:53 +00:00
|
|
|
|
</Box>
|
2023-07-30 21:25:47 +00:00
|
|
|
|
)}
|
|
|
|
|
</Box>
|
|
|
|
|
);
|
|
|
|
|
}
|