import { UserOutlined } from '@ant-design/icons';
import { Button, Card, Dropdown, Flex, MenuProps, Tooltip, Typography } from 'antd';
import { Link } from 'react-router-dom';
import { useTranslation } from 'react-i18next';
import { useAppSelector } from '@/hooks/useAppSelector';
import { RootState } from '@/app/store';
import { getRole } from '@/utils/session-helper';
import './profile-dropdown.css';
import './profile-button.css';
import SingleAvatar from '@/components/common/single-avatar/single-avatar';
import { useAuthService } from '@/hooks/useAuth';
import { useEffect, useState } from 'react';
interface ProfileButtonProps {
isOwnerOrAdmin: boolean;
}
const ProfileButton = ({ isOwnerOrAdmin }: ProfileButtonProps) => {
const { t } = useTranslation('navbar');
const authService = useAuthService();
const currentSession = useAppSelector((state: RootState) => state.userReducer);
const role = getRole();
const themeMode = useAppSelector((state: RootState) => state.themeReducer.mode);
const getLinkStyle = () => ({
color: themeMode === 'dark' ? '#ffffffd9' : '#181818',
});
const profile: MenuProps['items'] = [
{
key: '1',
label: (
Account
{currentSession?.name}
{currentSession?.email}
({role})
}
variant="borderless"
style={{ width: 230 }}
>
{isOwnerOrAdmin && (
{t('adminCenter')}
)}
{t('settings')}
{t('logOut')}
),
},
];
return (
) : (
)
}
/>
);
};
export default ProfileButton;