'use client' import { useState } from 'react' import { DndContext, closestCenter, type DragEndEvent } from '@dnd-kit/core' import { SortableContext, verticalListSortingStrategy } from '@dnd-kit/sortable' import KeywordRow from './KeywordRow' import { useKeywords, useAddKeyword, useReorderKeywords } from '@/hooks/useKeywords' export default function KeywordsTable() { const { data: keywords, isLoading } = useKeywords() const addKw = useAddKeyword() const reorder = useReorderKeywords() const [newTerm, setNewTerm] = useState('') const [newWeight, setNewWeight] = useState('1') const [batchText, setBatchText] = useState('') const [showBatch, setShowBatch] = useState(false) const handleDragEnd = ({ active, over }: DragEndEvent) => { if (!over || active.id === over.id || !keywords) return const ids = keywords.map((k) => k.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) } const handleBatchImport = () => { const lines = batchText.split('\n').map((l) => l.trim()).filter(Boolean) lines.forEach((line) => { const [term, weight] = line.split(':') addKw.mutate({ term: term.trim(), weight: parseFloat(weight || '1') }) }) setBatchText('') setShowBatch(false) } if (isLoading) return (
Each target is a search label sent to auction sites. Set an AI Description on each target to filter lot titles semantically.
One target per line. Format: laptop:2
| Target label | Weight | AI description | Price filter |
|---|
No targets yet — add one above