diff --git a/web/pages/challenges/[username]/[contractSlug]/[challengeSlug].tsx b/web/pages/challenges/[username]/[contractSlug]/[challengeSlug].tsx index 6eda3717..0a51a8fe 100644 --- a/web/pages/challenges/[username]/[contractSlug]/[challengeSlug].tsx +++ b/web/pages/challenges/[username]/[contractSlug]/[challengeSlug].tsx @@ -35,6 +35,7 @@ import { import { ContractProbGraph } from 'web/components/contract/contract-prob-graph' import { SEO } from 'web/components/SEO' import { getOpenGraphProps } from 'web/components/contract/contract-card-preview' +import Custom404 from 'web/pages/404' export const getStaticProps = fromPropz(getStaticPropz) export async function getStaticPropz(props: { @@ -78,20 +79,29 @@ export default function ChallengePage(props: { slug: '', } - const contract = useContractWithPreload(props.contract) + const contract = useContractWithPreload(props.contract) ?? props.contract const challenge = useChallenge(props.challengeSlug, contract?.id) const { user, bets } = props const currentUser = useUser() - if (!contract || !challenge) { + if (!contract) return + const ogCardProps = getOpenGraphProps(contract) + if (!challenge) { return ( - - - + + + + + + ) } - const ogCardProps = getOpenGraphProps(contract) ogCardProps.question = challenge.creatorName.split(' ')[0] + "'s CHALLENGING you: " + @@ -101,14 +111,12 @@ export default function ChallengePage(props: { return ( - {ogCardProps && ( - - )} + {challenge.acceptances.length >= challenge.maxUses ? (