2023-12-31 02:53:25 +00:00
|
|
|
|
import {
|
|
|
|
|
Box,
|
|
|
|
|
Container,
|
|
|
|
|
IconButton,
|
|
|
|
|
Typography,
|
|
|
|
|
useTheme,
|
|
|
|
|
useMediaQuery,
|
|
|
|
|
} from "@mui/material";
|
2023-05-10 11:40:39 +00:00
|
|
|
|
import NavMenuItem from "./NavMenuItem";
|
2023-12-16 23:10:24 +00:00
|
|
|
|
import Logotip from "../../pages/Landing/images/icons/QuizLogo";
|
2023-05-10 11:40:39 +00:00
|
|
|
|
import WalletIcon from "@icons/WalletIcon";
|
|
|
|
|
import CustomAvatar from "./Avatar";
|
2023-10-18 11:05:25 +00:00
|
|
|
|
import { Burger } from "@icons/Burger";
|
2023-11-08 12:51:40 +00:00
|
|
|
|
import { clearAuthToken } from "@frontend/kitui";
|
|
|
|
|
import { logout } from "@api/auth";
|
2023-12-15 22:46:57 +00:00
|
|
|
|
import { Link, useNavigate } from "react-router-dom";
|
2023-11-08 12:51:40 +00:00
|
|
|
|
import { enqueueSnackbar } from "notistack";
|
|
|
|
|
import { clearUserData } from "@root/user";
|
|
|
|
|
import { LogoutButton } from "@ui_kit/LogoutButton";
|
2024-01-03 19:41:41 +00:00
|
|
|
|
import { ToTariffsButton } from "@ui_kit/Toolbars/ToTariffsButton";
|
2023-05-10 11:40:39 +00:00
|
|
|
|
|
|
|
|
|
export default function HeaderFull() {
|
2023-10-18 11:05:25 +00:00
|
|
|
|
const theme = useTheme();
|
2023-11-08 12:51:40 +00:00
|
|
|
|
const navigate = useNavigate();
|
2023-10-18 11:05:25 +00:00
|
|
|
|
const isTablet = useMediaQuery(theme.breakpoints.down(1000));
|
|
|
|
|
const isMobile = useMediaQuery(theme.breakpoints.down(500));
|
2023-05-10 11:40:39 +00:00
|
|
|
|
|
2023-11-08 12:51:40 +00:00
|
|
|
|
async function handleLogoutClick() {
|
|
|
|
|
const [, logoutError] = await logout();
|
|
|
|
|
|
|
|
|
|
if (logoutError) {
|
|
|
|
|
return enqueueSnackbar(logoutError);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
clearAuthToken();
|
|
|
|
|
clearUserData();
|
|
|
|
|
navigate("/");
|
|
|
|
|
}
|
|
|
|
|
|
2023-10-18 11:05:25 +00:00
|
|
|
|
return (
|
|
|
|
|
<Container
|
|
|
|
|
component="nav"
|
|
|
|
|
disableGutters
|
|
|
|
|
maxWidth={false}
|
|
|
|
|
sx={{
|
|
|
|
|
px: "16px",
|
|
|
|
|
display: "flex",
|
|
|
|
|
height: "80px",
|
|
|
|
|
alignItems: "center",
|
|
|
|
|
gap: isTablet ? "20px" : "60px",
|
|
|
|
|
flexDirection: isMobile ? "row-reverse" : "row",
|
|
|
|
|
justifyContent: isMobile ? "space-between" : "center",
|
|
|
|
|
bgcolor: "white",
|
|
|
|
|
borderBottom: "1px solid #E3E3E3",
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
{isTablet && (
|
|
|
|
|
<Burger
|
|
|
|
|
// onClick={() => setMobileSidebar(!mobileSidebar)}
|
|
|
|
|
style={{ fontSize: "30px", color: "#000000", cursor: "pointer" }}
|
|
|
|
|
/>
|
|
|
|
|
)}
|
2023-12-15 22:46:57 +00:00
|
|
|
|
<Link to="/">
|
2023-12-16 23:10:24 +00:00
|
|
|
|
<Logotip width={124} />
|
2023-12-15 22:46:57 +00:00
|
|
|
|
</Link>
|
2023-10-18 11:05:25 +00:00
|
|
|
|
{!isTablet && (
|
|
|
|
|
<Box
|
|
|
|
|
sx={{
|
|
|
|
|
display: "flex",
|
|
|
|
|
gap: "30px",
|
|
|
|
|
overflow: "hidden",
|
|
|
|
|
}}
|
2023-05-10 11:40:39 +00:00
|
|
|
|
>
|
2023-12-29 14:48:53 +00:00
|
|
|
|
{/* <NavMenuItem text="Квизы" />
|
2023-10-18 11:05:25 +00:00
|
|
|
|
<NavMenuItem text="Меню 2" isActive />
|
|
|
|
|
<NavMenuItem text="Меню 3" />
|
|
|
|
|
<NavMenuItem text="Меню 4" />
|
|
|
|
|
<NavMenuItem text="Меню 5" />
|
|
|
|
|
<NavMenuItem text="Меню 1" />
|
2023-12-29 14:48:53 +00:00
|
|
|
|
<NavMenuItem text="Меню 2" /> */}
|
2023-10-18 11:05:25 +00:00
|
|
|
|
</Box>
|
|
|
|
|
)}
|
|
|
|
|
<Box sx={{ display: isMobile ? "none" : "flex", ml: "auto" }}>
|
2023-12-29 14:48:53 +00:00
|
|
|
|
{/* {!isTablet && (
|
2023-10-18 11:05:25 +00:00
|
|
|
|
<>
|
|
|
|
|
<IconButton sx={{ p: 0 }}>
|
|
|
|
|
<WalletIcon color={theme.palette.grey2.main} bgcolor="#F2F3F7" />
|
|
|
|
|
</IconButton>
|
|
|
|
|
<Box sx={{ ml: "8px", whiteSpace: "nowrap" }}>
|
|
|
|
|
<Typography
|
2023-05-10 11:40:39 +00:00
|
|
|
|
sx={{
|
2023-10-18 11:05:25 +00:00
|
|
|
|
fontSize: "12px",
|
|
|
|
|
lineHeight: "14px",
|
|
|
|
|
color: theme.palette.grey3.main,
|
2023-05-10 11:40:39 +00:00
|
|
|
|
}}
|
2023-10-18 11:05:25 +00:00
|
|
|
|
>
|
|
|
|
|
Мой баланс
|
|
|
|
|
</Typography>
|
2023-12-15 22:46:57 +00:00
|
|
|
|
<Typography variant="body2" color={theme.palette.brightPurple.main}>
|
2023-10-18 11:05:25 +00:00
|
|
|
|
00.00 руб.
|
|
|
|
|
</Typography>
|
2023-05-10 11:40:39 +00:00
|
|
|
|
</Box>
|
2023-10-18 11:05:25 +00:00
|
|
|
|
</>
|
2023-12-29 14:48:53 +00:00
|
|
|
|
)} */}
|
2023-10-18 11:05:25 +00:00
|
|
|
|
{!isMobile && (
|
|
|
|
|
<>
|
2023-12-29 14:48:53 +00:00
|
|
|
|
{/* <CustomAvatar
|
2023-10-18 11:05:25 +00:00
|
|
|
|
sx={{
|
|
|
|
|
ml: "27px",
|
|
|
|
|
backgroundColor: theme.palette.orange.main,
|
|
|
|
|
height: "36px",
|
|
|
|
|
width: "36px",
|
|
|
|
|
}}
|
2023-12-29 14:48:53 +00:00
|
|
|
|
/> */}
|
2023-12-15 22:46:57 +00:00
|
|
|
|
<LogoutButton
|
|
|
|
|
onClick={handleLogoutClick}
|
|
|
|
|
sx={{
|
|
|
|
|
ml: "20px",
|
|
|
|
|
}}
|
|
|
|
|
/>
|
2023-10-18 11:05:25 +00:00
|
|
|
|
</>
|
|
|
|
|
)}
|
|
|
|
|
</Box>
|
2024-01-03 19:41:41 +00:00
|
|
|
|
<ToTariffsButton />
|
2023-10-18 11:05:25 +00:00
|
|
|
|
</Container>
|
|
|
|
|
);
|
|
|
|
|
}
|