import { useChat } from '@/lib/hooks/useChat'; import { Popover, PopoverButton, PopoverPanel, Switch, } from '@headlessui/react'; import { GlobeIcon, GraduationCapIcon, NetworkIcon, } from '@phosphor-icons/react'; import { AnimatePresence, motion } from 'motion/react'; const sourcesList = [ { name: 'Web', key: 'web', icon: , }, { name: 'Academic', key: 'academic', icon: , }, { name: 'Social', key: 'social', icon: , }, ]; const Sources = () => { const { sources, setSources } = useChat(); return ( {({ open }) => ( <> {open && ( {sourcesList.map((source, i) => ( { if (!sources.includes(source.key)) { setSources([...sources, source.key]); } else { setSources(sources.filter((s) => s !== source.key)); } }} > {source.icon} {source.name} ))} )} > )} ); }; export default Sources;
{source.name}