Fix host count on team details page (#4103)

This commit is contained in:
Tharun Rajendran 2022-02-09 23:24:12 +05:30 committed by GitHub
parent 778ee22147
commit 1f75429775
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -20,6 +20,7 @@ export interface ITeamSummary {
id: number;
name: string;
description?: string;
host_count: number;
}
/**

View File

@ -350,8 +350,9 @@ const TeamDetailsWrapper = ({
);
}
const hostsCount = teams?.length || 1;
const hostsTotalDisplay = hostsCount === 1 ? "1 host" : `${hostsCount} hosts`;
const hostCount = currentTeam.host_count;
const hostsTotalDisplay =
hostCount >= 2 ? `${hostCount} hosts` : `${hostCount} host`;
const userAdminTeams = userTeams.filter(
(thisTeam) => thisTeam.role === "admin"
);