From 61cfb484c82b4b5d9a18ff0b8122f90460fad921 Mon Sep 17 00:00:00 2001 From: hokageCodes Date: Sun, 11 Dec 2022 09:49:00 +0000 Subject: [PATCH 1/2] upload forms changed to look the same --- .../src/pages/Dashboard/DashboardMain/UploadFile/Upload.jsx | 4 ++-- .../Dashboard/DashboardMain/UploadReady/UploadReady.jsx | 2 +- frontend/src/pages/Dashboard/ImportData/Hero/ImportData.jsx | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/frontend/src/pages/Dashboard/DashboardMain/UploadFile/Upload.jsx b/frontend/src/pages/Dashboard/DashboardMain/UploadFile/Upload.jsx index b4138c0d..2bd2566c 100644 --- a/frontend/src/pages/Dashboard/DashboardMain/UploadFile/Upload.jsx +++ b/frontend/src/pages/Dashboard/DashboardMain/UploadFile/Upload.jsx @@ -17,7 +17,7 @@ function Upload() { inputRef.current.click(); }} role="presentation" - className="flex flex-col items-center py-[2em] space-y-[2em] w-full md:w-[60%] lg:w-[40%] rounded-xl border-[2px] border-dashed border-[#1D2939]" + className="flex flex-col items-center py-[4em] space-y-[2em] w-full md:w-[60%] lg:w-[40%] rounded-xl border-[2px] border-dashed border-[#1D2939] cursor-pointer" >

- Drop your account statement in here + Drag & Drop first record in here

Supported formats: PDF, Word DOCS, Excel diff --git a/frontend/src/pages/Dashboard/DashboardMain/UploadReady/UploadReady.jsx b/frontend/src/pages/Dashboard/DashboardMain/UploadReady/UploadReady.jsx index 3efca3e9..c8e35bc6 100644 --- a/frontend/src/pages/Dashboard/DashboardMain/UploadReady/UploadReady.jsx +++ b/frontend/src/pages/Dashboard/DashboardMain/UploadReady/UploadReady.jsx @@ -21,7 +21,7 @@ function UploadReady() { return (

Ready for Upload

-
+
{fileErr ? ( -

Next, upload Sales Record

+

Upload Second Document

{showUpload ? (
{fileErr ? ( @@ -338,7 +338,7 @@ function ImportData() { setShowUpload(true); setFileDropped2(e.dataTransfer?.files[0]); }} - className=" text-center flex flex-col justify-center items-center mx-auto bg-white py-[4em] px-[1em] md:py-[2em] w-full md:w-[70%] lg:w-[40%] space-y-3 border border-black border-dashed " + className="ml-[450px] flex flex-col items-center py-[4em] space-y-[2em] w-full md:w-[60%] lg:w-[40%] rounded-xl border-[2px] border-dashed border-[#1D2939] cursor-pointer" > */}

- Drag and drop sales record here. + Drag & Drop second document here.

Supported formats: PDF, Word DOCS, Excel From 82818d84a8ddc3d486db54d41e62ef28abedfc5d Mon Sep 17 00:00:00 2001 From: hokageCodes Date: Mon, 12 Dec 2022 08:52:35 +0000 Subject: [PATCH 2/2] persist fix --- frontend/src/Store/Context.jsx | 20 +++++++++++-------- .../Dashboard/ImportData/Hero/ImportData.jsx | 1 + 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/frontend/src/Store/Context.jsx b/frontend/src/Store/Context.jsx index 6fc3838b..d2cee6b0 100644 --- a/frontend/src/Store/Context.jsx +++ b/frontend/src/Store/Context.jsx @@ -20,6 +20,10 @@ export const UserProvider = ({ children }) => { const ReconciledRecordsSaved = JSON.parse( localStorage.getItem('localData3') || '[]' ); + const ClearFileName = JSON.parse( + localStorage.removeItem('fileName') || '[]' + ); + // Persisting data for uploaded files @@ -40,18 +44,18 @@ export const UserProvider = ({ children }) => { const [localFile, setLocalFile] = useState([]); const [localFile2, setLocalFile2] = useState([]); - const [localData, setLocalData] = useState(AccountStatementsaved); - const [localData2, setLocalData2] = useState(SalesRecordsaved); + const [localData, setLocalData] = useState(AccountStatementsaved, ClearFileName); + const [localData2, setLocalData2] = useState(SalesRecordsaved, ClearFileName); // reconcile data - const [localData3, setLocalData3] = useState(ReconciledRecordsSaved); + const [localData3, setLocalData3] = useState(ReconciledRecordsSaved, ClearFileName); const [loading, setLoading] = useState(true); const [uploadLoading, setUploadLoading] = useState(true); const [uploadLoading2, setUploadLoading2] = useState(true); const [rError, setRError] = useState(''); - const [fileDropped, setFileDropped] = useState([]); - const [fileDropped2, setFileDropped2] = useState([]); + const [fileDropped, setFileDropped] = useState(ClearFileName); + const [fileDropped2, setFileDropped2] = useState(ClearFileName); const uploadUrl = 'https://api.reconcileai.hng.tech/upload'; const reconcileUrl = `https://api.reconcileai.hng.tech/reconcile`; @@ -180,9 +184,9 @@ export const UserProvider = ({ children }) => { localStorage.removeItem('localData3'); setLocalData([]); setLocalData2([]); - setFileDropped([]); - setFileDropped2([]); - setLocalData3([]); + setFileDropped(fileDropped); + setFileDropped2(fileDropped2); + setLocalData3(localData3); }; const value = useMemo( diff --git a/frontend/src/pages/Dashboard/ImportData/Hero/ImportData.jsx b/frontend/src/pages/Dashboard/ImportData/Hero/ImportData.jsx index e50ddc7e..29ea77ec 100644 --- a/frontend/src/pages/Dashboard/ImportData/Hero/ImportData.jsx +++ b/frontend/src/pages/Dashboard/ImportData/Hero/ImportData.jsx @@ -233,6 +233,7 @@ function ImportData() { {fileValidationError && !uploadLoading && ( + )}