diff --git a/frontend/src/modules/dashboard/components/VersionInfo/VersionInfo.tsx b/frontend/src/modules/dashboard/components/VersionInfo/VersionInfo.tsx index 60251d8cf309110cb3759ef333e1184bc643e187..8f7da1cb90f46c8758bdbe973ccf9f9154f22fad 100644 --- a/frontend/src/modules/dashboard/components/VersionInfo/VersionInfo.tsx +++ b/frontend/src/modules/dashboard/components/VersionInfo/VersionInfo.tsx @@ -15,40 +15,37 @@ export const VersionInfo = (sysInfo: SysInfoState) => { const branch = sysInfo.sysInfo.followingGit; const updateTime: Date = new Date(sysInfo.sysInfo.lastUpdated); - // eslint-disable-next-line - // let branch = 'DF234FD'; - const knownMainBranch = 'v2'; + const branchInfoAvailable = typeof branch !== 'undefined'; + const stableBranch = branchInfoAvailable ? branch.match(/^v(\d)+$/) : false; - const versionInfo = - branch === knownMainBranch ? ( - <> - <CheckCircleIcon className="h-4 w-4 text-primary-600" /> - <span>Stackspin v{sysInfo.sysInfo.version}</span> - </> - ) : branch !== knownMainBranch ? ( - <> - <span>Stackspin v{sysInfo.sysInfo.version}</span> - </> - ) : null; + const versionInfo = stableBranch ? ( + <> + <CheckCircleIcon className="h-4 w-4 text-primary-600" /> + <span>Stackspin v{sysInfo.sysInfo.version}</span> + </> + ) : branchInfoAvailable ? ( + <> + <span>Stackspin v{sysInfo.sysInfo.version}</span> + </> + ) : null; - const updatesText = - branch === knownMainBranch ? ( - <> - <div className="px-4 py-2 flex items-center gap-1"> - <HomeIcon className="w-4 h-4 text-gray-500" /> - <span>Latest stable 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> - </> - ) : branch !== knownMainBranch ? ( + const updatesText = stableBranch ? ( + <> <div className="px-4 py-2 flex items-center gap-1"> - <BeakerIcon className="w-4 h-4 text-gray-500" /> - <span>Custom branch ({branch})</span> + <HomeIcon className="w-4 h-4 text-gray-500" /> + <span>Latest stable branch ({branch})</span> </div> - ) : null; + <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> + </> + ) : branchInfoAvailable ? ( + <div className="px-4 py-2 flex items-center gap-1"> + <BeakerIcon className="w-4 h-4 text-gray-500" /> + <span>Custom branch ({branch})</span> + </div> + ) : null; return ( <Popover className="relative flex items-center">