Remove invalid versions when filtering platforms (#801)

This commit is contained in:
Bjarne Koll 2022-07-29 23:31:57 +02:00 committed by GitHub
parent 571c2cad5c
commit 451056ce1e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -89,6 +89,15 @@ function versions(platform: Platform) {
});
}
function updatePlatform(platform: any) {
filters.value.platform = platform;
const allowedVersion = versions(platform);
filters.value.versions = filters.value.versions.filter((existingVersion) => {
return allowedVersion.find((allowedNewVersion) => allowedNewVersion.version === existingVersion);
});
}
const meta = useSeo("Home", null, route, null);
const script = {
type: "application/ld+json",
@ -167,7 +176,7 @@ useHead(meta);
<div class="flex flex-col gap-1">
<ul>
<li v-for="platform in backendData.visiblePlatforms" :key="platform.enumName" class="inline-flex w-full">
<InputRadio v-model="filters.platform" :value="platform.enumName" :label="platform.name">
<InputRadio :label="platform.name" :model-value="filters.platform" :value="platform.enumName" @update:modelValue="updatePlatform">
<PlatformLogo :platform="platform.enumName" :size="24" class="mr-1" />
</InputRadio>
</li>