comment bounty styling
This commit is contained in:
parent
a25acbe1db
commit
17d1b8575c
|
@ -12,15 +12,15 @@ export function BountiedContractBadge() {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function BountiedContractSmallBadge(props: { contract: Contract }) {
|
export function BountiedContractSmallBadge(props: { contract: Contract, showAmount?: boolean }) {
|
||||||
const { contract } = props
|
const { contract, showAmount } = props
|
||||||
const { openCommentBounties } = contract
|
const { openCommentBounties } = contract
|
||||||
if (!openCommentBounties) return <div />
|
if (!openCommentBounties) return <div />
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Tooltip text={CommentBountiesTooltipText(openCommentBounties)}>
|
<Tooltip text={CommentBountiesTooltipText(openCommentBounties)}>
|
||||||
<span className="bg-greyscale-4 inline-flex cursor-default items-center gap-1 rounded-full px-2 py-0.5 text-xs font-medium text-white">
|
<span className="bg-indigo-300 inline-flex cursor-default items-center gap-1 rounded-full px-2 py-0.5 text-xs font-medium text-white">
|
||||||
<CurrencyDollarIcon className={'h3 w-3'} /> Bountied Comments
|
<CurrencyDollarIcon className={'h3 w-3'} />{showAmount && formatMoney(openCommentBounties)} Bounty
|
||||||
</span>
|
</span>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
)
|
)
|
||||||
|
|
|
@ -25,13 +25,14 @@ import {
|
||||||
import { buildArray } from 'common/util/array'
|
import { buildArray } from 'common/util/array'
|
||||||
import { ContractComment } from 'common/comment'
|
import { ContractComment } from 'common/comment'
|
||||||
|
|
||||||
import { formatMoney } from 'common/util/format'
|
|
||||||
import { Button } from 'web/components/button'
|
import { Button } from 'web/components/button'
|
||||||
import { MINUTE_MS } from 'common/util/time'
|
import { MINUTE_MS } from 'common/util/time'
|
||||||
import { useUser } from 'web/hooks/use-user'
|
import { useUser } from 'web/hooks/use-user'
|
||||||
import { COMMENT_BOUNTY_AMOUNT } from 'common/economy'
|
|
||||||
import { Tooltip } from 'web/components/tooltip'
|
import { Tooltip } from 'web/components/tooltip'
|
||||||
import { CommentBountiesTooltipText } from 'web/components/contract/bountied-contract-badge'
|
import {
|
||||||
|
BountiedContractSmallBadge,
|
||||||
|
} from 'web/components/contract/bountied-contract-badge'
|
||||||
|
import { Row } from '../layout/row'
|
||||||
|
|
||||||
export function ContractTabs(props: {
|
export function ContractTabs(props: {
|
||||||
contract: Contract
|
contract: Contract
|
||||||
|
@ -40,7 +41,6 @@ export function ContractTabs(props: {
|
||||||
comments: ContractComment[]
|
comments: ContractComment[]
|
||||||
}) {
|
}) {
|
||||||
const { contract, bets, userBets, comments } = props
|
const { contract, bets, userBets, comments } = props
|
||||||
const { openCommentBounties } = contract
|
|
||||||
|
|
||||||
const yourTrades = (
|
const yourTrades = (
|
||||||
<div>
|
<div>
|
||||||
|
@ -52,14 +52,8 @@ export function ContractTabs(props: {
|
||||||
|
|
||||||
const tabs = buildArray(
|
const tabs = buildArray(
|
||||||
{
|
{
|
||||||
title: `Comments`,
|
title: 'Comments',
|
||||||
tooltip: openCommentBounties
|
|
||||||
? CommentBountiesTooltipText(openCommentBounties)
|
|
||||||
: undefined,
|
|
||||||
content: <CommentsTabContent contract={contract} comments={comments} />,
|
content: <CommentsTabContent contract={contract} comments={comments} />,
|
||||||
inlineTabIcon: openCommentBounties ? (
|
|
||||||
<span>({formatMoney(COMMENT_BOUNTY_AMOUNT)})</span>
|
|
||||||
) : undefined,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: capitalize(PAST_BETS),
|
title: capitalize(PAST_BETS),
|
||||||
|
@ -156,23 +150,28 @@ const CommentsTabContent = memo(function CommentsTabContent(props: {
|
||||||
const topLevelComments = commentsByParent['_'] ?? []
|
const topLevelComments = commentsByParent['_'] ?? []
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Button
|
|
||||||
size={'xs'}
|
|
||||||
color={'gray-white'}
|
|
||||||
className="mb-4"
|
|
||||||
onClick={() => setSort(sort === 'Newest' ? 'Best' : 'Newest')}
|
|
||||||
>
|
|
||||||
<Tooltip
|
|
||||||
text={
|
|
||||||
sort === 'Best'
|
|
||||||
? 'Comments with tips or bounties will be shown first. Your comments made within the last 10 minutes will temporarily appear (to you) first.'
|
|
||||||
: ''
|
|
||||||
}
|
|
||||||
>
|
|
||||||
Sorted by: {sort}
|
|
||||||
</Tooltip>
|
|
||||||
</Button>
|
|
||||||
<ContractCommentInput className="mb-5" contract={contract} />
|
<ContractCommentInput className="mb-5" contract={contract} />
|
||||||
|
|
||||||
|
<Row className="mb-4 items-center">
|
||||||
|
<Button
|
||||||
|
size={'xs'}
|
||||||
|
color={'gray-white'}
|
||||||
|
onClick={() => setSort(sort === 'Newest' ? 'Best' : 'Newest')}
|
||||||
|
>
|
||||||
|
<Tooltip
|
||||||
|
text={
|
||||||
|
sort === 'Best'
|
||||||
|
? 'Comments with tips or bounties will be shown first. Your comments made within the last 10 minutes will temporarily appear (to you) first.'
|
||||||
|
: ''
|
||||||
|
}
|
||||||
|
>
|
||||||
|
Sorted by: {sort}
|
||||||
|
</Tooltip>
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
<BountiedContractSmallBadge contract={contract} showAmount />
|
||||||
|
</Row>
|
||||||
|
|
||||||
{topLevelComments.map((parent) => (
|
{topLevelComments.map((parent) => (
|
||||||
<FeedCommentThread
|
<FeedCommentThread
|
||||||
key={parent.id}
|
key={parent.id}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user