import _ from 'lodash' import { Contract } 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 { ContractActivity } from './contract-activity' export function ActivityFeed(props: { contracts: Contract[] recentBets: Bet[] recentComments: Comment[] mode: 'only-recent' | 'abbreviated' | 'all' getContractPath?: (contract: Contract) => string }) { const { contracts, recentBets, recentComments, mode, getContractPath } = props const user = useUser() const groupedBets = _.groupBy(recentBets, (bet) => bet.contractId) const groupedComments = _.groupBy( recentComments, (comment) => comment.contractId ) return ( ( )} /> ) } function FeedContainer(props: { contracts: Contract[] renderContract: (contract: Contract) => any }) { const { contracts, renderContract } = props return ( {contracts.map((contract) => (
{renderContract(contract)}
))} ) }