import { Calendar, Clock, Database, FolderTree, HardDrive } from "lucide-react"; import type { ListSnapshotsResponse } from "~/api-client/types.gen"; import { ByteSize } from "~/components/bytes-size"; import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "~/components/ui/table"; import { Tooltip, TooltipContent, TooltipTrigger } from "~/components/ui/tooltip"; import { formatSnapshotDuration } from "~/modules/repositories/tabs/snapshots"; type Snapshot = ListSnapshotsResponse["snapshots"][0]; type Props = { snapshots: Snapshot[]; }; export const SnapshotsTable = ({ snapshots }: Props) => { return (
Snapshot ID Date & Time Size Duration Volume {snapshots.map((snapshot) => (
{snapshot.short_id}
{new Date(snapshot.time).toLocaleString()}
{formatSnapshotDuration(snapshot.duration / 1000)}
{snapshot.paths[0].split("/").filter(Boolean).at(-2) || "/"} +{snapshot.paths.length - 1}
{snapshot.paths.slice(1).map((path) => (
{path}
))}
))}
); };