client portal update
This commit is contained in:
@@ -1,31 +1,30 @@
|
||||
import { useState } from 'react';
|
||||
// @mui
|
||||
import { alpha } from '@mui/material/styles';
|
||||
import { Box, Divider, Typography, Stack, MenuItem, Avatar } from '@mui/material';
|
||||
import { Box, Divider, Typography, MenuItem, Avatar } from '@mui/material';
|
||||
// components
|
||||
import MenuPopover from '../../../components/MenuPopover';
|
||||
import { IconButtonAnimate } from '../../../components/animate';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import useAuth from '../../../hooks/useAuth';
|
||||
import useLocalStorage from '../../../hooks/useLocalStorage';
|
||||
import { enqueueSnackbar } from 'notistack';
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
const MENU_OPTIONS = [
|
||||
{
|
||||
label: 'Home',
|
||||
linkTo: '/',
|
||||
},
|
||||
{
|
||||
label: 'Profile',
|
||||
linkTo: '/',
|
||||
},
|
||||
{
|
||||
label: 'Settings',
|
||||
linkTo: '/',
|
||||
},
|
||||
];
|
||||
// const MENU_OPTIONS = [
|
||||
// {
|
||||
// label: 'Home',
|
||||
// linkTo: '/',
|
||||
// },
|
||||
// {
|
||||
// label: 'Profile',
|
||||
// linkTo: '/',
|
||||
// },
|
||||
// {
|
||||
// label: 'Settings',
|
||||
// linkTo: '/',
|
||||
// },
|
||||
// ];
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
@@ -34,6 +33,8 @@ export default function AccountPopover() {
|
||||
const navigate = useNavigate();
|
||||
const { logout, user } = useAuth();
|
||||
|
||||
console.log(user);
|
||||
|
||||
const handleOpen = (event: React.MouseEvent<HTMLElement>) => {
|
||||
setOpen(event.currentTarget);
|
||||
};
|
||||
@@ -67,10 +68,7 @@ export default function AccountPopover() {
|
||||
}),
|
||||
}}
|
||||
>
|
||||
{user && user.user.avatar_url && (<Avatar
|
||||
src={user ? user.user.avatar_url : ''}
|
||||
alt={user ? user.user.full_name : ''}
|
||||
/>)}
|
||||
<Avatar src={user?.user.avatar_url || ''} alt={user?.user.full_name || ''} />
|
||||
</IconButtonAnimate>
|
||||
|
||||
<MenuPopover
|
||||
@@ -89,10 +87,10 @@ export default function AccountPopover() {
|
||||
>
|
||||
<Box sx={{ my: 1.5, px: 2.5 }}>
|
||||
<Typography variant="subtitle2" noWrap>
|
||||
{ user ? user.user.full_name ?? 'Hi, ' : 'Hi, '}
|
||||
{`Hi, ${user?.user?.full_name || 'User'}`}
|
||||
</Typography>
|
||||
<Typography variant="body2" sx={{ color: 'text.secondary' }} noWrap>
|
||||
{ user ? user.user.email : 'Please Wait'}
|
||||
{user ? user.user.email : 'Please Wait'}
|
||||
</Typography>
|
||||
</Box>
|
||||
|
||||
|
||||
@@ -13,11 +13,7 @@ import Logo from '../../../components/Logo';
|
||||
import Iconify from '../../../components/Iconify';
|
||||
import { IconButtonAnimate } from '../../../components/animate';
|
||||
//
|
||||
import Searchbar from './Searchbar';
|
||||
import AccountPopover from './AccountPopover';
|
||||
import LanguagePopover from './LanguagePopover';
|
||||
import ContactsPopover from './ContactsPopover';
|
||||
import NotificationsPopover from './NotificationsPopover';
|
||||
import CorporatePopover from './CorporatePopover';
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
@@ -46,11 +42,11 @@ const RootStyle = styled(AppBar, {
|
||||
width: `calc(100% - ${NAVBAR.DASHBOARD_COLLAPSE_WIDTH}px)`,
|
||||
}),
|
||||
...(isOffset && {
|
||||
height: HEADER.DASHBOARD_DESKTOP_OFFSET_HEIGHT,
|
||||
height: HEADER.DASHBOARD_DESKTOP_HEIGHT,
|
||||
}),
|
||||
...(verticalLayout && {
|
||||
width: '100%',
|
||||
height: HEADER.DASHBOARD_DESKTOP_OFFSET_HEIGHT,
|
||||
height: HEADER.DASHBOARD_DESKTOP_HEIGHT,
|
||||
backgroundColor: theme.palette.background.default,
|
||||
}),
|
||||
},
|
||||
@@ -89,15 +85,15 @@ export default function DashboardHeader({
|
||||
</IconButtonAnimate>
|
||||
)}
|
||||
|
||||
<Searchbar />
|
||||
{/* <Searchbar /> */}
|
||||
<Box sx={{ flexGrow: 1 }} />
|
||||
|
||||
<Stack direction="row" alignItems="center" spacing={{ xs: 0.5, sm: 1.5 }}>
|
||||
<CorporatePopover />
|
||||
<Divider orientation="vertical" flexItem />
|
||||
<LanguagePopover />
|
||||
<NotificationsPopover />
|
||||
<ContactsPopover />
|
||||
{/* <LanguagePopover /> */}
|
||||
{/* <NotificationsPopover /> */}
|
||||
{/* <ContactsPopover /> */}
|
||||
<AccountPopover />
|
||||
</Stack>
|
||||
</Toolbar>
|
||||
|
||||
@@ -23,10 +23,8 @@ type Props = {
|
||||
};
|
||||
|
||||
export default function NavbarAccount({ isCollapse }: Props) {
|
||||
|
||||
const { user } = useAuth();
|
||||
|
||||
// console.log('current user is ', user)
|
||||
return (
|
||||
<Link underline="none" color="inherit">
|
||||
<RootStyle
|
||||
@@ -36,10 +34,9 @@ export default function NavbarAccount({ isCollapse }: Props) {
|
||||
}),
|
||||
}}
|
||||
>
|
||||
{user && user.user.avatar_url && (<Avatar
|
||||
src={user ? user.user.avatar_url : ''}
|
||||
alt={user ? user.user.full_name : ''}
|
||||
/>)}
|
||||
{user && user.user.avatar_url && (
|
||||
<Avatar src={user?.user.avatar_url || ''} alt={user?.user.full_name || ''} />
|
||||
)}
|
||||
|
||||
<Box
|
||||
sx={{
|
||||
@@ -55,10 +52,10 @@ export default function NavbarAccount({ isCollapse }: Props) {
|
||||
}}
|
||||
>
|
||||
<Typography variant="subtitle2" noWrap>
|
||||
{ user ? user.user.full_name ?? 'Hi, ' : 'Hi, '}
|
||||
{`Hi, ${user?.user?.full_name || 'User'}`}
|
||||
</Typography>
|
||||
<Typography variant="body2" noWrap sx={{ color: 'text.secondary', fontSize: '11px' }}>
|
||||
{ user ? user.user.email : 'Please Wait'}
|
||||
{user ? user.user.email : 'Please Wait'}
|
||||
</Typography>
|
||||
</Box>
|
||||
</RootStyle>
|
||||
|
||||
Reference in New Issue
Block a user