Disable group prefetching from contract links (#836)
* Kill dead code * Stop prefetching groups when viewing contract * Tidy markup
This commit is contained in:
parent
04e8bb248b
commit
dca7205a47
|
@ -8,6 +8,7 @@ import {
|
||||||
import clsx from 'clsx'
|
import clsx from 'clsx'
|
||||||
import { Editor } from '@tiptap/react'
|
import { Editor } from '@tiptap/react'
|
||||||
import dayjs from 'dayjs'
|
import dayjs from 'dayjs'
|
||||||
|
import Link from 'next/link'
|
||||||
|
|
||||||
import { Row } from '../layout/row'
|
import { Row } from '../layout/row'
|
||||||
import { formatMoney } from 'common/util/format'
|
import { formatMoney } from 'common/util/format'
|
||||||
|
@ -26,7 +27,7 @@ import { Button } from 'web/components/button'
|
||||||
import { Modal } from 'web/components/layout/modal'
|
import { Modal } from 'web/components/layout/modal'
|
||||||
import { Col } from 'web/components/layout/col'
|
import { Col } from 'web/components/layout/col'
|
||||||
import { ContractGroupsList } from 'web/components/groups/contract-groups-list'
|
import { ContractGroupsList } from 'web/components/groups/contract-groups-list'
|
||||||
import { SiteLink } from 'web/components/site-link'
|
import { linkClass } from 'web/components/site-link'
|
||||||
import { getGroupLinkToDisplay, groupPath } from 'web/lib/firebase/groups'
|
import { getGroupLinkToDisplay, groupPath } from 'web/lib/firebase/groups'
|
||||||
import { insertContent } from '../editor/utils'
|
import { insertContent } from '../editor/utils'
|
||||||
import { contractMetrics } from 'common/contract-details'
|
import { contractMetrics } from 'common/contract-details'
|
||||||
|
@ -83,12 +84,11 @@ export function MiscDetails(props: {
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{!hideGroupLink && groupToDisplay && (
|
{!hideGroupLink && groupToDisplay && (
|
||||||
<SiteLink
|
<Link prefetch={false} href={groupPath(groupToDisplay.slug)}>
|
||||||
href={groupPath(groupToDisplay.slug)}
|
<a className={clsx(linkClass, 'truncate text-sm text-gray-400')}>
|
||||||
className="truncate text-sm text-gray-400"
|
{groupToDisplay.name}
|
||||||
>
|
</a>
|
||||||
{groupToDisplay.name}
|
</Link>
|
||||||
</SiteLink>
|
|
||||||
)}
|
)}
|
||||||
</Row>
|
</Row>
|
||||||
)
|
)
|
||||||
|
@ -116,25 +116,6 @@ export function AvatarDetails(props: {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function AbbrContractDetails(props: {
|
|
||||||
contract: Contract
|
|
||||||
showHotVolume?: boolean
|
|
||||||
showTime?: ShowTime
|
|
||||||
}) {
|
|
||||||
const { contract, showHotVolume, showTime } = props
|
|
||||||
return (
|
|
||||||
<Row className="items-center justify-between">
|
|
||||||
<AvatarDetails contract={contract} />
|
|
||||||
|
|
||||||
<MiscDetails
|
|
||||||
contract={contract}
|
|
||||||
showHotVolume={showHotVolume}
|
|
||||||
showTime={showTime}
|
|
||||||
/>
|
|
||||||
</Row>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
export function ContractDetails(props: {
|
export function ContractDetails(props: {
|
||||||
contract: Contract
|
contract: Contract
|
||||||
disabled?: boolean
|
disabled?: boolean
|
||||||
|
@ -156,19 +137,18 @@ export function ContractDetails(props: {
|
||||||
const isMobile = (width ?? 0) < 600
|
const isMobile = (width ?? 0) < 600
|
||||||
const groupToDisplay = getGroupLinkToDisplay(contract)
|
const groupToDisplay = getGroupLinkToDisplay(contract)
|
||||||
const groupInfo = groupToDisplay ? (
|
const groupInfo = groupToDisplay ? (
|
||||||
<Row
|
<Link prefetch={false} href={groupPath(groupToDisplay.slug)}>
|
||||||
className={clsx(
|
<a
|
||||||
'items-center pr-0 sm:pr-2',
|
className={clsx(
|
||||||
isMobile ? 'max-w-[140px]' : 'max-w-[250px]'
|
linkClass,
|
||||||
)}
|
'flex flex-row items-center truncate pr-0 sm:pr-2',
|
||||||
>
|
isMobile ? 'max-w-[140px]' : 'max-w-[250px]'
|
||||||
<SiteLink href={groupPath(groupToDisplay.slug)} className={'truncate'}>
|
)}
|
||||||
<Row>
|
>
|
||||||
<UserGroupIcon className="mx-1 inline h-5 w-5 shrink-0" />
|
<UserGroupIcon className="mx-1 inline h-5 w-5 shrink-0" />
|
||||||
<span className="items-center truncate">{groupToDisplay.name}</span>
|
<span className="items-center truncate">{groupToDisplay.name}</span>
|
||||||
</Row>
|
</a>
|
||||||
</SiteLink>
|
</Link>
|
||||||
</Row>
|
|
||||||
) : (
|
) : (
|
||||||
<Button
|
<Button
|
||||||
size={'xs'}
|
size={'xs'}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user