refactor(web): reuse stats-utils formatDuration in stats-sections (#2068)

Co-authored-by: Kandev Agent <agent@kandev.dev>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
João Salavisa
2026-07-30 21:31:25 +01:00
committed by GitHub
parent f74b0cc618
commit 5211a2d197
+1 -15
View File
@@ -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)}%`;