mirror of
https://github.com/ivabus/gui
synced 2025-04-23 14:07:14 +03:00
filter what is available in user arch (#542)
Co-authored-by: neil molina <neil@neils-MacBook-Pro.local>
This commit is contained in:
parent
7ae1dd2ddb
commit
90b7c750de
2 changed files with 9 additions and 13 deletions
|
@ -46,20 +46,15 @@
|
|||
>
|
||||
<div class="version-button h-full">
|
||||
<div class="flex h-full flex-col justify-center p-2">
|
||||
{#if hasVersionSelectorDropdown}
|
||||
<div class="flex items-center justify-between gap-x-2">
|
||||
<div class="flex items-center gap-x-2">
|
||||
<div>{ctaLabel}</div>
|
||||
<div class="version-label {badgeClass[pkg.state]}">{pkg.version}</div>
|
||||
</div>
|
||||
<i class="icon-downward-arrow flex" />
|
||||
</div>
|
||||
{:else}
|
||||
<div class="flex items-center justify-center gap-x-2">
|
||||
<div class="flex items-center justify-between gap-x-2">
|
||||
<div class="flex items-center gap-x-2">
|
||||
<div>{ctaLabel}</div>
|
||||
<div class="version-label {badgeClass[pkg.state]}">{pkg.version}</div>
|
||||
</div>
|
||||
{/if}
|
||||
{#if hasVersionSelectorDropdown}
|
||||
<i class="icon-downward-arrow flex" />
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
<!-- This slot holds the drop down menu and it inside of the button so that the
|
||||
hover effect remain on the button while the user is hovering the dropdown items-->
|
||||
|
|
|
@ -3,15 +3,16 @@ import { clean } from "semver";
|
|||
import semverCompare from "semver/functions/compare";
|
||||
|
||||
// Find a list of available versions for a package based on the bottles
|
||||
export const findAvailableVersions = (pkg: GUIPackage) => {
|
||||
export const findAvailableVersions = (pkg: Pick<GUIPackage, "bottles" | "version">) => {
|
||||
// default to just showing the latest if bottles haven't loaded yet
|
||||
if (!pkg.bottles) {
|
||||
return [pkg.version];
|
||||
}
|
||||
|
||||
const versionSet = new Set<string>();
|
||||
const arch = process.arch === "arm64" ? "aarch64" : "x86-64";
|
||||
for (const b of pkg.bottles) {
|
||||
versionSet.add(b.version);
|
||||
if (b.arch === arch) versionSet.add(b.version);
|
||||
}
|
||||
|
||||
return Array.from(versionSet).sort((a, b) => semverCompare(cleanVersion(b), cleanVersion(a)));
|
||||
|
|
Loading…
Reference in a new issue