diff --git a/frontend/src/components/DiskSpaceCard.tsx b/frontend/src/components/DiskSpaceCard.tsx deleted file mode 100644 index 9a4781c..0000000 --- a/frontend/src/components/DiskSpaceCard.tsx +++ /dev/null @@ -1,78 +0,0 @@ -import { Card, CardContent } from "@/components/ui/card"; -import { Progress } from "@/components/ui/progress"; - -interface Props { - used: number; - available: number; - size: number; - usedPct: string; -} - -function formatBytes(bytes: number): string { - if (!bytes || bytes === 0) return "0 B"; - const units = ["B", "KB", "MB", "GB", "TB"]; - let value = bytes; - let unitIdx = 0; - while (value >= 1000 && unitIdx < units.length - 1) { - value /= 1000; - unitIdx++; - } - return `${value.toFixed(1)} ${units[unitIdx]}`; -} - -/** - * Progress-bar class (full static strings so Tailwind's scanner emits them). - * `chart-2`=success, `chart-3`=warning, `destructive`=error, per design ยง2.3. - */ -function progressBarClass(pct: number): string { - if (pct < 70) { - return "h-3 [&_[data-slot=progress-indicator]]:bg-chart-2"; - } - if (pct < 90) { - return "h-3 [&_[data-slot=progress-indicator]]:bg-chart-3"; - } - return "h-3 [&_[data-slot=progress-indicator]]:bg-destructive"; -} - -/** - * Dashboard card that summarizes the configured media disk. - * - * Keeps the progress bar inside the card so the capacity signal, raw byte - * values, and free-space breakdown stay visually grouped. The used / free / - * total / percent breakdown is preserved verbatim from the MUI version. - */ -export function DiskSpaceCard({ used, available, size, usedPct }: Props) { - const pct = Math.max(0, Math.min(100, Number.parseFloat(usedPct) || 0)); - const cells = [ - { label: "Used", value: formatBytes(used) }, - { label: "Free", value: formatBytes(available) }, - { label: "Total", value: formatBytes(size) }, - ]; - - return ( - - -
- - Disk space - - {usedPct} used -
- -
- {cells.map((cell) => ( -
- - {cell.label} - - {cell.value} -
- ))} -
-
-
- ); -} diff --git a/frontend/src/components/__tests__/DiskSpaceCard.test.tsx b/frontend/src/components/__tests__/DiskSpaceCard.test.tsx deleted file mode 100644 index f0f040b..0000000 --- a/frontend/src/components/__tests__/DiskSpaceCard.test.tsx +++ /dev/null @@ -1,22 +0,0 @@ -import { describe, it, expect } from "vitest"; -import { render, screen } from "@testing-library/react"; -import { DiskSpaceCard } from "../DiskSpaceCard"; - -describe("DiskSpaceCard", () => { - it("preserves the used / free / total breakdown and percent headline", () => { - render( - , - ); - expect(screen.getByText(/50 used/i)).toBeInTheDocument(); - expect(screen.getByText("Used")).toBeInTheDocument(); - expect(screen.getByText("Free")).toBeInTheDocument(); - expect(screen.getByText("Total")).toBeInTheDocument(); - // Disk space label - expect(screen.getByText(/disk space/i)).toBeInTheDocument(); - }); -}); diff --git a/frontend/src/types/index.ts b/frontend/src/types/index.ts index 0456762..3d185f2 100644 --- a/frontend/src/types/index.ts +++ b/frontend/src/types/index.ts @@ -276,15 +276,6 @@ export interface AppVersionInfo { backend_label: string; } -export interface DiskSpace { - filesystem: string; - size: number; - used: number; - available: number; - used_pct: string; - mount: string; -} - export interface MediaIndexStatus { exists: boolean; item_count: number;