import { Box, Button, ButtonBase, Link, Paper, Typography, useMediaQuery, useTheme, } from "@mui/material"; import YoutubeEmbedIframe from "./tools/YoutubeEmbedIframe"; import { QuizStartpageAlignType, QuizStartpageType } from "@model/quizSettings"; import { notReachable } from "../../utils/notReachable"; import { useUADevice } from "../../utils/hooks/useUADevice"; import { useQuestionsStore } from "@root/quizData/store"; interface Props { setVisualStartPage: (a: boolean) => void } export const StartPageViewPublication = ({ setVisualStartPage }: Props) => { const theme = useTheme(); const { isMobileDevice } = useUADevice(); const { settings } = useQuestionsStore() if (!settings) return null; const handleCopyNumber = () => { navigator.clipboard.writeText(settings.cfg.info.phonenumber); }; const background = settings.cfg.startpage.background.type === "image" ? settings.cfg.startpage.background.desktop ? ( ) : null : settings.cfg.startpage.background.type === "video" ? settings.cfg.startpage.background.video ? ( ) : null : null; return ( {settings.cfg.startpage.logo && ( )} {settings.cfg.info.orgname} {settings.cfg.info.site} } quizMainBlock={<> {settings.name} {settings.cfg.startpage.description} {settings.cfg.info.clickable ? ( isMobileDevice ? ( {settings.cfg.info.phonenumber} ) : ( {settings.cfg.info.phonenumber} ) ) : ( {settings.cfg.info.phonenumber} )} {settings.cfg.info.law} } backgroundBlock={background} startpageType={settings.cfg.startpageType} alignType={settings.cfg.startpage.position} /> ); } function QuizPreviewLayoutByType({ quizHeaderBlock, quizMainBlock, backgroundBlock, startpageType, alignType }: { quizHeaderBlock: JSX.Element; quizMainBlock: JSX.Element; backgroundBlock: JSX.Element | null; startpageType: QuizStartpageType; alignType: QuizStartpageAlignType; }) { const theme = useTheme(); const isTablet = useMediaQuery(theme.breakpoints.down(630)); switch (startpageType) { case null: case "standard": { return ( {quizHeaderBlock} {quizMainBlock} {backgroundBlock} ); } case "expanded": { return ( {quizHeaderBlock} {quizMainBlock} {backgroundBlock} ); } case "centered": { return ( {quizHeaderBlock} {backgroundBlock && {backgroundBlock} } {quizMainBlock} ); } default: notReachable(startpageType); } } const startpageAlignTypeToJustifyContent: Record = { left: "start", center: "center", right: "end", };