import {Box, Button, ButtonBase, FormControl, Link, MenuItem, Select, Typography, useTheme} from "@mui/material";
import { useState } from "react";
import CustomCheckbox from "@ui_kit/CustomCheckbox";
import AlignLeftIcon from "../../assets/icons/AlignLeftIcon";
import AlignRightIcon from "../../assets/icons/AlignRightIcon";
import ArrowDown from "../../assets/icons/ArrowDownIcon";
import InfoIcon from "../../assets/icons/InfoIcon";
import LayoutCenteredIcon from "../../assets/icons/LayoutCenteredIcon";
import LayoutExpandedIcon from "../../assets/icons/LayoutExpandedIcon";
import LayoutStandartIcon from "../../assets/icons/LayoutStandartIcon";
import MobilePhoneIcon from "../../assets/icons/MobilePhoneIcon";
import UploadIcon from "../../assets/icons/UploadIcon";
import SelectableButton from "@ui_kit/SelectableButton";
import SelectableIconButton from "./SelectableIconButton";
import UploadBox from "@ui_kit/UploadBox";
import CustomTextField from "@ui_kit/CustomTextField";
import {quizStore} from "@root/quizes";
import {useParams} from "react-router-dom";
import * as React from "react";
const designTypes = [
["standard", (color: string) => , "Standard"],
["expanded", (color: string) => , "Expanded"],
["centered", (color: string) => , "Centered"]
] as const;
// type DesignType = typeof designTypes[number][0];
type BackgroundType = "image" | "video";
type AlignType = "left" | "right";
export default function StartPageSettings() {
const {listQuizes, updateQuizesList, removeQuiz, createBlank} = quizStore();
const params = Number(useParams().quizId);
const theme = useTheme();
const designType = listQuizes[params].startpage
const StartPageClone = listQuizes[params]
console.log(StartPageClone)
const [backgroundType, setBackgroundType] = useState("image");
const [alignType, setAlignType] = useState("left");
//дропзона
const imgHC = (imgInp:any) => {
const [file] = imgInp.files
setImg(URL.createObjectURL(file))
}
const [img, setImg] = React.useState("");
const dropZone = React.useRef(null);
const [ready, setReady] = React.useState(false);
const dragenterHC = () => {
console.log("a")
setReady(true)
}
console.log(dropZone.current)
React.useEffect(() => {
console.log(dropZone.current)
if (dropZone.current) {
dropZone.current.addEventListener("dragenter", dragenterHC)
}
return () => {dropZone.current.removeEventListener("dragenter", dragenterHC)}
},)
const mutationHC = (e: any) => {
let SPageClone = listQuizes[params].config1
SPageClone.startpage.description = e.target.value
updateQuizesList(params, {config1: SPageClone })
}
const mutationButtonHC = (e: any) => {
let SPageClone = listQuizes[params].config1
SPageClone.startpage.button = e.target.value
updateQuizesList(params, {config1: SPageClone })
}
const mutationPhoneHC = (e: any) => {
let SPageClone = listQuizes[params].config1
SPageClone.info.phonenumber = e.target.value
updateQuizesList(params, {config1: SPageClone })
}
const mutationSiteHC = (e: any) => {
let SPageClone = listQuizes[params].config1
SPageClone.info.site = e.target.value
updateQuizesList(params, {config1: SPageClone })
}
const mutationLawHC = (e: any) => {
let SPageClone = listQuizes[params].config1
SPageClone.info.law = e.target.value
updateQuizesList(params, {config1: SPageClone })
}
const mutationOrgNameHC = (e: any) => {
let SPageClone = listQuizes[params].config1
SPageClone.info.orgname = e.target.value
updateQuizesList(params, {config1: SPageClone })
}
const mutationOrgMetaHC = (e: any) => {
let SPageClone = listQuizes[params].config1
SPageClone.meta = e.target.value
updateQuizesList(params, {config1: SPageClone })
}
return (
<>
Дизайн
Фон
setBackgroundType("image")}>
Изображение
setBackgroundType("video")}>
Видео
{backgroundType === "image" ?
<>
Изображение
imgHC(event.target)} hidden accept="image/*" multiple type="file" />
5 MB максимум
{/*} text="5 MB максимум" ref={dropZone} sx={{border: `1px solid ${ready ? "red" : theme.palette.grey2.main}`}}/>*/}
Размер картинок
мобильная версия
>
:
<>
Добавить видео
}
sx={{
height: "48px",
width: "48px",
}}
/>
Настройки видео
Изображение для мобильной версии
} text="5 MB максимум" />
>
}
Расположение элементов
setAlignType("left")} isActive={alignType === "left"} Icon={AlignLeftIcon} />
setAlignType("right")} isActive={alignType === "right"} Icon={AlignRightIcon} />
{backgroundType === "image" &&
Логотип
}
} text="5 MB максимум" />
Favicon
}
sx={{
height: "48px",
width: "48px",
}}
/>
5 MB максимум
Заголовок
updateQuizesList(params, {name: e.target.value})}
/>
Текст
Текст кнопки
Телефон
{console.log(e.target.checked)
let SPageClone = listQuizes[params].config1
SPageClone.info.clickable = e.target.checked
updateQuizesList(params, {config1: SPageClone })}
}/>
Название или слоган компании
Сайт
Юридическая информация
Дополнительно
Mета заголовок
Текст-заполнитель —
это текст, который имеет Текст-заполнитель —
это текст, который имеет Текст-заполнитель —
это текст, который имеет Текст-заполнитель —
это текст, который имеет Текст-заполнитель
>
);
}