Added Notifications
This commit is contained in:
@@ -25,7 +25,7 @@ function getCode(airline: Airline): string | null {
|
||||
|
||||
function airlineEntriesForLetter(letter: string): AirlineEntry[] {
|
||||
const flights = props.flightsByLetter[letter] ?? []
|
||||
const seen = new Map<string, AirlineEntry>()
|
||||
const seen = new Map<number, AirlineEntry>() // key by airline.id
|
||||
|
||||
for (const flight of flights) {
|
||||
const airline = flight.airline
|
||||
@@ -35,15 +35,15 @@ function airlineEntriesForLetter(letter: string): AirlineEntry[] {
|
||||
if (!code?.startsWith(letter)) continue
|
||||
|
||||
const year = new Date(flight.departure_date).getFullYear()
|
||||
const existing = seen.get(code)
|
||||
const existing = seen.get(airline.id)
|
||||
if (!existing || year < existing.firstYear) {
|
||||
seen.set(code, { airline, code, firstYear: year })
|
||||
seen.set(airline.id, { airline, code, firstYear: year })
|
||||
}
|
||||
}
|
||||
|
||||
return [...seen.entries()]
|
||||
.sort(([a], [b]) => a.localeCompare(b))
|
||||
.map(([, entry]) => entry)
|
||||
return [...seen.values()]
|
||||
.sort((a, b) => a.code.localeCompare(b.code))
|
||||
.map(entry => entry)
|
||||
}
|
||||
|
||||
function isHighlighted({ firstYear }: AirlineEntry): boolean {
|
||||
@@ -89,7 +89,7 @@ defineExpose({ toBBCode })
|
||||
<template #items="{ row: letter }">
|
||||
<div
|
||||
v-for="entry in airlineEntriesForLetter(letter)"
|
||||
:key="entry.airline.IATA_code!"
|
||||
:key="entry.airline.id"
|
||||
>
|
||||
<InlineBadge style="align-items:center;gap:0.2em" :variant="isHighlighted(entry) ? 'business' : undefined">
|
||||
<AirlineLogo :airline="entry.airline" /> {{ entry.code }}
|
||||
|
||||
Reference in New Issue
Block a user