From a63be7143ce1f76e9b8e92d9ddf7f2604d4dfa24 Mon Sep 17 00:00:00 2001 From: casens5 Date: Tue, 20 Aug 2024 14:28:50 -0500 Subject: [PATCH 1/4] make sidebar height fit content --- .../(main)/questions/[id]/components/sidebar/index.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/front_end/src/app/(main)/questions/[id]/components/sidebar/index.tsx b/front_end/src/app/(main)/questions/[id]/components/sidebar/index.tsx index 0082ac8685..588d045d75 100644 --- a/front_end/src/app/(main)/questions/[id]/components/sidebar/index.tsx +++ b/front_end/src/app/(main)/questions/[id]/components/sidebar/index.tsx @@ -25,7 +25,7 @@ const Sidebar: FC = ({ }) => { if (layout === "mobile") { return ( -
+
= ({ -
+
); } return ( -
+
@@ -81,7 +81,7 @@ const Sidebar: FC = ({ -
+
); }; From 9b9364e22c8a073dd30f66e794d86a7e4abc9c56 Mon Sep 17 00:00:00 2001 From: casens5 Date: Tue, 20 Aug 2024 14:29:44 -0500 Subject: [PATCH 2/4] don't display empty newsmatch --- .../questions/[id]/components/sidebar/news_match/index.tsx | 4 +++- .../components/sidebar/news_match/news_match_drawer.tsx | 6 ++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/front_end/src/app/(main)/questions/[id]/components/sidebar/news_match/index.tsx b/front_end/src/app/(main)/questions/[id]/components/sidebar/news_match/index.tsx index 57b7c35812..a0cb9abb55 100644 --- a/front_end/src/app/(main)/questions/[id]/components/sidebar/news_match/index.tsx +++ b/front_end/src/app/(main)/questions/[id]/components/sidebar/news_match/index.tsx @@ -16,7 +16,9 @@ const fetchArticles = async (postId: number) => { const NewsMatch: FC = async ({ questionId }) => { const articles = await fetchArticles(questionId); - return ; + if (articles.length > 0) { + return ; + } }; export default NewsMatch; diff --git a/front_end/src/app/(main)/questions/[id]/components/sidebar/news_match/news_match_drawer.tsx b/front_end/src/app/(main)/questions/[id]/components/sidebar/news_match/news_match_drawer.tsx index 3aec0c66e3..03caff52d7 100644 --- a/front_end/src/app/(main)/questions/[id]/components/sidebar/news_match/news_match_drawer.tsx +++ b/front_end/src/app/(main)/questions/[id]/components/sidebar/news_match/news_match_drawer.tsx @@ -30,7 +30,7 @@ const NewsMatchDrawer: FC = ({ questionId, articles }) => { /> ))}
- {articles.length > articleDisplayLimit ? ( + {articles.length > articleDisplayLimit && ( - ) : ( -
)} -
+
{t.rich("learnMoreAboutNewsMatch", { link: (chunks) => ( Date: Tue, 20 Aug 2024 15:01:35 -0500 Subject: [PATCH 3/4] add border to comment editor --- front_end/src/components/comment_feed/comment_editor.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/front_end/src/components/comment_feed/comment_editor.tsx b/front_end/src/components/comment_feed/comment_editor.tsx index fa95c7be7e..d873d39fc6 100644 --- a/front_end/src/components/comment_feed/comment_editor.tsx +++ b/front_end/src/components/comment_feed/comment_editor.tsx @@ -104,7 +104,7 @@ const CommentEditor: FC = ({ )*/} {isEditing && ( -
+
= ({ )} {!isEditing && } -
+
{ @@ -144,9 +144,9 @@ const CommentEditor: FC = ({
{!!errorMessage && ( -

+

{errorMessage} -

+
)} ); From 3bc192a46125cc93ae42ff8fe717bff8a2fc0475 Mon Sep 17 00:00:00 2001 From: casens5 Date: Thu, 22 Aug 2024 09:48:46 -0500 Subject: [PATCH 4/4] show private/public filter on post comment feeds --- .../src/components/comment_feed/index.tsx | 43 ++++++++++--------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/front_end/src/components/comment_feed/index.tsx b/front_end/src/components/comment_feed/index.tsx index 0c4a028ad6..83c2ffaa85 100644 --- a/front_end/src/components/comment_feed/index.tsx +++ b/front_end/src/components/comment_feed/index.tsx @@ -1,4 +1,5 @@ "use client"; + import { faChevronDown } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import Link from "next/link"; @@ -72,6 +73,26 @@ type Props = { profileId?: number; }; +function shouldIncludeForecast(postData: PostWithForecasts | undefined) { + if (postData === undefined) return false; + + // disable forecasts for notebooks + if (postData.notebook !== undefined) { + return false; + } + + // we can link forecast only for date, binary and numeric questions + if (postData.question) { + if (postData.question.type === QuestionType.MultipleChoice) { + return false; + } + + return !!postData.question.my_forecasts?.history.length; + } + + return false; +} + const COMMENTS_PER_PAGE = 10; const CommentFeed: FC = ({ postData, postPermissions, profileId }) => { @@ -240,7 +261,7 @@ const CommentFeed: FC = ({ postData, postPermissions, profileId }) => { > {t("comments")} - {profileId && ( + {!profileId && user && ( = ({ postData, postPermissions, profileId }) => { ); }; -function shouldIncludeForecast(postData: PostWithForecasts | undefined) { - if (postData === undefined) return false; - - // disable forecasts for notebooks - if (postData.notebook !== undefined) { - return false; - } - - // we can link forecast only for date, binary and numeric questions - if (postData.question) { - if (postData.question.type === QuestionType.MultipleChoice) { - return false; - } - - return !!postData.question.my_forecasts?.history.length; - } - - return false; -} - export default CommentFeed;