From 7e4f4b9a87e7601b4158300e7808a1547b41b4df Mon Sep 17 00:00:00 2001 From: Marshall Polaris Date: Tue, 26 Jul 2022 00:10:11 -0700 Subject: [PATCH] Clean up a bunch of crufty stuff on user comments list (#693) --- web/components/comments-list.tsx | 75 +++++++++++++++----------------- 1 file changed, 36 insertions(+), 39 deletions(-) diff --git a/web/components/comments-list.tsx b/web/components/comments-list.tsx index ab9ed523..f8e1d7e1 100644 --- a/web/components/comments-list.tsx +++ b/web/components/comments-list.tsx @@ -17,58 +17,55 @@ export function UserCommentsList(props: { 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) + // we don't show comments in groups here atm, just comments on contracts + const contractComments = comments.filter((c) => c.contractId) + const commentsByContract = groupBy(contractComments, 'contractId') return ( - {contractCommentPairs.map(([contract, comments]) => ( -
-
- + {Object.entries(commentsByContract).map(([contractId, comments]) => { + const contract = contractsById[contractId] + return ( +
+ {contract.question} + {comments.map((comment) => ( + + ))}
- {comments.map((comment) => ( -
-
- -
-
- ))} -
- ))} + ) + })} ) } -function ProfileComment(props: { comment: Comment }) { - const { comment } = props +function ProfileComment(props: { comment: Comment; className?: string }) { + const { comment, className } = props const { text, userUsername, userName, userAvatarUrl, createdTime } = comment // TODO: find and attach relevant bets by comment betId at some point return ( -
- - -
-
-

- {' '} - -

-
- -
-
-
+ + +
+

+ {' '} + +

+ +
+
) }