Avatars don't link during contract selection

This commit is contained in:
Ian Philips 2022-09-15 09:51:52 -06:00
parent e9f136a653
commit be91d5d5e0
7 changed files with 40 additions and 15 deletions

View File

@ -72,11 +72,10 @@ type UniqueBettorBonus = {
fromType: 'BANK'
toType: 'USER'
category: 'UNIQUE_BETTOR_BONUS'
// This data was mistakenly stored as a stringified JSON object in description previously
data: {
contractId: string
uniqueNewBettorId?: string
// Previously stored all unique bettor ids in description
// Old unique bettor bonus txns stored all unique bettor ids
uniqueBettorIds?: string[]
}
}
@ -85,7 +84,6 @@ type BettingStreakBonus = {
fromType: 'BANK'
toType: 'USER'
category: 'BETTING_STREAK_BONUS'
// This data was mistakenly stored as a stringified JSON object in description previously
data: {
currentBettingStreak?: number
}

View File

@ -80,9 +80,10 @@ export function ContractSearch(props: {
highlightOptions?: ContractHighlightOptions
onContractClick?: (contract: Contract) => void
hideOrderSelector?: boolean
cardHideOptions?: {
cardUIOptions?: {
hideGroupLink?: boolean
hideQuickBet?: boolean
noLinkAvatar?: boolean
}
headerClassName?: string
persistPrefix?: string
@ -102,7 +103,7 @@ export function ContractSearch(props: {
additionalFilter,
onContractClick,
hideOrderSelector,
cardHideOptions,
cardUIOptions,
highlightOptions,
headerClassName,
persistPrefix,
@ -223,7 +224,7 @@ export function ContractSearch(props: {
showTime={state.showTime ?? undefined}
onContractClick={onContractClick}
highlightOptions={highlightOptions}
cardHideOptions={cardHideOptions}
cardUIOptions={cardUIOptions}
/>
)}
</Col>

View File

@ -85,7 +85,11 @@ export function SelectMarketsModal(props: {
<ContractSearch
hideOrderSelector
onContractClick={addContract}
cardHideOptions={{ hideGroupLink: true, hideQuickBet: true }}
cardUIOptions={{
hideGroupLink: true,
hideQuickBet: true,
noLinkAvatar: true,
}}
highlightOptions={{
contractIds: contracts.map((c) => c.id),
highlightClassName:

View File

@ -42,6 +42,7 @@ export function ContractCard(props: {
hideQuickBet?: boolean
hideGroupLink?: boolean
trackingPostfix?: string
noLinkAvatar?: boolean
}) {
const {
showTime,
@ -51,6 +52,7 @@ export function ContractCard(props: {
hideQuickBet,
hideGroupLink,
trackingPostfix,
noLinkAvatar,
} = props
const contract = useContractWithPreload(props.contract) ?? props.contract
const { question, outcomeType } = contract
@ -78,6 +80,7 @@ export function ContractCard(props: {
<AvatarDetails
contract={contract}
className={'hidden md:inline-flex'}
noLink={noLinkAvatar}
/>
<p
className={clsx(
@ -142,7 +145,12 @@ export function ContractCard(props: {
showQuickBet ? 'w-[85%]' : 'w-full'
)}
>
<AvatarDetails contract={contract} short={true} className="md:hidden" />
<AvatarDetails
contract={contract}
short={true}
className="md:hidden"
noLink={noLinkAvatar}
/>
<MiscDetails
contract={contract}
showTime={showTime}

View File

@ -86,8 +86,9 @@ export function AvatarDetails(props: {
contract: Contract
className?: string
short?: boolean
noLink?: boolean
}) {
const { contract, short, className } = props
const { contract, short, className, noLink } = props
const { creatorName, creatorUsername, creatorAvatarUrl } = contract
return (
@ -98,8 +99,14 @@ export function AvatarDetails(props: {
username={creatorUsername}
avatarUrl={creatorAvatarUrl}
size={6}
noLink={noLink}
/>
<UserLink
name={creatorName}
username={creatorUsername}
short={short}
noLink={noLink}
/>
<UserLink name={creatorName} username={creatorUsername} short={short} />
</Row>
)
}

View File

@ -21,9 +21,10 @@ export function ContractsGrid(props: {
loadMore?: () => void
showTime?: ShowTime
onContractClick?: (contract: Contract) => void
cardHideOptions?: {
cardUIOptions?: {
hideQuickBet?: boolean
hideGroupLink?: boolean
noLinkAvatar?: boolean
}
highlightOptions?: ContractHighlightOptions
trackingPostfix?: string
@ -34,11 +35,11 @@ export function ContractsGrid(props: {
showTime,
loadMore,
onContractClick,
cardHideOptions,
cardUIOptions,
highlightOptions,
trackingPostfix,
} = props
const { hideQuickBet, hideGroupLink } = cardHideOptions || {}
const { hideQuickBet, hideGroupLink, noLinkAvatar } = cardUIOptions || {}
const { contractIds, highlightClassName } = highlightOptions || {}
const onVisibilityUpdated = useCallback(
(visible) => {
@ -80,6 +81,7 @@ export function ContractsGrid(props: {
onClick={
onContractClick ? () => onContractClick(contract) : undefined
}
noLinkAvatar={noLinkAvatar}
hideQuickBet={hideQuickBet}
hideGroupLink={hideGroupLink}
trackingPostfix={trackingPostfix}

View File

@ -20,13 +20,18 @@ export function UserLink(props: {
username: string
className?: string
short?: boolean
noLink?: boolean
}) {
const { name, username, className, short } = props
const { name, username, className, short, noLink } = props
const shortName = short ? shortenName(name) : name
return (
<SiteLink
href={`/${username}`}
className={clsx('z-10 truncate', className)}
className={clsx(
'z-10 truncate',
className,
noLink ? 'pointer-events-none' : ''
)}
>
{shortName}
</SiteLink>