From e8328ab7a0ff77a28d499c7e75e5687d61557cc4 Mon Sep 17 00:00:00 2001 From: Austin Chen Date: Wed, 23 Feb 2022 16:40:21 -0800 Subject: [PATCH] Show feed item for FR answer submission --- web/components/answers/answer-item.tsx | 5 ++-- web/components/contract-feed.tsx | 32 +++++++++++++++++++++++++- 2 files changed, 33 insertions(+), 4 deletions(-) diff --git a/web/components/answers/answer-item.tsx b/web/components/answers/answer-item.tsx index 7d371ad8..51ea9631 100644 --- a/web/components/answers/answer-item.tsx +++ b/web/components/answers/answer-item.tsx @@ -8,7 +8,6 @@ import { Col } from '../layout/col' import { Row } from '../layout/row' import { Avatar } from '../avatar' import { SiteLink } from '../site-link' -import dayjs from 'dayjs' import { BuyButton } from '../yes-no-selector' import { formatPercent } from '../../../common/util/format' import { getOutcomeProbability } from '../../../common/calculate' @@ -35,7 +34,7 @@ export function AnswerItem(props: { onDeselect, } = props const { resolution, resolutions, totalShares } = contract - const { username, avatarUrl, name, createdTime, number, text } = answer + const { username, avatarUrl, name, number, text } = answer const isChosen = chosenProb !== undefined const prob = getOutcomeProbability(totalShares, answer.id) @@ -73,7 +72,7 @@ export function AnswerItem(props: {
{name}
- {/* TODO: Show total pool */} + {/* TODO: Show total pool? */} {isBetting && ( diff --git a/web/components/contract-feed.tsx b/web/components/contract-feed.tsx index 7ce2f3e4..52da0f23 100644 --- a/web/components/contract-feed.tsx +++ b/web/components/contract-feed.tsx @@ -382,6 +382,29 @@ function FeedDescription(props: { contract: Contract }) { ) } +function FeedAnswer(props: { contract: Contract; outcome: string }) { + const { contract, outcome } = props + const answer = contract?.answers?.[Number(outcome) - 1] + if (!answer) return null + + return ( + <> + +
+
+ {' '} + submitted answer {' '} + +
+
+ + ) +} + function OutcomeIcon(props: { outcome?: string }) { const { outcome } = props switch (outcome) { @@ -638,6 +661,7 @@ function MaybeOutcomeLabel(props: { outcome: string; feedType: FeedType }) { {' '} of + {/* TODO: Link to the correct e.g. #23 */} ) } @@ -684,7 +708,7 @@ export function ContractFeed(props: { ? bets.filter((bet) => !bet.isAnte) : bets.filter((bet) => !(bet.isAnte && (bet.outcome as string) === '0')) - if (feedType == 'multi') { + if (feedType === 'multi') { bets = bets.filter((bet) => bet.outcome === outcome) } @@ -702,6 +726,10 @@ export function ContractFeed(props: { if (contract.resolution) { allItems.push({ type: 'resolve', id: `${contract.resolutionTime}` }) } + if (feedType === 'multi') { + // Hack to add some more padding above the 'multi' feedType, by adding a null item + allItems.unshift({ type: '', id: -1 }) + } // If there are more than 5 items, only show the first, an expand item, and last 3 let items = allItems @@ -730,6 +758,8 @@ export function ContractFeed(props: { ) : feedType === 'market' ? ( + ) : feedType === 'multi' ? ( + ) : null ) : activityItem.type === 'comment' ? (