-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.tsx
32 lines (27 loc) · 1011 Bytes
/
index.tsx
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
import { useRouter } from 'next/dist/client/router';
import { useAuth } from '../../hooks/useAuth';
import useChallenge from '../../hooks/useChallenge';
import styles from './Profile.module.scss';
export default function Profile(){
const { level } = useChallenge();
const { user, name } = useAuth();
const router = useRouter();
return(
<div className={styles.profileContainer}>
<img src={user? user.avatar: name? `https://avatars.dicebear.com/api/human/${name}.svg`:'icons/avatar.svg'} alt={user? user.name: name? name:'Player 404'} />
<div>
<strong>{user? user.name: name? name:'Player 404'}</strong>
<p>
<img src="icons/Up.svg" alt="Up" />
Level {level}
</p>
</div>
{!user &&
<div onClick={()=>router.push('/login')} className={styles.githubButton} title="Login ou Mudar nome do usuário">
<img src="icons/github-icon.svg" alt="github" />
<p>Login</p>
</div>
}
</div>
);
}