From f3db54e7d5b718011e1f09e8840d15d2c9a1c973 Mon Sep 17 00:00:00 2001 From: Akalanka Date: Sun, 15 Oct 2023 01:31:58 +0530 Subject: [PATCH] Fix: id form btn loading glitch --- package.json | 2 +- pnpm-lock.yaml | 11 ++++------- src/components/identification-form.jsx | 10 +++++----- 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/package.json b/package.json index a29c879..8eae00e 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "@azure/storage-blob": "12.15.0", "@reduxjs/toolkit": "1.9.5", "@sentry/react": "7.69.0", - "@sliit-foss/bashaway-ui": "0.8.0", + "@sliit-foss/bashaway-ui": "0.10.3", "async-mutex": "^0.4.0", "firebase": "10.2.0", "framer-motion": "10.14.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 6e20f6c..a5b6deb 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -13,9 +13,6 @@ dependencies: '@azure/storage-blob': specifier: 12.15.0 version: 12.15.0 - '@radix-ui/react-accordion': - specifier: 1.1.2 - version: 1.1.2(@types/react-dom@18.0.11)(@types/react@18.0.28)(react-dom@18.0.0)(react@18.0.0) '@reduxjs/toolkit': specifier: 1.9.5 version: 1.9.5(react-redux@8.1.2)(react@18.0.0) @@ -23,8 +20,8 @@ dependencies: specifier: 7.69.0 version: 7.69.0(react@18.0.0) '@sliit-foss/bashaway-ui': - specifier: 0.8.0 - version: 0.8.0(@babel/core@7.22.9)(@types/react-dom@18.0.11)(@types/react@18.0.28)(react-native@0.72.4)(redux@4.2.1)(tailwindcss@3.3.2) + specifier: 0.10.3 + version: 0.10.3(@babel/core@7.22.9)(@types/react-dom@18.0.11)(@types/react@18.0.28)(react-native@0.72.4)(redux@4.2.1)(tailwindcss@3.3.2) async-mutex: specifier: ^0.4.0 version: 0.4.0 @@ -3882,8 +3879,8 @@ packages: '@sinonjs/commons': 3.0.0 dev: false - /@sliit-foss/bashaway-ui@0.8.0(@babel/core@7.22.9)(@types/react-dom@18.0.11)(@types/react@18.0.28)(react-native@0.72.4)(redux@4.2.1)(tailwindcss@3.3.2): - resolution: {integrity: sha512-olPfiY7pWzmGpDkav62FeaFZ2UbLW8o7drENfwqMibXGmhGtbIgtZ5AsUQ2KDA+9Z8XrZzPxLJiEhnTI1IbzMQ==} + /@sliit-foss/bashaway-ui@0.10.3(@babel/core@7.22.9)(@types/react-dom@18.0.11)(@types/react@18.0.28)(react-native@0.72.4)(redux@4.2.1)(tailwindcss@3.3.2): + resolution: {integrity: sha512-7hI44+c+mdJUqLPNi8t/WY5ivlmpMSiARs/FFHF8Wkf4PUcJl3xkEjoo54oXr21fS+LNzRm/AWi/qTLuOk3FwA==} dependencies: '@radix-ui/react-accordion': 1.1.2(@types/react-dom@18.0.11)(@types/react@18.0.28)(react-dom@18.0.0)(react@18.0.0) '@radix-ui/react-alert-dialog': 1.0.4(@types/react-dom@18.0.11)(@types/react@18.0.28)(react-dom@18.0.0)(react@18.0.0) diff --git a/src/components/identification-form.jsx b/src/components/identification-form.jsx index 82d1fdd..d7f2ccf 100644 --- a/src/components/identification-form.jsx +++ b/src/components/identification-form.jsx @@ -34,6 +34,7 @@ const IdentificationForm = () => { const [formData, setFormData] = useState(team?.members); const [idFiles, setIdFiles] = useState([]); + const [isUploading, setIsUploading] = useState(false); useEffect(() => { if (team) setFormData(team.members); @@ -49,14 +50,13 @@ const IdentificationForm = () => { ) { return toast({ variant: "destructive", title: "Please make sure that all required fields are filled" }); } + setIsUploading(true); const members = await Promise.all( formData.map(async (member, index) => { - if (idFiles[index]) { - member["student_id_url"] = await uploadIdCard(team.name, member.name, idFiles[index]); - } + if (idFiles[index]) member["student_id_url"] = await uploadIdCard(team.name, member.name, idFiles[index]); return member; }) - ); + ).finally(() => setIsUploading(false)); await updateProfile({ id: team._id, data: { members } @@ -157,7 +157,7 @@ const IdentificationForm = () => { ))} -