import { Calendar, Clock, Database, FolderTree, HardDrive } from "lucide-react"; import { useNavigate } from "react-router"; import { ByteSize } from "~/client/components/bytes-size"; import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "~/client/components/ui/table"; import { Tooltip, TooltipContent, TooltipTrigger } from "~/client/components/ui/tooltip"; import { formatDuration } from "~/utils/utils"; import type { ListSnapshotsResponse } from "../api-client"; type Snapshot = ListSnapshotsResponse[number]; type Props = { snapshots: Snapshot[]; repositoryName: string; }; export const SnapshotsTable = ({ snapshots, repositoryName }: Props) => { const navigate = useNavigate(); const handleRowClick = (snapshotId: string) => { navigate(`/repositories/${repositoryName}/${snapshotId}`); }; return (
Snapshot ID Date & Time Size Duration Paths {snapshots.map((snapshot) => ( handleRowClick(snapshot.short_id)} >
{snapshot.short_id}
{new Date(snapshot.time).toLocaleString()}
{formatDuration(snapshot.duration / 1000)}
{snapshot.paths.length} {snapshot.paths.length === 1 ? "path" : "paths"}
{snapshot.paths.map((path) => (
{path}
))}
))}
); };