From 1271da24b762645a154538f98c25d73ff698560f Mon Sep 17 00:00:00 2001 From: Austin Chen Date: Mon, 3 Jan 2022 01:05:20 -0800 Subject: [PATCH] Incorporate contract description into the feed --- web/components/contract-feed.tsx | 44 ++++++++++++++++++++++++---- web/components/contract-overview.tsx | 8 ----- 2 files changed, 39 insertions(+), 13 deletions(-) diff --git a/web/components/contract-feed.tsx b/web/components/contract-feed.tsx index 1ccc1e13..cfb24a17 100644 --- a/web/components/contract-feed.tsx +++ b/web/components/contract-feed.tsx @@ -1,6 +1,6 @@ // From https://tailwindui.com/components/application-ui/lists/feeds import { Fragment, useState } from 'react' -import { ChatAltIcon, TagIcon, UserCircleIcon } from '@heroicons/react/solid' +import { ChatAltIcon, StarIcon, UserCircleIcon } from '@heroicons/react/solid' import { useBets } from '../hooks/use-bets' import { Bet, createComment } from '../lib/firebase/bets' import dayjs from 'dayjs' @@ -38,7 +38,7 @@ function FeedComment(props: { activityItem: any }) {

-
+

@@ -110,6 +110,33 @@ function FeedBet(props: { activityItem: any; user: User | null }) { ) } +function FeedStart(props: { contract: Contract }) { + const { contract } = props + return ( + <> +
+
+
+
+
+
+
+
+ {contract.creatorName} created + this market +
+
+

+ + {/* TODO: Allow creator to update the description */} +

+
+
+ + ) +} + function toFeedBet(bet: Bet) { return { id: bet.id, @@ -156,8 +183,13 @@ export function ContractFeed(props: { contract: Contract }) { let bets = useBets(id) if (bets === 'loading') bets = [] - // TODO: aggregate bets across each day window - const allItems = bets.map(toActivityItem) + const allItems = [{ type: 'start', id: 0 }, ...bets.map(toActivityItem)] + + // Missing feed items: + // - Aggegated bets (e.g. daily) + // - Bet sale + // - Market closed + // - Market resolved return (
@@ -172,7 +204,9 @@ export function ContractFeed(props: { contract: Contract }) { /> ) : null}
- {activityItem.type === 'comment' ? ( + {activityItem.type === 'start' ? ( + + ) : activityItem.type === 'comment' ? ( ) : activityItem.type === 'bet' ? ( diff --git a/web/components/contract-overview.tsx b/web/components/contract-overview.tsx index 80cace20..29e620d9 100644 --- a/web/components/contract-overview.tsx +++ b/web/components/contract-overview.tsx @@ -145,14 +145,6 @@ export const ContractOverview = (props: { - {((isCreator && !contract.resolution) || contract.description) && ( - - )} - - - - - {/* Show a delete button for contracts without any trading */}