diff --git a/src/components/MessageInputActions/Sources.tsx b/src/components/MessageInputActions/Sources.tsx new file mode 100644 index 0000000..e996b6e --- /dev/null +++ b/src/components/MessageInputActions/Sources.tsx @@ -0,0 +1,93 @@ +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}