diff --git a/web/components/contracts-list.tsx b/web/components/contracts-list.tsx index 0c45da1c..4ce007fc 100644 --- a/web/components/contracts-list.tsx +++ b/web/components/contracts-list.tsx @@ -199,13 +199,16 @@ const MAX_CONTRACTS_DISPLAYED = 99 export function SearchableGrid(props: { contracts: Contract[] - query: string - setQuery: (query: string) => void - sort: Sort - setSort: (sort: Sort) => void byOneCreator?: boolean + querySortOptions?: { + defaultSort: Sort + shouldLoadFromStorage?: boolean + } }) { - const { contracts, query, setQuery, sort, setSort, byOneCreator } = props + const { contracts, byOneCreator, querySortOptions } = props + + const { query, setQuery, sort, setSort } = + useQueryAndSortParams(querySortOptions) const queryWords = query.toLowerCase().split(' ') function check(corpus: String) { @@ -324,11 +327,6 @@ export function CreatorContractsList(props: { creator: User }) { const { creator } = props const [contracts, setContracts] = useState('loading') - const { query, setQuery, sort, setSort } = useQueryAndSortParams({ - defaultSort: 'all', - shouldLoadFromStorage: false, - }) - useEffect(() => { if (creator?.id) { // TODO: stream changes from firestore @@ -342,10 +340,10 @@ export function CreatorContractsList(props: { creator: User }) { ) } diff --git a/web/pages/fold/[...slugs]/index.tsx b/web/pages/fold/[...slugs]/index.tsx index 0135d273..c7ac014a 100644 --- a/web/pages/fold/[...slugs]/index.tsx +++ b/web/pages/fold/[...slugs]/index.tsx @@ -22,7 +22,6 @@ import { Col } from '../../../components/layout/col' import { useUser } from '../../../hooks/use-user' import { useFold } from '../../../hooks/use-fold' import { SearchableGrid } from '../../../components/contracts-list' -import { useQueryAndSortParams } from '../../../hooks/use-sort-and-query-params' import { useRouter } from 'next/router' import clsx from 'clsx' import { scoreCreators, scoreTraders } from '../../../../common/scoring' @@ -138,8 +137,6 @@ export default function FoldPage(props: { const fold = useFold(props.fold?.id) ?? props.fold - const { query, setQuery, sort, setSort } = useQueryAndSortParams() - const user = useUser() const isCurator = user && fold && user.id === fold.curatorId @@ -259,13 +256,7 @@ export default function FoldPage(props: { ) ) : ( - + )} diff --git a/web/pages/markets.tsx b/web/pages/markets.tsx index 53156a33..fd1492b1 100644 --- a/web/pages/markets.tsx +++ b/web/pages/markets.tsx @@ -3,7 +3,6 @@ import { Page } from '../components/page' import { SEO } from '../components/SEO' import { Title } from '../components/title' import { useContracts } from '../hooks/use-contracts' -import { useQueryAndSortParams } from '../hooks/use-sort-and-query-params' import { Contract, listAllContracts } from '../lib/firebase/contracts' export async function getStaticProps() { @@ -21,8 +20,6 @@ export async function getStaticProps() { export default function Markets(props: { contracts: Contract[] }) { const contracts = useContracts() ?? props.contracts ?? [] - const { query, setQuery, sort, setSort } = useQueryAndSortParams() - return ( */} - + ) } diff --git a/web/pages/tag/[tag].tsx b/web/pages/tag/[tag].tsx index 2ea1143d..f571bb74 100644 --- a/web/pages/tag/[tag].tsx +++ b/web/pages/tag/[tag].tsx @@ -3,7 +3,6 @@ import { SearchableGrid } from '../../components/contracts-list' import { Page } from '../../components/page' import { Title } from '../../components/title' import { useContracts } from '../../hooks/use-contracts' -import { useQueryAndSortParams } from '../../hooks/use-sort-and-query-params' import { Contract, listAllContracts } from '../../lib/firebase/contracts' export async function getStaticProps() { @@ -31,18 +30,10 @@ export default function TagPage(props: { contracts: Contract[] }) { contract.lowercaseTags.includes(tag.toLowerCase()) ) - const { query, setQuery, sort, setSort } = useQueryAndSortParams() - return ( - <SearchableGrid - contracts={taggedContracts} - query={query} - setQuery={setQuery} - sort={sort} - setSort={setSort} - /> + <SearchableGrid contracts={taggedContracts} /> </Page> ) }