From cc7e223082b5d0939f762c9acf2e4e6b5aca6363 Mon Sep 17 00:00:00 2001
From: Srayash
Date: Mon, 2 Dec 2024 23:21:41 +0530
Subject: [PATCH] enhancement: style the drag and drop feature.
---
frontend/src/assets/DragFileUpload.svg | 4 ++++
frontend/src/conversation/Conversation.tsx | 25 ++++++++++++++++++----
2 files changed, 25 insertions(+), 4 deletions(-)
create mode 100644 frontend/src/assets/DragFileUpload.svg
diff --git a/frontend/src/assets/DragFileUpload.svg b/frontend/src/assets/DragFileUpload.svg
new file mode 100644
index 00000000..1b41d193
--- /dev/null
+++ b/frontend/src/assets/DragFileUpload.svg
@@ -0,0 +1,4 @@
+
diff --git a/frontend/src/conversation/Conversation.tsx b/frontend/src/conversation/Conversation.tsx
index 1d0e129e..2614104e 100644
--- a/frontend/src/conversation/Conversation.tsx
+++ b/frontend/src/conversation/Conversation.tsx
@@ -4,6 +4,7 @@ import { useDispatch, useSelector } from 'react-redux';
import { useNavigate } from 'react-router-dom';
import Hero from '../Hero';
import { useDropzone } from 'react-dropzone';
+import DragFileUpload from '../assets/DragFileUpload.svg';
import ArrowDown from '../assets/arrow-down.svg';
import newChatIcon from '../assets/openNewChat.svg';
import Send from '../assets/send.svg';
@@ -51,19 +52,24 @@ export default function Conversation() {
const [uploadModalState, setUploadModalState] =
useState('INACTIVE');
const [files, setFiles] = useState([]);
+ const [handleDragActive, setHandleDragActive] = useState(false);
const onDrop = useCallback((acceptedFiles: File[]) => {
setUploadModalState('ACTIVE');
setFiles(acceptedFiles);
+ setHandleDragActive(false);
}, []);
- const { getRootProps, getInputProps, isDragActive } = useDropzone({
+ const { getRootProps, getInputProps } = useDropzone({
onDrop,
noClick: true,
multiple: true,
- onDragEnter: () => undefined,
- onDragOver: () => undefined,
- onDragLeave: () => undefined,
+ onDragEnter: () => {
+ setHandleDragActive(true);
+ },
+ onDragLeave: () => {
+ setHandleDragActive(false);
+ },
maxSize: 25000000,
accept: {
'application/pdf': ['.pdf'],
@@ -401,6 +407,17 @@ export default function Conversation() {
{t('tagline')}
+ {handleDragActive && (
+
+

+
+ {t('modals.uploadDoc.drag.title')}
+
+
+ {t('modals.uploadDoc.drag.description')}
+
+
+ )}
{uploadModalState === 'ACTIVE' && (