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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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