Kill now unhelpful CommentRepliesList
wrapper component
This commit is contained in:
parent
6f6a70fa51
commit
01880160dc
|
@ -139,7 +139,6 @@ export function FreeResponseContractCommentsActivity(props: {
|
||||||
answer={answer}
|
answer={answer}
|
||||||
answerComments={commentsByOutcome[answer.number.toString()]}
|
answerComments={commentsByOutcome[answer.number.toString()]}
|
||||||
tips={tips}
|
tips={tips}
|
||||||
bets={bets}
|
|
||||||
betsByUserId={betsByUserId}
|
betsByUserId={betsByUserId}
|
||||||
commentsByUserId={commentsByUserId}
|
commentsByUserId={commentsByUserId}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -11,7 +11,7 @@ import { Linkify } from 'web/components/linkify'
|
||||||
import clsx from 'clsx'
|
import clsx from 'clsx'
|
||||||
import {
|
import {
|
||||||
CommentInput,
|
CommentInput,
|
||||||
CommentRepliesList,
|
FeedComment,
|
||||||
getMostRecentCommentableBet,
|
getMostRecentCommentableBet,
|
||||||
} from 'web/components/feed/feed-comments'
|
} from 'web/components/feed/feed-comments'
|
||||||
import { CopyLinkDateTimeComponent } from 'web/components/feed/copy-link-date-time'
|
import { CopyLinkDateTimeComponent } from 'web/components/feed/copy-link-date-time'
|
||||||
|
@ -27,7 +27,6 @@ export function FeedAnswerCommentGroup(props: {
|
||||||
answer: Answer
|
answer: Answer
|
||||||
answerComments: ContractComment[]
|
answerComments: ContractComment[]
|
||||||
tips: CommentTipMap
|
tips: CommentTipMap
|
||||||
bets: Bet[]
|
|
||||||
betsByUserId: Dictionary<Bet[]>
|
betsByUserId: Dictionary<Bet[]>
|
||||||
commentsByUserId: Dictionary<ContractComment[]>
|
commentsByUserId: Dictionary<ContractComment[]>
|
||||||
}) {
|
}) {
|
||||||
|
@ -36,7 +35,6 @@ export function FeedAnswerCommentGroup(props: {
|
||||||
contract,
|
contract,
|
||||||
answerComments,
|
answerComments,
|
||||||
tips,
|
tips,
|
||||||
bets,
|
|
||||||
betsByUserId,
|
betsByUserId,
|
||||||
commentsByUserId,
|
commentsByUserId,
|
||||||
user,
|
user,
|
||||||
|
@ -160,17 +158,18 @@ export function FeedAnswerCommentGroup(props: {
|
||||||
)}
|
)}
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
<CommentRepliesList
|
{answerComments.map((comment) => (
|
||||||
contract={contract}
|
<FeedComment
|
||||||
comments={answerComments}
|
key={comment.id}
|
||||||
betsByUserId={betsByUserId}
|
indent={true}
|
||||||
smallAvatar={true}
|
contract={contract}
|
||||||
bets={bets}
|
comment={comment}
|
||||||
tips={tips}
|
tips={tips[comment.id]}
|
||||||
scrollAndOpenReplyInput={scrollAndOpenReplyInput}
|
betsBySameUser={betsByUserId[comment.userId] ?? []}
|
||||||
treatFirstIndexEqually={true}
|
onReplyClick={scrollAndOpenReplyInput}
|
||||||
/>
|
smallAvatar={true}
|
||||||
|
/>
|
||||||
|
))}
|
||||||
{showReply && (
|
{showReply && (
|
||||||
<div className={'ml-6'}>
|
<div className={'ml-6'}>
|
||||||
<span
|
<span
|
||||||
|
|
|
@ -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"
|
className="absolute top-5 left-5 -ml-px h-[calc(100%-2rem)] w-0.5 bg-gray-200"
|
||||||
aria-hidden="true"
|
aria-hidden="true"
|
||||||
/>
|
/>
|
||||||
<CommentRepliesList
|
{[parentComment].concat(threadComments).map((comment, commentIdx) => (
|
||||||
contract={contract}
|
<FeedComment
|
||||||
comments={[parentComment].concat(threadComments)}
|
key={comment.id}
|
||||||
betsByUserId={betsByUserId}
|
indent={commentIdx != 0}
|
||||||
tips={tips}
|
contract={contract}
|
||||||
bets={bets}
|
comment={comment}
|
||||||
scrollAndOpenReplyInput={scrollAndOpenReplyInput}
|
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 && (
|
{showReply && (
|
||||||
<Col className={'-pb-2 ml-6'}>
|
<Col className={'-pb-2 ml-6'}>
|
||||||
<span
|
<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: {
|
export function FeedComment(props: {
|
||||||
contract: Contract
|
contract: Contract
|
||||||
comment: ContractComment
|
comment: ContractComment
|
||||||
|
@ -189,6 +154,7 @@ export function FeedComment(props: {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Row
|
<Row
|
||||||
|
id={comment.id}
|
||||||
className={clsx(
|
className={clsx(
|
||||||
'relative flex space-x-1.5 sm:space-x-3',
|
'relative flex space-x-1.5 sm:space-x-3',
|
||||||
indent ? 'ml-6' : '',
|
indent ? 'ml-6' : '',
|
||||||
|
|
Loading…
Reference in New Issue
Block a user