From c78df4abded2da00ecacde52075e4ef908b9719c Mon Sep 17 00:00:00 2001 From: James Grugett Date: Fri, 4 Mar 2022 15:45:01 -0800 Subject: [PATCH] Add see more button, description to explore items --- web/components/activity-feed.tsx | 31 ++++++++++++++++------ web/components/contract-feed.tsx | 40 +++++++++++++++++++++-------- web/pages/fold/[...slugs]/index.tsx | 1 + web/pages/home.tsx | 2 +- 4 files changed, 55 insertions(+), 19 deletions(-) diff --git a/web/components/activity-feed.tsx b/web/components/activity-feed.tsx index e05165d1..bfd4cc1c 100644 --- a/web/components/activity-feed.tsx +++ b/web/components/activity-feed.tsx @@ -1,5 +1,9 @@ import _ from 'lodash' -import { ContractActivityFeed, ContractSummaryFeed } from './contract-feed' +import { + ContractActivityFeed, + ContractFeed, + ContractSummaryFeed, +} from './contract-feed' import { Contract } from '../lib/firebase/contracts' import { Comment } from '../lib/firebase/comments' import { Col } from './layout/col' @@ -73,8 +77,10 @@ export function ActivityFeed(props: { contracts: Contract[] recentBets: Bet[] recentComments: Comment[] + loadBetAndCommentHistory?: boolean }) { - const { contracts, recentBets, recentComments } = props + const { contracts, recentBets, recentComments, loadBetAndCommentHistory } = + props const groupedBets = _.groupBy(recentBets, (bet) => bet.contractId) const groupedComments = _.groupBy( @@ -86,13 +92,22 @@ export function ActivityFeed(props: { - {contracts.map((contract, i) => ( + {contracts.map((contract) => (
- + {loadBetAndCommentHistory ? ( + + ) : ( + + )}
))} diff --git a/web/components/contract-feed.tsx b/web/components/contract-feed.tsx index 2269efbb..766ba94b 100644 --- a/web/components/contract-feed.tsx +++ b/web/components/contract-feed.tsx @@ -304,8 +304,11 @@ function TruncatedComment(props: { ) } -function FeedQuestion(props: { contract: Contract }) { - const { contract } = props +function FeedQuestion(props: { + contract: Contract + showDescription?: boolean +}) { + const { contract, showDescription } = props const { creatorName, creatorUsername, question, resolution, outcomeType } = contract const { truePool } = contractMetrics(contract) @@ -341,16 +344,33 @@ function FeedQuestion(props: { contract: Contract }) { - - {question} - + + + {question} + + {!showDescription && ( + +
See more...
+
+ )} + {(isBinary || resolution) && ( )} + {showDescription && ( + + )} ) @@ -705,7 +725,7 @@ function FeedItems(props: { return (
-
+
{items.map((activityItem, activityItemIdx) => (
{activityItemIdx !== items.length - 1 ? ( @@ -875,7 +895,7 @@ export function ContractSummaryFeed(props: {
- +
diff --git a/web/pages/fold/[...slugs]/index.tsx b/web/pages/fold/[...slugs]/index.tsx index 9fd1f4fc..757fe325 100644 --- a/web/pages/fold/[...slugs]/index.tsx +++ b/web/pages/fold/[...slugs]/index.tsx @@ -234,6 +234,7 @@ export default function FoldPage(props: { contracts={activeContracts} recentBets={recentBets ?? []} recentComments={recentComments ?? []} + loadBetAndCommentHistory /> {activeContracts.length === 0 && (
diff --git a/web/pages/home.tsx b/web/pages/home.tsx index 5fb6321d..548f1057 100644 --- a/web/pages/home.tsx +++ b/web/pages/home.tsx @@ -57,7 +57,7 @@ const Home = (props: { const { activeContracts } = useFindActiveContracts({ contracts: yourContracts, recentBets: initialRecentBets ?? [], - recentComments, + recentComments: props.recentComments, }) const exploreContracts = useExploreContracts()