96be4e8992
* Add embedded market grids * Hacky way to set height I haven't figured out a way yet to get the height of the actual iframe's content, so I did some bad estimate for now to unblock shipping the feature, while I continue investigating.
38 lines
893 B
TypeScript
38 lines
893 B
TypeScript
import React from 'react'
|
|
import { Contract, getContractFromSlug } from 'web/lib/firebase/contracts'
|
|
import { ContractsGrid } from 'web/components/contract/contracts-grid'
|
|
|
|
export async function getStaticProps(props: { params: { slugs: string[] } }) {
|
|
const { slugs } = props.params
|
|
|
|
const contracts = (await Promise.all(
|
|
slugs.map((slug) =>
|
|
getContractFromSlug(slug) != null ? getContractFromSlug(slug) : []
|
|
)
|
|
)) as Contract[]
|
|
|
|
return {
|
|
props: {
|
|
contracts,
|
|
},
|
|
revalidate: 60, // regenerate after a minute
|
|
}
|
|
}
|
|
|
|
export async function getStaticPaths() {
|
|
return { paths: [], fallback: 'blocking' }
|
|
}
|
|
|
|
export default function ContractGridPage(props: { contracts: Contract[] }) {
|
|
const { contracts } = props
|
|
|
|
return (
|
|
<>
|
|
<ContractsGrid
|
|
contracts={contracts}
|
|
breakpointColumns={{ default: 2, 650: 1 }}
|
|
/>
|
|
</>
|
|
)
|
|
}
|