2022-01-15 23:28:32 +00:00
|
|
|
import clsx from 'clsx'
|
2022-01-24 05:43:07 +00:00
|
|
|
import { User } from '../lib/firebase/users'
|
2021-12-30 20:03:32 +00:00
|
|
|
import { CreatorContractsList } from './contracts-list'
|
2021-12-16 02:11:29 +00:00
|
|
|
import { Title } from './title'
|
2021-12-16 21:17:32 +00:00
|
|
|
import { SEO } from './SEO'
|
2021-12-20 04:06:30 +00:00
|
|
|
import { Page } from './page'
|
2021-12-31 19:17:32 +00:00
|
|
|
import { SiteLink } from './site-link'
|
2021-12-16 02:11:29 +00:00
|
|
|
|
2022-01-13 21:16:47 +00:00
|
|
|
export function UserLink(props: {
|
|
|
|
name: string
|
|
|
|
username: string
|
|
|
|
showUsername?: boolean
|
|
|
|
className?: string
|
|
|
|
}) {
|
|
|
|
const { name, username, showUsername, className } = props
|
2021-12-16 02:11:29 +00:00
|
|
|
|
|
|
|
return (
|
2022-01-15 23:28:32 +00:00
|
|
|
<SiteLink href={`/${username}`} className={clsx('z-10', className)}>
|
2022-01-13 21:16:47 +00:00
|
|
|
{name}
|
|
|
|
{showUsername && ` (@${username})`}
|
2021-12-30 20:03:32 +00:00
|
|
|
</SiteLink>
|
2021-12-16 02:11:29 +00:00
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2021-12-16 21:17:32 +00:00
|
|
|
export function UserPage(props: { user: User; currentUser?: User }) {
|
|
|
|
const { user, currentUser } = props
|
|
|
|
|
|
|
|
const isCurrentUser = user.id === currentUser?.id
|
|
|
|
|
2021-12-31 20:25:01 +00:00
|
|
|
const possesive = isCurrentUser ? 'Your ' : `${user.name}'s `
|
2021-12-16 21:17:32 +00:00
|
|
|
|
2021-12-16 02:11:29 +00:00
|
|
|
return (
|
2021-12-20 04:06:30 +00:00
|
|
|
<Page>
|
2021-12-16 21:17:32 +00:00
|
|
|
<SEO
|
|
|
|
title={possesive + 'markets'}
|
|
|
|
description={possesive + 'markets'}
|
|
|
|
url={`/@${user.username}`}
|
|
|
|
/>
|
|
|
|
|
2021-12-18 23:40:39 +00:00
|
|
|
<Title text={possesive + 'markets'} />
|
2021-12-16 02:11:29 +00:00
|
|
|
|
2021-12-30 20:03:32 +00:00
|
|
|
<CreatorContractsList creator={user} />
|
2021-12-20 04:06:30 +00:00
|
|
|
</Page>
|
2021-12-16 02:11:29 +00:00
|
|
|
)
|
|
|
|
}
|