fix: header profile image
This commit is contained in:
@@ -10,24 +10,19 @@ import {
|
|||||||
} from '@mui/material';
|
} from '@mui/material';
|
||||||
import { Icon } from '@rkheftan/harmony-ui';
|
import { Icon } from '@rkheftan/harmony-ui';
|
||||||
import { Logout, More } from 'iconsax-react';
|
import { Logout, More } from 'iconsax-react';
|
||||||
import type { UserInfo } from '@/contexts/AuthContext';
|
|
||||||
import { LTRTypography } from '../common/LTRTypography';
|
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';
|
import { FlexBox } from '../common/FlexBox';
|
||||||
|
|
||||||
interface HeaderProps {
|
export const Header: React.FC = () => {
|
||||||
user: UserInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const Header: React.FC<HeaderProps> = ({ user }) => {
|
|
||||||
const { t, i18n } = useTranslation('sideNav');
|
const { t, i18n } = useTranslation('sideNav');
|
||||||
|
|
||||||
const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);
|
const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);
|
||||||
const open = Boolean(anchorEl);
|
const open = Boolean(anchorEl);
|
||||||
|
|
||||||
const { logout } = useAuth();
|
const { logout, userInfo: user } = useAuth();
|
||||||
|
|
||||||
const handleClick = (event: React.MouseEvent<HTMLElement>) => {
|
const handleClick = (event: React.MouseEvent<HTMLElement>) => {
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
@@ -57,7 +52,7 @@ export const Header: React.FC<HeaderProps> = ({ user }) => {
|
|||||||
<FlexBox sx={{ alignItems: 'center', gap: 1 }}>
|
<FlexBox sx={{ alignItems: 'center', gap: 1 }}>
|
||||||
<Avatar
|
<Avatar
|
||||||
sx={{ width: 32, height: 32, fontSize: '14px' }}
|
sx={{ width: 32, height: 32, fontSize: '14px' }}
|
||||||
src={user.picture}
|
src={import.meta.env.VITE_IMAGE_BASE_URL + '/' + user.picture}
|
||||||
>
|
>
|
||||||
{user.firstName.charAt(0) + ' ' + user.lastName.charAt(0)}
|
{user.firstName.charAt(0) + ' ' + user.lastName.charAt(0)}
|
||||||
</Avatar>
|
</Avatar>
|
||||||
|
|||||||
Reference in New Issue
Block a user