Added Crew and General Aviation Filters
This commit is contained in:
@@ -1,26 +1,16 @@
|
||||
<script setup lang="ts">
|
||||
import {Flight} from "@/Types/types";
|
||||
import {BadgeVariant, Flight} from "@/Types/types";
|
||||
import InlineBadge from "@/Components/FlightsGoneBy/InlineBadge.vue";
|
||||
|
||||
const props = defineProps<{
|
||||
flight: Flight
|
||||
}>();
|
||||
|
||||
type BadgeVariant = 'first' | 'business' | 'premium' | 'economy' | 'private' | 'unspecified';
|
||||
|
||||
function classVariant(name?: string | null): BadgeVariant {
|
||||
const n = name?.toLowerCase() ?? '';
|
||||
if (n.includes('private')) return 'private';
|
||||
if (n.includes('first')) return 'first';
|
||||
if (n.includes('business')) return 'business';
|
||||
if (n.includes('premium')) return 'premium';
|
||||
if (n.includes('economy')) return 'economy';
|
||||
return 'unspecified';
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<InlineBadge :variant="classVariant(flight.flight_class?.name)">
|
||||
<InlineBadge :variant="flight.flight_class?.internal_name ?? 'generic'">
|
||||
{{ flight.flight_class?.name }}
|
||||
</InlineBadge>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user