From 0f12c494c289fcbd613d5b581a2b748dfbdcfa6f Mon Sep 17 00:00:00 2001 From: Kainoa Kanter Date: Thu, 30 Jul 2026 15:46:23 -0700 Subject: [PATCH] fix: pluralize files changed count in PR og image --- ogre/src/components/cards/pull-request.tsx | 3 ++- ogre/src/components/shared/metrics.tsx | 3 +-- ogre/src/lib/pluralize.ts | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) create mode 100644 ogre/src/lib/pluralize.ts 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"}`); -- 2.51.2