import { Comment } from 'common/comment' import { Contract } from 'common/contract' import { contractPath } from 'web/lib/firebase/contracts' import { SiteLink } from './site-link' import { Row } from './layout/row' import { Avatar } from './avatar' import { RelativeTimestamp } from './relative-timestamp' import { UserLink } from './user-page' import { User } from 'common/user' import { Col } from './layout/col' import { Linkify } from './linkify' import { groupBy } from 'lodash' export function UserCommentsList(props: { user: User comments: Comment[] contractsById: { [id: string]: Contract } }) { const { comments, contractsById } = props const commentsByContract = groupBy(comments, 'contractId') const contractCommentPairs = Object.entries(commentsByContract) .map( ([contractId, comments]) => [contractsById[contractId], comments] as const ) .filter(([contract]) => contract) return ( {contractCommentPairs.map(([contract, comments]) => (
{contract.question}
{comments.map((comment) => (
))}
))} ) } function ProfileComment(props: { comment: Comment }) { const { comment } = props const { text, userUsername, userName, userAvatarUrl, createdTime } = comment // TODO: find and attach relevant bets by comment betId at some point return (

{' '}

) }