"use client" import { Pool } from "@/lib/api" import { formatBytes } from "@/lib/utils" import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" import { Badge } from "@/components/ui/badge" import { Progress } from "@/components/ui/progress" interface PoolCardProps { pool: Pool onClick?: () => void } export function PoolCard({ pool, onClick }: PoolCardProps) { const usedBytes = pool.alloc const freeBytes = pool.free const totalBytes = pool.size const capacityPercent = parseInt(pool.capacity) let badgeVariant: "success" | "warning" | "destructive" = "success" if (pool.health === "DEGRADED") badgeVariant = "warning" else if (pool.health !== "ONLINE") badgeVariant = "destructive" return (
{pool.name} {pool.health}
{/* Capacity Bar */}
Capacity {pool.capacity}
{/* Size Information */}
Total
{formatBytes(totalBytes)}
Used
{formatBytes(usedBytes)}
Free
{formatBytes(freeBytes)}
{/* Fragmentation */}
Fragmentation {pool.fragmentation}
) }