import { Avatar, AvatarIcon, Card, CardBody } from '@nextui-org/react';
import { TEAM_ALIASES } from '@/common/constants/team';
import styles from "./profile-card.module.css"
import Dropdown from './components/Dropdown';
import getServerCredential from '@/common/libs/getServerCredential';

const ProfileCard = () => {
  const credential = getServerCredential()

  return credential && (
    <Card shadow='none' radius='none' className={styles.card}>
      <CardBody className={styles.cardBody}>
        <Avatar icon={<AvatarIcon />} size='sm' isBordered color='primary' classNames={{ icon: 'text-white' }} />
        <div>
          <div className={styles.name}>{credential.name}</div>
          <div className={styles.description}>
            <span>
              {credential.company.name}
            </span>
            &#183;
            <span>
              Tim {TEAM_ALIASES[credential.team].name}
            </span>
          </div>
        </div>

        <div className="ml-auto">
          <Dropdown />
        </div>
      </CardBody>
    </Card>
  )
}

export default ProfileCard