import { AtSign, Braces, FileCode, FileText, X } from "lucide-react"; import { useMemo, useState } from "react"; import { useQueryClient } from "@tanstack/react-query"; import { Popover, PopoverContent, PopoverTrigger, } from "@/components/ui/popover"; import { Button } from "@/components/ui/button"; import { File } from "@/lib/type"; import { cn } from "@/lib/utils"; export const Context = ({ files, setFiles, }: { files: File[]; setFiles: (files: File[]) => void; }) => { const queryClient = useQueryClient(); const [open, setOpen] = useState(false); const getFileIcon = (filePath: string, size = "size-3.5") => { if (filePath.endsWith(".css")) { return ; } else if (filePath.endsWith(".js")) { return ; } else if (filePath.endsWith(".json")) { return ; } else { return ; } }; const getFiles = () => queryClient.getQueryData(["files"]) ?? []; return (

Select a file to send as context

{getFiles().length === 0 ? (
No files available
) : ( <> {getFiles()?.map((page) => ( ))} )}
{files?.map((file) => ( ))}
); };