import { DocumentTextIcon, XMarkIcon } from '@heroicons/react/24/outline'; import { MessageExtra } from '../utils/types'; import { useState } from 'react'; import { classNames } from '../utils/misc'; export default function ChatInputExtraContextItem({ items, removeItem, clickToShow, }: { items?: MessageExtra[]; removeItem?: (index: number) => void; clickToShow?: boolean; }) { const [show, setShow] = useState(-1); const showingItem = show >= 0 ? items?.[show] : undefined; if (!items) return null; return (
{items.map((item, i) => (
clickToShow && setShow(i)} > {removeItem && (
)}
{item.type === 'imageFile' ? ( <> {item.name} ) : ( <>
{item.name ?? 'Extra content'}
)}
))} {showingItem && (
{showingItem.name ?? 'Extra content'}
{showingItem.type === 'imageFile' ? ( {showingItem.name} ) : (
                  {showingItem.content}
                
)}
setShow(-1)}>
)}
); }