1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-03-23 00:16:25 +01:00

fix(1-3377): handle singular counts in project status lifecycle boxes (#9317)

If the average number of days in a stage is 1, use `1 day` instead of
`1 days`.

Likewise, if your total number of archived flags is 1, use `1 flag
archived` instead of `1 flags archived`.

I grepped through the file, but couldn't find any other hardcoded
instances of "flags" or "days", so I think this is everything.
This commit is contained in:
Thomas Heartman 2025-02-17 13:41:04 +01:00 committed by GitHub
parent 134c32589a
commit b15502ec5e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -116,6 +116,8 @@ const AverageDaysStat: FC<{ averageDays?: number | null }> = ({
if (averageDays < 1) {
return 'less than a day';
} else if (averageDays === 1) {
return '1 day';
}
return `${averageDays} days`;
};
@ -165,6 +167,10 @@ export const ProjectLifecycleSummary = () => {
);
};
const archivedLast30DaysCount =
data?.lifecycleSummary.archived.last30Days ?? 0;
const totalArchivedText = `${archivedLast30DaysCount} ${archivedLast30DaysCount === 1 ? 'flag' : 'flags'} archived`;
return (
<LifecycleList ref={loadingRef}>
<LifecycleBox tooltipText={lifecycleMessages.initial}>
@ -258,8 +264,7 @@ export const ProjectLifecycleSummary = () => {
<Stats>
<dt>Last 30 days</dt>
<dd data-loading-project-lifecycle-summary>
{data?.lifecycleSummary.archived.last30Days ?? 0} flags
archived
{totalArchivedText}
</dd>
</Stats>
</LifecycleBox>