From 0959ec7679d981493c6fac21ea425e9602543b9c Mon Sep 17 00:00:00 2001 From: Austin Chen Date: Fri, 4 Feb 2022 10:30:56 -0800 Subject: [PATCH] Show avatar on contract cards --- web/components/avatar.tsx | 38 ++++++++++++++++++----------- web/components/contract-card.tsx | 41 ++++++++++++++++++++------------ web/components/contract-feed.tsx | 34 +++++++------------------- 3 files changed, 58 insertions(+), 55 deletions(-) diff --git a/web/components/avatar.tsx b/web/components/avatar.tsx index 0500fced..e3e58e6c 100644 --- a/web/components/avatar.tsx +++ b/web/components/avatar.tsx @@ -1,12 +1,15 @@ import Router from 'next/router' import clsx from 'clsx' +import { UserCircleIcon } from '@heroicons/react/solid' export function Avatar(props: { username?: string avatarUrl?: string noLink?: boolean + size?: number }) { - const { username, avatarUrl, noLink } = props + const { username, avatarUrl, noLink, size } = props + const s = size || 10 const onClick = noLink && username @@ -16,19 +19,26 @@ export function Avatar(props: { Router.push(`/${username}`) } return ( -
- {username} +
+ {avatarUrl ? ( + {username} + ) : ( + // TODO: After 2022-03-01, can just assume that all contracts have an avatarUrl +
) } diff --git a/web/components/contract-card.tsx b/web/components/contract-card.tsx index 77d32166..84690fae 100644 --- a/web/components/contract-card.tsx +++ b/web/components/contract-card.tsx @@ -9,12 +9,13 @@ import { contractPath, } from '../lib/firebase/contracts' import { Col } from './layout/col' -import { parseTags } from '../../common/util/parse' import dayjs from 'dayjs' import { TrendingUpIcon } from '@heroicons/react/solid' import { DateTimeTooltip } from './datetime-tooltip' import { ClockIcon } from '@heroicons/react/outline' import { fromNow } from '../lib/util/time' +import { Avatar } from './avatar' +import { Spacer } from './layout/spacer' export function ContractCard(props: { contract: Contract @@ -37,7 +38,15 @@ export function ContractCard(props: { - + + + + +

{question}

-
) @@ -104,7 +108,7 @@ export function ResolutionOrChance(props: { ) } -export function AbbrContractDetails(props: { +function AbbrContractDetails(props: { contract: Contract showHotVolume?: boolean showCloseTime?: boolean @@ -115,13 +119,20 @@ export function AbbrContractDetails(props: { return ( - - -
+ + + + + + {showHotVolume ? (
{' '} diff --git a/web/components/contract-feed.tsx b/web/components/contract-feed.tsx index 2279e2fb..32db9013 100644 --- a/web/components/contract-feed.tsx +++ b/web/components/contract-feed.tsx @@ -283,19 +283,10 @@ function FeedQuestion(props: { contract: Contract }) { return ( <> - {contract.creatorAvatarUrl ? ( - - ) : ( - // TODO: After 2022-03-01, can just assume that all contracts have an avatarUrl -
-
-
-
- )} +
- {contract.creatorAvatarUrl ? ( - - ) : ( - // TODO: After 2022-03-01, can just assume that all contracts have an avatarUrl -
-
-
-
- )} +