diff --git a/frontend/src/upload/Upload.tsx b/frontend/src/upload/Upload.tsx index 7b426e19..0360e2e5 100644 --- a/frontend/src/upload/Upload.tsx +++ b/frontend/src/upload/Upload.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import React, { useRef } from 'react'; import { useCallback, useEffect, useState } from 'react'; import { useDropzone } from 'react-dropzone'; import { useDispatch } from 'react-redux'; @@ -35,6 +35,7 @@ function Upload({ }>(); const { t } = useTranslation(); + const setTimeoutRef = useRef(); const urlOptions: { label: string; value: string }[] = [ { label: 'Crawler', value: 'crawler' }, @@ -48,6 +49,31 @@ function Upload({ value: 'url', }); + useEffect(() => { + if (setTimeoutRef.current) { + clearTimeout(setTimeoutRef.current); + } + }, []); + + function ProgressBar({ progress }: { progress: number }) { + return ( +
+
+
+ {progress >= 5 && `${progress}%`} +
+
+
+ ); + } + function Progress({ title, isCancellable = false, @@ -64,15 +90,10 @@ function Upload({

Over the token limit, please consider uploading smaller document

-

{progress?.percentage || 0}%

+ {/*

{progress?.percentage || 0}%

*/} -
-
-
-
+ {/* progress bar */} +