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",
|
2024-01-04 15:18:29 +00:00
|
|
|
flexDirection: "row",
|
2023-10-18 11:05:25 +00:00
|
|
|
justifyContent: isMobile ? "space-between" : "center",
|
|
|
|
bgcolor: "white",
|
|
|
|
borderBottom: "1px solid #E3E3E3",
|
|
|
|
}}
|
|
|
|
>
|
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",
|
|
|
|
}}
|
2024-01-04 15:18:29 +00:00
|
|
|
></Box>
|
2023-10-18 11:05:25 +00:00
|
|
|
)}
|
2024-01-04 15:18:29 +00:00
|
|
|
<Box sx={{ display: "flex", ml: "auto" }}>
|
|
|
|
<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>
|
|
|
|
);
|
|
|
|
}
|