import { useState, useEffect } from 'react'; import { X, Trash2, Play, Bookmark, Clock } from 'lucide-react'; import type { SavedQuery } from './types-v3'; import { savedQueryStorage } from './types-v3'; import { ENGINE_META } from './types-v3'; interface Props { visible: boolean; onClose: () => void; onSelect: (item: SavedQuery) => void; } // 已保存查询面板(localStorage)// Logan.Li export function SavedQueriesPanel({ visible, onClose, onSelect }: Props) { const [items, setItems] = useState([]); useEffect(() => { if (visible) setItems(savedQueryStorage.getAll()); }, [visible]); if (!visible) return null; return ( <>
已保存查询 {items.length}
{items.length === 0 ? (

暂无保存的查询

) : items.map((item) => (

{item.name}

{ENGINE_META[item.engine]?.name} · {item.timeRangeLabel}

{item.query}

{new Date(item.createdAt).toLocaleString()}

))}
); }