Kill now unhelpful CommentRepliesList wrapper component

This commit is contained in:
Marshall Polaris 2022-08-27 15:23:29 -07:00
parent 6f6a70fa51
commit 01880160dc
3 changed files with 34 additions and 70 deletions

View File

@ -139,7 +139,6 @@ export function FreeResponseContractCommentsActivity(props: {
answer={answer}
answerComments={commentsByOutcome[answer.number.toString()]}
tips={tips}
bets={bets}
betsByUserId={betsByUserId}
commentsByUserId={commentsByUserId}
/>

View File

@ -11,7 +11,7 @@ import { Linkify } from 'web/components/linkify'
import clsx from 'clsx'
import {
CommentInput,
CommentRepliesList,
FeedComment,
getMostRecentCommentableBet,
} from 'web/components/feed/feed-comments'
import { CopyLinkDateTimeComponent } from 'web/components/feed/copy-link-date-time'
@ -27,7 +27,6 @@ export function FeedAnswerCommentGroup(props: {
answer: Answer
answerComments: ContractComment[]
tips: CommentTipMap
bets: Bet[]
betsByUserId: Dictionary<Bet[]>
commentsByUserId: Dictionary<ContractComment[]>
}) {
@ -36,7 +35,6 @@ export function FeedAnswerCommentGroup(props: {
contract,
answerComments,
tips,
bets,
betsByUserId,
commentsByUserId,
user,
@ -160,17 +158,18 @@ export function FeedAnswerCommentGroup(props: {
)}
</Col>
</Row>
<CommentRepliesList
{answerComments.map((comment) => (
<FeedComment
key={comment.id}
indent={true}
contract={contract}
comments={answerComments}
betsByUserId={betsByUserId}
comment={comment}
tips={tips[comment.id]}
betsBySameUser={betsByUserId[comment.userId] ?? []}
onReplyClick={scrollAndOpenReplyInput}
smallAvatar={true}
bets={bets}
tips={tips}
scrollAndOpenReplyInput={scrollAndOpenReplyInput}
treatFirstIndexEqually={true}
/>
))}
{showReply && (
<div className={'ml-6'}>
<span

View File

@ -64,14 +64,26 @@ export function FeedCommentThread(props: {
className="absolute top-5 left-5 -ml-px h-[calc(100%-2rem)] w-0.5 bg-gray-200"
aria-hidden="true"
/>
<CommentRepliesList
{[parentComment].concat(threadComments).map((comment, commentIdx) => (
<FeedComment
key={comment.id}
indent={commentIdx != 0}
contract={contract}
comments={[parentComment].concat(threadComments)}
betsByUserId={betsByUserId}
tips={tips}
bets={bets}
scrollAndOpenReplyInput={scrollAndOpenReplyInput}
comment={comment}
tips={tips[comment.id]}
betsBySameUser={betsByUserId[comment.userId] ?? []}
onReplyClick={scrollAndOpenReplyInput}
probAtCreatedTime={
contract.outcomeType === 'BINARY'
? minBy(bets, (bet) => {
return bet.createdTime < comment.createdTime
? comment.createdTime - bet.createdTime
: comment.createdTime
})?.probAfter
: undefined
}
/>
))}
{showReply && (
<Col className={'-pb-2 ml-6'}>
<span
@ -93,53 +105,6 @@ export function FeedCommentThread(props: {
)
}
export function CommentRepliesList(props: {
contract: Contract
comments: ContractComment[]
betsByUserId: Dictionary<Bet[]>
tips: CommentTipMap
scrollAndOpenReplyInput: (comment: ContractComment) => void
bets: Bet[]
treatFirstIndexEqually?: boolean
smallAvatar?: boolean
}) {
const {
contract,
comments,
betsByUserId,
tips,
smallAvatar,
bets,
scrollAndOpenReplyInput,
treatFirstIndexEqually,
} = props
return (
<>
{comments.map((comment, commentIdx) => (
<FeedComment
key={comment.id}
indent={treatFirstIndexEqually || commentIdx != 0}
contract={contract}
comment={comment}
tips={tips[comment.id]}
betsBySameUser={betsByUserId[comment.userId] ?? []}
onReplyClick={scrollAndOpenReplyInput}
probAtCreatedTime={
contract.outcomeType === 'BINARY'
? minBy(bets, (bet) => {
return bet.createdTime < comment.createdTime
? comment.createdTime - bet.createdTime
: comment.createdTime
})?.probAfter
: undefined
}
smallAvatar={smallAvatar}
/>
))}
</>
)
}
export function FeedComment(props: {
contract: Contract
comment: ContractComment
@ -189,6 +154,7 @@ export function FeedComment(props: {
return (
<Row
id={comment.id}
className={clsx(
'relative flex space-x-1.5 sm:space-x-3',
indent ? 'ml-6' : '',