import _ from 'lodash' import clsx from 'clsx' import { Contract, tradingAllowed } from '../../lib/firebase/contracts' import { Comment } from '../../lib/firebase/comments' import { Col } from '../layout/col' import { Bet } from '../../../common/bet' import { useUser } from '../../hooks/use-user' import BetRow from '../bet-row' import { FeedQuestion } from './feed-items' import { ContractActivity } from './contract-activity' export function ActivityFeed(props: { contracts: Contract[] recentBets: Bet[] recentComments: Comment[] mode: 'only-recent' | 'abbreviated' | 'all' }) { const { contracts, recentBets, recentComments, mode } = props const user = useUser() const groupedBets = _.groupBy(recentBets, (bet) => bet.contractId) const groupedComments = _.groupBy( recentComments, (comment) => comment.contractId ) return ( ( )} /> ) } export function SummaryActivityFeed(props: { contracts: Contract[] }) { const { contracts } = props return ( } /> ) } function FeedContainer(props: { contracts: Contract[] renderContract: (contract: Contract) => any }) { const { contracts, renderContract } = props return ( {contracts.map((contract) => (
{renderContract(contract)}
))} ) } function ContractSummary(props: { contract: Contract betRowClassName?: string }) { const { contract, betRowClassName } = props const { outcomeType } = contract const isBinary = outcomeType === 'BINARY' return (
{isBinary && tradingAllowed(contract) && ( )}
) }