не открывается логика ветвления
This commit is contained in:
parent
7c396f1f50
commit
97b2d3ac97
@ -101,13 +101,6 @@ export function useUserAccountFetcher({
|
|||||||
dayjs.locale("ru");
|
dayjs.locale("ru");
|
||||||
|
|
||||||
const routeslink = [
|
const routeslink = [
|
||||||
{
|
|
||||||
path: "/tariffs",
|
|
||||||
page: <Tariffs />,
|
|
||||||
header: true,
|
|
||||||
sidebar: false,
|
|
||||||
footer: false,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
path: "/edit",
|
path: "/edit",
|
||||||
page: <EditPage />,
|
page: <EditPage />,
|
||||||
@ -199,6 +192,7 @@ export default function App() {
|
|||||||
/>
|
/>
|
||||||
<Route path="/list" element={<MyQuizzesFull />} />
|
<Route path="/list" element={<MyQuizzesFull />} />
|
||||||
<Route path={"/view"} element={<ViewPage />} />
|
<Route path={"/view"} element={<ViewPage />} />
|
||||||
|
<Route path={"/tariffs"} element={<Tariffs />} />
|
||||||
<Route element={<PrivateRoute />}>
|
<Route element={<PrivateRoute />}>
|
||||||
{routeslink.map((e, i) => (
|
{routeslink.map((e, i) => (
|
||||||
<Route
|
<Route
|
||||||
|
|||||||
@ -138,20 +138,6 @@ export const DesignFilling = () => {
|
|||||||
))}
|
))}
|
||||||
</Box>
|
</Box>
|
||||||
</Paper>
|
</Paper>
|
||||||
<Box sx={{ textAlign: "end" }}>
|
|
||||||
<IconButton
|
|
||||||
onClick={toggleQuizPreview}
|
|
||||||
sx={{
|
|
||||||
pointerEvents: "auto",
|
|
||||||
marginLeft: "auto",
|
|
||||||
position: "relative",
|
|
||||||
zIndex: "999999",
|
|
||||||
alignItems: "end",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<VisibilityIcon sx={{ height: "30px", width: "30px" }} />
|
|
||||||
</IconButton>
|
|
||||||
</Box>
|
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@ -6,7 +6,7 @@ import { useQuizStore } from "@root/quizes/store";
|
|||||||
import Sidebar from "@ui_kit/Sidebar";
|
import Sidebar from "@ui_kit/Sidebar";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
import { SidebarMobile } from "../startPage/Sidebar/SidebarMobile";
|
import { SidebarMobile } from "../../ui_kit/Sidebar/SidebarMobile";
|
||||||
import { cleanQuestions, setQuestions } from "@root/questions/actions";
|
import { cleanQuestions, setQuestions } from "@root/questions/actions";
|
||||||
import {
|
import {
|
||||||
updateModalInfoWhyCantCreate,
|
updateModalInfoWhyCantCreate,
|
||||||
@ -17,7 +17,7 @@ import { questionApi } from "@api/question";
|
|||||||
import { useUiTools } from "@root/uiTools/store";
|
import { useUiTools } from "@root/uiTools/store";
|
||||||
|
|
||||||
import { ConfirmLeaveModal } from "../startPage/ConfirmLeaveModal";
|
import { ConfirmLeaveModal } from "../startPage/ConfirmLeaveModal";
|
||||||
import { Header } from "../startPage/Header";
|
import { Header } from "@ui_kit/Header/Header";
|
||||||
import { DesignFilling } from "./DesignFilling";
|
import { DesignFilling } from "./DesignFilling";
|
||||||
import { createPortal } from "react-dom";
|
import { createPortal } from "react-dom";
|
||||||
import QuizPreview from "@ui_kit/QuizPreview/QuizPreview";
|
import QuizPreview from "@ui_kit/QuizPreview/QuizPreview";
|
||||||
@ -69,13 +69,7 @@ export const DesignPage = () => {
|
|||||||
);
|
);
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{/*<Header setMobileSidebar={setMobileSidebar} />*/}
|
|
||||||
<Box sx={{ display: "flex", flexDirection: isMobile ? "column" : "row" }}>
|
<Box sx={{ display: "flex", flexDirection: isMobile ? "column" : "row" }}>
|
||||||
{/*{isMobile ? (*/}
|
|
||||||
{/* <SidebarMobile open={mobileSidebar} changePage={changePage} />*/}
|
|
||||||
{/*) : (*/}
|
|
||||||
{/* <Sidebar changePage={changePage} />*/}
|
|
||||||
{/*)}*/}
|
|
||||||
<DesignFilling />
|
<DesignFilling />
|
||||||
{createPortal(<QuizPreview />, document.body)}
|
{createPortal(<QuizPreview />, document.body)}
|
||||||
</Box>
|
</Box>
|
||||||
|
|||||||
@ -85,6 +85,7 @@ export default function QuestionsPage({
|
|||||||
display: "flex",
|
display: "flex",
|
||||||
justifyContent: "space-between",
|
justifyContent: "space-between",
|
||||||
maxWidth: "796px",
|
maxWidth: "796px",
|
||||||
|
position: "relative",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<IconButton
|
<IconButton
|
||||||
@ -93,7 +94,6 @@ export default function QuestionsPage({
|
|||||||
}}
|
}}
|
||||||
sx={{
|
sx={{
|
||||||
position: "fixed",
|
position: "fixed",
|
||||||
left: isMobile ? "20px" : "250px",
|
|
||||||
bottom: "140px",
|
bottom: "140px",
|
||||||
}}
|
}}
|
||||||
data-cy="create-question"
|
data-cy="create-question"
|
||||||
|
|||||||
@ -7,7 +7,7 @@ import {
|
|||||||
AnyTypedQuizQuestion,
|
AnyTypedQuizQuestion,
|
||||||
UntypedQuizQuestion,
|
UntypedQuizQuestion,
|
||||||
} from "@model/questionTypes/shared";
|
} from "@model/questionTypes/shared";
|
||||||
import { Pencil } from "../../startPage/Sidebar/icons/Pencil";
|
import { Pencil } from "../../../ui_kit/Sidebar/icons/Pencil";
|
||||||
import {
|
import {
|
||||||
updateEditSomeQuestion,
|
updateEditSomeQuestion,
|
||||||
updateDragQuestionContentId,
|
updateDragQuestionContentId,
|
||||||
|
|||||||
@ -16,6 +16,7 @@ import { enqueueSnackbar } from "notistack";
|
|||||||
import { Tariff, getMessageFromFetchError } from "@frontend/kitui";
|
import { Tariff, getMessageFromFetchError } from "@frontend/kitui";
|
||||||
import { withErrorBoundary } from "react-error-boundary";
|
import { withErrorBoundary } from "react-error-boundary";
|
||||||
import { createTariffElements } from "./tariffsUtils/createTariffElements";
|
import { createTariffElements } from "./tariffsUtils/createTariffElements";
|
||||||
|
import HeaderFull from "@ui_kit/Header/HeaderFull";
|
||||||
|
|
||||||
function TariffPage() {
|
function TariffPage() {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
@ -93,6 +94,7 @@ function TariffPage() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
<HeaderFull />
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
justifyContent: "left",
|
justifyContent: "left",
|
||||||
|
|||||||
@ -1,10 +1,10 @@
|
|||||||
import { Header } from "../../src/pages/startPage/Header";
|
import { Header } from "@ui_kit/Header/Header";
|
||||||
import Sidebar from "@ui_kit/Sidebar";
|
import Sidebar from "@ui_kit/Sidebar";
|
||||||
import Box from "@mui/material/Box";
|
import Box from "@mui/material/Box";
|
||||||
import { useTheme, useMediaQuery } from "@mui/material";
|
import { useTheme, useMediaQuery, IconButton } from "@mui/material";
|
||||||
import HeaderFull from "@ui_kit/Header/HeaderFull";
|
import HeaderFull from "@ui_kit/Header/HeaderFull";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { SidebarMobile } from "./startPage/Sidebar/SidebarMobile";
|
import { SidebarMobile } from "../ui_kit/Sidebar/SidebarMobile";
|
||||||
import { setShowConfirmLeaveModal } from "@root/uiTools/actions";
|
import { setShowConfirmLeaveModal } from "@root/uiTools/actions";
|
||||||
import { setCurrentStep, setQuizes } from "@root/quizes/actions";
|
import { setCurrentStep, setQuizes } from "@root/quizes/actions";
|
||||||
import { useQuizStore } from "@root/quizes/store";
|
import { useQuizStore } from "@root/quizes/store";
|
||||||
@ -20,15 +20,17 @@ import { useQuestionsStore } from "@root/questions/store";
|
|||||||
import { quizApi } from "@api/quiz";
|
import { quizApi } from "@api/quiz";
|
||||||
import { questionApi } from "@api/question";
|
import { questionApi } from "@api/question";
|
||||||
import { createResult, setQuestions } from "@root/questions/actions";
|
import { createResult, setQuestions } from "@root/questions/actions";
|
||||||
|
import { toggleQuizPreview } from "@root/quizPreview";
|
||||||
|
import VisibilityIcon from "@mui/icons-material/Visibility";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
sidebar: boolean;
|
sidebar: boolean;
|
||||||
header?: boolean;
|
header?: boolean;
|
||||||
footer?: boolean;
|
footer?: boolean;
|
||||||
page: JSX.Element;
|
Page: JSX.Element;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function Main({ sidebar, header, footer, page }: Props) {
|
export default function Main({ sidebar, header, footer, Page }: Props) {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const quiz = useCurrentQuiz();
|
const quiz = useCurrentQuiz();
|
||||||
const quizConfig = quiz?.config;
|
const quizConfig = quiz?.config;
|
||||||
@ -115,22 +117,22 @@ export default function Main({ sidebar, header, footer, page }: Props) {
|
|||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
width: "100%",
|
width: "100%",
|
||||||
height: "calc(100vh - 80px)",
|
height: isMobile ? "calc(100vh - 51px)" : "calc(100vh - 80px)",
|
||||||
|
display: "flex",
|
||||||
|
flexDirection: "column",
|
||||||
|
justifyContent: "space-between",
|
||||||
overflow: "hidden",
|
overflow: "hidden",
|
||||||
// padding: isMobile ? "15px" : "25px",
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
background: theme.palette.background.default,
|
background: theme.palette.background.default,
|
||||||
width: "100%",
|
width: "100%",
|
||||||
// padding: isMobile ? "15px" : "25px",
|
|
||||||
// height: "calc(100vh - 80px)",
|
|
||||||
overflow: "auto",
|
overflow: "auto",
|
||||||
boxSizing: "border-box",
|
boxSizing: "border-box",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{page}
|
<Page state={openBranchingPage} HC={openBranchingPageHC} />
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
{footer && (
|
{footer && (
|
||||||
@ -229,6 +231,20 @@ export default function Main({ sidebar, header, footer, page }: Props) {
|
|||||||
<LinkSimple />
|
<LinkSimple />
|
||||||
</Box>
|
</Box>
|
||||||
)}
|
)}
|
||||||
|
<Box sx={{ textAlign: "end", width: "100%" }}>
|
||||||
|
<IconButton
|
||||||
|
onClick={toggleQuizPreview}
|
||||||
|
sx={{
|
||||||
|
pointerEvents: "auto",
|
||||||
|
marginLeft: "auto",
|
||||||
|
position: "relative",
|
||||||
|
zIndex: "999999",
|
||||||
|
alignItems: "end",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<VisibilityIcon sx={{ height: "30px", width: "30px" }} />
|
||||||
|
</IconButton>
|
||||||
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
)}
|
)}
|
||||||
</Box>
|
</Box>
|
||||||
|
|||||||
@ -20,7 +20,7 @@ import SwitchStepPages from "@ui_kit/switchStepPages";
|
|||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { Link, useNavigate } from "react-router-dom";
|
import { Link, useNavigate } from "react-router-dom";
|
||||||
import { useDebouncedCallback } from "use-debounce";
|
import { useDebouncedCallback } from "use-debounce";
|
||||||
import { SidebarMobile } from "./Sidebar/SidebarMobile";
|
import { SidebarMobile } from "../../ui_kit/Sidebar/SidebarMobile";
|
||||||
import {
|
import {
|
||||||
cleanQuestions,
|
cleanQuestions,
|
||||||
createResult,
|
createResult,
|
||||||
@ -32,7 +32,7 @@ import {
|
|||||||
setShowConfirmLeaveModal,
|
setShowConfirmLeaveModal,
|
||||||
updateSomeWorkBackend,
|
updateSomeWorkBackend,
|
||||||
} from "@root/uiTools/actions";
|
} from "@root/uiTools/actions";
|
||||||
import { Header } from "./Header";
|
import { Header } from "@ui_kit/Header/Header";
|
||||||
import { useQuestionsStore } from "@root/questions/store";
|
import { useQuestionsStore } from "@root/questions/store";
|
||||||
import { questionApi } from "@api/question";
|
import { questionApi } from "@api/question";
|
||||||
import { useUiTools } from "@root/uiTools/store";
|
import { useUiTools } from "@root/uiTools/store";
|
||||||
|
|||||||
@ -1,178 +0,0 @@
|
|||||||
import { LogoutButton } from "@ui_kit/LogoutButton";
|
|
||||||
import BackArrowIcon from "@icons/BackArrowIcon";
|
|
||||||
import { Burger } from "@icons/Burger";
|
|
||||||
|
|
||||||
import {
|
|
||||||
Box,
|
|
||||||
Container,
|
|
||||||
FormControl,
|
|
||||||
IconButton,
|
|
||||||
TextField,
|
|
||||||
useMediaQuery,
|
|
||||||
useTheme,
|
|
||||||
} from "@mui/material";
|
|
||||||
import { updateQuiz } from "@root/quizes/actions";
|
|
||||||
import { useCurrentQuiz } from "@root/quizes/hooks";
|
|
||||||
import CustomAvatar from "@ui_kit/Header/Avatar";
|
|
||||||
import NavMenuItem from "@ui_kit/Header/NavMenuItem";
|
|
||||||
|
|
||||||
import { enqueueSnackbar } from "notistack";
|
|
||||||
import { useState } from "react";
|
|
||||||
import { Link, useNavigate } from "react-router-dom";
|
|
||||||
|
|
||||||
import Logotip from "../Landing/images/icons/QuizLogo";
|
|
||||||
import { clearUserData } from "@root/user";
|
|
||||||
import { clearAuthToken } from "@frontend/kitui";
|
|
||||||
import { logout } from "@api/auth";
|
|
||||||
|
|
||||||
type HeaderProps = {
|
|
||||||
setMobileSidebar: (callback: (visible: boolean) => boolean) => void;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const Header = ({ setMobileSidebar }: HeaderProps) => {
|
|
||||||
const quiz = useCurrentQuiz();
|
|
||||||
const theme = useTheme();
|
|
||||||
const navigate = useNavigate();
|
|
||||||
const isTablet = useMediaQuery(theme.breakpoints.down(1000));
|
|
||||||
const isMobile = useMediaQuery(theme.breakpoints.down(660));
|
|
||||||
|
|
||||||
async function handleLogoutClick() {
|
|
||||||
const [, logoutError] = await logout();
|
|
||||||
|
|
||||||
if (logoutError) {
|
|
||||||
return enqueueSnackbar(logoutError);
|
|
||||||
}
|
|
||||||
|
|
||||||
clearAuthToken();
|
|
||||||
clearUserData();
|
|
||||||
navigate("/");
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Container
|
|
||||||
component="nav"
|
|
||||||
maxWidth={false}
|
|
||||||
disableGutters
|
|
||||||
sx={{
|
|
||||||
px: "16px",
|
|
||||||
display: "flex",
|
|
||||||
height: isMobile ? "51px" : "80px",
|
|
||||||
alignItems: "center",
|
|
||||||
bgcolor: isMobile ? "#333647" : "white",
|
|
||||||
borderBottom: "1px solid #E3E3E3",
|
|
||||||
zIndex: theme.zIndex.drawer + 1,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Link to="/" style={{ display: "flex" }}>
|
|
||||||
{isMobile ? <Logotip width={100} /> : <Logotip width={124} />}
|
|
||||||
</Link>
|
|
||||||
<Box
|
|
||||||
sx={{
|
|
||||||
display: isMobile ? "none" : "flex",
|
|
||||||
alignItems: "center",
|
|
||||||
ml: "37px",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Link to="/list">
|
|
||||||
<IconButton sx={{ p: "6px" }}>
|
|
||||||
<BackArrowIcon />
|
|
||||||
</IconButton>
|
|
||||||
</Link>
|
|
||||||
<FormControl fullWidth variant="standard">
|
|
||||||
<TextField
|
|
||||||
// value={quiz.name}
|
|
||||||
// onChange={(e) =>
|
|
||||||
// updateQuiz(quiz.id, (quiz) => {
|
|
||||||
// quiz.name = e.target.value;
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
fullWidth
|
|
||||||
id="project-name"
|
|
||||||
placeholder="Название проекта окно"
|
|
||||||
sx={{
|
|
||||||
width: "270px",
|
|
||||||
"& .MuiInputBase-root": {
|
|
||||||
height: "34px",
|
|
||||||
borderRadius: "8px",
|
|
||||||
p: 0,
|
|
||||||
},
|
|
||||||
}}
|
|
||||||
inputProps={{
|
|
||||||
sx: {
|
|
||||||
height: "20px",
|
|
||||||
borderRadius: "8px",
|
|
||||||
fontSize: "16px",
|
|
||||||
lineHeight: "20px",
|
|
||||||
p: "7px",
|
|
||||||
color: "black",
|
|
||||||
"&::placeholder": {
|
|
||||||
opacity: 1,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</FormControl>
|
|
||||||
</Box>
|
|
||||||
{isTablet ? (
|
|
||||||
<Box
|
|
||||||
sx={{
|
|
||||||
display: "flex",
|
|
||||||
ml: "auto",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{isMobile ? (
|
|
||||||
<Burger
|
|
||||||
onClick={() => setMobileSidebar((visible: boolean) => !visible)}
|
|
||||||
style={{ fontSize: "30px", color: "white", cursor: "pointer" }}
|
|
||||||
/>
|
|
||||||
) : (
|
|
||||||
<Box>
|
|
||||||
{/* <CustomAvatar
|
|
||||||
sx={{
|
|
||||||
ml: "11px",
|
|
||||||
backgroundColor: theme.palette.orange.main,
|
|
||||||
height: "36px",
|
|
||||||
width: "36px",
|
|
||||||
}}
|
|
||||||
/> */}
|
|
||||||
</Box>
|
|
||||||
)}
|
|
||||||
</Box>
|
|
||||||
) : (
|
|
||||||
<>
|
|
||||||
<Box
|
|
||||||
sx={{
|
|
||||||
display: "flex",
|
|
||||||
gap: "30px",
|
|
||||||
overflow: "hidden",
|
|
||||||
ml: "20px",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{/* <NavMenuItem text="Редактировать" isActive /> */}
|
|
||||||
{/* <NavMenuItem text="Заявки" />
|
|
||||||
<NavMenuItem text="Аналитика" />
|
|
||||||
<NavMenuItem text="История" />
|
|
||||||
<NavMenuItem text="Помощь" /> */}
|
|
||||||
</Box>
|
|
||||||
<Box
|
|
||||||
sx={{
|
|
||||||
display: "flex",
|
|
||||||
ml: "auto",
|
|
||||||
gap: "15px",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{/* <CustomAvatar
|
|
||||||
sx={{
|
|
||||||
ml: "11px",
|
|
||||||
backgroundColor: theme.palette.orange.main,
|
|
||||||
height: "36px",
|
|
||||||
width: "36px",
|
|
||||||
}}
|
|
||||||
/> */}
|
|
||||||
<LogoutButton onClick={handleLogoutClick} />
|
|
||||||
</Box>
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
</Container>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
111
src/ui_kit/Header/Header.tsx
Executable file → Normal file
111
src/ui_kit/Header/Header.tsx
Executable file → Normal file
@ -1,8 +1,9 @@
|
|||||||
|
import { LogoutButton } from "@ui_kit/LogoutButton";
|
||||||
import BackArrowIcon from "@icons/BackArrowIcon";
|
import BackArrowIcon from "@icons/BackArrowIcon";
|
||||||
import EyeIcon from "@icons/EyeIcon";
|
import { Burger } from "@icons/Burger";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Box,
|
Box,
|
||||||
Button,
|
|
||||||
Container,
|
Container,
|
||||||
FormControl,
|
FormControl,
|
||||||
IconButton,
|
IconButton,
|
||||||
@ -10,15 +11,43 @@ import {
|
|||||||
useMediaQuery,
|
useMediaQuery,
|
||||||
useTheme,
|
useTheme,
|
||||||
} from "@mui/material";
|
} from "@mui/material";
|
||||||
import { decrementCurrentStep } from "@root/quizes/actions";
|
import { updateQuiz } from "@root/quizes/actions";
|
||||||
import PenaLogo from "../PenaLogo";
|
import { useCurrentQuiz } from "@root/quizes/hooks";
|
||||||
import CustomAvatar from "./Avatar";
|
import CustomAvatar from "@ui_kit/Header/Avatar";
|
||||||
import NavMenuItem from "./NavMenuItem";
|
import NavMenuItem from "@ui_kit/Header/NavMenuItem";
|
||||||
import { Link } from "react-router-dom";
|
|
||||||
|
|
||||||
export default function Header() {
|
import { enqueueSnackbar } from "notistack";
|
||||||
|
import { useState } from "react";
|
||||||
|
import { Link, useNavigate } from "react-router-dom";
|
||||||
|
|
||||||
|
import Logotip from "../../pages/Landing/images/icons/QuizLogo";
|
||||||
|
import { clearUserData } from "@root/user";
|
||||||
|
import { clearAuthToken } from "@frontend/kitui";
|
||||||
|
import { logout } from "@api/auth";
|
||||||
|
import { ToTariffsButton } from "@ui_kit/Toolbars/ToTariffsButton";
|
||||||
|
|
||||||
|
type HeaderProps = {
|
||||||
|
setMobileSidebar: (callback: (visible: boolean) => boolean) => void;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const Header = ({ setMobileSidebar }: HeaderProps) => {
|
||||||
|
const quiz = useCurrentQuiz();
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
|
const navigate = useNavigate();
|
||||||
const isTablet = useMediaQuery(theme.breakpoints.down(1000));
|
const isTablet = useMediaQuery(theme.breakpoints.down(1000));
|
||||||
|
const isMobile = useMediaQuery(theme.breakpoints.down(600));
|
||||||
|
|
||||||
|
async function handleLogoutClick() {
|
||||||
|
const [, logoutError] = await logout();
|
||||||
|
|
||||||
|
if (logoutError) {
|
||||||
|
return enqueueSnackbar(logoutError);
|
||||||
|
}
|
||||||
|
|
||||||
|
clearAuthToken();
|
||||||
|
clearUserData();
|
||||||
|
navigate("/");
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Container
|
<Container
|
||||||
@ -28,28 +57,36 @@ export default function Header() {
|
|||||||
sx={{
|
sx={{
|
||||||
px: "16px",
|
px: "16px",
|
||||||
display: "flex",
|
display: "flex",
|
||||||
height: "80px",
|
height: isMobile ? "51px" : "80px",
|
||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
bgcolor: "white",
|
bgcolor: isMobile ? "#333647" : "white",
|
||||||
borderBottom: "1px solid #E3E3E3",
|
borderBottom: "1px solid #E3E3E3",
|
||||||
zIndex: theme.zIndex.drawer + 1,
|
zIndex: theme.zIndex.drawer + 1,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Link to="/">
|
<Link to="/" style={{ display: "flex" }}>
|
||||||
<PenaLogo width={124} />
|
{isMobile ? <Logotip width={100} /> : <Logotip width={124} />}
|
||||||
</Link>
|
</Link>
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
display: "flex",
|
display: isMobile ? "none" : "flex",
|
||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
ml: "37px",
|
ml: "37px",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<IconButton sx={{ p: "6px" }} onClick={decrementCurrentStep}>
|
<Link to="/list">
|
||||||
<BackArrowIcon />
|
<IconButton sx={{ p: "6px" }}>
|
||||||
</IconButton>
|
<BackArrowIcon />
|
||||||
|
</IconButton>
|
||||||
|
</Link>
|
||||||
<FormControl fullWidth variant="standard">
|
<FormControl fullWidth variant="standard">
|
||||||
<TextField
|
<TextField
|
||||||
|
value={quiz.name}
|
||||||
|
onChange={(e) =>
|
||||||
|
updateQuiz(quiz.id, (quiz) => {
|
||||||
|
quiz.name = e.target.value;
|
||||||
|
})
|
||||||
|
}
|
||||||
fullWidth
|
fullWidth
|
||||||
id="project-name"
|
id="project-name"
|
||||||
placeholder="Название проекта окно"
|
placeholder="Название проекта окно"
|
||||||
@ -77,13 +114,37 @@ export default function Header() {
|
|||||||
/>
|
/>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
</Box>
|
</Box>
|
||||||
|
{isTablet ? (
|
||||||
{isTablet ? null : (
|
<Box
|
||||||
|
sx={{
|
||||||
|
display: "flex",
|
||||||
|
ml: "auto",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{isMobile ? (
|
||||||
|
<Burger
|
||||||
|
onClick={() => setMobileSidebar((visible: boolean) => !visible)}
|
||||||
|
style={{ fontSize: "30px", color: "white", cursor: "pointer" }}
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<Box>
|
||||||
|
{/* <CustomAvatar
|
||||||
|
sx={{
|
||||||
|
ml: "11px",
|
||||||
|
backgroundColor: theme.palette.orange.main,
|
||||||
|
height: "36px",
|
||||||
|
width: "36px",
|
||||||
|
}}
|
||||||
|
/> */}
|
||||||
|
</Box>
|
||||||
|
)}
|
||||||
|
</Box>
|
||||||
|
) : (
|
||||||
<>
|
<>
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
display: "flex",
|
display: "flex",
|
||||||
gap: "31px",
|
gap: "30px",
|
||||||
overflow: "hidden",
|
overflow: "hidden",
|
||||||
ml: "20px",
|
ml: "20px",
|
||||||
}}
|
}}
|
||||||
@ -94,7 +155,6 @@ export default function Header() {
|
|||||||
<NavMenuItem text="История" />
|
<NavMenuItem text="История" />
|
||||||
<NavMenuItem text="Помощь" /> */}
|
<NavMenuItem text="Помощь" /> */}
|
||||||
</Box>
|
</Box>
|
||||||
а я типа обычный хедер
|
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
display: "flex",
|
display: "flex",
|
||||||
@ -103,11 +163,18 @@ export default function Header() {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{/* <CustomAvatar
|
{/* <CustomAvatar
|
||||||
sx={{ ml: "11px", backgroundColor: theme.palette.orange.main, height: "36px", width: "36px" }}
|
sx={{
|
||||||
|
ml: "11px",
|
||||||
|
backgroundColor: theme.palette.orange.main,
|
||||||
|
height: "36px",
|
||||||
|
width: "36px",
|
||||||
|
}}
|
||||||
/> */}
|
/> */}
|
||||||
|
<LogoutButton onClick={handleLogoutClick} />
|
||||||
</Box>
|
</Box>
|
||||||
|
<ToTariffsButton />
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</Container>
|
</Container>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user