import React from 'react'; import { PartsSearchHistoryItem } from '@/lib/graphql/search-history'; interface SearchHistoryDropdownProps { isVisible: boolean; historyItems: PartsSearchHistoryItem[]; onItemClick: (searchQuery: string) => void; loading?: boolean; } const SearchHistoryDropdown: React.FC = ({ isVisible, historyItems, onItemClick, loading = false }) => { if (!isVisible) return null; // Фильтруем уникальные запросы const uniqueQueries = Array.from( new Map( historyItems.map(item => [item.searchQuery.toLowerCase(), item]) ).values() ); const getSearchTypeLabel = (type: string) => { switch (type) { case 'VIN': return 'VIN'; case 'PLATE': return 'Госномер'; case 'OEM': case 'ARTICLE': return 'Артикул'; default: return 'Поиск'; } }; return (
{loading ? (
Загрузка истории...
) : uniqueQueries.length > 0 ? ( <> {uniqueQueries.map((item) => ( ))} ) : (

История поиска пуста

)}
); }; export default SearchHistoryDropdown;