import { Link } from 'wouter'; import { useSyncs, useRunSync, useUpdateSync } from '@/lib/api-hooks'; import { DESTINATIONS } from '@/lib/api'; import { Badge, Button } from '@/components/ui'; import { formatDate } from '@/lib/utils'; import { toast } from 'sonner'; import { FolderSync, Play, Plus, Pause, Power, Settings2, History } from 'lucide-react'; import React from 'react'; export default function SyncsList() { const { data: syncs, isLoading } = useSyncs(); const runSync = useRunSync(); const updateSync = useUpdateSync(); const [runningId, setRunningId] = React.useState(null); const handleRun = (e: React.MouseEvent, id: string) => { e.preventDefault(); setRunningId(id); runSync.mutate(id, { onSuccess: () => { toast.success('Sync run started'); setRunningId(null); }, onError: (err) => { toast.error(err.message); setRunningId(null); } }); }; const toggleStatus = (e: React.MouseEvent, id: string, currentStatus: string) => { e.preventDefault(); const newStatus = currentStatus === 'active' ? 'paused' : 'active'; updateSync.mutate({ id, status: newStatus }, { onSuccess: () => toast.success(`Sync ${newStatus}`) }); }; return (

Syncs

Configure and manage data routing pipelines.

{isLoading ? ( [1, 2, 3, 4].map(i => ( )) ) : syncs?.length === 0 ? ( ) : ( syncs?.map((sync) => { const dest = DESTINATIONS.find(d => d.id === sync.connection?.destination); return ( ); }) )}
Name Destination Status Mode Last Run Actions

No syncs yet

Create a sync to start moving data to your destinations.

{sync.name}

{sync.sourceType} → {sync.objectType}

{sync.connection?.name || 'Unknown'}
{sync.status}
{sync.runMode.replace('_', ' ')} {sync.scheduleExpr && {sync.scheduleExpr}}
{sync.lastRunAt ? ( <> {formatDate(sync.lastRunAt)} ) : ( Never )}
); }