import React from 'react' import Head from 'next/head' import clsx from 'clsx' import { useContract, useContractWithPreload } from '../../hooks/use-contract' import { Header } from '../../components/header' import { ContractOverview } from '../../components/contract-overview' import { BetPanel } from '../../components/bet-panel' import { Col } from '../../components/layout/col' import { useUser } from '../../hooks/use-user' import { ResolutionPanel } from '../../components/resolution-panel' import { Contract, getContract } from '../../lib/firebase/contracts' export async function getStaticProps(props: { params: any }) { const { contractId } = props.params const contract = (await getContract(contractId)) || null return { props: { contractId, contract, }, revalidate: 60, // regenerate after a minute } } export async function getStaticPaths() { return { paths: [], fallback: 'blocking' } } export default function ContractPage(props: { contract: Contract contractId: string }) { const user = useUser() const contract = useContractWithPreload(props.contractId, props.contract) if (!contract) { return
Contract not found...
} const { creatorId, isResolved } = contract const isCreator = user?.id === creatorId return ( {contract.question} | Mantic Markets
{!isResolved && ( <>
{isCreator && user && ( )} )} ) }