// Global search modal — stub for now (autocomplete over services + directions + doctors) const { useState: smS, useEffect: smE, useRef: smR, useMemo: smM } = React; const SearchModal = ({ open, onClose }) => { const [q, setQ] = smS(''); const inputRef = smR(null); smE(() => { if (open) { setTimeout(() => inputRef.current && inputRef.current.focus(), 50); setQ(''); } }, [open]); // Build combined index const index = smM(() => { const items = []; DATA.directions.forEach(d => items.push({ type: 'Направление', label: d.name, sub: d.desc, icon: d.icon, href: `direction.html?id=${d.id}`, })); DATA.doctors.forEach(d => items.push({ type: 'Врач', label: d.fullName, sub: d.specs.join(', '), icon: 'doctor', href: `doctor.html?id=${d.id}`, })); DATA.services.forEach(s => items.push({ type: 'Услуга', label: s, sub: '', icon: 'pill', href: '#', })); return items; }, []); const filtered = smM(() => { if (!q.trim()) return index.slice(0, 8); const lq = q.toLowerCase(); return index.filter(it => it.label.toLowerCase().includes(lq) || (it.sub || '').toLowerCase().includes(lq) ).slice(0, 12); }, [q, index]); const popular = ['Кардиолог', 'МРТ', 'Гастроэнтерология', 'Второе мнение', 'Чек-ап']; if (!open) return null; return (
Ничего не найдено по запросу «{q}»
Попробуйте другое слово или позвоните администратору