diff --git a/web/components/header.tsx b/web/components/header.tsx index 95632265..93726b00 100644 --- a/web/components/header.tsx +++ b/web/components/header.tsx @@ -1,44 +1,55 @@ import clsx from 'clsx' import Link from 'next/link' +import Image from 'next/Image' import { useUser } from '../hooks/use-user' - -const navigation: any[] = [ - // { - // name: 'About', - // href: 'https://mantic.notion.site/About-Mantic-Markets-7c44bc161356474cad54cba2d2973fe2', - // }, -] +import { formatMoney } from '../lib/util/format' +import { Row } from './layout/row' +import { User } from '../lib/firebase/users' const hoverClasses = 'hover:underline hover:decoration-indigo-400 hover:decoration-2' -function SignInLink(props: { darkBackground?: boolean }) { - const { darkBackground } = props - - const user = useUser() - - const themeClasses = (darkBackground ? 'text-white ' : '') + hoverClasses +function SignedInHeaders(props: { user: User; themeClasses?: string }) { + const { user, themeClasses } = props return ( <> - {user ? ( - <> - - - Create a market - - + + + Create a market + + - - - Your account - - - - ) : ( - <> - )} + + Your bets + + + + + +
+ +
+
+ {user.name} +
+ {formatMoney(user.balance)} +
+
+
+
+ + + ) +} + +function SignedOutHeaders(props: { themeClasses?: string }) { + const { themeClasses } = props + + return ( + <> +
Sign in
) } @@ -46,55 +57,43 @@ function SignInLink(props: { darkBackground?: boolean }) { export function Header(props: { darkBackground?: boolean; children?: any }) { const { darkBackground, children } = props + const user = useUser() + + const themeClasses = clsx(darkBackground && 'text-white', hoverClasses) + return ( -
- -
+ {user ? ( + + ) : ( + + )} + + ) }