summaryrefslogtreecommitdiff
path: root/src/modules/profile-card/index.tsx
blob: 08c4478031fa3e01bab6cc8808065401d26cfb73 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import { Credential } from "@/common/types/auth"
import { Avatar, AvatarIcon, Card, CardBody } from '@nextui-org/react';
import { teamAliases } from '@/common/constants/team';
import styles from "./profile-card.module.css"
import Dropdown from './components/Dropdown';
import { cookies } from 'next/headers';

const ProfileCard = () => {
  const credentialStr = cookies().get('credential')?.value
  const credential: Credential | null = credentialStr ? JSON.parse(credentialStr) : null

  return credential && (
    <Card shadow='sm'>
      <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 {teamAliases[credential.team].name}
            </span>
          </div>
        </div>

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

export default ProfileCard