Use client side contract search for emulator

This commit is contained in:
James Grugett 2022-07-01 12:26:45 -04:00
parent d29115b05a
commit cb68530e2a
3 changed files with 6 additions and 2 deletions

View File

@ -122,7 +122,7 @@ export function ContractSearch(props: {
const indexName = `${indexPrefix}contracts-${sort}`
if (IS_PRIVATE_MANIFOLD) {
if (IS_PRIVATE_MANIFOLD || process.env.NEXT_PUBLIC_FIREBASE_EMULATE) {
return (
<ContractSearchFirestore
querySortOptions={querySortOptions}

View File

@ -74,7 +74,7 @@ export function FreeResponseOutcomeLabel(props: {
if (resolution === 'CANCEL') return <CancelLabel />
if (resolution === 'MKT') return <MultiLabel />
const chosen = contract.answers.find((answer) => answer.id === resolution)
const chosen = contract.answers?.find((answer) => answer.id === resolution)
if (!chosen) return <AnswerNumberLabel number={resolution} />
return (
<FreeResponseAnswerToolTip text={chosen.text}>

View File

@ -9,6 +9,8 @@ import {
useInitialQueryAndSort,
} from 'web/hooks/use-sort-and-query-params'
const MAX_CONTRACTS_RENDERED = 100
export default function ContractSearchFirestore(props: {
querySortOptions?: {
defaultSort: Sort
@ -80,6 +82,8 @@ export default function ContractSearchFirestore(props: {
}
}
matches = matches.slice(0, MAX_CONTRACTS_RENDERED)
const showTime = ['close-date', 'closed'].includes(sort)
? 'close-date'
: sort === 'resolve-date'