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' && (