From 74d05691ca8b89d156b6410ea4aabd693c1c9326 Mon Sep 17 00:00:00 2001 From: Charles Le Maux Date: Thu, 4 Jul 2024 06:13:10 +0100 Subject: [PATCH] [~] Fixed poor optimisation. --- src/components/serverCard/serverCard.jsx | 11 +++-------- src/components/serverCard/serverCard.module.scss | 5 ----- src/pages/DashboardPage/DashboardPage.jsx | 7 ++++--- 3 files changed, 7 insertions(+), 16 deletions(-) diff --git a/src/components/serverCard/serverCard.jsx b/src/components/serverCard/serverCard.jsx index 48e0c84..7b7654f 100644 --- a/src/components/serverCard/serverCard.jsx +++ b/src/components/serverCard/serverCard.jsx @@ -5,12 +5,8 @@ const ServerCard = ({ color, status, version, link, name, onRunClick, onStopClic const getStatusColor = () => { switch (status) { - case 'En cours': + case true: return 'green'; - case 'Démarrage': - return 'orange'; - case 'Hors ligne': - return 'gray'; default: return 'gray'; } @@ -49,12 +45,11 @@ const ServerCard = ({ color, status, version, link, name, onRunClick, onStopClic
{name}
-
{status}
- {status === 'Hors ligne' && ( + {status && ( )} - {status === 'En cours' && ( + {!status && ( )}
diff --git a/src/components/serverCard/serverCard.module.scss b/src/components/serverCard/serverCard.module.scss index c295275..af0ecd0 100644 --- a/src/components/serverCard/serverCard.module.scss +++ b/src/components/serverCard/serverCard.module.scss @@ -37,11 +37,6 @@ font-size: 1.5rem; } -.statusText { - font-size: 1rem; - margin-top: 0.5rem; -} - .version { font-size: 1.5rem; margin-left: auto; diff --git a/src/pages/DashboardPage/DashboardPage.jsx b/src/pages/DashboardPage/DashboardPage.jsx index 097f74c..9d6a5b4 100644 --- a/src/pages/DashboardPage/DashboardPage.jsx +++ b/src/pages/DashboardPage/DashboardPage.jsx @@ -43,6 +43,7 @@ const DashboardPage = ({ user }) => { const handleRunServer = async (serverName) => { try { await serviiApi.serverRun(serverName); + await loadServers(); } catch (error) { console.error('Error starting server:', error); } @@ -51,6 +52,7 @@ const DashboardPage = ({ user }) => { const handleStopServer = async (serverName) => { try { await serviiApi.serverStop(serverName); + await loadServers(); } catch (error) { console.error('Error stopping server:', error); } @@ -59,7 +61,7 @@ const DashboardPage = ({ user }) => { const handleDeleteServer = async (serverName) => { try { await serviiApi.serverDelete(serverName); - loadServers(); + await loadServers(); } catch (error) { console.error('Error deleting server:', error); } @@ -79,10 +81,9 @@ const DashboardPage = ({ user }) => { handleRunServer(server.name)} onStopClick={() => handleStopServer(server.name)} onDeleteClick={() => handleDeleteServer(server.name)}