"use client"; import { Badge, Button } from "@/components/ui"; import { formatDuration } from "@/lib/format"; import type { ConnectionStatus } from "@/types/connection"; export interface TrackingControlsProps { isTracking: boolean; canStart: boolean; starting: boolean; onStart: () => void; onStop: () => void; syncIntervalMs: number; connectionStatus: ConnectionStatus; queueCount: number; } const STATUS_LABEL: Record = { online: "Connected", offline: "Offline", syncing: "Syncing", }; const STATUS_VARIANT = { online: "success", offline: "danger", syncing: "warning", } as const; export function TrackingControls({ isTracking, canStart, starting, onStart, onStop, syncIntervalMs, connectionStatus, queueCount, }: TrackingControlsProps) { return (
{isTracking ? ( ) : ( )} {/* The interval is interpolated. The previous version rendered a template literal that said "Log interval custom" with nothing substituted in. */}

{isTracking ? `Logging one entry every ${formatDuration(syncIntervalMs / 1000)}` : "Tracking is stopped"}

{STATUS_LABEL[connectionStatus]} {queueCount > 0 && {queueCount} queued}
); }