import { useEffect, useState } from "react"; import { updateQuiz } from "@root/quizes/actions"; import { useCurrentQuiz } from "@root/quizes/hooks"; import { SwitchSetting } from "../SwichResult"; import Info from "@icons/Info"; import { Box, IconButton, Paper, Button, Typography, useMediaQuery, useTheme, Popover, } from "@mui/material"; import ExpandLessIconBG from "@icons/ExpandLessIconBG"; import ExpandLessIcon from "@mui/icons-material/ExpandLess"; import ShareNetwork from "@icons/ShareNetwork.svg"; import ArrowCounterClockWise from "@icons/ArrowCounterClockWise.svg"; type WhenVariants = { title: string; value: "before" | "after"; id: string; }; const whenValues: WhenVariants[] = [ { title: "До формы контактов", value: "before", id: "before-contact-form", }, { title: "После формы контактов", value: "after", id: "after-the-contact-form", }, ]; interface Props { quizExpand: boolean; } const InfoView = () => { const [anchorEl, setAnchorEl] = useState(null); const handleClick = (event: React.MouseEvent) => { setAnchorEl(event.currentTarget); }; const handleClose = () => { setAnchorEl(null); }; const open = Boolean(anchorEl); const id = open ? "simple-popover" : undefined; return ( <> Oтправка письма с результатом респонденту после отображения на экране ); }; export const WhenCard = ({ quizExpand }: Props) => { const quiz = useCurrentQuiz(); const theme = useTheme(); const isMobile = useMediaQuery(theme.breakpoints.down(790)); const isSmallMonitor = useMediaQuery(theme.breakpoints.down(1100)); const [expand, setExpand] = useState(true); useEffect(() => { setExpand(true); }, [quizExpand]); return ( Показывать результат setExpand(!expand)} > {expand ? ( ) : ( )} {expand && quiz && ( <> {whenValues.map(({ title, value, id }, index) => ( ))} )} ); };