Compare commits

...
32 Commits
Author SHA1 Message Date
dredgy 91a6873b64 Merge pull request 'Add historic airports to database' (#20) from add-historic-airports into main
Reviewed-on: #20
2026-08-22 14:14:05 +10:00
dredgy 4a9b1ad56a Add historic airports to database 2026-08-22 14:13:37 +10:00
dredgy ad61508b3c Merge pull request 'Add a flight arc on the map for flights with same departing and arrival airport' (#19) from add-same-point-flights into main
Reviewed-on: #19
2026-08-22 13:16:10 +10:00
dredgy 95ed0e339f Add a flight arc on the map for flights with same departing and arrival airport 2026-08-22 13:15:39 +10:00
dredgy 4102dd29ef Merge pull request 'Add a flight arc on the map for flights with same departing and arrival airport' (#18) from add-same-point-flights into main
Reviewed-on: #18
2026-08-22 13:11:34 +10:00
dredgy 28fd782a40 Add a flight arc on the map for flights with same departing and arrival airport 2026-08-22 13:11:03 +10:00
dredgy 3c66a3945c Merge pull request 'Fix achievement category ordering' (#17) from fix-achievement-category-ordering into main
Reviewed-on: #17
2026-08-21 23:23:24 +10:00
dredgy a68e31dad7 Merge remote-tracking branch 'origin/main' into fix-achievement-category-ordering 2026-08-21 23:22:56 +10:00
dredgy 023ce6f964 Sort achievement categories 2026-08-21 23:22:42 +10:00
dredgy c66c734868 Merge pull request 'Ui fixes' (#16) from ui-fixes into main
Reviewed-on: #16
2026-08-21 22:54:13 +10:00
dredgy 94a7bc2807 Added missing data tooltips 2026-08-21 22:53:29 +10:00
dredgy 4a296705a6 Added admin controls for missing airlines 2026-08-21 22:41:29 +10:00
dredgy a6bf1c09fe Added "Save Flight And Add Another Button" 2026-08-21 22:17:53 +10:00
dredgy ef73dc0bc3 Added note on flight details page 2026-08-21 22:03:10 +10:00
dredgy b395de6719 Fixed column width on mobile and added a note column 2026-08-21 21:59:04 +10:00
dredgy 3b4ded2fab Fixed notification menu on mobile 2026-08-21 21:45:52 +10:00
dredgy 5492cc72d7 Updated arrival date input on flight form 2026-08-21 21:40:02 +10:00
dredgy 76118d0bfd Set default view to Profile 2026-08-21 20:52:06 +10:00
dredgy c0b8d10add Make progressive achievements get notifications when complete 2026-08-21 17:02:12 +10:00
dredgy 3ae1e75275 Merge branch 'make-flighttooltip-better-on-mobile' into main 2026-08-20 16:47:07 +10:00
dredgy 1ef4ae4a21 Merge remote-tracking branch 'origin/main' into make-flighttooltip-better-on-mobile 2026-08-20 16:46:44 +10:00
dredgy 90ea8d81d2 Allow "Log 1st Flight" achievement to be awarded even if flight is upcoming 2026-08-20 16:21:14 +10:00
dredgy 8514d76724 Merge pull request 'Tooltip on Mobile' (#12) from make-flighttooltip-better-on-mobile into main
Reviewed-on: #12
2026-08-16 20:48:02 +10:00
dredgy 7bca9a8d31 Tooltip on Mobile 2026-08-16 20:47:20 +10:00
dredgy e17203aefc Merge pull request 'Formatting and Share Buttons' (#11) from form-validation-improvements into main
Reviewed-on: #11
2026-08-15 21:05:22 +10:00
dredgy 02521da9c3 Merge remote-tracking branch 'origin/main' into form-validation-improvements
# Conflicts:
#	resources/js/Components/FlightsGoneBy/MainHeader.vue
2026-08-15 21:05:07 +10:00
dredgy ed0ce97548 Formatting and Share Buttons 2026-08-15 21:02:02 +10:00
dredgy 1030a14094 Merge pull request 'Add London Airport and Million Mile Challenges' (#10) from add-london-airport-challenge into main
Reviewed-on: #10
2026-08-11 20:53:13 +10:00
dredgy 2b41c3ed44 Add London Airport and Million Mile Challenges 2026-08-11 20:52:21 +10:00
dredgy 65e8c7575e Allowed filters in the url 2026-08-11 20:04:11 +10:00
dredgy 9d175a1525 Allowed filters in the url 2026-08-11 16:11:31 +10:00
dredgy c602393c95 Adds a user search box 2026-08-09 20:08:49 +10:00
47 changed files with 2043 additions and 596 deletions
@@ -17,7 +17,10 @@ class PopulateAirportTimezones extends Command
*/
public function handle()
{
Airport::whereNull('timezone')->chunkById(100, function ($airports) {
Airport::where(function ($query) {
$query->whereNull('timezone')
->orWhere('timezone', 'Undefined');
})->chunkById(100, function ($airports) {
foreach ($airports as $airport) {
$zoneName = null;
$attempts = 0;
@@ -3,19 +3,35 @@
namespace App\Console\Commands;
use App\Models\User;
use Illuminate\Console\Attributes\Argument;
use Illuminate\Console\Attributes\Description;
use Illuminate\Console\Attributes\Signature;
use Illuminate\Console\Command;
#[Signature('app:recalculate-achivements')]
#[Description('Recalculate achievements for all users')]
#[Signature('app:recalculate-achievements {username? : The username of a single user to recalculate}')]
#[Description('Recalculate achievements for all users, or a single user by username')]
class RecalculateAchievements extends Command
{
public function handle(): void
{
$users = User::all();
foreach ($users as $user) {
$user->calculateAchievements();
$username = $this->argument('username');
if ($username) {
$user = User::where('name', $username)->first();
if (! $user) {
$this->error("No user found with username [{$username}].");
return;
}
$user->calculateAchievements();
$this->info("Recalculated achievements for {$username}.");
return;
}
$users = User::all();
$this->withProgressBar($users, fn (User $user) => $user->calculateAchievements());
$this->newLine();
$this->info("Recalculated achievements for {$users->count()} users.");
}
}
+14
View File
@@ -7,6 +7,7 @@ use App\Models\IgnoredMissingLivery;
use App\Models\User;
use App\Models\UserFlight;
use App\Services\AdminService;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Carbon;
use Inertia\Inertia;
@@ -66,4 +67,17 @@ class AdminController extends Controller
return back();
}
public function ignoreMissingAirline(Request $request): JsonResponse
{
$validated = $request->validate([
'flight_id' => ['required', 'integer', 'exists:user_flights,id'],
]);
$flight = UserFlight::findOrFail($validated['flight_id']);
$flight->ignoreMissingAirline()->firstOrCreate([]);
return response()->json(['status' => 'ok']);
}
}
+5 -1
View File
@@ -252,8 +252,12 @@ class FlightController extends Controller
],
]);
if ($request->boolean('add_more')) {
return redirect()->route('flights.add')
->with('success', 'Flight saved. Add another below.');
}
return redirect()->route('profile.departure-board', [Auth::user()->name, $newFlight->id]);
return redirect()->route('profile.flight', [Auth::user()->name, $newFlight->id]);
}
+34 -4
View File
@@ -5,6 +5,7 @@ namespace App\Http\Controllers;
use App\Models\Aircraft;
use App\Models\Airline;
use App\Models\Airport;
use App\Models\User;
use Illuminate\Http\Request;
class SearchController extends Controller
@@ -57,28 +58,57 @@ class SearchController extends Controller
{
$q = request('q', '');
$len = strlen($q);
$includeInactive = request()->boolean('include_inactive');
if ($len < 3) return [];
return Airport::with('region.country')
->when(!$includeInactive, fn($query) => $query->where('active', true))
->when($len === 3, fn($query) => $query->where('iata_code', 'ilike', $q))
->when($len >= 4, fn($query) => $query->where(function ($sub) use ($q, $len) {
$sub->when($len === 4, fn($s) => $s->where('icao_code', 'ilike', $q))
->orWhere('name', 'ilike', "%{$q}%")
->orWhere('municipality', 'ilike', "%{$q}%");
})->orderByRaw("
}))
->orderByRaw("
CASE
WHEN active THEN 0
ELSE 1
END
")
->orderByRaw("
CASE
WHEN icao_code = ? THEN 0
WHEN iata_code = ? THEN 1
ELSE 2
END
", [$q, $q]))
", [$q, $q])
->limit(15)
->get(['id', 'name', 'municipality', 'iata_code', 'icao_code', 'region_id'])
->map(fn($airport) => [
->get(['id', 'name', 'municipality', 'iata_code', 'icao_code', 'region_id', 'active'])
->map(fn(Airport $airport) => [
'value' => $airport->id,
'title' => $airport->display_name,
'country_code' => strtolower($airport->region->country->code),
'active' => $airport->active,
])
->values();
}
public function users()
{
$q = request('q', '');
if (strlen($q) < 2) return [];
return User::where('name', 'ilike', "%{$q}%")
->orderBy('name')
->limit(50)
->get(['id', 'name'])
->map(fn($user) => [
'value' => $user->id,
'title' => $user->name,
])
->values();
}
+16 -2
View File
@@ -3,7 +3,9 @@
namespace App\Http\Controllers;
use App\Models\Achievement;
use App\Models\AchievementCategory;
use App\Models\Aircraft;
use App\Models\Airport;
use App\Models\Alliance;
use App\Models\Continent;
use App\Models\Country;
@@ -104,8 +106,14 @@ class UserProfileController extends Controller
$achievements = Achievement::with(['category', 'difficulty'])
->orderBy('id', 'asc')
->get()
->groupBy(fn(Achievement $a) => $a->category->name)
->map(fn($group) => $group->sortBy('sort_order')->values());
->groupBy(fn(Achievement $a) => $a->category->internal_name)
->sortBy(function ($group, $internalName) {
$index = array_search($internalName, AchievementCategory::ORDER);
return $index === false ? PHP_INT_MAX : $index;
})
->mapWithKeys(fn($group) => [
$group->first()->category->name => $group->sortBy('sort_order')->values(),
]);
$userAchievements = $user->achievements()
->with('achievement')
@@ -199,6 +207,11 @@ class UserProfileController extends Controller
default => [],
};
$londonAirports = match($achievement->internal_name){
'fun_challenges.all_london_airports' => Airport::LONDON_AIRPORTS,
default => [],
};
$canView = Gate::allows('viewProfileData', $user);
return Inertia::render('Profile/UserAchievement', [
@@ -212,6 +225,7 @@ class UserProfileController extends Controller
'airlines' => $airlines,
'continents' => $continents,
'aircraft_families' => $aircraftFamilies,
'london_airports' => $londonAirports,
'achievementCount' => $user->unlockedAchievements()->count(),
'majorAlliances' => Alliance::whereIn('internal_name', $majorAlliances)->get(),
'canView' => $canView,
+10
View File
@@ -16,6 +16,16 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
*/
class AchievementCategory extends Model
{
const array ORDER = [
'number_of_flights',
'distance',
'general_flying',
'countries_and_continents',
'aircraft',
'airlines_and_alliances',
'fun_challenges',
];
protected $fillable = [
'internal_name',
'name',
+13
View File
@@ -20,12 +20,14 @@ class Airport extends Model
'icao_code',
'iata_code',
'local_code',
'active',
];
protected $casts = [
'latitude_deg' => 'float',
'longitude_deg' => 'float',
'elevation_ft' => 'integer',
'active' => 'boolean',
];
protected $appends = [
@@ -33,6 +35,12 @@ class Airport extends Model
'display_name',
];
const array LONDON_AIRPORTS = [
'LHR', 'LGW', 'STN', 'LTN', 'LCY', 'SEN',
];
protected function displayName() : Attribute{
return Attribute::make(
get: function () {
@@ -49,6 +57,11 @@ class Airport extends Model
);
}
public function scopeActive($query)
{
return $query->where('active', true);
}
public function region(): BelongsTo
{
return $this->belongsTo(Region::class);
+11
View File
@@ -9,6 +9,7 @@ use Illuminate\Database\Eloquent\Casts\Attribute;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasOne;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Storage;
@@ -271,6 +272,16 @@ class UserFlight extends Model
}
public function ignoreMissingAirline(): HasOne
{
return $this->hasOne(UserFlightIgnoreMissingAirline::class);
}
public function isIgnoringMissingAirline(): bool
{
return $this->ignoreMissingAirline()->exists();
}
public function aircraft(): BelongsTo
{
return $this->belongsTo(Aircraft::class);
@@ -0,0 +1,20 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class UserFlightIgnoreMissingAirline extends Model
{
protected $table = 'user_flights_ignore_missing_airlines';
protected $fillable = [
'user_flight_id',
];
public function userFlight(): BelongsTo
{
return $this->belongsTo(UserFlight::class);
}
}
@@ -12,6 +12,7 @@ use App\Services\Achievements\Checkers\AchievementCheckerInterface;
use App\Services\Achievements\Checkers\AircraftChecker;
use App\Services\Achievements\Checkers\CountriesAndContinentsChecker;
use App\Services\Achievements\Checkers\AirlinesAndAlliancesChecker;
use App\Services\Achievements\Checkers\DistanceChecker;
use App\Services\Achievements\Checkers\FunChallengesChecker;
use App\Services\Achievements\Checkers\GeneralFlyingChecker;
use Illuminate\Support\Collection;
@@ -30,6 +31,7 @@ class AchievementService
AircraftChecker::class,
AirlinesAndAlliancesChecker::class,
FunChallengesChecker::class,
DistanceChecker::class,
];
public function __construct()
@@ -45,6 +47,7 @@ class AchievementService
* @var Collection<int,UserFlight> $flights
*/
private Collection $flights;
private int $loggedFlightCount;
public function calculate(User $user): void
{
@@ -62,20 +65,24 @@ class AchievementService
'arrivalAirport.region.continent',
])->where('departure_date', '<=', now('UTC'))->get();
$this->loggedFlightCount = $user->flights()->count();
foreach ($this->checkers as $checkerClass) {
$checker = new $checkerClass($this);
$checker->check($user);
}
}
/**
* @return Collection<int,UserFlight>
*/
public function getFlights(): Collection
{
return $this->flights;
}
public function getLoggedFlightCount(): int
{
return $this->loggedFlightCount;
}
// ---------------------------------------------------------------
// Award / revoke
@@ -91,7 +98,8 @@ class AchievementService
->where('achievement_id', $achievement->id)
->first();
$alreadyUnlocked = $existing !== null;
$alreadyUnlocked = $existing !== null
&& (! $achievement->progressive || $existing->progress >= $achievement->threshold);
UserAchievement::updateOrCreate(
['user_id' => $user->id, 'achievement_id' => $achievement->id],
@@ -15,6 +15,11 @@ abstract class BaseChecker implements AchievementCheckerInterface
return $this->service->getFlights();
}
protected function allLoggedFlightsCount(): int
{
return $this->service->getLoggedFlightCount();
}
/**
* Resolve an achievement ID from its internal name.
* Results are cached on the service so repeated lookups are free.
@@ -0,0 +1,26 @@
<?php
namespace App\Services\Achievements\Checkers;
use App\Models\User;
use App\Models\UserFlight;
use Illuminate\Database\Eloquent\Collection;
class DistanceChecker extends BaseChecker
{
public function check(): void
{
/**
* @var $flights Collection<int, UserFlight>
*/
$flights = $this->flights();
$totalDistance = $flights->sum('distance');
$this->awardProgress((int) $totalDistance, 'distance.circumference_of_the_earth');
$this->awardProgress((int) $totalDistance, 'distance.to_the_moon');
$this->awardProgress((int) $totalDistance, 'distance.gigametre');
$this->awardProgress((int) $totalDistance, 'distance.million_miles');
}
}
@@ -2,6 +2,7 @@
namespace App\Services\Achievements\Checkers;
use App\Models\Airport;
use App\Models\User;
use App\Models\UserFlight;
@@ -131,5 +132,19 @@ class FunChallengesChecker extends BaseChecker
->count();
$this->awardProgress($visitedCanadianProvinces, 'fun_challenges.canadian_provinces');
// --- London Airports ---
$visitedLondonAirports = $flights
->flatMap(fn(UserFlight $f) => [
$f->departureAirport?->iata_code,
$f->arrivalAirport?->iata_code,
])
->filter()
->map(fn($code) => strtoupper($code))
->filter(fn($code) => in_array($code, Airport::LONDON_AIRPORTS))
->unique()
->count();
$this->awardProgress($visitedLondonAirports, 'fun_challenges.all_london_airports');
}
}
@@ -15,10 +15,11 @@ class GeneralFlyingChecker extends BaseChecker
*/
$flights = $this->flights();
$count = $flights->count();
$allLoggedFlightsCount = $this->allLoggedFlightsCount();
// --- Boolean achievements ---
$this->awardIf($count >= 1, 'general_flying.first_flight');
$this->awardIf($allLoggedFlightsCount >= 1, 'general_flying.first_flight');
$this->awardIf(
$flights->contains(fn ($f) => $f->isDomestic()),
@@ -68,14 +69,6 @@ class GeneralFlyingChecker extends BaseChecker
'general_flying.domestic_two_countries'
);
// --- Progressive achievements ---
$totalDistance = $flights->sum('distance');
$this->awardProgress((int) $totalDistance, 'general_flying.circumference_of_the_earth');
$this->awardProgress((int) $totalDistance, 'general_flying.to_the_moon');
$this->awardProgress((int) $totalDistance, 'general_flying.gigametre');
$this->awardProgress($count,'general_flying.10_flights');
$this->awardProgress($count,'general_flying.50_flights');
$this->awardProgress($count,'general_flying.100_flights');
+5 -3
View File
@@ -51,26 +51,28 @@ class AdminService
{
$flights = UserFlight::whereNotNull('flight_number')
->whereNull('airline_id')
->with('user:id,name') // adjust to your actual user relation/columns
->whereDoesntHave('ignoreMissingAirline')
->with('user:id,name')
->get(['id', 'flight_number', 'user_id']);
return $flights
->map(function ($flight) {
// Extract the 2-character IATA-style prefix (letters and/or digits)
preg_match('/^([A-Za-z0-9]{2})\d+/', trim($flight->flight_number), $matches);
return [
'id' => $flight->id,
'code' => $matches[1] ?? null,
'flight_number' => $flight->flight_number,
'link' => "/u/{$flight->user->name}/flight/{$flight->id}",
];
})
->filter(fn ($f) => $f['code'] !== null) // drop any that didn't match the pattern
->filter(fn ($f) => $f['code'] !== null)
->groupBy('code')
->map(function ($group, $code) {
return [
'code' => $code,
'flights' => $group->map(fn ($f) => [
'id' => $f['id'],
'flight_number' => $f['flight_number'],
'link' => $f['link'],
])->values()->all(),
+2 -2
View File
@@ -72,7 +72,7 @@ class SettingsRegistry
'type' => 'select',
'label' => 'Default Page',
'category' => 'FlightsGoneBy Settings',
'default' => 'feed_first',
'default' => 'profile',
'options' => [
['value' => 'feed_first', 'label' => 'My Feed if Following People, My Profile if Not'],
['value' => 'profile', 'label' => 'My Profile'],
@@ -155,7 +155,7 @@ class SettingsRegistry
['value' => 'seat_type_id', 'label' => 'Seat Type'],
['value' => 'seat_number', 'label' => 'Seat Number'],
['value' => 'flight_reason_id', 'label' => 'Reason'],
['value' => 'note', 'label' => 'Note'],
['value' => 'aircraft.display_name_short', 'label' => 'Aircraft Full Name'],
['value' => 'class_seat_combined', 'label' => 'Class/Seat Type/Seat Number Combined'],
],
+1 -1
View File
@@ -67,7 +67,7 @@ return Application::configure(basePath: dirname(__DIR__))
'message' => 'You don\'t have permission to access this page.',
],
404 => [
'title' => 'You Flight Has Been Cancelled',
'title' => 'Your Flight Has Been Cancelled',
'message' => 'The page you are looking for doesn\'t exist or has been moved.',
],
419 => [
@@ -0,0 +1,87 @@
<?php
use App\Models\Achievement;
use App\Models\AchievementCategory;
use App\Models\AchievementDifficulty;
use App\Models\User;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
$hard = AchievementDifficulty::where('internal_name', 'hard')->first();
$near_impossible = AchievementDifficulty::where('internal_name', 'near_impossible')->first();
$fun_challenges = AchievementCategory::where('internal_name', 'fun_challenges')->first();
Achievement::create([
'name' => 'London Calling',
'internal_name' => 'fun_challenges.all_london_airports',
'short_description' => 'Fly to all official London airports',
'progressive' => true,
'difficulty_description' => 'Much more achievable if you live in London!',
'threshold' => 6,
'achievement_category_id' => $fun_challenges->id,
'achievement_difficulty_id' => $hard->id,
'has_page' => true,
'sort_order' => 10,
'icon' => 'standard_achievement.png',
'long_description' => '',
]);
$distance = AchievementCategory::create([
'name' => 'Distance',
'internal_name' => 'distance',
'description' => 'Achievements that are based on distance'
]);
Achievement::create([
'name' => 'Million Miler',
'internal_name' => 'distance.million_miles',
'short_description' => 'Fly one million miles',
'progressive' => true,
'threshold' => 1609344,
'achievement_category_id' => $distance->id,
'achievement_difficulty_id' => $near_impossible->id,
'has_page' => false,
'sort_order' => 4,
'icon' => 'standard_achievement.png',
'long_description' => '',
]);
Achievement::whereInternalName('general_flying.gigametre')->update([
'internal_name' => 'distance.gigametre',
'achievement_category_id' => $distance->id,
'sort_order' => 3
]);
Achievement::whereInternalName('general_flying.circumference_of_the_earth')->update([
'internal_name' => 'distance.circumference_of_the_earth',
'achievement_category_id' => $distance->id,
'sort_order' => 1
]);
Achievement::whereInternalName('general_flying.to_the_moon')->update([
'internal_name' => 'distance.to_the_moon',
'achievement_category_id' => $distance->id,
'sort_order' => 2
]);
foreach(User::all() as $user){
$user->calculateAchievements();
}
}
/**
* Reverse the migrations.
*/
public function down(): void
{
//
}
};
@@ -0,0 +1,26 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('user_flights_ignore_missing_airlines', function (Blueprint $table) {
$table->id();
$table->foreignId('user_flight_id')
->constrained('user_flights')
->cascadeOnDelete();
$table->timestamps();
$table->unique('user_flight_id');
});
}
public function down(): void
{
Schema::dropIfExists('user_flights_ignore_missing_airlines');
}
};
@@ -0,0 +1,57 @@
<?php
use App\Models\Achievement;
use App\Models\AchievementCategory;
use Illuminate\Database\Migrations\Migration;
return new class extends Migration
{
public function up(): void
{
$newCategory = AchievementCategory::create([
'internal_name' => 'number_of_flights',
'name' => 'Number of Flights',
'description' => 'Achievements for reaching flight count milestones.',
]);
$achievementsToUpdate = [
'general_flying.first_flight',
'general_flying.10_flights',
'general_flying.500_flights',
'general_flying.50_flights',
'general_flying.100_flights',
'general_flying.1000_flights',
];
foreach ($achievementsToUpdate as $internalName) {
$achievement = Achievement::where('internal_name', $internalName)->first();
if (!$achievement) {
continue; // or throw, depending how strict you want this
}
$achievement->update([
'achievement_category_id' => $newCategory->id,
'internal_name' => str_replace('general_flying.', 'number_of_flights.', $internalName),
]);
}
}
public function down(): void
{
$oldCategory = AchievementCategory::where('internal_name', 'general_flying')->first();
if ($oldCategory) {
Achievement::where('internal_name', 'like', 'number_of_flights.%')
->get()
->each(function (Achievement $achievement) use ($oldCategory) {
$achievement->update([
'achievement_category_id' => $oldCategory->id,
'internal_name' => str_replace('number_of_flights.', 'general_flying.', $achievement->internal_name),
]);
});
}
AchievementCategory::where('internal_name', 'number_of_flights')->delete();
}
};
@@ -0,0 +1,133 @@
<?php
use App\Models\Airport;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('airports', function (Blueprint $table) {
$table->boolean('active')->default(true);
});
Airport::whereIataCode('TXL')->update(['active' => false]);
$this->importCsv();
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('airports', function (Blueprint $table) {
$table->dropColumn('active');
});
}
private function importCsv(): void
{
$path = storage_path('app/private/seed_data/airports.csv');
if (! file_exists($path)) {
throw new \RuntimeException("Airports CSV not found at: {$path}");
}
$handle = fopen($path, 'rb');
if ($handle === false) {
throw new \RuntimeException("Failed to open airports CSV at: {$path}");
}
// Skip header row
fgetcsv($handle);
$regionMap = DB::table('regions')->pluck('id', 'code')->all();
$batch = [];
$batchSize = 500;
$now = now()->toDateTimeString();
while (($row = fgetcsv($handle)) !== false) {
if (count($row) < 19) {
continue;
}
// id, ident, type, name, latitude_deg, longitude_deg, elevation_ft,
// continent, iso_country, iso_region, municipality, scheduled_service,
// icao_code, iata_code, gps_code, local_code, home_link, wikipedia_link, keywords
[
,
,
$type,
$name,
$latitudeDeg,
$longitudeDeg,
$elevationFt,
,
,
$isoRegion,
$municipality,
,
$icaoCode,
$iataCode,
,
$localCode,
] = $row;
$icaoCode = trim(str_replace(["\r", "\n"], '', $icaoCode));
$iataCode = trim(str_replace(["\r", "\n"], '', $iataCode));
// Only importing airports with no IATA/ICAO code — coded airports are already in the DB
if ($icaoCode !== '' || $iataCode !== '') {
continue;
}
$type = trim($type);
$name = trim($name);
$localCode = trim($localCode);
$isoRegion = trim($isoRegion);
if (! isset($regionMap[$isoRegion])) {
continue;
}
$elevationFt = trim($elevationFt);
$batch[] = [
'type' => $type,
'name' => $name,
'latitude_deg' => (float) trim($latitudeDeg),
'longitude_deg' => (float) trim($longitudeDeg),
'elevation_ft' => $elevationFt !== '' ? (int) $elevationFt : null,
'region_id' => $regionMap[$isoRegion],
'municipality' => trim($municipality) !== '' ? trim($municipality) : null,
'icao_code' => null,
'iata_code' => null,
'local_code' => $localCode !== '' ? $localCode : null,
'timezone' => 'Undefined',
'active' => $type !== 'closed',
'created_at' => $now,
'updated_at' => $now,
];
echo "Added: {$name}\n";
if (count($batch) >= $batchSize) {
DB::table('airports')->insert($batch);
$batch = [];
}
}
fclose($handle);
if (! empty($batch)) {
DB::table('airports')->insert($batch);
}
}
};
@@ -1,25 +1,63 @@
<script setup lang="ts">
import { ref, computed } from "vue"
import axios from "axios"
import { MissingAirline } from "@/Types/types"
defineProps<{
const props = defineProps<{
airline: MissingAirline
}>()
// Track ids we've dismissed locally (optimistic UI) and ones currently in-flight
const dismissedIds = ref<Set<number>>(new Set())
const pendingIds = ref<Set<number>>(new Set())
const visibleFlights = computed(() =>
props.airline.flights.filter(flight => !dismissedIds.value.has(flight.id))
)
async function dismissFlight(flightId: number) {
if (pendingIds.value.has(flightId)) return
pendingIds.value.add(flightId)
// Optimistically remove the pill
dismissedIds.value.add(flightId)
try {
await axios.post('/admin/ignore-missing-airline', {
flight_id: flightId,
})
} catch (error) {
// Revert on failure so the flight isn't silently lost from view
dismissedIds.value.delete(flightId)
console.error('Failed to ignore missing airline for flight', flightId, error)
} finally {
pendingIds.value.delete(flightId)
}
}
</script>
<template>
<div class="missing-airline-card">
<div class="card-header">
<span class="airline-code">{{ airline.code }}</span>
<span class="flight-count">{{ airline.flights.length }} flight{{ airline.flights.length === 1 ? '' : 's' }}</span>
<span class="flight-count">{{ visibleFlights.length }} flight{{ visibleFlights.length === 1 ? '' : 's' }}</span>
</div>
<ul class="flight-list">
<li v-for="flight in airline.flights" :key="flight.link" class="flight-item">
<a :href="flight.link" class="flight-link" target="_blank" rel="noopener">
<div class="flight-list">
<v-chip
v-for="flight in visibleFlights"
:key="flight.link"
class="flight-chip"
size="small"
closable
:disabled="pendingIds.has(flight.id)"
@click:close="dismissFlight(flight.id)"
>
<a :href="flight.link" class="flight-link" target="_blank" rel="noopener" @click.stop>
{{ flight.flight_number }}
</a>
</li>
</ul>
</v-chip>
</div>
</div>
</template>
@@ -62,30 +100,23 @@ defineProps<{
display: flex;
flex-wrap: wrap;
gap: 0.5rem;
list-style: none;
padding: 0;
margin: 0;
}
.flight-item {
display: flex;
}
.flight-link {
.flight-chip {
font-family: 'Share Tech Mono', monospace;
font-size: 0.72rem;
letter-spacing: 0.06em;
background: rgba(255, 255, 255, 0.04) !important;
border: 1px solid rgba(255, 255, 255, 0.06);
}
.flight-link {
color: #9fb3c8;
text-decoration: none;
background: rgba(255, 255, 255, 0.04);
border: 1px solid rgba(255, 255, 255, 0.06);
border-radius: 4px;
padding: 0.25rem 0.5rem;
transition: color 0.15s ease, border-color 0.15s ease;
transition: color 0.15s ease;
}
.flight-link:hover {
color: #ffc107;
border-color: rgba(255, 193, 7, 0.4);
}
</style>
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { ref, nextTick } from 'vue'
import { ref, nextTick, watch } from 'vue'
import axios from 'axios'
const props = defineProps<{
@@ -12,6 +12,8 @@ const model = defineModel<{ value: number, title: string, country_code: string }
const airportOptions = ref(props.prefilledOptions ?? [])
const autocompleteRef = ref<any>(null)
const includeInactive = ref(true)
const lastQuery = ref('')
const onFocus = () => {
nextTick(() => {
@@ -21,6 +23,8 @@ const onFocus = () => {
}
const searchAirports = async (query: string) => {
lastQuery.value = query
if (!query || query.length < 2) {
airportOptions.value = props.prefilledOptions ?? []
return
@@ -28,9 +32,19 @@ const searchAirports = async (query: string) => {
if (query === model.value?.title) return
const { data } = await axios.get('/search/airports', { params: { q: query } })
const { data } = await axios.get('/search/airports', {
params: {
q: query,
include_inactive: includeInactive.value ? 1 : undefined,
},
})
airportOptions.value = data
}
// Re-run the last search when the checkbox is toggled, so results update immediately
watch(includeInactive, () => {
if (lastQuery.value) searchAirports(lastQuery.value)
})
</script>
<template>
@@ -62,7 +76,6 @@ const searchAirports = async (query: string) => {
<span :class="`fi fi-${item.country_code}`"></span>
</span>
</template>
</v-list-item>
</template>
</v-autocomplete>
@@ -0,0 +1,55 @@
<template>
<v-btn
:color="copied ? 'success' : color"
:variant="variant"
:icon="iconOnly"
:size="iconOnly ? 'x-small' : 'default'"
@click="handleCopy"
>
<v-icon :start="!iconOnly" :icon="copied ? 'mdi-check' : 'mdi-content-copy'" />
<template v-if="!iconOnly">{{ copied ? 'Copied Link To Page!' : label }}</template>
<v-tooltip v-if="iconOnly" activator="parent" location="top">
{{ copied ? 'Copied Link To Page!' : label }}
</v-tooltip>
</v-btn>
</template>
<script setup lang="ts">
import { ref } from 'vue';
import { useDisplay } from 'vuetify';
import { copyToClipboard } from '@/Composables/useClipboard';
interface Props {
label?: string;
color?: string;
variant?: 'flat' | 'text' | 'elevated' | 'tonal' | 'outlined' | 'plain';
resetDelay?: number;
}
const props = withDefaults(defineProps<Props>(), {
label: 'Copy link',
color: 'primary',
variant: 'outlined',
resetDelay: 2000,
});
const { mobile } = useDisplay();
const iconOnly = mobile;
const copied = ref(false);
let resetTimeout: ReturnType<typeof setTimeout> | null = null;
async function handleCopy() {
try {
await copyToClipboard(window.location.href);
copied.value = true;
if (resetTimeout) clearTimeout(resetTimeout);
resetTimeout = setTimeout(() => {
copied.value = false;
}, props.resetDelay);
} catch (err) {
console.error('Failed to copy URL:', err);
}
}
</script>
@@ -17,7 +17,7 @@ const props = defineProps<{
const page = usePage<SharedProps>().props
const ITEMS_PER_PAGE = 25
const defaultColumns = ['airline', 'flight_number', 'departure_airport', 'arrival_airport', 'departure_date', 'departure_time', 'arrival_time', 'duration', 'distance', 'aircraft', 'registration', 'class_seat_combined']
const defaultColumns = ['airline', 'flight_number', 'departure_airport', 'arrival_airport', 'departure_date', 'departure_time', 'arrival_time', 'duration', 'distance', 'aircraft', 'registration', 'class_seat_combined', 'note']
const columnsToShow = computed(() => page.auth.user?.resolved_settings?.departure_board_columns ?? defaultColumns)
const showColumn = (column: string) => columnsToShow.value.includes(column)
@@ -44,6 +44,7 @@ const allHeaders = [
{ title: 'SEAT TYPE', key: 'seat_type_id', sortable: true },
{ title: 'SEAT NO.', key: 'seat_number', sortable: true },
{ title: 'REASON', key: 'flight_reason_id', sortable: true },
{ title: 'NOTE', key: 'note', sortable: true },
{ title: '', key: 'actions', sortable: false },
]
@@ -41,7 +41,7 @@ const reasonBadgeVariant = (reason: string) => {
}
const showColumn = (column: string) => props.columnsToShow.includes(column)
console.log(props.columnsToShow)
</script>
<template>
@@ -170,6 +170,10 @@ const showColumn = (column: string) => props.columnsToShow.includes(column)
</span>
</td>
<td v-if="showColumn('note')" class="v-data-table__td note-cell">
<span v-if="flight.note" class="note-text">{{ flight.note }}</span>
</td>
<td class="v-data-table__td actions-cell">
<UserFlightContextMenu :profile-user="user" :can-edit="canEdit" :flight="flight" />
</td>
@@ -184,6 +188,17 @@ const showColumn = (column: string) => props.columnsToShow.includes(column)
padding-right: 0 !important;
}
.note-cell {
min-width: 200px;
max-width: 320px;
}
.note-text {
display: block;
overflow: hidden;
font-size: 0.85rem;
}
.city-name{
color: #556;
text-transform: uppercase;
@@ -211,23 +226,14 @@ const showColumn = (column: string) => props.columnsToShow.includes(column)
align-items: center;
vertical-align: middle;
gap: 0.5rem;
overflow-x: auto;
max-width: 160px;
/* Hide scrollbar but keep functionality */
scrollbar-width: none;
&::-webkit-scrollbar { display: none; }
width: fit-content;
}
.iata {
font-weight: 600;
}
.class-cell {
display: flex;
align-items: center;
vertical-align: middle;
gap: 0.5rem;
}
.actions-cell {
width: 40px;
@@ -277,15 +283,5 @@ const showColumn = (column: string) => props.columnsToShow.includes(column)
padding: 0 !important;
}
.class-badges-cell {
max-width: 140px;
overflow: hidden;
}
.class-cell > *:not(:first-child) {
display: none;
}
}
</style>
@@ -1,6 +1,6 @@
<script setup lang="ts">
import type { Airline, Alliance, Flight, RegionRange, FlightRange, FlightScope } from '@/Types/types'
import { ref, watch } from 'vue'
import { reactive, ref, watch, onMounted, nextTick } from 'vue'
import AllianceLogo from "@/Components/FlightsGoneBy/AllianceLogo.vue"
const props = defineProps<{
@@ -30,6 +30,56 @@ const emit = defineEmits<{
}]
}>()
// ── Filter registry ──────────────────────────────────────────────────────────
//
// This is the single source of truth for every filter's identity. To add a
// new filter:
// 1. Add one entry here (name = the key used in `filters` + the URL param,
// emitKey = the key expected by the `change` event, kind = how to parse
// values coming back out of the URL).
// 2. Add a <v-select> in the template with :name="'yourName'" and
// v-model="filters.yourName" (initialise it in `filters` below, or just
// let step 1 do it for you since `filters` is derived from this list).
//
// Nothing else needs to know about the new filter — URL loading, URL syncing,
// and the emitted payload are all generic over this list.
type FilterKind = 'number' | 'string'
interface FilterDef {
name: string // key in `filters`, and the URL query param name
emitKey: string // key in the payload sent via the `change` event
kind: FilterKind // how to coerce values parsed back out of the URL
}
const FILTER_DEFS: FilterDef[] = [
{ name: 'year', emitKey: 'years', kind: 'number' },
{ name: 'airline', emitKey: 'airlines', kind: 'number' },
{ name: 'alliance', emitKey: 'alliances', kind: 'number' },
{ name: 'country', emitKey: 'countries', kind: 'string' },
{ name: 'continent', emitKey: 'continents', kind: 'string' },
{ name: 'flightClass', emitKey: 'flightClasses', kind: 'number' },
{ name: 'crewType', emitKey: 'crewTypes', kind: 'number' },
{ name: 'flightScope', emitKey: 'flightScopes', kind: 'string' },
{ name: 'flightRange', emitKey: 'flightRanges', kind: 'string' },
{ name: 'regionRange', emitKey: 'regionRanges', kind: 'string' },
{ name: 'flightReason', emitKey: 'flightReasons', kind: 'number' },
{ name: 'seatType', emitKey: 'seatTypes', kind: 'number' },
{ name: 'manufacturer', emitKey: 'manufacturers', kind: 'string' },
{ name: 'aircraftModel', emitKey: 'aircraftModels', kind: 'number' },
{ name: 'engineType', emitKey: 'engineTypes', kind: 'string' },
{ name: 'engineCount', emitKey: 'engineCounts', kind: 'number' },
{ name: 'airportRegion', emitKey: 'airportRegions', kind: 'number' },
{ name: 'otherUsers', emitKey: 'otherUsers', kind: 'string' },
]
// Single reactive bag of filter state, one array per FILTER_DEFS entry.
// `filters.year`, `filters.airline`, etc. This is what every v-select
// v-models against.
const filters = reactive<Record<string, any[]>>(
Object.fromEntries(FILTER_DEFS.map(d => [d.name, []])),
)
// ── Available options ─────────────────────────────────────────────────────────
type AirlineData = { id: number; name: string; airline: Airline }
@@ -163,61 +213,64 @@ function buildOptions(flights: Flight[]) {
const availableOptions = buildOptions(props.flights)
// ── Filter state ──────────────────────────────────────────────────────────────
// ── URL query sync ──────────────────────────────────────────────────────────
const selectedYears = ref<number[]>([])
const selectedAirlines = ref<number[]>([])
const selectedAlliances = ref<number[]>([])
const selectedCountries = ref<string[]>([])
const selectedContinents = ref<string[]>([])
const selectedFlightClasses = ref<number[]>([])
const selectedCrewTypes = ref<number[]>([])
const selectedFlightScopes = ref<FlightScope[]>([])
const selectedFlightRanges = ref<FlightRange[]>([])
const selectedRegionRanges = ref<RegionRange[]>([])
const selectedFlightReasons = ref<number[]>([])
const selectedSeatTypes = ref<number[]>([])
const selectedManufacturers = ref<string[]>([])
const selectedAircraftModels = ref<number[]>([])
const selectedEngineTypes = ref<string[]>([])
const selectedEngineCounts = ref<number[]>([])
const selectedAirportRegions = ref<number[]>([])
const selectedOtherUsers = ref<string[]>([])
function loadFiltersFromQuery(): boolean {
const params = new URLSearchParams(window.location.search)
let foundAny = false
for (const def of FILTER_DEFS) {
const raw = params.get(def.name)
if (!raw) continue
const values = raw.split(',').filter(Boolean)
filters[def.name] = def.kind === 'number'
? values.map(Number).filter(n => !Number.isNaN(n))
: values
foundAny = true
}
return foundAny
}
// When selected countries change, drop any selected regions that no longer
// belong to any of the selected countries.
watch(selectedCountries, (countries) => {
if (countries.length === 0) return
selectedAirportRegions.value = selectedAirportRegions.value.filter(regionId => {
const region = availableOptions.airportRegions.find(r => r.id === regionId)
if (!region) return false
return [...(region as any).countryCodes].some((code: string) => countries.includes(code))
})
})
function syncUrlWithFilters() {
const params = new URLSearchParams()
for (const def of FILTER_DEFS) {
const value = filters[def.name]
if (value.length > 0)
params.set(def.name, value.join(','))
}
const query = params.toString()
const newUrl = `${window.location.pathname}${query ? `?${query}` : ''}`
window.history.replaceState(window.history.state, '', newUrl)
}
// ── Emit ──────────────────────────────────────────────────────────────────────
function emitFilters() {
emit('change', {
years: selectedYears.value,
airlines: selectedAirlines.value,
alliances: selectedAlliances.value,
countries: selectedCountries.value,
continents: selectedContinents.value,
flightClasses: selectedFlightClasses.value,
crewTypes: selectedCrewTypes.value,
flightScopes: selectedFlightScopes.value,
flightRanges: selectedFlightRanges.value,
regionRanges: selectedRegionRanges.value,
flightReasons: selectedFlightReasons.value,
seatTypes: selectedSeatTypes.value,
manufacturers: selectedManufacturers.value,
aircraftModels: selectedAircraftModels.value,
engineTypes: selectedEngineTypes.value,
engineCounts: selectedEngineCounts.value,
airportRegions: selectedAirportRegions.value,
otherUsers: selectedOtherUsers.value,
})
syncUrlWithFilters()
const payload = Object.fromEntries(
FILTER_DEFS.map(def => [def.emitKey, filters[def.name]]),
)
emit('change', payload as Parameters<typeof emit>[1] extends [infer T] ? T : never)
}
onMounted(async () => {
const hasQueryFilters = loadFiltersFromQuery()
// Only emit if the URL actually seeded some filters - a plain page load
// (no query params) should behave exactly like before and not emit at all,
// since the parent already renders its own initial, unfiltered state.
if (!hasQueryFilters) return
// Wait a beat before emitting. Charts further down the tree (ApexCharts,
// in particular) initialize asynchronously on their own mount; firing our
// update in the same synchronous pass can hand them new series data before
// their internal chart instance exists yet, which throws inside the
// charting library. A couple of ticks is enough to let that settle.
await nextTick()
await nextTick()
emitFilters()
})
// ── Helpers ───────────────────────────────────────────────────────────────────
const countryFlagClass = (code: string) =>
@@ -225,10 +278,12 @@ const countryFlagClass = (code: string) =>
</script>
<template>
<div class="flight-filters-wrapper">
<div class="flight-filters">
<v-select
v-model="selectedYears"
name="year"
v-model="filters.year"
:items="availableOptions.years"
label="Year"
multiple clearable hide-details
@@ -237,14 +292,15 @@ const countryFlagClass = (code: string) =>
>
<template #selection="{ item, index }">
<span v-if="index < 2" class="v-select__selection-text">
{{ item }}<span v-if="index < Math.min(selectedYears.length, 2) - 1">,&nbsp;</span>
{{ item }}<span v-if="index < Math.min(filters.year.length, 2) - 1">,&nbsp;</span>
</span>
<span v-if="index === 2" class="text-caption text-medium-emphasis">+{{ selectedYears.length - 2 }}</span>
<span v-if="index === 2" class="text-caption text-medium-emphasis">+{{ filters.year.length - 2 }}</span>
</template>
</v-select>
<v-select
v-model="selectedAirlines"
name="airline"
v-model="filters.airline"
:items="availableOptions.airlines"
item-title="name" item-value="id"
label="Airline"
@@ -270,15 +326,16 @@ const countryFlagClass = (code: string) =>
</template>
<template #selection="{ item, index }">
<span v-if="index < 2" class="v-select__selection-text">
{{ (item as any).name }}<span v-if="index < Math.min(selectedAirlines.length, 2) - 1">,&nbsp;</span>
{{ (item as any).name }}<span v-if="index < Math.min(filters.airline.length, 2) - 1">,&nbsp;</span>
</span>
<span v-if="index === 2" class="text-caption text-medium-emphasis">+{{ selectedAirlines.length - 2 }}</span>
<span v-if="index === 2" class="text-caption text-medium-emphasis">+{{ filters.airline.length - 2 }}</span>
</template>
</v-select>
<v-select
v-if="availableOptions.alliances.length > 0"
v-model="selectedAlliances"
name="alliance"
v-model="filters.alliance"
:items="availableOptions.alliances"
item-title="name" item-value="id"
label="Alliance"
@@ -299,14 +356,15 @@ const countryFlagClass = (code: string) =>
</template>
<template #selection="{ item, index }">
<span v-if="index < 2" class="v-select__selection-text">
{{ (item as any).name }}<span v-if="index < Math.min(selectedAlliances.length, 2) - 1">,&nbsp;</span>
{{ (item as any).name }}<span v-if="index < Math.min(filters.alliance.length, 2) - 1">,&nbsp;</span>
</span>
<span v-if="index === 2" class="text-caption text-medium-emphasis">+{{ selectedAlliances.length - 2 }}</span>
<span v-if="index === 2" class="text-caption text-medium-emphasis">+{{ filters.alliance.length - 2 }}</span>
</template>
</v-select>
<v-select
v-model="selectedCountries"
name="country"
v-model="filters.country"
:items="availableOptions.countries"
item-title="name" item-value="code"
label="Country"
@@ -328,15 +386,16 @@ const countryFlagClass = (code: string) =>
<template #selection="{ item, index }">
<span v-if="index < 2" class="v-select__selection-text">
<span :class="countryFlagClass((item as any).code)" style="margin-right: 4px;" />
{{ (item as any).name }}<span v-if="index < Math.min(selectedCountries.length, 2) - 1">,&nbsp;</span>
{{ (item as any).name }}<span v-if="index < Math.min(filters.country.length, 2) - 1">,&nbsp;</span>
</span>
<span v-if="index === 2" class="text-caption text-medium-emphasis">+{{ selectedCountries.length - 2 }}</span>
<span v-if="index === 2" class="text-caption text-medium-emphasis">+{{ filters.country.length - 2 }}</span>
</template>
</v-select>
<v-select
v-if="availableOptions.flightScopes.length > 1"
v-model="selectedFlightScopes"
name="flightScope"
v-model="filters.flightScope"
:items="availableOptions.flightScopes"
item-title="label" item-value="value"
label="Flight Scope"
@@ -346,15 +405,16 @@ const countryFlagClass = (code: string) =>
>
<template #selection="{ item, index }">
<span v-if="index < 2" class="v-select__selection-text">
{{ (item as any).label }}<span v-if="index < Math.min(selectedFlightScopes.length, 2) - 1">,&nbsp;</span>
{{ (item as any).label }}<span v-if="index < Math.min(filters.flightScope.length, 2) - 1">,&nbsp;</span>
</span>
<span v-if="index === 2" class="text-caption text-medium-emphasis">+{{ selectedFlightScopes.length - 2 }}</span>
<span v-if="index === 2" class="text-caption text-medium-emphasis">+{{ filters.flightScope.length - 2 }}</span>
</template>
</v-select>
<v-select
v-if="availableOptions.airportRegions.length > 0"
v-model="selectedAirportRegions"
name="airportRegion"
v-model="filters.airportRegion"
:items="availableOptions.airportRegions"
item-title="name" item-value="id"
label="Region"
@@ -364,15 +424,16 @@ const countryFlagClass = (code: string) =>
>
<template #selection="{ item, index }">
<span v-if="index < 2" class="v-select__selection-text">
{{ (item as any).name }}<span v-if="index < Math.min(selectedAirportRegions.length, 2) - 1">,&nbsp;</span>
{{ (item as any).name }}<span v-if="index < Math.min(filters.airportRegion.length, 2) - 1">,&nbsp;</span>
</span>
<span v-if="index === 2" class="text-caption text-medium-emphasis">+{{ selectedAirportRegions.length - 2 }}</span>
<span v-if="index === 2" class="text-caption text-medium-emphasis">+{{ filters.airportRegion.length - 2 }}</span>
</template>
</v-select>
<v-select
v-if="availableOptions.regionRanges.length > 1"
v-model="selectedRegionRanges"
name="regionRange"
v-model="filters.regionRange"
:items="availableOptions.regionRanges"
item-title="label" item-value="value"
label="Region Range"
@@ -382,14 +443,15 @@ const countryFlagClass = (code: string) =>
>
<template #selection="{ item, index }">
<span v-if="index < 2" class="v-select__selection-text">
{{ (item as any).label }}<span v-if="index < Math.min(selectedRegionRanges.length, 2) - 1">,&nbsp;</span>
{{ (item as any).label }}<span v-if="index < Math.min(filters.regionRange.length, 2) - 1">,&nbsp;</span>
</span>
<span v-if="index === 2" class="text-caption text-medium-emphasis">+{{ selectedRegionRanges.length - 2 }}</span>
<span v-if="index === 2" class="text-caption text-medium-emphasis">+{{ filters.regionRange.length - 2 }}</span>
</template>
</v-select>
<v-select
v-model="selectedContinents"
name="continent"
v-model="filters.continent"
:items="availableOptions.continents"
item-title="name" item-value="code"
label="Continent"
@@ -399,15 +461,16 @@ const countryFlagClass = (code: string) =>
>
<template #selection="{ item, index }">
<span v-if="index < 2" class="v-select__selection-text">
{{ (item as any).name }}<span v-if="index < Math.min(selectedContinents.length, 2) - 1">,&nbsp;</span>
{{ (item as any).name }}<span v-if="index < Math.min(filters.continent.length, 2) - 1">,&nbsp;</span>
</span>
<span v-if="index === 2" class="text-caption text-medium-emphasis">+{{ selectedContinents.length - 2 }}</span>
<span v-if="index === 2" class="text-caption text-medium-emphasis">+{{ filters.continent.length - 2 }}</span>
</template>
</v-select>
<v-select
v-if="availableOptions.flightRanges.length > 1"
v-model="selectedFlightRanges"
name="flightRange"
v-model="filters.flightRange"
:items="availableOptions.flightRanges"
item-title="label" item-value="value"
label="Flight Range"
@@ -417,14 +480,15 @@ const countryFlagClass = (code: string) =>
>
<template #selection="{ item, index }">
<span v-if="index < 2" class="v-select__selection-text">
{{ (item as any).label }}<span v-if="index < Math.min(selectedFlightRanges.length, 2) - 1">,&nbsp;</span>
{{ (item as any).label }}<span v-if="index < Math.min(filters.flightRange.length, 2) - 1">,&nbsp;</span>
</span>
<span v-if="index === 2" class="text-caption text-medium-emphasis">+{{ selectedFlightRanges.length - 2 }}</span>
<span v-if="index === 2" class="text-caption text-medium-emphasis">+{{ filters.flightRange.length - 2 }}</span>
</template>
</v-select>
<v-select
v-model="selectedFlightClasses"
name="flightClass"
v-model="filters.flightClass"
:items="availableOptions.classes"
item-title="name" item-value="id"
label="Flight Class"
@@ -434,15 +498,16 @@ const countryFlagClass = (code: string) =>
>
<template #selection="{ item, index }">
<span v-if="index < 2" class="v-select__selection-text">
{{ (item as any).name }}<span v-if="index < Math.min(selectedFlightClasses.length, 2) - 1">,&nbsp;</span>
{{ (item as any).name }}<span v-if="index < Math.min(filters.flightClass.length, 2) - 1">,&nbsp;</span>
</span>
<span v-if="index === 2" class="text-caption text-medium-emphasis">+{{ selectedFlightClasses.length - 2 }}</span>
<span v-if="index === 2" class="text-caption text-medium-emphasis">+{{ filters.flightClass.length - 2 }}</span>
</template>
</v-select>
<v-select
v-if="availableOptions.flightReasons.length > 0"
v-model="selectedFlightReasons"
name="flightReason"
v-model="filters.flightReason"
:items="availableOptions.flightReasons"
item-title="name" item-value="id"
label="Flight Reason"
@@ -452,15 +517,16 @@ const countryFlagClass = (code: string) =>
>
<template #selection="{ item, index }">
<span v-if="index < 2" class="v-select__selection-text">
{{ (item as any).name }}<span v-if="index < Math.min(selectedFlightReasons.length, 2) - 1">,&nbsp;</span>
{{ (item as any).name }}<span v-if="index < Math.min(filters.flightReason.length, 2) - 1">,&nbsp;</span>
</span>
<span v-if="index === 2" class="text-caption text-medium-emphasis">+{{ selectedFlightReasons.length - 2 }}</span>
<span v-if="index === 2" class="text-caption text-medium-emphasis">+{{ filters.flightReason.length - 2 }}</span>
</template>
</v-select>
<v-select
v-if="availableOptions.seatTypes.length > 0"
v-model="selectedSeatTypes"
name="seatType"
v-model="filters.seatType"
:items="availableOptions.seatTypes"
item-title="name" item-value="id"
label="Seat Type"
@@ -470,15 +536,16 @@ const countryFlagClass = (code: string) =>
>
<template #selection="{ item, index }">
<span v-if="index < 2" class="v-select__selection-text">
{{ (item as any).name }}<span v-if="index < Math.min(selectedSeatTypes.length, 2) - 1">,&nbsp;</span>
{{ (item as any).name }}<span v-if="index < Math.min(filters.seatType.length, 2) - 1">,&nbsp;</span>
</span>
<span v-if="index === 2" class="text-caption text-medium-emphasis">+{{ selectedSeatTypes.length - 2 }}</span>
<span v-if="index === 2" class="text-caption text-medium-emphasis">+{{ filters.seatType.length - 2 }}</span>
</template>
</v-select>
<v-select
v-if="availableOptions.manufacturers.length > 0"
v-model="selectedManufacturers"
name="manufacturer"
v-model="filters.manufacturer"
:items="availableOptions.manufacturers"
item-title="name" item-value="name"
label="Aircraft Manufacturer"
@@ -488,15 +555,16 @@ const countryFlagClass = (code: string) =>
>
<template #selection="{ item, index }">
<span v-if="index < 2" class="v-select__selection-text">
{{ (item as any).name }}<span v-if="index < Math.min(selectedManufacturers.length, 2) - 1">,&nbsp;</span>
{{ (item as any).name }}<span v-if="index < Math.min(filters.manufacturer.length, 2) - 1">,&nbsp;</span>
</span>
<span v-if="index === 2" class="text-caption text-medium-emphasis">+{{ selectedManufacturers.length - 2 }}</span>
<span v-if="index === 2" class="text-caption text-medium-emphasis">+{{ filters.manufacturer.length - 2 }}</span>
</template>
</v-select>
<v-select
v-if="availableOptions.aircraftModels.length > 0"
v-model="selectedAircraftModels"
name="aircraftModel"
v-model="filters.aircraftModel"
:items="availableOptions.aircraftModels"
item-title="name" item-value="id"
label="Aircraft Model"
@@ -506,15 +574,16 @@ const countryFlagClass = (code: string) =>
>
<template #selection="{ item, index }">
<span v-if="index < 2" class="v-select__selection-text">
{{ (item as any).name }}<span v-if="index < Math.min(selectedAircraftModels.length, 2) - 1">,&nbsp;</span>
{{ (item as any).name }}<span v-if="index < Math.min(filters.aircraftModel.length, 2) - 1">,&nbsp;</span>
</span>
<span v-if="index === 2" class="text-caption text-medium-emphasis">+{{ selectedAircraftModels.length - 2 }}</span>
<span v-if="index === 2" class="text-caption text-medium-emphasis">+{{ filters.aircraftModel.length - 2 }}</span>
</template>
</v-select>
<v-select
v-if="availableOptions.engineTypes.length > 0"
v-model="selectedEngineTypes"
name="engineType"
v-model="filters.engineType"
:items="availableOptions.engineTypes"
item-title="name" item-value="name"
label="Engine Type"
@@ -524,15 +593,16 @@ const countryFlagClass = (code: string) =>
>
<template #selection="{ item, index }">
<span v-if="index < 2" class="v-select__selection-text">
{{ (item as any).name }}<span v-if="index < Math.min(selectedEngineTypes.length, 2) - 1">,&nbsp;</span>
{{ (item as any).name }}<span v-if="index < Math.min(filters.engineType.length, 2) - 1">,&nbsp;</span>
</span>
<span v-if="index === 2" class="text-caption text-medium-emphasis">+{{ selectedEngineTypes.length - 2 }}</span>
<span v-if="index === 2" class="text-caption text-medium-emphasis">+{{ filters.engineType.length - 2 }}</span>
</template>
</v-select>
<v-select
v-if="availableOptions.engineCounts.length > 0"
v-model="selectedEngineCounts"
name="engineCount"
v-model="filters.engineCount"
:items="availableOptions.engineCounts"
item-title="count" item-value="count"
label="Engine Count"
@@ -542,15 +612,16 @@ const countryFlagClass = (code: string) =>
>
<template #selection="{ item, index }">
<span v-if="index < 2" class="v-select__selection-text">
{{ (item as any).count }}<span v-if="index < Math.min(selectedEngineCounts.length, 2) - 1">,&nbsp;</span>
{{ (item as any).count }}<span v-if="index < Math.min(filters.engineCount.length, 2) - 1">,&nbsp;</span>
</span>
<span v-if="index === 2" class="text-caption text-medium-emphasis">+{{ selectedEngineCounts.length - 2 }}</span>
<span v-if="index === 2" class="text-caption text-medium-emphasis">+{{ filters.engineCount.length - 2 }}</span>
</template>
</v-select>
<v-select
v-if="availableOptions.crewTypes.length > 0"
v-model="selectedCrewTypes"
name="crewType"
v-model="filters.crewType"
:items="availableOptions.crewTypes"
item-title="name" item-value="id"
label="Crew Type"
@@ -560,14 +631,16 @@ const countryFlagClass = (code: string) =>
>
<template #selection="{ item, index }">
<span v-if="index < 2" class="v-select__selection-text">
{{ (item as any).name }}<span v-if="index < Math.min(selectedCrewTypes.length, 2) - 1">,&nbsp;</span>
{{ (item as any).name }}<span v-if="index < Math.min(filters.crewType.length, 2) - 1">,&nbsp;</span>
</span>
<span v-if="index === 2" class="text-caption text-medium-emphasis">+{{ selectedCrewTypes.length - 2 }}</span>
<span v-if="index === 2" class="text-caption text-medium-emphasis">+{{ filters.crewType.length - 2 }}</span>
</template>
</v-select>
<v-select
v-if="availableOptions.otherUsers.length > 0"
v-model="selectedOtherUsers"
name="otherUsers"
v-model="filters.otherUsers"
:items="availableOptions.otherUsers"
label="Flew With"
multiple clearable hide-details
@@ -576,11 +649,13 @@ const countryFlagClass = (code: string) =>
>
<template #selection="{ item, index }">
<span v-if="index < 2" class="v-select__selection-text">
{{ item }}<span v-if="index < Math.min(selectedOtherUsers.length, 2) - 1">,&nbsp;</span>
{{ item }}<span v-if="index < Math.min(filters.otherUsers.length, 2) - 1">,&nbsp;</span>
</span>
<span v-if="index === 2" class="text-caption text-medium-emphasis">+{{ selectedOtherUsers.length - 2 }}</span>
<span v-if="index === 2" class="text-caption text-medium-emphasis">+{{ filters.otherUsers.length - 2 }}</span>
</template>
</v-select>
</div>
</div>
</template>
@@ -595,4 +670,8 @@ const countryFlagClass = (code: string) =>
.flight-filters .v-select {
flex: 1 1 160px;
}
.flight-filters-actions {
margin-top: 12px;
}
</style>
@@ -1,6 +1,6 @@
<template>
<div>
<div class="flight-map-wrapper">
<div class="flight-map-wrapper" :class="{ tooltip }">
<PlaneLoader v-if="!mapReady" class="map-loader" />
<div ref="mapContainer" class="map-container" :class="{ 'map-hidden': !mapReady }" />
<button @click="exportMapBasic()" class="export-btn" title="Download as Image">
@@ -277,8 +277,11 @@ export default defineComponent({
compact: {
type: Boolean,
default: false,
},
tooltip: {
type: Boolean,
default: false,
}
},
setup(props) {
@@ -367,10 +370,34 @@ export default defineComponent({
link.click()
}
function loopPoints(origin: LngLat, radiusDeg = 0.2, steps = 48): LngLat[] {
const [lng, lat] = origin
// Widen the longitude radius to compensate for mercator distortion at this latitude
const lngRadius = radiusDeg / Math.max(Math.cos(lat * Math.PI / 180), 0.15)
// Center the loop above the origin so the airport point sits at the bottom of the loop
const centerLat = lat + radiusDeg
const points: LngLat[] = []
for (let i = 0; i <= steps; i++) {
const theta = (i / steps) * Math.PI * 2
points.push([
lng + Math.sin(theta) * lngRadius,
centerLat - radiusDeg * Math.cos(theta),
])
}
return points // first and last point === origin, at the bottom of the loop
}
const getArc = (flight: Flight): LngLat[] => {
const key = routeKey(flight.departure_airport, flight.arrival_airport)
if (!arcCache.has(key)) {
arcCache.set(key, greatCirclePoints(
const isSameAirport = flight.departure_airport.id === flight.arrival_airport.id
arcCache.set(key, isSameAirport
? loopPoints([flight.departure_airport.longitude_deg, flight.departure_airport.latitude_deg])
: greatCirclePoints(
[flight.departure_airport.longitude_deg, flight.departure_airport.latitude_deg],
[flight.arrival_airport.longitude_deg, flight.arrival_airport.latitude_deg],
))
@@ -663,8 +690,10 @@ export default defineComponent({
? { top: 20, bottom: 20, left: 55, right: 55 }
: { top: 60, bottom: 60, left: 60, right: 60 }
const lngs = props.flights.flatMap(f => [f.departure_airport.longitude_deg, f.arrival_airport.longitude_deg])
const lats = props.flights.flatMap(f => [f.departure_airport.latitude_deg, f.arrival_airport.latitude_deg])
// Use full arc/loop geometry, not just endpoints, so loops aren't clipped
const allPoints = props.flights.flatMap(getArc)
const lngs = allPoints.map(p => p[0])
const lats = allPoints.map(p => p[1])
const minLat = Math.min(...lats)
const maxLat = Math.max(...lats)
@@ -686,7 +715,6 @@ export default defineComponent({
}
map!.fitBounds([[minLng, minLat], [maxLng, maxLat]], { padding, duration: 0 })
}
// ── Map init ──────────────────────────────────────────────────────────
const initMap = (): void => {
@@ -821,6 +849,11 @@ export default defineComponent({
aspect-ratio: 7 / 10;
max-height: none;
}
.flight-map-wrapper.tooltip {
aspect-ratio: 16 / 10;
max-height: 30vh;
}
}
small.attribution{
@@ -40,7 +40,7 @@ defineProps<{
<ToolTipRows v-if="isActive.value">
<FlightMap :flights="[flight]" :showLegend="false" compact />
<FlightMap :flights="[flight]" :showLegend="false" compact tooltip />
</ToolTipRows>
<ToolTipDivider />
@@ -4,6 +4,7 @@ defineProps<{
rowKey: (row: T) => string | number
hasItems: (row: T) => boolean
labelWidth?: string
compactOnMobile?: boolean
}>()
</script>
@@ -15,7 +16,11 @@ defineProps<{
class="badge-row"
>
<!-- Label column: consumer provides content -->
<div class="badge-label" :style="labelWidth ? `width: ${labelWidth}` : ''">
<div
class="badge-label"
:class="{ 'badge-label--compact': compactOnMobile }"
:style="labelWidth ? `width: ${labelWidth}` : ''"
>
<slot name="label" :row="row" />
</div>
@@ -38,8 +43,6 @@ defineProps<{
container-type: inline-size;
}
.badge-row {
display: flex;
align-items: center;
@@ -49,13 +52,13 @@ defineProps<{
.badge-label {
flex: 0 0 auto;
width: 15em;
width: 21em;
padding: 0.5em;
border-right: 1px solid var(--table-border);
align-self: stretch;
display: flex;
align-items: center;
font-size:0.9rem;
font-size: 0.9rem;
}
@container (max-width: 480px) {
@@ -63,6 +66,12 @@ defineProps<{
font-size: 0.75rem;
width: 9em;
}
.badge-label--compact {
font-size: 0.7rem;
width: clamp(6em, 50cqw, 9em);
flex-shrink: 0;
}
}
.badge-scroll-container {
@@ -1,6 +1,7 @@
<script setup lang="ts">
import { Link, usePage } from "@inertiajs/vue3"
import { SharedProps } from "@/Types/types"
import CopyPageButton from "@/Components/FlightsGoneBy/CopyPageButton.vue";
const page = usePage<SharedProps>().props
const year = new Date().getFullYear()
@@ -63,9 +64,17 @@ footer {
color: #ffc107;
}
.footer-version {
opacity: 0.8;
margin-left: 0.4em;
}
@media (max-width: 600px) {
footer {
padding: 0 1rem;
flex-wrap: wrap;
flex: 0 0 auto;
row-gap: 0.5rem;
padding: 0.6rem 1rem;
}
.footer-copyright {
@@ -75,10 +84,6 @@ footer {
.footer-link {
font-size: 0.6rem;
}
}
.footer-version {
opacity: 0.8;
margin-left: 0.4em;
}
</style>
@@ -5,6 +5,7 @@ import type { SharedProps } from '@/Types/types'
import { ref, onMounted, onUnmounted } from 'vue'
import NotificationMenu from "@/Components/FlightsGoneBy/NotificationMenu.vue";
import Logo from "@/Components/FlightsGoneBy/Logo.vue";
import UserSearchBox from "@/Components/UserSearchBox.vue";
const page = usePage<SharedProps>()
const menuOpen = ref(false)
@@ -30,6 +31,7 @@ onUnmounted(() => document.removeEventListener('click', handleClickOutside))
<Logo variant="color" />
</Link>
<UserSearchBox class="nav-desktop" density="compact" style="max-width:400px; width: 400px;" />
<NotificationMenu v-if="page.props.auth?.user" :unread-count="page.props.unread_notification_count" />
<!-- Desktop nav -->
@@ -369,5 +371,6 @@ header {
@media (max-width: 600px) {
.nav-desktop { display: none; }
.hamburger { display: flex; }
.user-search-box { display: none; }
}
</style>
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { ref, watch, onMounted } from 'vue'
import { ref, watch, onMounted, onUnmounted } from 'vue'
import axios from "axios";
import { Notification } from "@/Types/types";
import { Link } from "@inertiajs/vue3";
@@ -18,6 +18,7 @@ onMounted(() => {
const open = ref(false)
const notifications = ref<Notification[]>([])
const loading = ref(false)
const wrapperRef = ref<HTMLElement | null>(null)
const markAllRead = async (notifications: Notification[]) => {
const unread = notifications.filter(n => !n.read_at)
@@ -27,6 +28,20 @@ const markAllRead = async (notifications: Notification[]) => {
unread.forEach(n => n.read_at = new Date().toISOString())
}
const handleClickOutside = (event: MouseEvent) => {
if (open.value && wrapperRef.value && !wrapperRef.value.contains(event.target as Node)) {
open.value = false
}
}
onMounted(() => {
document.addEventListener('click', handleClickOutside)
})
onUnmounted(() => {
document.removeEventListener('click', handleClickOutside)
})
watch(open, async (isOpen) => {
if (!isOpen) return
@@ -43,7 +58,7 @@ watch(open, async (isOpen) => {
</script>
<template>
<div class="notif-wrapper">
<div class="notif-wrapper" ref="wrapperRef">
<v-btn icon variant="text" @click="open = !open" aria-label="Notifications">
<v-badge :content="store.unreadCount" :model-value="store.unreadCount > 0" color="primary">
<v-icon>mdi-bell-outline</v-icon>
@@ -106,6 +121,16 @@ watch(open, async (isOpen) => {
overflow: hidden;
}
@media (max-width: 480px) {
.notif-menu {
position: fixed;
top: 4.5rem; /* adjust to sit just below your navbar height */
left: 50%;
transform: translateX(-50%);
width: min(320px, calc(100vw - 1.5rem));
}
}
.notif-header {
display: flex;
align-items: center;
@@ -4,6 +4,7 @@ import FlightMap from "@/Components/FlightsGoneBy/FlightMap.vue";
import Panel from "@/Components/FlightsGoneBy/Panels/Panel.vue";
import DetailRows from "@/Components/FlightsGoneBy/Panels/DetailRows.vue";
import DetailRow from "@/Components/FlightsGoneBy/Panels/DetailRow.vue";
import PanelLabel from "@/Components/FlightsGoneBy/Panels/PanelLabel.vue";
defineProps<{
flight: Flight
@@ -19,6 +20,10 @@ defineProps<{
<DetailRow label="Distance" :value="flight.distance + 'km'" />
<DetailRow label="Duration" :value="flight.duration_display" />
</DetailRows>
<DetailRows>
<PanelLabel v-if="flight.note?.length">Notes</PanelLabel>
{{flight.note}}
</DetailRows>
</Panel>
</template>
@@ -0,0 +1,53 @@
<script setup lang="ts">
import GlassTooltip from '@/Components/FlightsGoneBy/GlassTooltip.vue'
import type { Anchor } from 'vuetify'
withDefaults(defineProps<{
label?: string
location?: Anchor
}>(), {
label: 'Missing something?',
})
defineSlots<{
default(): any
}>()
</script>
<template>
<GlassTooltip :location="location ?? 'top'" :open-delay="150">
<template #activator="{ props: activatorProps }">
<button
v-bind="activatorProps"
type="button"
class="missing-entity-link"
>
{{ label }}
</button>
</template>
<template #default>
<slot />
</template>
</GlassTooltip>
</template>
<style scoped>
.missing-entity-link {
display: inline-block;
margin-top: 4px;
padding: 0;
background: none;
border: none;
font-size: 12px;
color: rgba(255, 255, 255, 0.55);
text-decoration: underline;
text-underline-offset: 2px;
cursor: pointer;
transition: color 0.15s ease;
}
.missing-entity-link:hover {
color: rgba(255, 255, 255, 0.85);
}
</style>
+84
View File
@@ -0,0 +1,84 @@
<script setup lang="ts">
import { ref, watch } from 'vue'
import { Link } from '@inertiajs/vue3'
defineProps<{
density?: null | 'default' | 'comfortable' | 'compact';
}>()
interface UserOption {
value: number
title: string
}
const search = ref('')
const selectedUser = ref<UserOption | null>(null)
const items = ref<UserOption[]>([])
const loading = ref(false)
let debounceTimeout: ReturnType<typeof setTimeout> | undefined
async function fetchUsers(query: string) {
if (!query) {
items.value = []
return
}
loading.value = true
try {
const response = await fetch(`/search/users?q=${encodeURIComponent(query)}`)
if (!response.ok) throw new Error('Failed to fetch users')
items.value = await response.json()
} catch (error) {
console.error('User search failed:', error)
items.value = []
} finally {
loading.value = false
}
}
watch(search, (newQuery) => {
clearTimeout(debounceTimeout)
debounceTimeout = setTimeout(() => {
fetchUsers(newQuery)
}, 300)
})
</script>
<template>
<div class="user-search-box">
<v-autocomplete
v-model="selectedUser"
v-model:search="search"
:items="items"
:loading="loading"
item-title="title"
item-value="value"
return-object
label="Search users"
placeholder="Type a name..."
prepend-inner-icon="mdi-magnify"
:density="density ?? 'default'"
variant="outlined"
no-filter
clearable
hide-details
hide-no-data
autocomplete="off"
>
<template #item="{ item }">
<Link :href="`/u/${item.title}`" class="user-search-result">
<v-list-item :title="item.title" />
</Link>
</template>
</v-autocomplete>
</div>
</template>
<style scoped>
.user-search-box {
display: block;
align-self: center;
width: 100%;
}
</style>
+18
View File
@@ -9,6 +9,7 @@ import { ref } from "vue";
import NotificationListener from "@/Components/FlightsGoneBy/NotificationListener.vue";
import {SharedProps} from "@/Types/types";
import PushNotificationPrompt from "@/Components/PushNotificationPrompt.vue";
import CopyPageButton from "@/Components/FlightsGoneBy/CopyPageButton.vue";
const transitionKey = ref(0);
const page = usePage<SharedProps>().props
@@ -27,6 +28,9 @@ router.on('success', () => {
<slot />
</main>
</Transition>
<span class="footer-share">
<CopyPageButton label="Share Link" />
</span>
<MainFooter :key="`footer-${transitionKey}`" />
</div>
<NotificationListener v-if="page.auth.user?.id" :user-id="page.auth.user?.id" />
@@ -51,6 +55,14 @@ footer {
min-height: 3rem;
}
@media (max-width: 600px) {
footer {
flex: 0 1 auto;
min-height: 3.25rem;
padding-block: 0.35rem;
}
}
main {
flex: 1 1 auto;
background: transparent;
@@ -60,6 +72,12 @@ main {
align-items: center;
}
.footer-share {
padding:1em;
display: flex;
justify-content: center;
}
.fade-enter-from,
.fade-leave-to { opacity: 0; }
.fade-enter-active,
+364 -73
View File
@@ -6,8 +6,9 @@ import AirlineSearchBox from '@/Components/FlightsGoneBy/AirlineSearchBox.vue'
import AircraftSearchBox from '@/Components/FlightsGoneBy/AircraftSearchBox.vue'
import AirportSearchBox from '@/Components/FlightsGoneBy/AirportSearchBox.vue'
import type {SeatType, FlightReason, FlightClass, CrewType, SharedProps} from '@/Types/types'
import { ref, watch, computed } from 'vue'
import { ref, watch, computed, onMounted, nextTick } from 'vue'
import { VTimePicker, VDatePicker } from 'vuetify/components'
import MissingEntityLink from "@/Components/FlightsGoneBy/Tooltips/MissingEntityLink.vue";
defineOptions({ layout: MainLayout })
const page = usePage<SharedProps>().props
@@ -49,25 +50,13 @@ const pad = (n: number) => String(n).padStart(2, '0')
const flightNumber = ref(props.flight?.flight_number ?? '')
const lookupLoading = ref(false)
const lookupError = ref<string | null>(null)
const lookupComplete = ref(true)
interface LookupResult {
airline_options: { value: number; title: string, logo_url: string }[]
from_options: { value: number; title: string; country_code: string }[]
to_options: { value: number; title: string; country_code: string }[]
aircraft_options: { value: number; title: string }[]
scheduled_departure_time: string | null
scheduled_arrival_time: string | null
}
const lookupResult = ref<LookupResult | null>(null)
const lookupKey = ref(0)
async function lookupFlight() {
if (!flightNumber.value.trim()) return
lookupLoading.value = true
lookupError.value = null
lookupResult.value = null
try {
const response = await fetch(`${route('flights.lookup')}?number=${encodeURIComponent(flightNumber.value.trim())}`, {
@@ -78,8 +67,6 @@ async function lookupFlight() {
lookupError.value = data.message ?? 'Lookup failed.'
return
}
lookupResult.value = data
lookupComplete.value = true
if (data.airline_options?.length) {
airlineOptionsData.value = data.airline_options
if (!form.airline) form.airline = data.airline_options[0]
@@ -111,6 +98,12 @@ async function lookupFlight() {
}
suppressArrivalAutoFill = false
// NOTE: if the lookup API is ever extended to return a day
// difference for the arrival (e.g. `data.arrival_day_offset`),
// wire it in here: `arrivalOffset.value = data.arrival_day_offset`
// (clamped/mapped to 'custom' if outside -1..2). Left out for now
// since the API doesn't provide it yet.
lookupKey.value++
} catch (e) {
lookupError.value = String(e)
@@ -122,7 +115,6 @@ async function lookupFlight() {
// ── Display form (drives the template) ───────────────────────────────────────
const form = useForm({
flight_number: props.flight?.flight_number ?? '',
departure_date: props.flight?.departure_date ?? '',
arrival_date: props.flight?.arrival_date ?? '',
from: props.flight?.from_options[0] ?? null as { value: number; title: string; country_code: string } | null,
@@ -163,9 +155,9 @@ const submitForm = useForm({
crew_type_id: null as number | null,
note: '' as string | null,
auto_update: false,
add_more: false,
})
const departureIsFuture = computed(() => {
if (!form.departure_date) return false
return new Date(form.departure_date) > new Date()
@@ -177,7 +169,7 @@ watch(departureIsFuture, (isFuture) => {
}, { immediate: true })
function submit() {
function submit(addMore = false) {
submitForm.flight_number = flightNumber.value
submitForm.departure_date = form.departure_date
submitForm.arrival_date = form.arrival_date
@@ -193,6 +185,7 @@ function submit() {
submitForm.crew_type_id = form.crew_type?.id ?? null
submitForm.note = form.note
submitForm.auto_update = form.auto_update
submitForm.add_more = addMore
if (isEdit) {
submitForm.put(route('flights.update', { flight: props.flight!.id }))
@@ -230,9 +223,15 @@ function combineDateTime(date: Date | null, time: string | null): string {
return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}T${(hh ?? '00').padStart(2, '0')}:${(mm ?? '00').padStart(2, '0')}`
}
function clearDepartureDate() { departureDatePart.value = null }
// Whole-day difference between two Date objects (time-of-day ignored).
function diffInDays(from: Date | null, to: Date | null): number | null {
if (!from || !to) return null
const a = new Date(from.getFullYear(), from.getMonth(), from.getDate())
const b = new Date(to.getFullYear(), to.getMonth(), to.getDate())
return Math.round((b.getTime() - a.getTime()) / 86_400_000)
}
function clearDepartureTime() { departureTimePart.value = null }
function clearArrivalDate() { arrivalDatePart.value = null }
function clearArrivalTime() { arrivalTimePart.value = null }
// Normalizes whatever shape the API sends a scheduled time in ("14:30",
@@ -278,19 +277,88 @@ watch([arrivalDatePart, arrivalTimePart], () => {
form.arrival_date = combineDateTime(arrivalDatePart.value, arrivalTimePart.value)
})
// Auto-fill arrival (+1hr) the first time a departure TIME is chosen (and a
// departure date is already set) and arrival is still empty. Picking the
// departure date alone no longer triggers this — only setting the time does.
// ── Arrival day offset ───────────────────────────────────────────────────────
// Rather than making the user pick an independent arrival date, arrival date
// is normally *derived* from departure date + a small relative offset
// (-1 / Same day / +1 / +2). "Custom" drops back to a real date picker for
// the rare case that falls outside that range. This avoids needing airport
// time zones to work out the arrival date, which a duration-based input
// would require.
type ArrivalOffset = -1 | 0 | 1 | 2
const arrivalOffsetOptions: { value: ArrivalOffset; label: string }[] = [
{ value: -1, label: '1 Day' },
{ value: 0, label: 'Same Day' },
{ value: 1, label: '+1 Day' },
{ value: 2, label: '+2 Days' },
]
const initialDiff = diffInDays(depInit.date, arrInit.date)
const initialDiffIsQuickOption = initialDiff !== null && ([-1, 0, 1, 2] as number[]).includes(initialDiff)
// 'offset' (the default): arrival date is derived from departure date + the
// selected quick offset. 'custom': the user has dropped into a real date
// picker, e.g. because the actual gap is more than +2 days.
const arrivalDateMode = ref<'offset' | 'custom'>(
initialDiff !== null && !initialDiffIsQuickOption ? 'custom' : 'offset'
)
const arrivalOffset = ref<ArrivalOffset>(
initialDiffIsQuickOption ? (initialDiff as ArrivalOffset) : 0
)
function applyArrivalOffset() {
if (suppressArrivalAutoFill) return
if (arrivalDateMode.value === 'custom') return
if (!departureDatePart.value) {
arrivalDatePart.value = null
return
}
const d = new Date(departureDatePart.value)
d.setDate(d.getDate() + arrivalOffset.value)
arrivalDatePart.value = d
}
// Re-derive arrival date whenever departure date moves, or the offset is
// changed by hand.
watch(departureDatePart, applyArrivalOffset)
watch(arrivalOffset, applyArrivalOffset)
function useCustomArrivalDate() {
arrivalDateMode.value = 'custom'
}
function useQuickArrivalOffset() {
arrivalDateMode.value = 'offset'
applyArrivalOffset()
}
function formatFullDate(d: Date | null): string {
if (!d) return ''
return d.toLocaleDateString(undefined, { weekday: 'short', day: 'numeric', month: 'short', year: 'numeric' })
}
// Auto-fill arrival TIME (+1hr) the first time a departure time is chosen
// (and a departure date is already set) and arrival time is still empty.
// If adding the hour rolls over midnight, bump the offset selector to match
// (e.g. departs 23:30 -> offset flips to "+1") so the resolved arrival date
// stays correct without the user having to notice and fix it themselves.
watch(departureTimePart, (newTime) => {
if (suppressArrivalAutoFill) return
if (!newTime || !departureDatePart.value || arrivalDatePart.value) return
if (arrivalDateMode.value === 'custom') return
if (!newTime || !departureDatePart.value || arrivalTimePart.value) return
const dep = new Date(departureDatePart.value)
const [h, m] = newTime.split(':').map(Number)
dep.setHours(h, m)
const arr = new Date(dep.getTime() + 60 * 60 * 1000)
const rawDiff = diffInDays(departureDatePart.value, arr) ?? 0
const clampedDiff = Math.min(Math.max(rawDiff, -1), 2) as -1 | 0 | 1 | 2
suppressArrivalAutoFill = true
arrivalOffset.value = clampedDiff
arrivalDatePart.value = new Date(arr.getFullYear(), arr.getMonth(), arr.getDate())
arrivalTimePart.value = `${pad(arr.getHours())}:${pad(arr.getMinutes())}`
suppressArrivalAutoFill = false
@@ -313,11 +381,31 @@ const arrivalMaxDate = computed(() => arrivalMax.value ? new Date(arrivalMax.val
// ── Native date inputs ───────────────────────────────────────────────────────
// departureDatePart / arrivalDatePart stay the source of truth as Date
// objects. These computed get/set pairs are what the native <input type=date>
// elements bind to — the browser handles locale display, typing, and
// validation itself, so no custom format-aware parsing is needed here.
// The Vuetify v-date-picker is still available via a separate calendar icon
// for users who prefer to pick from a calendar rather than type.
// objects. The <input type="date"> elements below are deliberately left
// UNCONTROLLED from Vue's perspective — no v-model, no :model-value, no
// reactive :value binding of any kind. That's on purpose: any reactive
// binding through Vuetify's v-text-field — even one that only commits on
// blur/change, not every keystroke — still runs through v-text-field's own
// internal echo of the field, which re-renders the wrapped <input> on every
// keystroke regardless of what we bind from outside. For type="date"
// specifically, that internal re-render resets the browser's own
// per-segment editing state mid-type (day/month/year), which is what was
// scrambling what you typed. Using a genuinely uncontrolled native <input>
// (not wrapped in v-text-field at all) sidesteps that entirely.
//
// We grab a direct DOM ref to each native input and manage its .value
// imperatively instead:
// - once on mount, to show the initial value
// - whenever departureDatePart/arrivalDatePart changes from elsewhere
// (the calendar picker, a flight lookup, auto-fill) — but only if the
// field isn't currently focused, so we never fight with active typing
// - the native `change` event (fires once a full date has been entered
// and committed, or cleared) is what flows the typed value back into
// departureDatePart/arrivalDatePart
// This keeps the real native, locale-aware date input and picker UI intact.
//
// The arrival native date input only exists in the DOM while arrivalOffset
// is 'custom' (see template); its value is (re)synced whenever it mounts.
function toIsoDateString(d: Date | null): string {
if (!d) return ''
@@ -331,16 +419,42 @@ function fromIsoDateString(value: string): Date | null {
return new Date(y, m - 1, d)
}
const departureDateValue = computed({
get: () => toIsoDateString(departureDatePart.value),
set: (value: string) => { departureDatePart.value = fromIsoDateString(value) },
const departureDateEl = ref<HTMLInputElement | null>(null)
const arrivalDateEl = ref<HTMLInputElement | null>(null)
onMounted(() => {
if (departureDateEl.value) departureDateEl.value.value = toIsoDateString(departureDatePart.value)
if (arrivalDateEl.value) arrivalDateEl.value.value = toIsoDateString(arrivalDatePart.value)
})
const arrivalDateValue = computed({
get: () => toIsoDateString(arrivalDatePart.value),
set: (value: string) => { arrivalDatePart.value = fromIsoDateString(value) },
watch(departureDatePart, (d) => {
const el = departureDateEl.value
if (el && document.activeElement !== el) el.value = toIsoDateString(d)
})
watch(arrivalDatePart, (d) => {
const el = arrivalDateEl.value
if (el && document.activeElement !== el) el.value = toIsoDateString(d)
})
// The arrival native input only exists while arrivalDateMode === 'custom',
// so re-sync its value whenever it (re)mounts into the DOM.
watch(arrivalDateMode, async (mode) => {
if (mode !== 'custom') return
await nextTick()
if (arrivalDateEl.value) arrivalDateEl.value.value = toIsoDateString(arrivalDatePart.value)
})
function commitDepartureDateInput(e: Event) {
const value = (e.target as HTMLInputElement).value
departureDatePart.value = value ? fromIsoDateString(value) : null
}
function commitArrivalDateInput(e: Event) {
const value = (e.target as HTMLInputElement).value
arrivalDatePart.value = value ? fromIsoDateString(value) : null
}
// ── Editable, format-aware time text fields ────────────────────────────────
// departureTimePart / arrivalTimePart stay the source of truth as internal
// "HH:mm" (24hr) strings. These input refs are what the text-fields actually
@@ -472,20 +586,21 @@ function commitArrivalTimeInput() {
<!-- Departure date + time -->
<v-row>
<v-col cols="12" sm="6">
<v-text-field
v-model="departureDateValue"
<div class="native-date-field">
<v-icon icon="mdi-calendar" size="20" class="native-date-field__icon" />
<label class="native-date-field__label">Departure Date</label>
<input
ref="departureDateEl"
type="date"
label="Departure Date"
prepend-inner-icon="mdi-calendar"
:disabled="!lookupComplete"
:error-messages="submitForm.errors.departure_date"
class="native-date-field__input"
@change="commitDepartureDateInput"
>
<template #append-inner>
<v-menu v-model="depDateMenu" :close-on-content-click="false">
<template #activator="{ props: menuProps }">
<v-icon
v-bind="menuProps"
icon="mdi-calendar-month"
size="20"
style="cursor: pointer"
/>
</template>
@@ -494,8 +609,10 @@ function commitArrivalTimeInput() {
@update:model-value="depDateMenu = false"
/>
</v-menu>
</template>
</v-text-field>
</div>
<div v-if="submitForm.errors.departure_date" class="native-date-field__error text-error">
{{ submitForm.errors.departure_date }}
</div>
</v-col>
<v-col cols="12" sm="6">
<v-menu v-model="depTimeMenu" :close-on-content-click="false">
@@ -507,7 +624,6 @@ function commitArrivalTimeInput() {
clearable
prepend-inner-icon="mdi-clock-outline"
:placeholder="timeFormat === '24hr' ? 'e.g. 1430' : 'e.g. 2:30 PM'"
:disabled="!lookupComplete"
@click:clear="clearDepartureTime"
@blur="commitDepartureTimeInput"
@keydown.enter="commitDepartureTimeInput"
@@ -528,23 +644,59 @@ function commitArrivalTimeInput() {
</v-col>
</v-row>
<!-- Arrival date + time -->
<!-- Arrival -->
<v-row>
<v-col cols="12" sm="6">
<v-text-field
v-model="arrivalDateValue"
<label class="arrival-offset__label">Arrival Date</label>
<template v-if="arrivalDateMode === 'offset'">
<v-btn-toggle
v-model="arrivalOffset"
mandatory
variant="outlined"
color="primary"
divided
class="arrival-offset__toggle"
>
<v-btn
v-for="opt in arrivalOffsetOptions"
:key="opt.value"
:value="opt.value"
class="arrival-offset__btn"
>
{{ opt.label }}
</v-btn>
</v-btn-toggle>
<div class="arrival-offset__footer">
<span v-if="arrivalDatePart" class="arrival-offset__hint">
Arrives {{ formatFullDate(arrivalDatePart) }}
</span>
<button
type="button"
class="arrival-offset__link"
@click="useCustomArrivalDate"
>
Custom date
</button>
</div>
</template>
<template v-else>
<div class="native-date-field">
<v-icon icon="mdi-calendar" size="20" class="native-date-field__icon" />
<input
ref="arrivalDateEl"
type="date"
label="Arrival Date"
prepend-inner-icon="mdi-calendar"
:disabled="!lookupComplete"
:error-messages="submitForm.errors.arrival_date"
class="native-date-field__input"
@change="commitArrivalDateInput"
>
<template #append-inner>
<v-menu v-model="arrDateMenu" :close-on-content-click="false">
<template #activator="{ props: menuProps }">
<v-icon
v-bind="menuProps"
icon="mdi-calendar-month"
size="20"
style="cursor: pointer"
/>
</template>
@@ -555,8 +707,19 @@ function commitArrivalTimeInput() {
@update:model-value="arrDateMenu = false"
/>
</v-menu>
</div>
<button
type="button"
class="arrival-offset__link mt-1"
@click="useQuickArrivalOffset"
>
Use quick select instead
</button>
</template>
</v-text-field>
<div v-if="submitForm.errors.arrival_date" class="native-date-field__error text-error">
{{ submitForm.errors.arrival_date }}
</div>
</v-col>
<v-col cols="12" sm="6">
<v-menu v-model="arrTimeMenu" :close-on-content-click="false">
@@ -568,7 +731,6 @@ function commitArrivalTimeInput() {
clearable
prepend-inner-icon="mdi-clock-outline"
:placeholder="timeFormat === '24hr' ? 'e.g. 1430' : 'e.g. 2:30 PM'"
:disabled="!lookupComplete"
@click:clear="clearArrivalTime"
@blur="commitArrivalTimeInput"
@keydown.enter="commitArrivalTimeInput"
@@ -597,8 +759,11 @@ function commitArrivalTimeInput() {
label="From"
:prefilled-options="fromOptionsData"
:error-messages="submitForm.errors.from_id"
:disabled="!lookupComplete"
/>
<MissingEntityLink label="Missing airport?">
<p>If you can't find an airport we will be happy to add it, but you'll have to contact support with details of the airport.</p>
<p>Unfortunately you won't be able to proceed with adding this flight until the airport has been added.</p>
</MissingEntityLink>
</v-col>
</v-row>
@@ -610,7 +775,6 @@ function commitArrivalTimeInput() {
label="To"
:prefilled-options="toOptionsData"
:error-messages="submitForm.errors.to_id"
:disabled="!lookupComplete"
/>
</v-col>
</v-row>
@@ -623,8 +787,11 @@ function commitArrivalTimeInput() {
v-model="form.airline"
:prefilled-options="airlineOptionsData"
:error-messages="submitForm.errors.airline_id"
:disabled="!lookupComplete"
/>
<MissingEntityLink label="Missing airline? No problem">
<p>If you can't find the airline you flew with, just leave it blank but make sure to add a valid flight number. We will be notified of flights with missing airlines and add the airline shortly.</p>
<p>If you don't know your flight number or a missing airline hasn't been added within 48 hours, please contact support.</p>
</MissingEntityLink>
</v-col>
</v-row>
@@ -636,7 +803,6 @@ function commitArrivalTimeInput() {
v-model="form.aircraft"
:prefilled-options="aircraftOptionsData"
:error-messages="submitForm.errors.aircraft_id"
:disabled="!lookupComplete"
/>
</v-col>
</v-row>
@@ -648,7 +814,6 @@ function commitArrivalTimeInput() {
v-model="form.aircraft_registration"
label="Aircraft Registration"
placeholder="e.g. VH-OQA"
:disabled="!lookupComplete"
:error-messages="submitForm.errors.aircraft_registration"
/>
</v-col>
@@ -660,7 +825,6 @@ function commitArrivalTimeInput() {
item-title="name"
item-value="id"
:return-object="true"
:disabled="!lookupComplete"
:error-messages="submitForm.errors.flight_class_id"
/>
</v-col>
@@ -673,7 +837,6 @@ function commitArrivalTimeInput() {
v-model="form.seat_number"
label="Seat Number"
placeholder="e.g. 12A"
:disabled="!lookupComplete"
:error-messages="submitForm.errors.seat_number"
/>
</v-col>
@@ -685,7 +848,6 @@ function commitArrivalTimeInput() {
item-title="name"
item-value="id"
:return-object="true"
:disabled="!lookupComplete"
:error-messages="submitForm.errors.seat_type_id"
/>
</v-col>
@@ -701,7 +863,6 @@ function commitArrivalTimeInput() {
item-title="name"
item-value="id"
:return-object="true"
:disabled="!lookupComplete"
:error-messages="submitForm.errors.flight_reason_id"
/>
</v-col>
@@ -713,7 +874,6 @@ function commitArrivalTimeInput() {
item-title="name"
item-value="id"
:return-object="true"
:disabled="!lookupComplete"
:error-messages="submitForm.errors.crew_type_id"
/>
</v-col>
@@ -726,7 +886,6 @@ function commitArrivalTimeInput() {
v-model="form.note"
label="Note"
placeholder="Any additional notes…"
:disabled="!lookupComplete"
:error-messages="submitForm.errors.note"
rows="3"
auto-grow
@@ -740,7 +899,6 @@ function commitArrivalTimeInput() {
<v-checkbox
v-model="form.auto_update"
label="Automatically update flight details within 24 hours of flight departure"
:disabled="!lookupComplete"
hide-details
density="compact"
/>
@@ -749,15 +907,27 @@ function commitArrivalTimeInput() {
<!-- Submit -->
<v-row>
<v-col cols="12">
<v-col v-if="!isEdit" cols="12" md="6">
<v-btn
block
size="large"
:loading="submitForm.processing"
:disabled="!lookupComplete || submitForm.processing"
@click="submit"
variant="outlined"
:loading="submitForm.processing && submitForm.add_more"
:disabled="submitForm.processing"
@click="submit(true)"
>
{{ isEdit ? 'Save Changes' : 'Add Flight' }}
Save Flight and Add Another
</v-btn>
</v-col>
<v-col cols="12" :md="isEdit ? 12 : 6">
<v-btn
block
size="large"
:loading="submitForm.processing && !submitForm.add_more"
:disabled="submitForm.processing"
@click="submit(false)"
>
{{ isEdit ? 'Save Changes' : 'Save Flight' }}
</v-btn>
</v-col>
</v-row>
@@ -768,8 +938,129 @@ function commitArrivalTimeInput() {
</template>
<style scoped>
:deep(input[type="date"]::-webkit-calendar-picker-indicator) {
/* Hand-rolled field chrome for the native <input type="date"> fields.
These deliberately bypass v-text-field (see the "Native date inputs"
comment in the script block for why), so we approximate the surrounding
Vuetify outlined-field look here instead of getting it for free. */
.native-date-field {
position: relative;
display: flex;
align-items: center;
gap: 10px;
min-height: 56px;
padding: 8px 12px;
border: 1px none rgba(255, 255, 255, 0.24);
border-bottom-style: solid;
background: transparent;
transition: border-color 0.15s ease;
}
.native-date-field:focus-within {
border-color: rgb(var(--surface));
border-width: 2px;
padding: 7px 11px;
}
.native-date-field__icon {
opacity: 0.7;
flex-shrink: 0;
}
.native-date-field__label {
position: absolute;
top: -8px;
left: 38px;
padding: 0 4px;
font-size: 12px;
line-height: 1;
color: rgba(255, 255, 255, 0.6);
pointer-events: none;
}
.native-date-field__input {
flex: 1;
min-width: 0;
background: transparent;
border: none;
outline: none;
color: inherit;
font-size: 16px;
color-scheme: dark;
}
.native-date-field__input::-webkit-calendar-picker-indicator {
display: none;
-webkit-appearance: none;
}
/* Firefox doesn't support ::-webkit-calendar-picker-indicator; this trims
its built-in indicator/spinner button area instead. */
.native-date-field__input::-moz-calendar-picker-indicator {
display: none;
}
.native-date-field__error {
margin-top: 4px;
padding-left: 12px;
font-size: 12px;
}
/* Arrival day-offset control */
.arrival-offset__label {
display: block;
font-size: 12px;
line-height: 1;
color: rgba(255, 255, 255, 0.6);
margin-bottom: 6px;
padding-left: 2px;
}
.arrival-offset__toggle {
display: grid;
grid-template-columns: repeat(4, 1fr);
width: 100%;
height: 48px;
border-radius: 4px;
}
.arrival-offset__btn {
min-width: 0;
flex: none;
width: 100%;
height: 100%;
font-size: 11px;
letter-spacing: 0;
text-transform: none;
padding: 0 4px;
}
.arrival-offset__footer {
display: flex;
align-items: baseline;
justify-content: space-between;
gap: 8px;
margin-top: 6px;
padding: 0 2px;
}
.arrival-offset__hint {
font-size: 13px;
color: rgba(255, 255, 255, 0.7);
}
.arrival-offset__link {
flex-shrink: 0;
font-size: 12px;
color: rgba(255, 255, 255, 0.75);
background: none;
border: none;
padding: 0;
cursor: pointer;
text-decoration: underline;
text-underline-offset: 2px;
}
.arrival-offset__link:hover {
color: rgb(255, 255, 255);
}
</style>
+1 -1
View File
@@ -19,7 +19,7 @@ defineProps<{
Reconcile Missing Liveries
<v-chip size="x-small" color="error" class="ml-1">{{ missingLiveryCount }}</v-chip>
</Link>
<Link :href="route('admin.reconcile-missing-airlines')" class="sidebar-link">
<Link v-if="missingAirlineCount" :href="route('admin.reconcile-missing-airlines')" class="sidebar-link">
<v-icon icon="mdi-airplane-takeoff" size="18" />
Reconcile Missing Airlines
<v-chip size="x-small" color="error" class="ml-1">{{ missingAirlineCount }}</v-chip>
+3 -1
View File
@@ -9,6 +9,7 @@ import PlaneLoader from "@/Components/FlightsGoneBy/PlaneLoader.vue";
import { useFlights } from "@/Composables/useFlights";
import { useApiResource } from "@/Composables/useApiResource";
import Avatar from "@/Components/FlightsGoneBy/Feed/Avatar.vue";
import UserSearchBox from "@/Components/UserSearchBox.vue";
defineOptions({ layout: MainLayout })
@@ -46,8 +47,9 @@ const { data: following, loading: followingLoading } = useApiResource<User[]>('/
</div>
</section>
<UserSearchBox />
<div class="feed-grid">
<!-- FOLLOWING: secondary, supporting content -->
<aside class="following-box">
<h2>Following</h2>
<div v-if="followingLoading" class="following-loading">
@@ -21,6 +21,12 @@ const continents = computed(() => props.continents.filter(c => c.internal_name !
const { entriesByDeparture, departureNames, completedCount, totalCount } =
useDirectedContinentPairs(flights, continents)
// Split "Africa Asia" into ["Africa", "Asia"] for independent flex items
function splitLabel(label: string): [string, string] {
const [from, to] = label.split('→').map(part => part.trim())
return [from, to]
}
</script>
<template>
@@ -35,11 +41,16 @@ const { entriesByDeparture, departureNames, completedCount, totalCount } =
:rows="entriesByDeparture.get(dep) ?? []"
:rowKey="entry => entry.key"
:hasItems="entry => entry.flights.length > 0"
labelWidth="18em"
compactOnMobile
>
<template #label="{ row: entry }">
<div class="pair-label">
<span class="pair-name">{{ entry.label }}</span>
<span class="pair-part">{{ splitLabel(entry.label)[0] }}</span>
<span class="pair-divider">
<span class="divider-horizontal">{{ '\u2192\uFE0E' }}</span>
<span class="divider-vertical">{{ '\u2193\uFE0E' }}</span>
</span>
<span class="pair-part">{{ splitLabel(entry.label)[1] }}</span>
</div>
</template>
@@ -80,4 +91,55 @@ const { entriesByDeparture, departureNames, completedCount, totalCount } =
gap: 1rem;
margin-bottom: 0.75rem;
}
.pair-label {
width: 100%;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
gap: 0.35rem;
padding: 0 0.25rem;
}
.pair-part {
font-size: 0.9rem;
text-align: center;
white-space: nowrap;
}
.pair-divider {
font-size: 0.9rem;
opacity: 0.6;
flex-shrink: 0;
}
.divider-vertical {
display: none;
}
@container (max-width: 480px) {
.pair-label {
flex-direction: column;
gap: 0.1rem;
}
.pair-part {
font-size: 0.7rem;
white-space: normal;
}
.pair-divider {
font-size: 0.65rem;
line-height: 1;
}
.divider-horizontal {
display: none;
}
.divider-vertical {
display: inline;
}
}
</style>
@@ -19,6 +19,12 @@ const flights = computed(() => props.flights)
const continents = computed(() => props.continents.filter(c => c.internal_name !== 'antarctica'))
const { entries, completedCount, totalCount } = useUndirectedContinentPairs(flights, continents)
// Split "AfricaAsia" into ["Africa", "Asia"] for independent flex items
function splitLabel(label: string): [string, string] {
const [from, to] = label.split('↔')
return [from, to]
}
</script>
<template>
@@ -32,11 +38,16 @@ const { entries, completedCount, totalCount } = useUndirectedContinentPairs(flig
:rows="entries"
:rowKey="entry => entry.key"
:hasItems="entry => entry.flights.length > 0"
labelWidth="18em"
compactOnMobile
>
<template #label="{ row: entry }">
<div class="pair-label">
<span class="pair-name">{{ entry.label }}</span>
<span class="pair-part">{{ splitLabel(entry.label)[0] }}</span>
<span class="pair-divider">
<span class="divider-horizontal">{{ '\u2194\uFE0E' }}</span>
<span class="divider-vertical">{{ '\u2195\uFE0E' }}</span>
</span>
<span class="pair-part">{{ splitLabel(entry.label)[1] }}</span>
</div>
</template>
@@ -80,12 +91,51 @@ const { entries, completedCount, totalCount } = useUndirectedContinentPairs(flig
.pair-label {
width: 100%;
display: flex;
flex-direction: row;
align-items: center;
gap: 0.5rem;
justify-content: center;
gap: 0.35rem;
padding: 0 0.25rem;
}
.pair-name {
.pair-part {
font-size: 0.9rem;
text-align: center;
white-space: nowrap;
}
.pair-divider {
font-size: 0.9rem;
opacity: 0.6;
flex-shrink: 0;
}
.divider-vertical {
display: none;
}
@container (max-width: 480px) {
.pair-label {
flex-direction: column;
gap: 0.1rem;
}
.pair-part {
font-size: 0.7rem;
white-space: normal;
}
.pair-divider {
font-size: 0.65rem;
line-height: 1;
}
.divider-horizontal {
display: none;
}
.divider-vertical {
display: inline;
}
}
</style>
@@ -0,0 +1,139 @@
<script setup lang="ts">
import { computed } from 'vue'
import { Achievement, Flight, User, Airport } from '@/Types/types'
import Panel from '@/Components/FlightsGoneBy/Panels/Panel.vue'
import PanelHeader from '@/Components/FlightsGoneBy/Panels/PanelHeader.vue'
import BadgeTable from '@/Components/FlightsGoneBy/GenericBadgeTable.vue'
import FlightBadge from '@/Components/FlightsGoneBy/FlightBadge.vue'
defineOptions({ inheritAttrs: false })
const props = defineProps<{
achievement: Achievement
user: User
followStatus: string
londonAirports: string[]
flights: Flight[]
}>()
interface AirportEntry {
code: string
airport: Airport | null
flights: Flight[]
}
const LONDON_AIRPORT_NAMES: Record<string, string> = {
LHR: 'Heathrow Airport',
LGW: 'Gatwick Airport',
STN: 'Stansted Airport',
LTN: 'Luton Airport',
LCY: 'City Airport',
SEN: 'Southend Airport',
}
const airports = computed<AirportEntry[]>(() => {
const entries = props.londonAirports.map(code => ({
code,
airport: null as Airport | null,
flights: [] as Flight[],
}))
const byCode = new Map(entries.map(e => [e.code, e]))
for (const flight of props.flights) {
const dep = flight.departure_airport
const arr = flight.arrival_airport
if (dep?.iata_code && byCode.has(dep.iata_code)) {
const entry = byCode.get(dep.iata_code)!
entry.airport ??= dep
entry.flights.push(flight)
}
if (arr?.iata_code && byCode.has(arr.iata_code)) {
const entry = byCode.get(arr.iata_code)!
entry.airport ??= arr
entry.flights.push(flight)
}
}
return entries
})
const rows = computed(() => airports.value.map(e => e.code))
function entryFor(code: string): AirportEntry {
return airports.value.find(e => e.code === code)!
}
function flightTitle(flight: Flight): string {
const name = flight.airline?.name ?? 'Unknown airline'
return `${name}: ${flight.departure_airport?.iata_code}${flight.arrival_airport?.iata_code}`
}
</script>
<template>
<!-- Airports table -->
<Panel>
<div class="table-toolbar">
<PanelHeader>London Airports</PanelHeader>
</div>
<BadgeTable
:rows="rows"
:rowKey="code => code"
:hasItems="code => entryFor(code).flights.length > 0"
labelWidth="14em"
>
<template #label="{ row: code }">
<div class="airport-label">
<span class="airport-code">{{ code }}</span>
<span>{{ LONDON_AIRPORT_NAMES[code] ?? code }}</span>
</div>
</template>
<template #items="{ row: code }">
<FlightBadge
v-for="flight in entryFor(code).flights"
:key="flight.id"
:title="flightTitle(flight)"
:flight="flight"
/>
</template>
</BadgeTable>
</Panel>
<!-- Requirements -->
<Panel>
<PanelHeader centered>Requirements</PanelHeader>
<p>
To complete this challenge you must fly to all {{ londonAirports.length }} of
London's airports Heathrow, Gatwick, Stansted, Luton, London City, and Southend.
</p>
</Panel>
</template>
<style scoped>
.table-toolbar {
display: flex;
align-items: center;
justify-content: space-between;
gap: 1rem;
margin-bottom: 0.75rem;
}
.airport-label {
width: 100%;
display: flex;
align-items: center;
gap: 0.5rem;
padding: 0 0.25rem;
}
.airport-code {
font-weight: 600;
opacity: 0.7;
min-width: 2.75rem;
}
</style>
@@ -25,6 +25,7 @@ const props = defineProps<{
regions: Region[]
alliance: Alliance | null
airlines: Airline[]
london_airports: string[]
continents: Continent[]
aircraft_families: Record<string, string[]>
majorAlliances: Alliance[]
@@ -119,6 +120,7 @@ const unlocked = computed(() => {
:continents="continents"
:families="aircraft_families"
:major-alliances="majorAlliances"
:london-airports="london_airports"
/>
<FollowingSelectBox
+1
View File
@@ -334,6 +334,7 @@ export interface MissingAirline{
flights: {
flight_number: string;
link: string;
id: number;
}[]
}
+4 -1
View File
@@ -42,6 +42,8 @@ use Inertia\Inertia;
Route::post('/ignore-missing-livery', [AdminController::class, 'ignoreMissingLivery'])->name('ignore-missing-livery');
Route::get('/missing-airlines', [AdminController::class, 'reconcileMissingAirlines'])->name('reconcile-missing-airlines')->middleware('permission:reconcile_missing_liveries');
Route::post('/ignore-missing-airline', [AdminController::class, 'ignoreMissingAirline'])->name('admin.ignore-missing-airline');
});
@@ -103,10 +105,11 @@ Route::middleware(['auth'])->group(function () {
//Search Routes
//Search Routes
Route::get('/search/airlines', [SearchController::class, 'airlines'])->name('search.airlines');
Route::get('/search/aircraft', [SearchController::class, 'aircraft'])->name('search.aircraft');
Route::get('/search/airports', [SearchController::class, 'airports'])->name('search.airports');
Route::get('/search/users', [SearchController::class, 'users'])->name('search.users');
Route::get('/u/{user}', [UserProfileController::class, 'view'])->name('profile.view');
Route::get('/u/{user}/map', [UserProfileController::class, 'map'])->name('profile.map');