import type { ListSnapshotsResponse } from "~/api-client/types.gen"; import { cn } from "~/lib/utils"; import { Card } from "~/components/ui/card"; import { ByteSize } from "~/components/bytes-size"; interface Props { snapshots: ListSnapshotsResponse; snapshotId: string; onSnapshotSelect: (snapshotId: string) => void; } export const SnapshotTimeline = (props: Props) => { const { snapshots, snapshotId, onSnapshotSelect } = props; if (snapshots.length === 0) { return (

No snapshots available

); } return (
{snapshots.map((snapshot, index) => { const date = new Date(snapshot.time); const isSelected = snapshotId === snapshot.short_id; const isLatest = index === snapshots.length - 1; return ( ); })}
{snapshots.length} snapshots {new Date(snapshots[0].time).toLocaleDateString()} -{" "} {new Date(snapshots.at(-1)?.time ?? 0).toLocaleDateString()}
); };