'use client' import { useState } from 'react' import { motion } from 'framer-motion' import ListingRow from './ListingRow' import ListingDetailPanel from './ListingDetailPanel' import { useListings, useDeleteAllListings } from '@/hooks/useListings' import { getExportUrl } from '@/lib/api/listings' import type { Listing } from '@/lib/types' export default function ListingsTable() { const { data: listings, isLoading, isError } = useListings() const deleteAll = useDeleteAllListings() const [selected, setSelected] = useState(null) const [search, setSearch] = useState('') if (isLoading) return if (isError) return const filtered = search ? (listings ?? []).filter((l) => l.title.toLowerCase().includes(search.toLowerCase()) || l.keyword.toLowerCase().includes(search.toLowerCase()) ) : (listings ?? []) return ( <> {/* Toolbar */}
setSearch(e.target.value)} placeholder="Search listings…" className="g-input pl-7 w-56 h-9 text-sm" />
{filtered.length} lots
{/* Table */}
{filtered.map((l) => )}
TitlePrice Time leftScore KeywordAI
{!filtered.length && (

No listings captured yet

Start the engine and add target sites

)}
setSelected(null)} /> ) } const SkeletonTable = () => (
{Array.from({ length: 6 }).map((_, i) => (
))}
) const ErrorBanner = () => (
Engine offline — cannot reach server
)