From 78b27ee9645de659add4b2ec003caaae0ef97b6e Mon Sep 17 00:00:00 2001 From: Austin Chen Date: Fri, 14 Jan 2022 17:28:19 -0500 Subject: [PATCH] Truncate activity feed descriptions to 400 chars --- web/components/contract-feed.tsx | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/web/components/contract-feed.tsx b/web/components/contract-feed.tsx index d50c9edb..68c333b2 100644 --- a/web/components/contract-feed.tsx +++ b/web/components/contract-feed.tsx @@ -212,6 +212,15 @@ function FeedQuestion(props: { contract: Contract }) { contract const { probPercent } = contractMetrics(contract) + let description = contract.description + // Keep descriptions to at most 400 characters + if (description.length > 400) { + description = description.slice(0, 400) + // Make sure to end on a space + const i = description.lastIndexOf(' ') + description = description.slice(0, i) + } + return ( <>
@@ -243,7 +252,14 @@ function FeedQuestion(props: { contract: Contract }) { probPercent={probPercent} /> - +
+ + {description != contract.description && ( + + ... (show more) + + )} +
)