diff --git a/client/src/Pages/Incidents/Components/SummaryCard.tsx b/client/src/Pages/Incidents/Components/SummaryCard.tsx index c1477cc5d..bd1e2ae8d 100644 --- a/client/src/Pages/Incidents/Components/SummaryCard.tsx +++ b/client/src/Pages/Incidents/Components/SummaryCard.tsx @@ -57,19 +57,15 @@ export const SummaryCardActiveIncidents = ({ incidents }: SummaryCardIncidentsPr if (!incidents) return null; - const hasActive = incidents.some((incident) => incident.status === true); - const activeCount = hasActive - ? incidents.filter((incident) => incident.status === true).length - : 0; + const activeCount = incidents.filter((incident) => incident.status === true).length; + const hasActive = activeCount > 0; const color = hasActive ? theme.palette.error.main : theme.palette.success.main; const icon = hasActive ? ( ) : ( ); - const msg = hasActive - ? `${activeCount} ${t("pages.incidents.summaryCard.activeIncidents.active")}` - : t("pages.incidents.summaryCard.activeIncidents.noActive"); + const msg = t("pages.incidents.summaryCard.activeIncidents.active", { count: activeCount }); return ( @@ -109,7 +105,7 @@ export const SummaryCardLatestIncidents = ({ }; interface SummaryCardStatsProps { - summary?: IncidentSummary; + summary?: IncidentSummary | null; } export const SummaryCardStats = ({ summary }: SummaryCardStatsProps) => { diff --git a/client/src/locales/en.json b/client/src/locales/en.json index 27513615f..e5fec64a6 100644 --- a/client/src/locales/en.json +++ b/client/src/locales/en.json @@ -355,8 +355,9 @@ "summaryCard": { "activeIncidents": { "title": "Active Incidents", - "noActive": "No active incidents", - "active": "Active incident(s)" + "active_zero": "No active incidents", + "active_one": "{{count}} Active incident", + "active_other": "{{count}} Active incidents" }, "latestIncidents": { "title": "Latest Incidents" }, "incidentStats": { "title": "Incident Statistics" }