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>
51 lines
1.6 KiB
TypeScript
51 lines
1.6 KiB
TypeScript
import { mapKeys } from 'lodash'
|
|
import { Contract } from 'common/contract'
|
|
import { SEO } from 'web/components/SEO'
|
|
import { Page } from 'web/components/layout/page'
|
|
import { Title } from 'web/components/widgets/title'
|
|
import { useContracts } from 'web/hooks/use-contract'
|
|
import { ScheduleItem, getActiveStream, useTVSchedule } from './tv-schedule'
|
|
import { TVDisplay } from './tv-display'
|
|
import { TVSchedulePage } from './tv-schedule-page'
|
|
import { capitalize } from 'lodash'
|
|
import { TRADE_TERM } from 'common/envs/constants'
|
|
|
|
export function TVPage(props: {
|
|
schedule: ScheduleItem[]
|
|
contracts: Contract[]
|
|
scheduleId: string | null
|
|
}) {
|
|
const schedule = useTVSchedule(props.schedule, props.scheduleId)
|
|
|
|
const contractsList = props.contracts.concat(
|
|
useContracts(
|
|
schedule.map((s) => s.contract_id),
|
|
undefined
|
|
)
|
|
)
|
|
const contracts = mapKeys(contractsList, 'id')
|
|
|
|
const stream = getActiveStream(schedule, props.scheduleId)
|
|
const contract = contracts[stream?.contract_id ?? '']
|
|
|
|
if (!contract && props.scheduleId && props.scheduleId !== 'schedule') {
|
|
return (
|
|
<Page trackPageView="tv page">
|
|
<SEO
|
|
title="Predikt TV"
|
|
description={`${capitalize(
|
|
TRADE_TERM
|
|
)} on live video streams with Predikt TV`}
|
|
/>
|
|
<Title>Predikt TV</Title>
|
|
<div className="italic">Cannot find scheduled event</div>
|
|
</Page>
|
|
)
|
|
}
|
|
|
|
if (!contract || props.scheduleId === 'schedule')
|
|
return <TVSchedulePage schedule={schedule} contracts={contracts} />
|
|
|
|
return <TVDisplay contract={contract} stream={stream} />
|
|
}
|