2022-03-17 07:50:45 +00:00
|
|
|
import { firebaseLogout, User } from '../../lib/firebase/users'
|
|
|
|
import { formatMoney } from '../../../common/util/format'
|
|
|
|
import { Avatar } from '../avatar'
|
|
|
|
import { IS_PRIVATE_MANIFOLD } from '../../../common/envs/constants'
|
2022-03-30 23:56:51 +00:00
|
|
|
import { Row } from '../layout/row'
|
2021-12-20 03:12:12 +00:00
|
|
|
|
2022-03-30 23:56:51 +00:00
|
|
|
export function getNavigationOptions(user?: User | null) {
|
|
|
|
if (IS_PRIVATE_MANIFOLD) {
|
|
|
|
return [{ name: 'Leaderboards', href: '/leaderboards' }]
|
|
|
|
}
|
2021-12-20 03:12:12 +00:00
|
|
|
|
2022-03-30 23:56:51 +00:00
|
|
|
if (!user) {
|
|
|
|
return [
|
|
|
|
{ name: 'Leaderboards', href: '/leaderboards' },
|
|
|
|
{ name: 'Discord', href: 'https://discord.gg/eHQBNBqXuh' },
|
|
|
|
]
|
|
|
|
}
|
2021-12-20 03:12:12 +00:00
|
|
|
|
|
|
|
return [
|
2022-03-30 23:56:51 +00:00
|
|
|
{ name: 'Your trades', href: '/trades' },
|
|
|
|
{ name: 'Add funds', href: '/add-funds' },
|
|
|
|
{ name: 'Leaderboards', href: '/leaderboards' },
|
|
|
|
{ name: 'Discord', href: 'https://discord.gg/eHQBNBqXuh' },
|
|
|
|
{ name: 'Sign out', href: '#', onClick: () => firebaseLogout() },
|
2021-12-20 03:12:12 +00:00
|
|
|
]
|
|
|
|
}
|
|
|
|
|
2022-03-30 23:56:51 +00:00
|
|
|
export function ProfileSummary(props: { user: User | undefined }) {
|
2021-12-20 03:12:12 +00:00
|
|
|
const { user } = props
|
|
|
|
return (
|
2022-03-30 23:56:51 +00:00
|
|
|
<Row className="group avatar items-center gap-4 py-6 text-gray-600 group-hover:text-gray-900">
|
2022-01-27 23:24:44 +00:00
|
|
|
<Avatar avatarUrl={user?.avatarUrl} username={user?.username} noLink />
|
|
|
|
|
2022-01-27 23:31:41 +00:00
|
|
|
<div className="truncate text-left sm:w-32">
|
2022-01-27 23:06:31 +00:00
|
|
|
<div className="hidden sm:flex">{user?.name}</div>
|
2022-03-30 23:56:51 +00:00
|
|
|
<div className="text-sm">
|
2022-02-17 03:14:12 +00:00
|
|
|
{user ? formatMoney(Math.floor(user.balance)) : ' '}
|
2022-01-08 18:14:20 +00:00
|
|
|
</div>
|
2021-12-20 03:12:12 +00:00
|
|
|
</div>
|
2022-03-30 23:56:51 +00:00
|
|
|
</Row>
|
2021-12-20 03:12:12 +00:00
|
|
|
)
|
|
|
|
}
|