diff --git a/ogre/src/components/cards/pull-request.tsx b/ogre/src/components/cards/pull-request.tsx index 2c0011c5..f0a61e38 100644 --- a/ogre/src/components/cards/pull-request.tsx +++ b/ogre/src/components/cards/pull-request.tsx @@ -5,6 +5,7 @@ import { CardHeader } from "../shared/card-header"; import { FooterStats } from "../shared/footer-stats"; import { FileDiff, RefreshCw } from "../../icons/lucide"; import { COLORS, TYPOGRAPHY } from "../shared/constants"; +import { pluralize } from "../../lib/pluralize"; import type { PullRequestCardData } from "../../validation"; interface FilesChangedPillProps { @@ -33,7 +34,7 @@ function FilesChangedPill({ }}> - {filesChanged} files + {filesChanged} {pluralize("file", filesChanged)} diff --git a/ogre/src/components/shared/metrics.tsx b/ogre/src/components/shared/metrics.tsx index 66f2ad59..be6b7d48 100644 --- a/ogre/src/components/shared/metrics.tsx +++ b/ogre/src/components/shared/metrics.tsx @@ -6,6 +6,7 @@ import { CircleDot, type LucideIcon, } from "../../icons/lucide"; +import { pluralize } from "../../lib/pluralize"; interface MetricsProps { stars: number; @@ -13,8 +14,6 @@ interface MetricsProps { issues: number; } -const pluralize = (label: string, n: number) => (`${label}${n === 1 ? "" : "s"}`); - // Display stars, pulls, issues with Lucide icons export function Metrics({ stars, pulls, issues }: MetricsProps) { return ( diff --git a/ogre/src/lib/pluralize.ts b/ogre/src/lib/pluralize.ts new file mode 100644 index 00000000..8ccf3987 --- /dev/null +++ b/ogre/src/lib/pluralize.ts @@ -0,0 +1 @@ +export const pluralize = (label: string, n: number) => (`${label}${n === 1 ? "" : "s"}`);