From 865f43193098e54944d7237764a0baccfe5b0097 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Sworze=C5=84?= Date: Wed, 6 Mar 2024 16:25:32 +0100 Subject: [PATCH] [#362] dont show links when unavailable --- .../ReviewCreatedGovernanceAction.tsx | 41 +++++++++++-------- 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/govtool/frontend/src/components/organisms/ReviewCreatedGovernanceAction.tsx b/govtool/frontend/src/components/organisms/ReviewCreatedGovernanceAction.tsx index a88a09796..4944804a1 100644 --- a/govtool/frontend/src/components/organisms/ReviewCreatedGovernanceAction.tsx +++ b/govtool/frontend/src/components/organisms/ReviewCreatedGovernanceAction.tsx @@ -59,17 +59,30 @@ export const ReviewCreatedGovernanceAction = ({ const renderLinks = () => { const links = values["links"]?.map((item) => item.link) ?? []; + const areLinks = links.some((item) => item); - return links.map((link: string) => { - return ( - } - label={link} - onClick={() => onClickLink(link)} - sx={{ mb: 1.75 }} - /> - ); - }); + return areLinks ? ( + <> + + {t("createGovernanceAction.supportingLinks")} + + {links.map((link: string) => { + return link ? ( + } + label={link} + onClick={() => onClickLink(link)} + sx={{ mb: 1.75 }} + /> + ) : null; + })} + + ) : null; }; return ( @@ -97,14 +110,6 @@ export const ReviewCreatedGovernanceAction = ({ {renderReviewFields()} - - {t("createGovernanceAction.supportingLinks")} - {renderLinks()}