From 5211a2d197b8c4d0d889ccd058bdf769994b4dae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Salavisa?= Date: Thu, 30 Jul 2026 21:31:25 +0100 Subject: [PATCH] refactor(web): reuse stats-utils formatDuration in stats-sections (#2068) Co-authored-by: Kandev Agent Co-authored-by: Claude Opus 5 (1M context) --- apps/web/app/stats/stats-sections.tsx | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/apps/web/app/stats/stats-sections.tsx b/apps/web/app/stats/stats-sections.tsx index da09444a14..3893695fef 100644 --- a/apps/web/app/stats/stats-sections.tsx +++ b/apps/web/app/stats/stats-sections.tsx @@ -4,21 +4,7 @@ import { IconGitCommit } from "@tabler/icons-react"; import { Card, CardContent, CardHeader, CardTitle } from "@kandev/ui/card"; import { Tooltip, TooltipContent, TooltipTrigger } from "@kandev/ui/tooltip"; import type { StatsResponse, TaskStatsDTO, RepositoryStatsDTO } from "@/lib/types/http"; - -function formatDuration(ms: number): string { - if (ms === 0) return "\u2014"; - const seconds = Math.floor(ms / 1000); - const minutes = Math.floor(seconds / 60); - const hours = Math.floor(minutes / 60); - - if (hours > 0) { - return `${hours}h ${minutes % 60}m`; - } - if (minutes > 0) { - return `${minutes}m ${seconds % 60}s`; - } - return `${seconds}s`; -} +import { formatDuration } from "./stats-utils"; function formatPercent(value: number): string { return `${Math.round(value)}%`;