manifold/web/pages/contract/[contractId].tsx

37 lines
992 B
TypeScript
Raw Normal View History

2021-12-10 06:21:12 +00:00
import React from 'react'
2021-12-09 22:44:04 +00:00
import { useRouter } from 'next/router'
import { useContract } from '../../hooks/use-contract'
2021-12-10 06:21:12 +00:00
import { Header } from '../../components/header'
import { Row } from '../../components/layout/row'
import { ContractOverview } from '../../components/contract-overview'
import { BetPanel } from '../../components/bet-panel'
2021-12-09 22:44:04 +00:00
export default function ContractPage() {
const router = useRouter()
const { contractId } = router.query as { contractId: string }
const contract = useContract(contractId)
if (contract === 'loading') {
2021-12-10 06:21:12 +00:00
return <div />
2021-12-09 22:44:04 +00:00
}
2021-12-10 06:21:12 +00:00
if (!contract) {
2021-12-09 22:44:04 +00:00
return <div>Contract not found...</div>
}
return (
2021-12-10 06:21:12 +00:00
<div className="max-w-7xl mx-auto sm:px-6 lg:px-8">
<Header />
<div className="w-full flex flex-col p-4 mt-4">
<Row className="justify-between">
<ContractOverview contract={contract} />
2021-12-10 07:01:39 +00:00
<BetPanel className="self-start" contract={contract} />
2021-12-10 06:21:12 +00:00
</Row>
</div>
2021-12-09 22:44:04 +00:00
</div>
)
}