From fe64edd2fc26ec46fa5512f7ee13923b2ca6fae9 Mon Sep 17 00:00:00 2001 From: Jay Sitter <jay@jaysitter.com> Date: Fri, 16 Jun 2023 20:56:01 -0400 Subject: [PATCH] fix: Re-add 'number of communities' to site sidebar --- src/shared/components/common/badges.tsx | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/shared/components/common/badges.tsx b/src/shared/components/common/badges.tsx index 2024ad2..5639034 100644 --- a/src/shared/components/common/badges.tsx +++ b/src/shared/components/common/badges.tsx @@ -18,6 +18,12 @@ const isCommunityAggregates = ( return "subscribers" in counts; }; +const isSiteAggregates = ( + counts: CommunityAggregates | SiteAggregates +): counts is SiteAggregates => { + return "communities" in counts; +}; + export const Badges = ({ counts, community_view }: BadgesProps) => { return ( <ul className="my-1 list-inline"> @@ -81,6 +87,14 @@ export const Badges = ({ counts, community_view }: BadgesProps) => { })} </li> )} + {isSiteAggregates(counts) && ( + <li className="list-inline-item badge badge-secondary"> + {i18n.t("number_of_communities", { + count: Number(counts.communities), + formattedCount: numToSI(counts.communities), + })} + </li> + )} <li className="list-inline-item badge badge-secondary"> {i18n.t("number_of_posts", { count: Number(counts.posts), -- 2.44.1