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-31 05:35:20 +00:00
|
|
|
import { Row } from '../layout/row'
|
2021-12-20 03:12:12 +00:00
|
|
|
|
2022-03-31 05:35:20 +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-31 05:35:20 +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-31 05:35:20 +00:00
|
|
|
{ name: 'Add funds', href: '/add-funds' },
|
|
|
|
{ name: 'Leaderboards', href: '/leaderboards' },
|
|
|
|
{ name: 'Discord', href: 'https://discord.gg/eHQBNBqXuh' },
|
2022-04-03 20:48:25 +00:00
|
|
|
{ name: 'About', href: 'https://docs.manifold.markets' },
|
2022-03-31 05:35:20 +00:00
|
|
|
{ name: 'Sign out', href: '#', onClick: () => firebaseLogout() },
|
2021-12-20 03:12:12 +00:00
|
|
|
]
|
|
|
|
}
|
|
|
|
|
2022-03-31 05:35:20 +00:00
|
|
|
export function ProfileSummary(props: { user: User | undefined }) {
|
2021-12-20 03:12:12 +00:00
|
|
|
const { user } = props
|
|
|
|
return (
|
2022-04-04 05:09:01 +00:00
|
|
|
<Row className="group avatar items-center gap-4 rounded-md py-3 text-gray-500 group-hover:bg-gray-100 group-hover:text-gray-700">
|
2022-01-27 23:24:44 +00:00
|
|
|
<Avatar avatarUrl={user?.avatarUrl} username={user?.username} noLink />
|
|
|
|
|
2022-03-31 05:35:20 +00:00
|
|
|
<div className="truncate text-left">
|
|
|
|
<div>{user?.name}</div>
|
|
|
|
<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-31 05:35:20 +00:00
|
|
|
</Row>
|
2021-12-20 03:12:12 +00:00
|
|
|
)
|
|
|
|
}
|