From d3d64e379629486d70d39a1827f95f1ebae21c41 Mon Sep 17 00:00:00 2001 From: harshau007 Date: Sat, 8 Jun 2024 13:51:47 +0530 Subject: [PATCH] Changed Theme & Need to fix multiple clicking of Update button --- frontend/src/App.tsx | 2 +- .../src/components/CountrySelectionScreen.tsx | 8 ++++++- frontend/src/components/WelcomeScreen.tsx | 21 +++++++++++-------- 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index e19c856..d561216 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -79,7 +79,7 @@ const App: React.FC = () => {
= ({ }; return ( -
+

Update MirrorList

diff --git a/frontend/src/components/WelcomeScreen.tsx b/frontend/src/components/WelcomeScreen.tsx index 8a4db40..6c4ee84 100644 --- a/frontend/src/components/WelcomeScreen.tsx +++ b/frontend/src/components/WelcomeScreen.tsx @@ -23,9 +23,9 @@ const WelcomeScreen: React.FC = ({ goToScreen, isDarkMode }) => { const [modalVisible, setModalVisible] = useState(false); const [modalTitle, setModalTitle] = useState(""); const [modalMessage, setModalMessage] = useState(""); - const [loading, setLoading] = useState(false); const [isInstalled, setIsInstalled] = useState(false); const [isActiveScreenRes, setIsActiveScreenRes] = useState(false); + const [isUpdating, setIsUpdating] = useState(false); const [isActiveInstall, setIsActiveInstall] = useState(false); useEffect(() => { @@ -47,17 +47,14 @@ const WelcomeScreen: React.FC = ({ goToScreen, isDarkMode }) => { }; const handleUpdateSystem = async () => { - setLoading(true); + setIsUpdating(true); try { await UpdateSystem(); - setModalTitle("Success"); - setModalMessage("System updated successfully."); } catch (error) { setModalTitle("Error"); setModalMessage("Failed to update the system."); } finally { - setLoading(false); - setModalVisible(true); + setIsUpdating(false); } }; @@ -74,7 +71,13 @@ const WelcomeScreen: React.FC = ({ goToScreen, isDarkMode }) => { }; return ( -
+
App Icon

Welcome to ALG

@@ -94,11 +97,11 @@ const WelcomeScreen: React.FC = ({ goToScreen, isDarkMode }) => {