From 5ffeb6ca87388399cc75276f51782c6e1f6b10b8 Mon Sep 17 00:00:00 2001 From: Austin Chen Date: Wed, 8 Dec 2021 17:57:59 -0800 Subject: [PATCH] Basic ability to sign in and view profile --- web/components/header.tsx | 27 +++++++++ web/pages/account.tsx | 115 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 142 insertions(+) create mode 100644 web/pages/account.tsx diff --git a/web/components/header.tsx b/web/components/header.tsx index 3015cb49..a90f5f77 100644 --- a/web/components/header.tsx +++ b/web/components/header.tsx @@ -1,5 +1,7 @@ import { Popover } from '@headlessui/react' import Link from 'next/link' +import { useEffect, useState } from 'react' +import { firebaseLogin, listenForLogin, User } from '../lib/firebase/users' const navigation = [ { @@ -9,6 +11,30 @@ const navigation = [ { name: 'Simulator', href: '/simulator' }, ] +function SignInLink() { + const [user, setUser] = useState(null) + useEffect(() => listenForLogin(setUser), []) + + return ( + <> + {user && user.id ? ( + + + {user.name} + + + ) : ( + + )} + + ) +} + export function Header() { return ( @@ -40,6 +66,7 @@ export function Header() { ))} + diff --git a/web/pages/account.tsx b/web/pages/account.tsx new file mode 100644 index 00000000..9173e2d8 --- /dev/null +++ b/web/pages/account.tsx @@ -0,0 +1,115 @@ +import { useRouter } from 'next/router' +import { useEffect, useState } from 'react' +import { firebaseLogout, listenForLogin, User } from '../lib/firebase/users' +import { Header } from '../components/header' + +export default function Account() { + const [user, setUser] = useState(null) + useEffect(() => listenForLogin(setUser), []) + const router = useRouter() + + return ( +
+
+
+
+
+ +
+
+

{user?.name}

+

{user?.email}

+

${user?.balanceUsd} USD

+
+ +
+
+
+ + {/* Lorem ipsum table. TODO: fill in user's bets and markets */} +

+ {user?.username}'s Bets +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameJobcompanylocationLast LoginFavorite Color
1Cy GandertonQuality Control SpecialistLittel, Schaden and VandervortCanada12/16/2020Blue
2Hart HagertyDesktop Support TechnicianZemlak, Daniel and LeannonUnited States12/5/2020Purple
3Brice SwyreTax AccountantCarroll GroupChina8/15/2020Red
4Marjy FerenczOffice Assistant IRowe-SchoenRussia3/25/2021Crimson
5Yancy TearCommunity Outreach SpecialistWyman-LednerBrazil5/22/2020Indigo
6Irma VasilikEditorWiza, Bins and EmardVenezuela12/8/2020Purple
+
+
+
+ ) +}