import { firebaseLogin, firebaseLogout, User } from '../lib/firebase/users' import { Header } from '../components/header' import { useUser } from '../hooks/use-user' import { useState, useEffect } from 'react' import { Contract, listContracts } from '../lib/firebase/contracts' import { ContractsList } from '../components/contracts-list' import { Title } from '../components/title' function UserCard(props: { user: User }) { const { user } = props return (
{user?.avatarUrl && ( )}

{user?.name}

{user?.email}

M$ {user?.balance}

) } function SignInCard() { return (

Welcome!

Sign in to get started

) } export default function Account() { const user = useUser() const [contracts, setContracts] = useState([]) useEffect(() => { console.log('Fetching contracts', user?.id) if (user?.id) { listContracts(user?.id).then(setContracts) } }, [user?.id]) return (
{user ? (
<ContractsList contracts={contracts} /> </div> ) : ( <SignInCard /> )} </div> </div> ) }