import { useState, useMemo } from 'react' import { MagnifyingGlass } from '@phosphor-icons/react' import { ICON_OPTIONS, type IconEntry } from '../utils/iconRegistry' import { ACCENT_COLORS } from '../utils/typeColors' import { cn } from '@/lib/utils' function filterIcons(icons: IconEntry[], query: string): IconEntry[] { if (!query) return icons const lower = query.toLowerCase() return icons.filter((o) => o.name.includes(lower)) } interface TypeCustomizePopoverProps { currentIcon: string | null currentColor: string | null onChangeIcon: (icon: string) => void onChangeColor: (color: string) => void onClose: () => void } export function TypeCustomizePopover({ currentIcon, currentColor, onChangeIcon, onChangeColor, onClose, }: TypeCustomizePopoverProps) { const [selectedColor, setSelectedColor] = useState(currentColor) const [selectedIcon, setSelectedIcon] = useState(currentIcon) const [search, setSearch] = useState('') const filteredIcons = useMemo(() => filterIcons(ICON_OPTIONS, search), [search]) const handleColorClick = (key: string) => { setSelectedColor(key) onChangeColor(key) } const handleIconClick = (name: string) => { setSelectedIcon(name) onChangeIcon(name) } return (