Hardcode in 8 frontpage markets
This commit is contained in:
parent
cea9422802
commit
2eed1c432a
|
@ -46,7 +46,7 @@ export function FeedPromo(props: { hotContracts: Contract[] }) {
|
||||||
|
|
||||||
<Row className="m-4 mb-6 items-center gap-1 text-xl font-semibold text-gray-800">
|
<Row className="m-4 mb-6 items-center gap-1 text-xl font-semibold text-gray-800">
|
||||||
<SparklesIcon className="inline h-5 w-5" aria-hidden="true" />
|
<SparklesIcon className="inline h-5 w-5" aria-hidden="true" />
|
||||||
Trending today
|
Trending markets
|
||||||
</Row>
|
</Row>
|
||||||
<ContractsGrid
|
<ContractsGrid
|
||||||
contracts={hotContracts?.slice(0, 10) || []}
|
contracts={hotContracts?.slice(0, 10) || []}
|
||||||
|
|
|
@ -239,6 +239,13 @@ export async function getHotContracts() {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function getContractsBySlugs(slugs: string[]) {
|
||||||
|
const q = query(contractCollection, where('slug', 'in', slugs))
|
||||||
|
const snapshot = await getDocs(q)
|
||||||
|
const contracts = snapshot.docs.map((doc) => doc.data() as Contract)
|
||||||
|
return _.sortBy(contracts, (contract) => -1 * contract.volume24Hours)
|
||||||
|
}
|
||||||
|
|
||||||
const topWeeklyQuery = query(
|
const topWeeklyQuery = query(
|
||||||
contractCollection,
|
contractCollection,
|
||||||
where('isResolved', '==', false),
|
where('isResolved', '==', false),
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
import Router from 'next/router'
|
import Router from 'next/router'
|
||||||
|
|
||||||
import { Contract, getHotContracts } from '../lib/firebase/contracts'
|
import { Contract, getContractsBySlugs } from '../lib/firebase/contracts'
|
||||||
import { Page } from '../components/page'
|
import { Page } from '../components/page'
|
||||||
import { FeedPromo } from '../components/feed-create'
|
import { FeedPromo } from '../components/feed-create'
|
||||||
import { Col } from '../components/layout/col'
|
import { Col } from '../components/layout/col'
|
||||||
|
@ -9,7 +9,16 @@ import { useUser } from '../hooks/use-user'
|
||||||
import { ManifoldLogo } from '../components/nav/manifold-logo'
|
import { ManifoldLogo } from '../components/nav/manifold-logo'
|
||||||
|
|
||||||
export async function getStaticProps() {
|
export async function getStaticProps() {
|
||||||
const hotContracts = (await getHotContracts().catch(() => [])) ?? []
|
const hotContracts = await getContractsBySlugs([
|
||||||
|
'if-boris-johnson-is-leader-of-the-c',
|
||||||
|
'will-ethereum-merge-to-proofofstake',
|
||||||
|
'will-russia-control-the-majority-of',
|
||||||
|
'will-elon-musk-buy-twitter-this-yea',
|
||||||
|
'will-an-ai-get-gold-on-any-internat',
|
||||||
|
'how-many-us-supreme-court-justices',
|
||||||
|
'who-will-win-the-nba-finals-champio',
|
||||||
|
'what-database-will-manifold-be-prim',
|
||||||
|
])
|
||||||
|
|
||||||
return {
|
return {
|
||||||
props: { hotContracts },
|
props: { hotContracts },
|
||||||
|
|
Loading…
Reference in New Issue
Block a user