From cb68530e2a8af2c50836ab3a04b26bd1797ea2d1 Mon Sep 17 00:00:00 2001 From: James Grugett Date: Fri, 1 Jul 2022 12:26:45 -0400 Subject: [PATCH] Use client side contract search for emulator --- web/components/contract-search.tsx | 2 +- web/components/outcome-label.tsx | 2 +- web/pages/contract-search-firestore.tsx | 4 ++++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/web/components/contract-search.tsx b/web/components/contract-search.tsx index fac02d74..9a4da597 100644 --- a/web/components/contract-search.tsx +++ b/web/components/contract-search.tsx @@ -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 ( if (resolution === 'MKT') return - const chosen = contract.answers.find((answer) => answer.id === resolution) + const chosen = contract.answers?.find((answer) => answer.id === resolution) if (!chosen) return return ( diff --git a/web/pages/contract-search-firestore.tsx b/web/pages/contract-search-firestore.tsx index c9a7a666..8cd80f7a 100644 --- a/web/pages/contract-search-firestore.tsx +++ b/web/pages/contract-search-firestore.tsx @@ -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'