test ssg
This commit is contained in:
parent
7b4e35699d
commit
fe0d666c2b
|
@ -10,44 +10,43 @@ import { BetPanel } from '../../components/bet-panel'
|
||||||
import { Col } from '../../components/layout/col'
|
import { Col } from '../../components/layout/col'
|
||||||
import { useUser } from '../../hooks/use-user'
|
import { useUser } from '../../hooks/use-user'
|
||||||
import { ResolutionPanel } from '../../components/resolution-panel'
|
import { ResolutionPanel } from '../../components/resolution-panel'
|
||||||
// import { Contract, getContract } from '../../lib/firebase/contracts'
|
import { Contract, getContract } from '../../lib/firebase/contracts'
|
||||||
// export async function getStaticProps({ params }: { params: any }) {
|
export async function getStaticProps({ params }: { params: any }) {
|
||||||
// console.log('params', params)
|
console.log('params', params)
|
||||||
// const contract = await getContract(params.contractId)
|
const contract = await getContract(params.contractId)
|
||||||
|
|
||||||
// return {
|
return {
|
||||||
// props: {
|
props: {
|
||||||
// contract: contract || null
|
contract: contract || null,
|
||||||
// }
|
},
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
// export async function getStaticPaths() {
|
export async function getStaticPaths() {
|
||||||
// return {
|
return {
|
||||||
// paths: [],
|
paths: [],
|
||||||
// fallback: true,
|
fallback: true,
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
export default function ContractPage() {//{ contract }: { contract: Contract }) {
|
export default function ContractPage({ contract }: { contract: Contract }) {
|
||||||
const user = useUser()
|
const user = useUser()
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const { contractId } = router.query as { contractId: string }
|
const { contractId } = router.query as { contractId: string }
|
||||||
|
|
||||||
const contract = useContract(contractId)
|
// const contract = useContract(contractId)
|
||||||
if (contract === 'loading') {
|
// if (contract === 'loading') {
|
||||||
return <div />
|
// return <div />
|
||||||
}
|
// }
|
||||||
if (!contract) {
|
// if (!contract) {
|
||||||
return <div>Contract not found...</div>
|
|
||||||
}
|
|
||||||
|
|
||||||
// if (contract === null) {
|
|
||||||
// return <div>Contract not found...</div>
|
// return <div>Contract not found...</div>
|
||||||
// }
|
// }
|
||||||
// if (!contract)
|
|
||||||
// return <div />
|
if (contract === null) {
|
||||||
|
return <div>Contract not found...</div>
|
||||||
|
}
|
||||||
|
if (!contract) return <div />
|
||||||
|
|
||||||
const { creatorId, isResolved } = contract
|
const { creatorId, isResolved } = contract
|
||||||
const isCreator = user?.id === creatorId
|
const isCreator = user?.id === creatorId
|
||||||
|
@ -63,10 +62,7 @@ export default function ContractPage() {//{ contract }: { contract: Contract })
|
||||||
content={contract.question}
|
content={contract.question}
|
||||||
key="title"
|
key="title"
|
||||||
/>
|
/>
|
||||||
<meta
|
<meta name="description" content={contract.description} />
|
||||||
name="description"
|
|
||||||
content={contract.description}
|
|
||||||
/>
|
|
||||||
<meta
|
<meta
|
||||||
property="og:description"
|
property="og:description"
|
||||||
name="twitter:description"
|
name="twitter:description"
|
||||||
|
@ -76,7 +72,6 @@ export default function ContractPage() {//{ contract }: { contract: Contract })
|
||||||
|
|
||||||
<Header />
|
<Header />
|
||||||
|
|
||||||
|
|
||||||
<Col
|
<Col
|
||||||
className={clsx(
|
className={clsx(
|
||||||
'w-full items-start md:flex-row mt-4',
|
'w-full items-start md:flex-row mt-4',
|
||||||
|
|
Loading…
Reference in New Issue
Block a user