diff --git a/src/frontend/src/modals/IOModal/components/chatView/chatInput/index.tsx b/src/frontend/src/modals/IOModal/components/chatView/chatInput/index.tsx index d5133f868..d33426169 100644 --- a/src/frontend/src/modals/IOModal/components/chatView/chatInput/index.tsx +++ b/src/frontend/src/modals/IOModal/components/chatView/chatInput/index.tsx @@ -56,6 +56,14 @@ export default function ChatInput({ newFiles[updatedIndex].loading = false; return newFiles; }) + }).catch((err) => { + setFiles(prev=>{ + const newFiles = [...prev]; + const updatedIndex = newFiles.findIndex((file)=>file.id===id); + newFiles[updatedIndex].loading = false; + newFiles[updatedIndex].error = true; + return newFiles; + }) }); } } @@ -150,10 +158,13 @@ export default function ChatInput({ -
+
{ files.map((file)=>( - + { + setFiles(prev=>prev.filter((f)=>f.id!==file.id)) + // TODO: delete file on backend + }}/> )) }
diff --git a/src/frontend/src/modals/IOModal/components/chatView/filePreviewChat/index.tsx b/src/frontend/src/modals/IOModal/components/chatView/filePreviewChat/index.tsx index 06bc1b348..8ec9f19c3 100644 --- a/src/frontend/src/modals/IOModal/components/chatView/filePreviewChat/index.tsx +++ b/src/frontend/src/modals/IOModal/components/chatView/filePreviewChat/index.tsx @@ -1,13 +1,33 @@ -export default function FilePreview( - { error, file, loading }: - { loading: boolean, file: File, error: boolean } -) { - return ( -
- {loading &&
Loading...
} - {error &&
Error...
} -
{file.name}
-
- ) +import React, { useState } from "react"; +import LoadingComponent from "../../../../../components/loadingComponent"; +import IconComponent from "../../../../../components/genericIconComponent"; -} \ No newline at end of file +export default function FilePreview({ error, file, loading,onDelete }: { loading: boolean, file: File, error: boolean,onDelete:()=>void }) { + const [isHovered, setIsHovered] = useState(false); + + return ( +
+ {loading && } + {error &&
Error...
} +
setIsHovered(true)} + onMouseLeave={() => setIsHovered(false)} + > + file + {isHovered && ( +
+
+ +
+
+ )} +
+
+ ); +}