Compare commits
10
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cf1a2f6cba | ||
|
|
3ae1e75275 | ||
|
|
1ef4ae4a21 | ||
|
|
90ea8d81d2 | ||
|
|
8514d76724 | ||
|
|
7bca9a8d31 | ||
|
|
e17203aefc | ||
|
|
02521da9c3 | ||
|
|
1030a14094 | ||
|
|
2b41c3ed44 |
@@ -3,19 +3,35 @@
|
|||||||
namespace App\Console\Commands;
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
|
use Illuminate\Console\Attributes\Argument;
|
||||||
use Illuminate\Console\Attributes\Description;
|
use Illuminate\Console\Attributes\Description;
|
||||||
use Illuminate\Console\Attributes\Signature;
|
use Illuminate\Console\Attributes\Signature;
|
||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
|
|
||||||
#[Signature('app:recalculate-achivements')]
|
#[Signature('app:recalculate-achievements {username? : The username of a single user to recalculate}')]
|
||||||
#[Description('Recalculate achievements for all users')]
|
#[Description('Recalculate achievements for all users, or a single user by username')]
|
||||||
class RecalculateAchievements extends Command
|
class RecalculateAchievements extends Command
|
||||||
{
|
{
|
||||||
public function handle(): void
|
public function handle(): void
|
||||||
{
|
{
|
||||||
$users = User::all();
|
$username = $this->argument('username');
|
||||||
foreach ($users as $user) {
|
|
||||||
|
if ($username) {
|
||||||
|
$user = User::where('name', $username)->first();
|
||||||
|
|
||||||
|
if (! $user) {
|
||||||
|
$this->error("No user found with username [{$username}].");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$user->calculateAchievements();
|
$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.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ namespace App\Http\Controllers;
|
|||||||
|
|
||||||
use App\Models\Achievement;
|
use App\Models\Achievement;
|
||||||
use App\Models\Aircraft;
|
use App\Models\Aircraft;
|
||||||
|
use App\Models\Airport;
|
||||||
use App\Models\Alliance;
|
use App\Models\Alliance;
|
||||||
use App\Models\Continent;
|
use App\Models\Continent;
|
||||||
use App\Models\Country;
|
use App\Models\Country;
|
||||||
@@ -199,6 +200,11 @@ class UserProfileController extends Controller
|
|||||||
default => [],
|
default => [],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$londonAirports = match($achievement->internal_name){
|
||||||
|
'fun_challenges.all_london_airports' => Airport::LONDON_AIRPORTS,
|
||||||
|
default => [],
|
||||||
|
};
|
||||||
|
|
||||||
$canView = Gate::allows('viewProfileData', $user);
|
$canView = Gate::allows('viewProfileData', $user);
|
||||||
|
|
||||||
return Inertia::render('Profile/UserAchievement', [
|
return Inertia::render('Profile/UserAchievement', [
|
||||||
@@ -212,6 +218,7 @@ class UserProfileController extends Controller
|
|||||||
'airlines' => $airlines,
|
'airlines' => $airlines,
|
||||||
'continents' => $continents,
|
'continents' => $continents,
|
||||||
'aircraft_families' => $aircraftFamilies,
|
'aircraft_families' => $aircraftFamilies,
|
||||||
|
'london_airports' => $londonAirports,
|
||||||
'achievementCount' => $user->unlockedAchievements()->count(),
|
'achievementCount' => $user->unlockedAchievements()->count(),
|
||||||
'majorAlliances' => Alliance::whereIn('internal_name', $majorAlliances)->get(),
|
'majorAlliances' => Alliance::whereIn('internal_name', $majorAlliances)->get(),
|
||||||
'canView' => $canView,
|
'canView' => $canView,
|
||||||
|
|||||||
@@ -33,6 +33,10 @@ class Airport extends Model
|
|||||||
'display_name',
|
'display_name',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const array LONDON_AIRPORTS = [
|
||||||
|
'LHR', 'LGW', 'STN', 'LTN', 'LCY', 'SEN',
|
||||||
|
];
|
||||||
|
|
||||||
protected function displayName() : Attribute{
|
protected function displayName() : Attribute{
|
||||||
return Attribute::make(
|
return Attribute::make(
|
||||||
get: function () {
|
get: function () {
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ use App\Services\Achievements\Checkers\AchievementCheckerInterface;
|
|||||||
use App\Services\Achievements\Checkers\AircraftChecker;
|
use App\Services\Achievements\Checkers\AircraftChecker;
|
||||||
use App\Services\Achievements\Checkers\CountriesAndContinentsChecker;
|
use App\Services\Achievements\Checkers\CountriesAndContinentsChecker;
|
||||||
use App\Services\Achievements\Checkers\AirlinesAndAlliancesChecker;
|
use App\Services\Achievements\Checkers\AirlinesAndAlliancesChecker;
|
||||||
|
use App\Services\Achievements\Checkers\DistanceChecker;
|
||||||
use App\Services\Achievements\Checkers\FunChallengesChecker;
|
use App\Services\Achievements\Checkers\FunChallengesChecker;
|
||||||
use App\Services\Achievements\Checkers\GeneralFlyingChecker;
|
use App\Services\Achievements\Checkers\GeneralFlyingChecker;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
@@ -30,6 +31,7 @@ class AchievementService
|
|||||||
AircraftChecker::class,
|
AircraftChecker::class,
|
||||||
AirlinesAndAlliancesChecker::class,
|
AirlinesAndAlliancesChecker::class,
|
||||||
FunChallengesChecker::class,
|
FunChallengesChecker::class,
|
||||||
|
DistanceChecker::class,
|
||||||
];
|
];
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
@@ -45,6 +47,7 @@ class AchievementService
|
|||||||
* @var Collection<int,UserFlight> $flights
|
* @var Collection<int,UserFlight> $flights
|
||||||
*/
|
*/
|
||||||
private Collection $flights;
|
private Collection $flights;
|
||||||
|
private int $loggedFlightCount;
|
||||||
|
|
||||||
public function calculate(User $user): void
|
public function calculate(User $user): void
|
||||||
{
|
{
|
||||||
@@ -62,20 +65,24 @@ class AchievementService
|
|||||||
'arrivalAirport.region.continent',
|
'arrivalAirport.region.continent',
|
||||||
])->where('departure_date', '<=', now('UTC'))->get();
|
])->where('departure_date', '<=', now('UTC'))->get();
|
||||||
|
|
||||||
|
$this->loggedFlightCount = $user->flights()->count();
|
||||||
|
|
||||||
foreach ($this->checkers as $checkerClass) {
|
foreach ($this->checkers as $checkerClass) {
|
||||||
$checker = new $checkerClass($this);
|
$checker = new $checkerClass($this);
|
||||||
$checker->check($user);
|
$checker->check($user);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return Collection<int,UserFlight>
|
|
||||||
*/
|
|
||||||
public function getFlights(): Collection
|
public function getFlights(): Collection
|
||||||
{
|
{
|
||||||
return $this->flights;
|
return $this->flights;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getLoggedFlightCount(): int
|
||||||
|
{
|
||||||
|
return $this->loggedFlightCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------
|
// ---------------------------------------------------------------
|
||||||
// Award / revoke
|
// Award / revoke
|
||||||
|
|||||||
@@ -15,6 +15,11 @@ abstract class BaseChecker implements AchievementCheckerInterface
|
|||||||
return $this->service->getFlights();
|
return $this->service->getFlights();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function allLoggedFlightsCount(): int
|
||||||
|
{
|
||||||
|
return $this->service->getLoggedFlightCount();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resolve an achievement ID from its internal name.
|
* Resolve an achievement ID from its internal name.
|
||||||
* Results are cached on the service so repeated lookups are free.
|
* 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;
|
namespace App\Services\Achievements\Checkers;
|
||||||
|
|
||||||
|
use App\Models\Airport;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use App\Models\UserFlight;
|
use App\Models\UserFlight;
|
||||||
|
|
||||||
@@ -131,5 +132,19 @@ class FunChallengesChecker extends BaseChecker
|
|||||||
->count();
|
->count();
|
||||||
|
|
||||||
$this->awardProgress($visitedCanadianProvinces, 'fun_challenges.canadian_provinces');
|
$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();
|
$flights = $this->flights();
|
||||||
$count = $flights->count();
|
$count = $flights->count();
|
||||||
|
$allLoggedFlightsCount = $this->allLoggedFlightsCount();
|
||||||
|
|
||||||
// --- Boolean achievements ---
|
// --- Boolean achievements ---
|
||||||
|
|
||||||
$this->awardIf($count >= 1, 'general_flying.first_flight');
|
$this->awardIf($allLoggedFlightsCount >= 1, 'general_flying.first_flight');
|
||||||
|
|
||||||
$this->awardIf(
|
$this->awardIf(
|
||||||
$flights->contains(fn ($f) => $f->isDomestic()),
|
$flights->contains(fn ($f) => $f->isDomestic()),
|
||||||
@@ -68,14 +69,6 @@ class GeneralFlyingChecker extends BaseChecker
|
|||||||
'general_flying.domestic_two_countries'
|
'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.10_flights');
|
||||||
$this->awardProgress($count,'general_flying.50_flights');
|
$this->awardProgress($count,'general_flying.50_flights');
|
||||||
$this->awardProgress($count,'general_flying.100_flights');
|
$this->awardProgress($count,'general_flying.100_flights');
|
||||||
|
|||||||
@@ -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
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<div class="flight-map-wrapper">
|
<div class="flight-map-wrapper" :class="{ tooltip }">
|
||||||
<PlaneLoader v-if="!mapReady" class="map-loader" />
|
<PlaneLoader v-if="!mapReady" class="map-loader" />
|
||||||
<div ref="mapContainer" class="map-container" :class="{ 'map-hidden': !mapReady }" />
|
<div ref="mapContainer" class="map-container" :class="{ 'map-hidden': !mapReady }" />
|
||||||
<button @click="exportMapBasic()" class="export-btn" title="Download as Image">
|
<button @click="exportMapBasic()" class="export-btn" title="Download as Image">
|
||||||
@@ -277,8 +277,11 @@ export default defineComponent({
|
|||||||
compact: {
|
compact: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false,
|
default: false,
|
||||||
|
},
|
||||||
|
tooltip: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
setup(props) {
|
setup(props) {
|
||||||
@@ -821,6 +824,11 @@ export default defineComponent({
|
|||||||
aspect-ratio: 7 / 10;
|
aspect-ratio: 7 / 10;
|
||||||
max-height: none;
|
max-height: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.flight-map-wrapper.tooltip {
|
||||||
|
aspect-ratio: 16 / 10;
|
||||||
|
max-height: 30vh;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
small.attribution{
|
small.attribution{
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ defineProps<{
|
|||||||
|
|
||||||
|
|
||||||
<ToolTipRows v-if="isActive.value">
|
<ToolTipRows v-if="isActive.value">
|
||||||
<FlightMap :flights="[flight]" :showLegend="false" compact />
|
<FlightMap :flights="[flight]" :showLegend="false" compact tooltip />
|
||||||
</ToolTipRows>
|
</ToolTipRows>
|
||||||
|
|
||||||
<ToolTipDivider />
|
<ToolTipDivider />
|
||||||
|
|||||||
@@ -371,5 +371,6 @@ header {
|
|||||||
@media (max-width: 600px) {
|
@media (max-width: 600px) {
|
||||||
.nav-desktop { display: none; }
|
.nav-desktop { display: none; }
|
||||||
.hamburger { display: flex; }
|
.hamburger { display: flex; }
|
||||||
|
.user-search-box { display: none; }
|
||||||
}
|
}
|
||||||
</style>
|
</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[]
|
regions: Region[]
|
||||||
alliance: Alliance | null
|
alliance: Alliance | null
|
||||||
airlines: Airline[]
|
airlines: Airline[]
|
||||||
|
london_airports: string[]
|
||||||
continents: Continent[]
|
continents: Continent[]
|
||||||
aircraft_families: Record<string, string[]>
|
aircraft_families: Record<string, string[]>
|
||||||
majorAlliances: Alliance[]
|
majorAlliances: Alliance[]
|
||||||
@@ -119,6 +120,7 @@ const unlocked = computed(() => {
|
|||||||
:continents="continents"
|
:continents="continents"
|
||||||
:families="aircraft_families"
|
:families="aircraft_families"
|
||||||
:major-alliances="majorAlliances"
|
:major-alliances="majorAlliances"
|
||||||
|
:london-airports="london_airports"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<FollowingSelectBox
|
<FollowingSelectBox
|
||||||
|
|||||||
Reference in New Issue
Block a user