import { Button, Popconfirm } from 'antd';
import { useUserStore } from '@/store/UserStore';
import { GapBox } from '../GapBox';

export const HeaderUserInfo: React.FC = () => {
  const userInfo = useUserStore().user;

  return (
    <GapBox>
      <div>{userInfo.login_name}</div>
      <Popconfirm
        title='确定要退出登录吗？'
        onConfirm={() => {
          location.hash = '#/login';
        }}
      >
        <Button size='small' variant='text' color='primary'>
          退出登录
        </Button>
      </Popconfirm>
    </GapBox>
  );
};
