fix: remove avatar from toolbar and add to sidenav header

This commit is contained in:
Sajad Mirjalili
2025-09-29 17:25:20 +03:30
parent b83e8f4af8
commit 190415c821
2 changed files with 19 additions and 21 deletions

View File

@@ -1,4 +1,5 @@
import { import {
Avatar,
Box, Box,
IconButton, IconButton,
ListItemIcon, ListItemIcon,
@@ -14,6 +15,7 @@ import { LTRTypography } from '../common/LTRTypography';
import { useState } from 'react'; import { useState } from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { useAuth } from '@/hooks/useAuth'; import { useAuth } from '@/hooks/useAuth';
import { FlexBox } from '../common/FlexBox';
interface HeaderProps { interface HeaderProps {
user: UserInfo; user: UserInfo;
@@ -52,6 +54,13 @@ export const Header: React.FC<HeaderProps> = ({ user }) => {
height: (t) => t.spacing(10.5), height: (t) => t.spacing(10.5),
}} }}
> >
<FlexBox sx={{ alignItems: 'center', gap: 1 }}>
<Avatar
sx={{ width: 32, height: 32, fontSize: '14px' }}
src={user.picture}
>
{user.firstName.charAt(0) + ' ' + user.lastName.charAt(0)}
</Avatar>
<Box> <Box>
<Typography variant="body1" color="textSecondary"> <Typography variant="body1" color="textSecondary">
{user.fullName} {user.fullName}
@@ -61,6 +70,7 @@ export const Header: React.FC<HeaderProps> = ({ user }) => {
{user.phoneNumber ?? user.email} {user.phoneNumber ?? user.email}
</LTRTypography> </LTRTypography>
</Box> </Box>
</FlexBox>
<IconButton onClick={handleClick} color="primary"> <IconButton onClick={handleClick} color="primary">
<Icon Component={More} /> <Icon Component={More} />

View File

@@ -63,21 +63,9 @@ export const Toolbar: React.FC<ToolbarProps> = ({
)} )}
<Logo /> <Logo />
</Box> </Box>
<Box
sx={{ display: 'flex', height: '100%', alignItems: 'center', gap: 1 }}
>
{isMobile && (
<Avatar
sx={{ width: 32, height: 32, fontSize: '14px' }}
src={user.picture}
>
{user.firstName.charAt(0) + ' ' + user.lastName.charAt(0)}
</Avatar>
)}
<IconButton color="primary" onClick={handleClick}> <IconButton color="primary" onClick={handleClick}>
<Icon Component={Menu} variant="Bold" /> <Icon Component={Menu} variant="Bold" />
</IconButton> </IconButton>
</Box>
<ProductsMenu anchorEl={anchorEl} onClose={handleClose} open={open} /> <ProductsMenu anchorEl={anchorEl} onClose={handleClose} open={open} />
</MuiToolbar> </MuiToolbar>
); );