diff --git a/.github/workflows/pr-changelog-label-check.yml b/.github/workflows/pr-changelog-label-check.yml index 42c451c..9682635 100644 --- a/.github/workflows/pr-changelog-label-check.yml +++ b/.github/workflows/pr-changelog-label-check.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest permissions: issues: write - pull-requests: read + pull-requests: write steps: - name: Check for required label(s) uses: mheap/github-action-required-labels@v5 diff --git a/README.md b/README.md index b1137f4..5916d67 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,9 @@ +[![Docker Pulls](https://img.shields.io/docker/pulls/johly/airtrail?style=for-the-badge)]() +[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/johanohly/AirTrail/build.yml?style=for-the-badge)]() +[![GitHub Release](https://img.shields.io/github/v/release/johanohly/AirTrail?style=for-the-badge)]() +[![Contributors](https://img.shields.io/github/contributors/johanohly/AirTrail?style=for-the-badge)]() +[![GitHub Stars](https://img.shields.io/github/stars/johanohly/AirTrail?style=for-the-badge)]() +
{label}
+{item.label}
@@ -40,12 +40,7 @@{item.label}
diff --git a/src/lib/components/dock/index.ts b/src/lib/components/dock/index.ts index c0dafe2..d7d5d07 100644 --- a/src/lib/components/dock/index.ts +++ b/src/lib/components/dock/index.ts @@ -1,3 +1,5 @@ export { default as Dock } from './Dock.svelte'; export { default as DockItem } from './DockItem.svelte'; export { default as DockTooltipItem } from './DockTooltipItem.svelte'; +export { default as DockDropdownItem } from './DockDropdownItem.svelte'; +export { default as DockFloatingItem } from './DockFloatingItem.svelte'; diff --git a/src/lib/components/form-fields/AircraftField.svelte b/src/lib/components/form-fields/AircraftField.svelte index a28ebbf..0250ce8 100644 --- a/src/lib/components/form-fields/AircraftField.svelte +++ b/src/lib/components/form-fields/AircraftField.svelte @@ -59,7 +59,6 @@ { key: 'icao', exact: true }, { key: 'name', exact: false }, ], - 20, ); } else { aircraft = []; diff --git a/src/lib/components/form-fields/AirlineField.svelte b/src/lib/components/form-fields/AirlineField.svelte index b7ee9d8..b1373b0 100644 --- a/src/lib/components/form-fields/AirlineField.svelte +++ b/src/lib/components/form-fields/AirlineField.svelte @@ -38,6 +38,19 @@ $formData.airline = item?.value ?? null; }); + // If the field is updated externally, update the selected value + formData.subscribe((data) => { + if (data['airline'] === $selected?.value) return; + selected.set( + data['airline'] + ? { + label: airlineFromICAO(data['airline'])?.name, + value: data['airline'], + } + : undefined, + ); + }); + $effect(() => { if (!$open) { $inputValue = $selected?.label ?? ''; @@ -47,16 +60,11 @@ let airlines: Airline[] = $state([]); $effect(() => { if ($touchedInput && $inputValue !== '') { - airlines = sortAndFilterByMatch( - AIRLINES, - $inputValue, - [ - { key: 'icao', exact: true }, - { key: 'iata', exact: true }, - { key: 'name', exact: false }, - ], - 20, - ); + airlines = sortAndFilterByMatch(AIRLINES, $inputValue, [ + { key: 'icao', exact: true }, + { key: 'iata', exact: true }, + { key: 'name', exact: false }, + ]); } else { airlines = []; } diff --git a/src/lib/components/form-fields/AirportField.svelte b/src/lib/components/form-fields/AirportField.svelte index fc88f74..2531125 100644 --- a/src/lib/components/form-fields/AirportField.svelte +++ b/src/lib/components/form-fields/AirportField.svelte @@ -9,7 +9,11 @@ import { z } from 'zod'; import type { flightSchema } from '$lib/zod/flight'; import { writable } from 'svelte/store'; - import { type Airport, airportFromICAO, airportSearchCache } from '$lib/utils/data/airports'; + import { + type Airport, + airportFromICAO, + airportSearchCache, + } from '$lib/utils/data/airports'; let { field, @@ -42,6 +46,19 @@ } }); + // If the field is updated externally, update the selected value + formData.subscribe((data) => { + if (data[field] === $selected?.value) return; + selected.set( + data[field] + ? { + label: airportFromICAO(data[field])?.name, + value: data[field], + } + : undefined, + ); + }); + $effect(() => { if (!$open) { $inputValue = $selected?.label ?? ''; diff --git a/src/lib/components/map/Map.svelte b/src/lib/components/map/Map.svelte index 45988ea..fe462da 100644 --- a/src/lib/components/map/Map.svelte +++ b/src/lib/components/map/Map.svelte @@ -28,6 +28,7 @@ const FROM_COLOR = [59, 130, 246]; // Also the primary color const TO_COLOR = [139, 92, 246]; // TW violet-500 const HOVER_COLOR = [16, 185, 129]; + const FUTURE_COLOR = [102, 217, 239, 100]; let { flights, @@ -102,9 +103,17 @@ getSourcePosition={(d) => d.from.position} getTargetPosition={(d) => d.to.position} getSourceColor={(d) => - hoveredArc && d === hoveredArc ? HOVER_COLOR : FROM_COLOR} + hoveredArc && d === hoveredArc + ? HOVER_COLOR + : d.exclusivelyFuture + ? FUTURE_COLOR + : FROM_COLOR} getTargetColor={(d) => - hoveredArc && d === hoveredArc ? HOVER_COLOR : TO_COLOR} + hoveredArc && d === hoveredArc + ? HOVER_COLOR + : d.exclusivelyFuture + ? FUTURE_COLOR + : TO_COLOR} updateTriggers={{ getSourceColor: hoveredArc, getTargetColor: hoveredArc }} getWidth={2} getHeight={0} diff --git a/src/lib/components/modals/add-flight/AddFlightModal.svelte b/src/lib/components/modals/add-flight/AddFlightModal.svelte index 91daf22..111d263 100644 --- a/src/lib/components/modals/add-flight/AddFlightModal.svelte +++ b/src/lib/components/modals/add-flight/AddFlightModal.svelte @@ -9,11 +9,10 @@ import FlightInformation from './FlightInformation.svelte'; import SeatInformation from './SeatInformation.svelte'; import { page } from '$app/stores'; + import FlightNumber from '$lib/components/modals/add-flight/FlightNumber.svelte'; + import { trpc } from '$lib/trpc'; - let { - open = $bindable(), - invalidator, - }: { open: boolean; invalidator: { onSuccess: () => void } } = $props(); + let { open = $bindable() }: { open: boolean } = $props(); const form = superForm( defaults