Skip to content

Commit

Permalink
Update build details update available
Browse files Browse the repository at this point in the history
  • Loading branch information
lucemans committed Dec 19, 2024
1 parent 4508bd8 commit ffe0865
Showing 1 changed file with 55 additions and 14 deletions.
69 changes: 55 additions & 14 deletions web/src/components/settings/BuildDetails.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { match } from 'ts-pattern';

import {
useInstanceSettings,
useInstanceVersion,
Expand All @@ -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 (
<div className="card space-y-2">
{instanceVersion?.update_available ? (
<div className="card bg-primary-foreground">
<div className="font-bold">Update available</div>
<div className="">
You are running{' '}
<code className="code">{instanceVersion?.version}</code>{' '}
but{' '}
<code className="code">{instanceVersion?.latest}</code>{' '}
is available!
</div>
</div>
) : (
<div>You are on the latest</div>
)}
{match({
update_available,
isAlpha,
})
.with(
{
update_available: true,
isAlpha: false,
},
() => (
<div className="card bg-yellow-100">
<div className="font-bold">Update available</div>
<div className="">
You are running{' '}
<code className="code border border-yellow-500 rounded-md !bg-yellow-50">
{instanceVersion?.version}
</code>{' '}
but{' '}
<code className="code border border-yellow-500 rounded-md !bg-yellow-50">
{instanceVersion?.latest}
</code>{' '}
is available!
</div>
</div>
)
)
.with(
{
isAlpha: true,
},
() => (
<div className="bg-yellow-100/50 p-2 px-3 border border-yellow-500 rounded-md">
<div>You're running an alpha build</div>
</div>
)
)
.with(
{
update_available: false,
isAlpha: false,
},
() => (
<div className="bg-green-100/50 p-2 px-3 border border-green-500 rounded-md">
<div>You are on the latest</div>
</div>
)
)
.otherwise(() => (
<></>
))}
<div className="grid grid-cols-1 md:grid-cols-2 gap-2">
<div>
<a href={github_link} className="link" target="_blank">
Expand Down

0 comments on commit ffe0865

Please sign in to comment.