import Icon from "@mui/material/Icon"; import { useEffect, useState } from "react"; import { Box, Button, Container, IconButton, Typography, useTheme } from "@mui/material"; import { Drawers } from "../Drawer/Drawers"; import NavMenuItem from "../NavMenuItem"; import SectionWrapper from "../SectionWrapper"; import { basketStore } from "@stores/BasketStore"; import { authStore } from "@stores/makeRequest"; import LogoutIcon from "../icons/LogoutIcon"; import WalletIcon from "../icons/WalletIcon"; import CustomAvatar from "./Avatar"; import PenaLogo from "../PenaLogo"; import { useLocation } from "react-router-dom"; interface Props { isLoggedIn: boolean; } export default function NavbarFull({ isLoggedIn }: Props) { const theme = useTheme(); const { clearToken } = authStore(); const [basketQuantity, setBasketQuantity] = useState(0); const location = useLocation(); const { templ, squiz, reducer, open } = basketStore(); useEffect(() => { setBasketQuantity(Object.keys(templ).length + Object.keys(squiz).length); if (location.pathname === "/basket") { open(false)(); } }, [templ, squiz, location.pathname, open]); async function handleLogoutClick() { clearToken(); } return isLoggedIn ? ( {basketQuantity && ( {basketQuantity} )} Мой баланс 00.00 руб. ) : ( ); }