embed: disable clicking contract details

This commit is contained in:
mantikoros 2022-09-30 20:30:45 -05:00
parent b0b1d72ba6
commit 2f3ae5192e

View File

@ -183,6 +183,7 @@ export function MarketSubheader(props: {
contract={contract} contract={contract}
resolvedDate={resolvedDate} resolvedDate={resolvedDate}
isCreator={isCreator} isCreator={isCreator}
disabled={disabled}
/> />
{!isMobile && ( {!isMobile && (
<Row className={'gap-1'}> <Row className={'gap-1'}>
@ -200,8 +201,9 @@ export function CloseOrResolveTime(props: {
contract: Contract contract: Contract
resolvedDate: any resolvedDate: any
isCreator: boolean isCreator: boolean
disabled?: boolean
}) { }) {
const { contract, resolvedDate, isCreator } = props const { contract, resolvedDate, isCreator, disabled } = props
const { resolutionTime, closeTime } = contract const { resolutionTime, closeTime } = contract
if (!!closeTime || !!resolvedDate) { if (!!closeTime || !!resolvedDate) {
return ( return (
@ -225,6 +227,7 @@ export function CloseOrResolveTime(props: {
closeTime={closeTime} closeTime={closeTime}
contract={contract} contract={contract}
isCreator={isCreator ?? false} isCreator={isCreator ?? false}
disabled={disabled}
/> />
</Row> </Row>
)} )}
@ -245,7 +248,8 @@ export function MarketGroups(props: {
return ( return (
<> <>
<Row className="items-center gap-1"> <Row className="items-center gap-1">
<GroupDisplay groupToDisplay={groupToDisplay} /> <GroupDisplay groupToDisplay={groupToDisplay} disabled={disabled} />
{!disabled && user && ( {!disabled && user && (
<button <button
className="text-greyscale-4 hover:text-greyscale-3" className="text-greyscale-4 hover:text-greyscale-3"
@ -330,14 +334,29 @@ export function ExtraMobileContractDetails(props: {
) )
} }
export function GroupDisplay(props: { groupToDisplay?: GroupLink | null }) { export function GroupDisplay(props: {
const { groupToDisplay } = props groupToDisplay?: GroupLink | null
disabled?: boolean
}) {
const { groupToDisplay, disabled } = props
if (groupToDisplay) { if (groupToDisplay) {
return ( const groupSection = (
<Link prefetch={false} href={groupPath(groupToDisplay.slug)}> <a
<a className="bg-greyscale-4 hover:bg-greyscale-3 max-w-[140px] truncate whitespace-nowrap rounded-full py-0.5 px-2 text-xs text-white sm:max-w-[250px]"> className={clsx(
'bg-greyscale-4 max-w-[140px] truncate whitespace-nowrap rounded-full py-0.5 px-2 text-xs text-white sm:max-w-[250px]',
!disabled && 'hover:bg-greyscale-3 cursor-pointer'
)}
>
{groupToDisplay.name} {groupToDisplay.name}
</a> </a>
)
return disabled ? (
groupSection
) : (
<Link prefetch={false} href={groupPath(groupToDisplay.slug)}>
{groupSection}
</Link> </Link>
) )
} else } else
@ -352,8 +371,9 @@ function EditableCloseDate(props: {
closeTime: number closeTime: number
contract: Contract contract: Contract
isCreator: boolean isCreator: boolean
disabled?: boolean
}) { }) {
const { closeTime, contract, isCreator } = props const { closeTime, contract, isCreator, disabled } = props
const dayJsCloseTime = dayjs(closeTime) const dayJsCloseTime = dayjs(closeTime)
const dayJsNow = dayjs() const dayJsNow = dayjs()
@ -452,8 +472,8 @@ function EditableCloseDate(props: {
time={closeTime} time={closeTime}
> >
<span <span
className={isCreator ? 'cursor-pointer' : ''} className={!disabled && isCreator ? 'cursor-pointer' : ''}
onClick={() => isCreator && setIsEditingCloseTime(true)} onClick={() => !disabled && isCreator && setIsEditingCloseTime(true)}
> >
{isSameDay ? ( {isSameDay ? (
<span className={'capitalize'}> {fromNow(closeTime)}</span> <span className={'capitalize'}> {fromNow(closeTime)}</span>