diff --git a/app/(tools)/csv-formatter/components/StatsBar.tsx b/app/(tools)/csv-formatter/components/StatsBar.tsx index 0f0bae7..8d67c22 100644 --- a/app/(tools)/csv-formatter/components/StatsBar.tsx +++ b/app/(tools)/csv-formatter/components/StatsBar.tsx @@ -1,5 +1,6 @@ "use client"; +import { formatBytes } from "@/lib/base64-utils"; import { byteLength, delimiterLabel, lineEndingLabel, DELIMITERS, type ParsedCsv } from "@/lib/csv-utils"; export function StatsBar({ parsed, input }: { parsed: ParsedCsv; input: string }) { @@ -43,9 +44,3 @@ function StatCell({ label, value, sub }: { label: string; value: string; sub?: s ); } - -function formatBytes(bytes: number): string { - if (bytes < 1024) return `${bytes} B`; - if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`; - return `${(bytes / (1024 * 1024)).toFixed(2)} MB`; -} diff --git a/app/(tools)/json-formatter/components/StatsBar.tsx b/app/(tools)/json-formatter/components/StatsBar.tsx index 299adb8..cf8761a 100644 --- a/app/(tools)/json-formatter/components/StatsBar.tsx +++ b/app/(tools)/json-formatter/components/StatsBar.tsx @@ -1,6 +1,7 @@ "use client"; import { useEffect, useState } from "react"; +import { formatBytes } from "@/lib/base64-utils"; import { computeStats, gzipSize } from "@/lib/json-utils"; export function StatsBar({ input, output }: { input: string; output: string }) { @@ -26,9 +27,9 @@ export function StatsBar({ input, output }: { input: string; output: string }) { return (
- - - + + + ); } - -function fmt(n: number): string { - if (n < 1024) return `${n} B`; - if (n < 1024 * 1024) return `${(n / 1024).toFixed(1)} KB`; - return `${(n / (1024 * 1024)).toFixed(2)} MB`; -}