'use client' import { DndContext, closestCenter, type DragEndEvent } from '@dnd-kit/core' import { SortableContext, verticalListSortingStrategy } from '@dnd-kit/sortable' import SiteRow from './SiteRow' import { useSites, useReorderSites } from '@/hooks/useSites' export default function SitesTable() { const { data: sites } = useSites() const reorder = useReorderSites() const handleDragEnd = ({ active, over }: DragEndEvent) => { if (!over || active.id === over.id || !sites) return const ids = sites.map((s) => s.id) const from = ids.indexOf(Number(active.id)) const to = ids.indexOf(Number(over.id)) const newOrder = [...ids] newOrder.splice(to, 0, newOrder.splice(from, 1)[0]) reorder.mutate(newOrder) } return (
s.id)} strategy={verticalListSortingStrategy}>
{(sites ?? []).map((s) => )}
Name URL template Health AI confidence Enabled Actions
{!(sites ?? []).length && (

No sites added yet

Add a site below to start scraping

)}
) }