Move avatar to below card on mobile
This commit is contained in:
parent
2ff2d6c1fc
commit
428d9a3692
|
@ -72,7 +72,7 @@ export function ContractCard(props: {
|
||||||
className
|
className
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<Col className="group relative flex-1 gap-3 py-4 pl-6">
|
<Col className="group relative flex-1 gap-3 py-4 pb-12 pl-6">
|
||||||
{onClick ? (
|
{onClick ? (
|
||||||
<a
|
<a
|
||||||
className="absolute top-0 left-0 right-0 bottom-0"
|
className="absolute top-0 left-0 right-0 bottom-0"
|
||||||
|
@ -100,7 +100,10 @@ export function ContractCard(props: {
|
||||||
/>
|
/>
|
||||||
</Link>
|
</Link>
|
||||||
)}
|
)}
|
||||||
<AvatarDetails contract={contract} />
|
<AvatarDetails
|
||||||
|
contract={contract}
|
||||||
|
className={'hidden md:inline-flex'}
|
||||||
|
/>
|
||||||
<p
|
<p
|
||||||
className="break-words font-semibold text-indigo-700 group-hover:underline group-hover:decoration-indigo-400 group-hover:decoration-2"
|
className="break-words font-semibold text-indigo-700 group-hover:underline group-hover:decoration-indigo-400 group-hover:decoration-2"
|
||||||
style={{ /* For iOS safari */ wordBreak: 'break-word' }}
|
style={{ /* For iOS safari */ wordBreak: 'break-word' }}
|
||||||
|
@ -119,13 +122,19 @@ export function ContractCard(props: {
|
||||||
) : (
|
) : (
|
||||||
<FreeResponseTopAnswer contract={contract} truncate="long" />
|
<FreeResponseTopAnswer contract={contract} truncate="long" />
|
||||||
))}
|
))}
|
||||||
|
<Row className={'absolute bottom-3 gap-2 md:gap-0'}>
|
||||||
<MiscDetails
|
<AvatarDetails
|
||||||
contract={contract}
|
contract={contract}
|
||||||
showHotVolume={showHotVolume}
|
short={true}
|
||||||
showTime={showTime}
|
className={'block md:hidden'}
|
||||||
hideGroupLink={hideGroupLink}
|
/>
|
||||||
/>
|
<MiscDetails
|
||||||
|
contract={contract}
|
||||||
|
showHotVolume={showHotVolume}
|
||||||
|
showTime={showTime}
|
||||||
|
hideGroupLink={hideGroupLink}
|
||||||
|
/>
|
||||||
|
</Row>
|
||||||
</Col>
|
</Col>
|
||||||
{showQuickBet ? (
|
{showQuickBet ? (
|
||||||
<QuickBet contract={contract} user={user} />
|
<QuickBet contract={contract} user={user} />
|
||||||
|
|
|
@ -34,6 +34,7 @@ import { ContractGroupsList } from 'web/components/groups/contract-groups-list'
|
||||||
import { SiteLink } from 'web/components/site-link'
|
import { SiteLink } from 'web/components/site-link'
|
||||||
import { groupPath } from 'web/lib/firebase/groups'
|
import { groupPath } from 'web/lib/firebase/groups'
|
||||||
import { insertContent } from '../editor/utils'
|
import { insertContent } from '../editor/utils'
|
||||||
|
import clsx from 'clsx'
|
||||||
|
|
||||||
export type ShowTime = 'resolve-date' | 'close-date'
|
export type ShowTime = 'resolve-date' | 'close-date'
|
||||||
|
|
||||||
|
@ -83,9 +84,8 @@ export function MiscDetails(props: {
|
||||||
{!hideGroupLink && groupLinks && groupLinks.length > 0 && (
|
{!hideGroupLink && groupLinks && groupLinks.length > 0 && (
|
||||||
<SiteLink
|
<SiteLink
|
||||||
href={groupPath(groupLinks[0].slug)}
|
href={groupPath(groupLinks[0].slug)}
|
||||||
className="line-clamp-1 text-sm text-gray-400"
|
className="truncate text-sm text-gray-400"
|
||||||
>
|
>
|
||||||
<UserGroupIcon className="mx-1 mb-0.5 inline h-4 w-4 shrink-0" />
|
|
||||||
{groupLinks[0].name}
|
{groupLinks[0].name}
|
||||||
</SiteLink>
|
</SiteLink>
|
||||||
)}
|
)}
|
||||||
|
@ -93,18 +93,24 @@ export function MiscDetails(props: {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function AvatarDetails(props: { contract: Contract }) {
|
export function AvatarDetails(props: {
|
||||||
const { contract } = props
|
contract: Contract
|
||||||
|
className?: string
|
||||||
|
short?: boolean
|
||||||
|
}) {
|
||||||
|
const { contract, short, className } = props
|
||||||
const { creatorName, creatorUsername } = contract
|
const { creatorName, creatorUsername } = contract
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Row className="items-center gap-2 text-sm text-gray-400">
|
<Row
|
||||||
|
className={clsx('items-center gap-2 text-sm text-gray-400', className)}
|
||||||
|
>
|
||||||
<Avatar
|
<Avatar
|
||||||
username={creatorUsername}
|
username={creatorUsername}
|
||||||
avatarUrl={contract.creatorAvatarUrl}
|
avatarUrl={contract.creatorAvatarUrl}
|
||||||
size={6}
|
size={6}
|
||||||
/>
|
/>
|
||||||
<UserLink name={creatorName} username={creatorUsername} />
|
<UserLink name={creatorName} username={creatorUsername} short={short} />
|
||||||
</Row>
|
</Row>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,16 +34,25 @@ export function UserLink(props: {
|
||||||
username: string
|
username: string
|
||||||
showUsername?: boolean
|
showUsername?: boolean
|
||||||
className?: string
|
className?: string
|
||||||
justFirstName?: boolean
|
short?: boolean
|
||||||
}) {
|
}) {
|
||||||
const { name, username, showUsername, className, justFirstName } = props
|
const { name, username, showUsername, className, short } = props
|
||||||
|
const firstName = name.split(' ')[0]
|
||||||
|
const maxLength = 10
|
||||||
|
const shortName =
|
||||||
|
firstName.length >= 3
|
||||||
|
? firstName.length < maxLength
|
||||||
|
? firstName
|
||||||
|
: firstName.substring(0, maxLength - 3) + '...'
|
||||||
|
: name.length > maxLength
|
||||||
|
? name.substring(0, maxLength) + '...'
|
||||||
|
: name
|
||||||
return (
|
return (
|
||||||
<SiteLink
|
<SiteLink
|
||||||
href={`/${username}`}
|
href={`/${username}`}
|
||||||
className={clsx('z-10 truncate', className)}
|
className={clsx('z-10 truncate', className)}
|
||||||
>
|
>
|
||||||
{justFirstName ? name.split(' ')[0] : name}
|
{short ? shortName : name}
|
||||||
{showUsername && ` (@${username})`}
|
{showUsername && ` (@${username})`}
|
||||||
</SiteLink>
|
</SiteLink>
|
||||||
)
|
)
|
||||||
|
|
|
@ -440,7 +440,7 @@ function IncomeNotificationItem(props: {
|
||||||
name={sourceUserName || ''}
|
name={sourceUserName || ''}
|
||||||
username={sourceUserUsername || ''}
|
username={sourceUserUsername || ''}
|
||||||
className={'mr-1 flex-shrink-0'}
|
className={'mr-1 flex-shrink-0'}
|
||||||
justFirstName={true}
|
short={true}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
{getReasonForShowingIncomeNotification(false)} {' on'}
|
{getReasonForShowingIncomeNotification(false)} {' on'}
|
||||||
|
@ -609,7 +609,7 @@ function NotificationItem(props: {
|
||||||
name={sourceUserName || ''}
|
name={sourceUserName || ''}
|
||||||
username={sourceUserUsername || ''}
|
username={sourceUserUsername || ''}
|
||||||
className={'mr-0 flex-shrink-0'}
|
className={'mr-0 flex-shrink-0'}
|
||||||
justFirstName={true}
|
short={true}
|
||||||
/>
|
/>
|
||||||
<div className={'inline-flex overflow-hidden text-ellipsis pl-1'}>
|
<div className={'inline-flex overflow-hidden text-ellipsis pl-1'}>
|
||||||
<span className={'flex-shrink-0'}>
|
<span className={'flex-shrink-0'}>
|
||||||
|
@ -681,7 +681,7 @@ function NotificationItem(props: {
|
||||||
name={sourceUserName || ''}
|
name={sourceUserName || ''}
|
||||||
username={sourceUserUsername || ''}
|
username={sourceUserUsername || ''}
|
||||||
className={'relative mr-1 flex-shrink-0'}
|
className={'relative mr-1 flex-shrink-0'}
|
||||||
justFirstName={true}
|
short={true}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{getReasonForShowingNotification(
|
{getReasonForShowingNotification(
|
||||||
|
|
Loading…
Reference in New Issue
Block a user