From ffe0865b97349490ddaf5b45de37ac0990393c28 Mon Sep 17 00:00:00 2001 From: Luc Date: Thu, 19 Dec 2024 02:26:11 +0100 Subject: [PATCH] Update build details update available --- web/src/components/settings/BuildDetails.tsx | 69 ++++++++++++++++---- 1 file changed, 55 insertions(+), 14 deletions(-) diff --git a/web/src/components/settings/BuildDetails.tsx b/web/src/components/settings/BuildDetails.tsx index 6edcbe3..e0228c7 100644 --- a/web/src/components/settings/BuildDetails.tsx +++ b/web/src/components/settings/BuildDetails.tsx @@ -1,3 +1,5 @@ +import { match } from 'ts-pattern'; + import { useInstanceSettings, useInstanceVersion, @@ -12,22 +14,61 @@ export const BuildDetails = () => { 'https://github.com/v3xlabs/v3x-property/commit/' + instanceSettings.build_info.git_hash; + const isAlpha = instanceSettings?.build_info.version.includes('alpha'); + const update_available = instanceVersion?.update_available; + return (
- {instanceVersion?.update_available ? ( -
-
Update available
-
- You are running{' '} - {instanceVersion?.version}{' '} - but{' '} - {instanceVersion?.latest}{' '} - is available! -
-
- ) : ( -
You are on the latest
- )} + {match({ + update_available, + isAlpha, + }) + .with( + { + update_available: true, + isAlpha: false, + }, + () => ( +
+
Update available
+
+ You are running{' '} + + {instanceVersion?.version} + {' '} + but{' '} + + {instanceVersion?.latest} + {' '} + is available! +
+
+ ) + ) + .with( + { + isAlpha: true, + }, + () => ( +
+
You're running an alpha build
+
+ ) + ) + .with( + { + update_available: false, + isAlpha: false, + }, + () => ( +
+
You are on the latest
+
+ ) + ) + .otherwise(() => ( + <> + ))}