beginning to change profile

This commit is contained in:
ingawei 2022-09-21 20:05:36 -07:00
parent 7988fdde60
commit 70cccee469
3 changed files with 198 additions and 176 deletions

View File

@ -102,6 +102,7 @@ export function ContractSearch(props: {
loadMore: () => void loadMore: () => void
) => ReactNode ) => ReactNode
autoFocus?: boolean autoFocus?: boolean
profile?: boolean | undefined
}) { }) {
const { const {
user, user,
@ -121,6 +122,7 @@ export function ContractSearch(props: {
maxResults, maxResults,
renderContracts, renderContracts,
autoFocus, autoFocus,
profile,
} = props } = props
const [state, setState] = usePersistentState( const [state, setState] = usePersistentState(
@ -228,6 +230,10 @@ export function ContractSearch(props: {
/> />
{renderContracts ? ( {renderContracts ? (
renderContracts(renderedContracts, performQuery) renderContracts(renderedContracts, performQuery)
) : renderedContracts && renderedContracts.length === 0 && profile ? (
<p className="mx-2 text-gray-500">
This creator does not yet have any markets.
</p>
) : ( ) : (
<ContractsGrid <ContractsGrid
contracts={renderedContracts} contracts={renderedContracts}

View File

@ -55,6 +55,13 @@ export function ContractsGrid(props: {
} }
if (contracts.length === 0) { if (contracts.length === 0) {
// if (profile) {
// return (
// <p className="mx-2 text-gray-500">
// This creator does not yet have any markets.
// </p>
// )
// } else {
return ( return (
<p className="mx-2 text-gray-500"> <p className="mx-2 text-gray-500">
No markets found. Why not{' '} No markets found. Why not{' '}
@ -63,6 +70,7 @@ export function ContractsGrid(props: {
</SiteLink> </SiteLink>
</p> </p>
) )
// }
} }
return ( return (
@ -118,6 +126,7 @@ export function CreatorContractsList(props: {
creatorId: creator.id, creatorId: creator.id,
}} }}
persistPrefix={`user-${creator.id}`} persistPrefix={`user-${creator.id}`}
profile={true}
/> />
) )
} }

View File

@ -94,22 +94,27 @@ export function UserPage(props: { user: User }) {
<LoansModal isOpen={showLoansModal} setOpen={setShowLoansModal} /> <LoansModal isOpen={showLoansModal} setOpen={setShowLoansModal} />
)} )}
{/* Banner image up top, with an circle avatar overlaid */} {/* Banner image up top, with an circle avatar overlaid */}
<div {/* <div
className="h-32 w-full bg-cover bg-center sm:h-40" className="h-32 w-full bg-cover bg-center sm:h-40"
style={{ style={{
backgroundImage: `url(${bannerUrl})`, backgroundImage: `url(${bannerUrl})`,
}} }}
></div> ></div> */}
<div className="relative mb-20"> <Col>
<div className="absolute -top-10 left-4"> <Row className="px-4 py-4">
<Avatar <Avatar
username={user.username} username={user.username}
avatarUrl={user.avatarUrl} avatarUrl={user.avatarUrl}
size={24} size={24}
className="bg-white ring-4 ring-white" className="bg-white ring-4 ring-white"
/> />
</div> <Col>
<span className="break-anywhere text-2xl font-bold">
{user.name}
</span>
<span className="text-gray-500">@{user.username}</span>
</Col>
</Row>
{/* Top right buttons (e.g. edit, follow) */} {/* Top right buttons (e.g. edit, follow) */}
<div className="absolute right-0 top-0 mt-2 mr-4"> <div className="absolute right-0 top-0 mt-2 mr-4">
{!isCurrentUser && <UserFollowButton userId={user.id} />} {!isCurrentUser && <UserFollowButton userId={user.id} />}
@ -120,17 +125,16 @@ export function UserPage(props: { user: User }) {
</SiteLink> </SiteLink>
)} )}
</div> </div>
</div>
{/* Profile details: name, username, bio, and link to twitter/discord */} {/* Profile details: name, username, bio, and link to twitter/discord */}
<Col className="mx-4 -mt-6"> <Col className="mx-4 -mt-6">
<Row className={'flex-wrap justify-between gap-y-2'}> <Row className={'flex-wrap justify-between gap-y-2'}>
<Col> {/* <Col>
<span className="break-anywhere text-2xl font-bold"> <span className="break-anywhere text-2xl font-bold">
{user.name} {user.name}
</span> </span>
<span className="text-gray-500">@{user.username}</span> <span className="text-gray-500">@{user.username}</span>
</Col> </Col> */}
<Col className={'justify-center'}> <Col className={'justify-center'}>
<Row className={'gap-3'}> <Row className={'gap-3'}>
<Col className={'items-center text-gray-500'}> <Col className={'items-center text-gray-500'}>
@ -190,7 +194,9 @@ export function UserPage(props: { user: User }) {
> >
<Row className="items-center gap-1"> <Row className="items-center gap-1">
<LinkIcon className="h-4 w-4" /> <LinkIcon className="h-4 w-4" />
<span className="text-sm text-gray-500">{user.website}</span> <span className="text-sm text-gray-500">
{user.website}
</span>
</Row> </Row>
</SiteLink> </SiteLink>
)} )}
@ -297,6 +303,7 @@ export function UserPage(props: { user: User }) {
]} ]}
/> />
</Col> </Col>
</Col>
</Page> </Page>
) )
} }