fix: Re-add 'number of communities' to site sidebar

This commit is contained in:
Jay Sitter 2023-06-16 20:56:01 -04:00
parent cb72180f97
commit fe64edd2fc

View file

@ -18,6 +18,12 @@ const isCommunityAggregates = (
return "subscribers" in counts; return "subscribers" in counts;
}; };
const isSiteAggregates = (
counts: CommunityAggregates | SiteAggregates
): counts is SiteAggregates => {
return "communities" in counts;
};
export const Badges = ({ counts, community_view }: BadgesProps) => { export const Badges = ({ counts, community_view }: BadgesProps) => {
return ( return (
<ul className="my-1 list-inline"> <ul className="my-1 list-inline">
@ -81,6 +87,14 @@ export const Badges = ({ counts, community_view }: BadgesProps) => {
})} })}
</li> </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"> <li className="list-inline-item badge badge-secondary">
{i18n.t("number_of_posts", { {i18n.t("number_of_posts", {
count: Number(counts.posts), count: Number(counts.posts),