2022-05-17 15:55:26 +00:00
|
|
|
import { Answer } from 'common/answer'
|
2022-10-07 00:51:58 +00:00
|
|
|
import { Contract, FreeResponseContract } from 'common/contract'
|
2022-08-19 08:06:40 +00:00
|
|
|
import { ContractComment } from 'common/comment'
|
2022-09-22 19:58:40 +00:00
|
|
|
import React, { useEffect, useRef, useState } from 'react'
|
2022-05-17 15:55:26 +00:00
|
|
|
import { Col } from 'web/components/layout/col'
|
|
|
|
import { Row } from 'web/components/layout/row'
|
|
|
|
import { Avatar } from 'web/components/avatar'
|
|
|
|
import { Linkify } from 'web/components/linkify'
|
|
|
|
import clsx from 'clsx'
|
2022-05-18 14:42:13 +00:00
|
|
|
import {
|
2022-09-07 22:09:20 +00:00
|
|
|
ContractCommentInput,
|
2022-08-30 09:41:47 +00:00
|
|
|
FeedComment,
|
2022-09-22 19:40:44 +00:00
|
|
|
ReplyTo,
|
2022-05-18 14:42:13 +00:00
|
|
|
} from 'web/components/feed/feed-comments'
|
2022-05-17 15:55:26 +00:00
|
|
|
import { CopyLinkDateTimeComponent } from 'web/components/feed/copy-link-date-time'
|
|
|
|
import { useRouter } from 'next/router'
|
2022-06-18 03:28:16 +00:00
|
|
|
import { CommentTipMap } from 'web/hooks/use-tip-txns'
|
2022-08-30 15:38:59 +00:00
|
|
|
import { UserLink } from 'web/components/user-link'
|
2022-10-05 03:33:26 +00:00
|
|
|
import TriangleDownFillIcon from 'web/lib/icons/triangle-down-fill-icon'
|
|
|
|
import { ReplyToggle } from '../comments/comments'
|
2022-10-07 00:37:41 +00:00
|
|
|
import { ReplyIcon } from '@heroicons/react/solid'
|
2022-05-17 15:55:26 +00:00
|
|
|
|
2022-10-07 00:51:58 +00:00
|
|
|
export function CommentsAnswer(props: { answer: Answer; contract: Contract }) {
|
|
|
|
const { answer, contract } = props
|
2022-05-17 15:55:26 +00:00
|
|
|
const { username, avatarUrl, name, text } = answer
|
|
|
|
const answerElementId = `answer-${answer.id}`
|
|
|
|
return (
|
2022-10-07 00:51:58 +00:00
|
|
|
<Row className="bg-greyscale-2 w-fit gap-1 rounded-t-xl rounded-bl-xl px-2 py-2">
|
|
|
|
<div className="ml-2">
|
|
|
|
<Avatar username={username} avatarUrl={avatarUrl} size="xxs" />
|
|
|
|
</div>
|
|
|
|
<Col>
|
|
|
|
<Row className="gap-1">
|
2022-10-05 05:48:37 +00:00
|
|
|
<div className="text-greyscale-6 text-xs">
|
2022-05-17 15:55:26 +00:00
|
|
|
<UserLink username={username} name={name} /> answered
|
|
|
|
<CopyLinkDateTimeComponent
|
2022-06-22 16:35:50 +00:00
|
|
|
prefix={contract.creatorUsername}
|
|
|
|
slug={contract.slug}
|
2022-05-17 15:55:26 +00:00
|
|
|
createdTime={answer.createdTime}
|
|
|
|
elementId={answerElementId}
|
|
|
|
/>
|
|
|
|
</div>
|
2022-10-07 00:51:58 +00:00
|
|
|
</Row>
|
|
|
|
<div className="text-greyscale-7 text-sm">{text}</div>
|
|
|
|
</Col>
|
|
|
|
</Row>
|
2022-05-17 15:55:26 +00:00
|
|
|
)
|
|
|
|
}
|