From d9da3b6c32b82dc554c849b7cecf3b5ba3471db3 Mon Sep 17 00:00:00 2001 From: Tin Geber <tin@greenhost.nl> Date: Thu, 1 Jun 2023 14:58:28 +0200 Subject: [PATCH] if else logic fix --- frontend/src/modules/dashboard/Dashboard.tsx | 22 +++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/frontend/src/modules/dashboard/Dashboard.tsx b/frontend/src/modules/dashboard/Dashboard.tsx index e0216c41..20a5b548 100644 --- a/frontend/src/modules/dashboard/Dashboard.tsx +++ b/frontend/src/modules/dashboard/Dashboard.tsx @@ -88,36 +88,42 @@ export const Dashboard: React.FC = () => { </div> ) : null; + const branch = sysInfo.sysInfo.followingGit; + + // eslint-disable-next-line + // let branch = 'DF234FD'; + const knownMainBranch = 'v2'; + const versionInfo = - sysInfo.sysInfo.followingGit === 'v2' ? ( + branch === knownMainBranch ? ( <> <CheckCircleIcon className="h-4 w-4 text-primary-600" /> <span>Stackspin v{sysInfo.sysInfo.version}</span> </> - ) : sysInfo.sysInfo.followingGit !== 'v2' ? null : ( + ) : branch !== knownMainBranch ? ( <> <span>Stackspin v{sysInfo.sysInfo.version}</span> </> - ); + ) : null; const updatesText = - sysInfo.sysInfo.followingGit === 'v2' ? ( + branch === knownMainBranch ? ( <> <div className="px-4 py-2 flex items-center gap-1"> <HomeIcon className="w-4 h-4 text-gray-500" /> - <span>Using main branch ({sysInfo.sysInfo.followingGit})</span> + <span>Using main branch ({branch})</span> </div> <div className="px-4 py-2 flex items-center gap-1"> <RefreshIcon className="w-4 h-4 text-gray-500" /> <span>Automatic updates active</span> </div> </> - ) : sysInfo.sysInfo.followingGit !== 'v2' ? null : ( + ) : branch !== knownMainBranch ? ( <div className="px-4 py-2 flex items-center gap-1"> <BeakerIcon className="w-4 h-4 text-gray-500" /> - <span>Using custom branch (SHA {sysInfo.sysInfo.version})</span> + <span>Custom branch ({branch})</span> </div> - ); + ) : null; return ( <div className="relative"> -- GitLab