caelum0x 2b68bde5d5 Predikt: full Polymarket-style prediction market — web + mobile + on-chain + bots
Working tree is now the canonical repo. Off-chain play-money + trustless on-chain
(FPMM AMM + CLOB via UMA settlement), AI market factory, creator/social/distribution,
mobile shell + push, one-command demo + deploy-kit. Secrets excluded (see ENV-AND-KEYS.md).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-06 23:29:50 +03:00

84 lines
2.5 KiB
TypeScript

import { Contract, contractPath } from 'common/contract'
import { getSeoDescription, getContractOGProps } from 'common/contract-seo'
import { removeUndefinedProps } from 'common/util/object'
import { parseJsonContentToText } from 'common/util/parse'
import { JsonLd } from 'web/components/JsonLd'
import { SEO } from 'web/components/SEO'
import { buildMarketQAPage, buildBreadcrumbs } from 'web/lib/json-ld'
export function ContractSEO(props: {
contract: Contract
/** Base64 encoded points */
points?: string
}) {
const { contract, points } = props
const { question } = contract
const seoDesc = getSeoDescription(contract)
const ogCardProps = removeUndefinedProps({
...getContractOGProps(contract),
points,
})
const seo = (
<SEO
title={question}
description={seoDesc}
url={contractPath(contract)}
ogProps={{ props: ogCardProps, endpoint: 'market' }}
shouldIgnore={contract.visibility !== 'public'}
/>
)
// Build JSON-LD for eligible market types
const descriptionText = parseJsonContentToText(contract.description)
const answers =
'answers' in contract
? contract.answers.slice(0, 10).map((a) => ({
text: a.text,
prob: a.prob,
resolution: a.resolution,
}))
: undefined
const jsonLd = buildMarketQAPage({
question: contract.question,
description: descriptionText,
url: `https://oracle.markets${contractPath(contract)}`,
creatorName: contract.creatorName,
creatorUsername: contract.creatorUsername,
createdTime: contract.createdTime,
closeTime: contract.closeTime ?? undefined,
resolutionTime: contract.resolutionTime ?? undefined,
resolution: contract.resolution ?? undefined,
outcomeType: contract.outcomeType,
probability: 'prob' in contract ? (contract as any).prob : undefined,
uniqueBettorCount: contract.uniqueBettorCount ?? 0,
answers,
lastUpdatedTime: contract.lastUpdatedTime,
coverImageUrl: contract.coverImageUrl ?? undefined,
visibility: contract.visibility,
deleted: contract.deleted,
})
const breadcrumbs = jsonLd
? buildBreadcrumbs([
{ name: 'Home', url: 'https://oracle.markets' },
{
name: contract.creatorName,
url: `https://oracle.markets/${contract.creatorUsername}`,
},
{ name: contract.question }, // Last item omits URL per Google docs
])
: null
return (
<>
{seo}
<JsonLd data={jsonLd} id="market" />
<JsonLd data={breadcrumbs} id="breadcrumbs" />
</>
)
}