import { firebaseLogout, User } from '../lib/firebase/users' import { Header } from './header' import { ContractsList } from './contracts-list' import { Title } from './title' import { Row } from './layout/row' import { formatMoney } from '../lib/util/format' import { BetsList } from './bets-list' import { Spacer } from './layout/spacer' import Link from 'next/link' import clsx from 'clsx' import { SEO } from './SEO' export function UserLink(props: { displayName: string; className?: string }) { const { displayName, className } = props const username = displayName.replace(/\s+/g, '') return ( e.stopPropagation()} > @{username} ) } function UserCard(props: { user: User; showPrivateInfo?: boolean }) { const { user, showPrivateInfo } = props return (
{user?.avatarUrl && ( )}
{user.name}
{showPrivateInfo && ( <>

{user?.email}

{formatMoney(user?.balance)}

)}
) } export function UserPage(props: { user: User; currentUser?: User }) { const { user, currentUser } = props const isCurrentUser = user.id === currentUser?.id const possesive = isCurrentUser ? 'Your ' : `${user.username}'s ` return (
<ContractsList creator={user} /> <Spacer h={4} /> {isCurrentUser && ( <> <Title text={possesive + 'bets'} /> <BetsList user={user} /> </> )} </div> </div> </div> ) }