// ** React Imports import { ElementType, ReactNode } from 'react' // ** Next Imports import Link from 'next/link' import { useRouter } from 'next/router' // ** MUI Imports import Chip from '@mui/material/Chip' import ListItem from '@mui/material/ListItem' import { styled } from '@mui/material/styles' import Typography from '@mui/material/Typography' import Box, { BoxProps } from '@mui/material/Box' import ListItemIcon from '@mui/material/ListItemIcon' import ListItemButton, { ListItemButtonProps } from '@mui/material/ListItemButton' // ** Configs Import import themeConfig from '../../../../../configs/themeConfig' // ** Types import { NavLink } from '../../../../../core/layouts/types' import { Settings } from '../../../../../core/context/settingsContext' // ** Custom Components Imports import UserIcon from '../../../../../layouts/components/UserIcon' // ** Utils import { handleURLQueries } from '../../../../../core/layouts/utils' interface Props { item: NavLink settings: Settings navVisible?: boolean toggleNavVisibility: () => void } // ** Styled Components const MenuNavLink = styled(ListItemButton)< ListItemButtonProps & { component?: ElementType; target?: '_blank' | undefined } >(({ theme }) => ({ width: '100%', borderTopRightRadius: 100, borderBottomRightRadius: 100, color: theme.palette.text.primary, padding: theme.spacing(2.25, 3.5), transition: 'opacity .25s ease-in-out', '&.active, &.active:hover': { boxShadow: theme.shadows[3], backgroundImage: `linear-gradient(98deg, ${theme.palette.customColors.primaryGradient}, ${theme.palette.primary.main} 94%)` }, '&.active .MuiTypography-root, &.active .MuiSvgIcon-root': { color: `${theme.palette.common.white} !important` } })) const MenuItemTextMetaWrapper = styled(Box)({ width: '100%', display: 'flex', alignItems: 'center', justifyContent: 'space-between', transition: 'opacity .25s ease-in-out', ...(themeConfig.menuTextTruncate && { overflow: 'hidden' }) }) const VerticalNavLink = ({ item, navVisible, toggleNavVisibility }: Props) => { // ** Hooks const router = useRouter() const IconTag: ReactNode = item.icon const isNavLinkActive = () => { if (router.pathname === item.path || handleURLQueries(router, item.path)) { return true } else { return false } } return ( { if (item.path === undefined) { e.preventDefault() e.stopPropagation() } if (navVisible) { toggleNavVisibility() } }} sx={{ pl: 5.5, ...(item.disabled ? { pointerEvents: 'none' } : { cursor: 'pointer' }) }} > {item.title} {item.badgeContent ? ( ) : null} ) } export default VerticalNavLink