Added achievement data

This commit is contained in:
2026-04-28 22:16:21 +10:00
parent 14aed7bf6e
commit b94b1d8ec2
43 changed files with 1559 additions and 130 deletions
@@ -0,0 +1,33 @@
<?php
namespace App\Http\Controllers;
use App\Models\Achievement;
use App\Models\User;
use Illuminate\Http\Request;
use Inertia\Inertia;
class AchievementController extends Controller
{
public function index(User $user)
{
$achievements = Achievement::with(['category', 'difficulty'])
->get()
->groupBy(fn(Achievement $a) => $a->category->name)
->map(fn($group) => $group->sortBy('id')->values());
$userAchievements = $user->achievements()
->with('achievement')
->orderBy('achievement_id')
->get()
->keyBy('achievement_id');
return Inertia::render('UserAchievements', [
'user' => $user,
'canEdit' => auth()->id() === $user->id,
'isFollowing' => auth()->check() && auth()->user()->isFollowing($user),
'achievements' => $achievements,
'userAchievements' => $userAchievements,
]);
}
}
+4 -20
View File
@@ -85,7 +85,6 @@ class FlightController extends Controller
UserAction::create([
'user_id' => $flight->user_id,
'user_flight_id' => $flight->id,
'data' => [
'changes' => $changes,
'original' => $original,
@@ -174,29 +173,14 @@ class FlightController extends Controller
'user_id' => $newFlight->user_id,
'type' => $newFlight->departure_date->isFuture() ? 'flight_booked' : 'flight_logged',
'data' => [
'flight' => $this->flightSnapshot($newFlight->id),
'flight' => $newFlight->snapshot($newFlight->id),
],
]);
return redirect()->route('profile.departure-board', [Auth::user()->name, $newFlight->id]);
}
private function flightSnapshot(int $id): array
{
return UserFlight::with([
'departureAirport',
'departureAirport.region.country',
'arrivalAirport',
'arrivalAirport.region.country',
'aircraft',
'airline',
'airline.country',
'flightClass',
'seatType',
'flightReason',
'crewType',
])->find($id)->toArray();
}
public function update(Request $request, UserFlight $flight)
@@ -212,11 +196,11 @@ class FlightController extends Controller
}
$dirty = $flight->getDirty();
$original = $this->flightSnapshot($flight->id);
$original = $flight->snapshot($flight->id);
$flight->save();
$updated = $this->flightSnapshot($flight->id);
$updated = $flight->snapshot($flight->id);
$this->recordChanges($flight, $dirty, $original, $updated);
return redirect()->route('profile.departure-board', [Auth::user()->name, $flight->id]);
@@ -9,6 +9,7 @@ use App\Models\FlightClass;
use App\Models\FlightReason;
use App\Models\ImportedFlight;
use App\Models\SeatType;
use App\Models\UserAction;
use App\Models\UserFlight;
use Carbon\Carbon;
use Illuminate\Http\Request;
@@ -128,10 +129,11 @@ class FlightImportController extends Controller
})
->orderByDesc('active')
->limit(10)
->get(['id', 'name', 'IATA_code', 'ICAO_code'])
->get(['id', 'name', 'IATA_code', 'ICAO_code', 'internal_name'])
->map(fn($airline) => [
'value' => $airline->id,
'title' => $airline->display_name,
'logo_url' => $airline->logo_url,
])
->values()
->toArray();
@@ -243,7 +245,7 @@ class FlightImportController extends Controller
$arrival = $durationArrival;
}
UserFlight::create([
$newFlight = UserFlight::create([
'user_id' => $user->id,
'departure_date' => $departure,
'arrival_date' => $arrival,
@@ -260,6 +262,14 @@ class FlightImportController extends Controller
'note' => $validated['note'] ?? null,
]);
UserAction::create([
'user_id' => $newFlight->user_id,
'type' => $newFlight->departure_date->isFuture() ? 'flight_booked' : 'flight_imported',
'data' => [
'flight' => $newFlight->snapshot($newFlight->id),
],
]);
ImportedFlight::destroy($validated['imported_flight_id']);
return to_route('reconcile');
}
@@ -11,13 +11,12 @@ use Inertia\Inertia;
class FlightProfileController extends Controller
{
public function profileData(User $user, string $view, ?int $selectedFlightId = null) : array {
$flights = $user->FlightController()->flights();
return [
'user' => $user,
'canEdit' => auth()->check() && auth()->id() === $user->id,
'flights' => UserFlightResource::collection($flights)->resolve(),
'initialView' => $view,
'selectedFlightId' => $selectedFlightId,
'flight_api_url' => '/data/user/'.$user->name.'/flights',
'isFollowing' => auth()->check() && auth()->user()->isFollowing($user),
];
}
@@ -0,0 +1,17 @@
<?php
namespace App\Http\Controllers;
use App\Models\Notification;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Http\Request;
class NotificationController extends Controller
{
use AuthorizesRequests;
public function markRead(Request $request, Notification $notification)
{
$this->authorize('update', $notification);
$notification->markAsRead();
}
}
@@ -23,6 +23,7 @@ class UserFlightController extends Controller
'arrivalAirport.region.country',
'arrivalAirport.region.continent',
'airline.country',
'airline.alliance',
'aircraft',
'seatType',
'flightReason',
@@ -34,8 +34,16 @@ class HandleInertiaRequests extends Middleware
'logo_api_url' => config('app.logo_api_url'),
'auth' => [
'user' => $request->user(),
'isLoggedIn' => $request->user() !== null,
],
'achievement_notifications' => fn() => $request->user()
? $request->user()
->notifications()
->with('achievement')
->where('is_achievement', true)
->whereNull('read_at')
->latest()
->get()
: [],
];
}
}
+15 -5
View File
@@ -2,18 +2,16 @@
namespace App\Models;
// use Illuminate\Contracts\Auth\MustVerifyEmail;
use App\Http\Controllers\UserFlightController;
use Database\Factories\UserFactory;
use Illuminate\Database\Eloquent\Attributes\Fillable;
use Illuminate\Database\Eloquent\Attributes\Hidden;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use App\Traits\HasAchievements;
use App\Models\Notification;
use Laravel\Sanctum\HasApiTokens;
#[Fillable(['name', 'email', 'password'])]
#[Hidden(['password', 'remember_token'])]
@@ -21,7 +19,9 @@ class User extends Authenticatable
{
/** @use HasFactory<UserFactory> */
use HasFactory, Notifiable, HasAchievements;
use HasFactory, HasAchievements, HasApiTokens;
/**
* Get the attributes that should be cast.
@@ -36,6 +36,11 @@ class User extends Authenticatable
];
}
public function achievements(): HasMany
{
return $this->hasMany(UserAchievement::class);
}
public function resolveRouteBinding($value, $field = null): ?User
{
return $this->where('name', 'ilike', $value)->firstOrFail();
@@ -69,4 +74,9 @@ class User extends Authenticatable
{
return $this->following()->where('followee_id', $user->id)->exists();
}
public function notifications(): HasMany
{
return $this->hasMany(Notification::class);
}
}
+1 -1
View File
@@ -30,7 +30,7 @@ class UserAction extends Model
'flight_booked' => 'Flight Booked',
'flight_cancelled' => 'Flight Cancelled',
'flight_updated' => 'Flight Updated',
'flight_imported' => 'Flight Imported',
'flight_imported' => 'Flight Imported from FR24',
'flight_logged' => 'Flight Logged',
'flight_deleted' => 'Flight Deleted',
default => 'Unknown Action'
+17
View File
@@ -156,6 +156,23 @@ class UserFlight extends Model
return !$this->isDomestic();
}
public static function snapshot($userFlightId){
return UserFlight::with([
'departureAirport',
'departureAirport.region.country',
'arrivalAirport',
'arrivalAirport.region.country',
'aircraft',
'airline',
'airline.country',
'airline.alliance',
'flightClass',
'seatType',
'flightReason',
'crewType',
])->find($userFlightId)->toArray();
}
public function user(): BelongsTo
{
return $this->belongsTo(User::class);
+66
View File
@@ -0,0 +1,66 @@
<?php
namespace App\Policies;
use App\Models\Notification;
use App\Models\User;
use Illuminate\Auth\Access\Response;
class NotificationPolicy
{
/**
* Determine whether the user can view any models.
*/
public function viewAny(User $user): bool
{
return false;
}
/**
* Determine whether the user can view the model.
*/
public function view(User $user, Notification $notification): bool
{
return false;
}
/**
* Determine whether the user can create models.
*/
public function create(User $user): bool
{
return false;
}
/**
* Determine whether the user can update the model.
*/
public function update(User $user, Notification $notification): bool
{
return $user->id === $notification->user_id;
}
/**
* Determine whether the user can delete the model.
*/
public function delete(User $user, Notification $notification): bool
{
return false;
}
/**
* Determine whether the user can restore the model.
*/
public function restore(User $user, Notification $notification): bool
{
return false;
}
/**
* Determine whether the user can permanently delete the model.
*/
public function forceDelete(User $user, Notification $notification): bool
{
return false;
}
}
@@ -55,6 +55,8 @@ class AchievementService
'airline.alliance',
'aircraft',
'flightClass',
'departureAirport.region',
'arrivalAirport.region',
'departureAirport.region.continent',
'arrivalAirport.region.continent',
])->get();
@@ -151,8 +153,8 @@ class AchievementService
{
Notification::create([
'user_id' => $user->id,
'title' => 'Achievement Unlocked!',
'body' => "You've earned the \"{$achievement->name}\" achievement — {$achievement->short_description}",
'title' => $achievement->name,
'body' => $achievement->short_description,
'is_achievement' => true,
'achievement_id' => $achievement->id,
'expires_at' => null,
@@ -5,9 +5,14 @@ namespace App\Services\Achievements\Checkers;
use App\Models\Alliance;
use App\Models\User;
use App\Models\UserFlight;
use Illuminate\Support\Collection;
class AirlinesAndAlliancesChecker extends BaseChecker
{
const array US_3 = ['american-airlines', 'delta', 'united-airlines'];
const array ME_3 = ['emirates', 'etihad-airways', 'qatar-airways'];
const array CN_3 = ['china-southern-airlines', 'china-eastern', 'air-china'];
public function check(): void
{
$flights = $this->flights();
@@ -25,5 +30,16 @@ class AirlinesAndAlliancesChecker extends BaseChecker
$this->awardProgress($check('oneworld'), 'airlines_alliances.all_oneworld');
$this->awardProgress($check('star_alliance'), 'airlines_alliances.all_star_alliance');
$this->awardProgress($check('vanilla_alliance'), 'airlines_alliances.all_vanilla_alliance');
$flownAirlines = $flights
->pluck('airline.internal_name')
->filter()
->unique();
$checkGroup = fn(array $group): int => $flownAirlines->intersect($group)->count();
$this->awardProgress($checkGroup(self::ME_3), 'airlines_alliances.me3');
$this->awardProgress($checkGroup(self::US_3), 'airlines_alliances.us3');
$this->awardProgress($checkGroup(self::CN_3), 'airlines_alliances.cn3');
}
}
@@ -3,27 +3,60 @@
namespace App\Services\Achievements\Checkers;
use App\Models\User;
use App\Models\UserFlight;
class FunChallengesChecker extends BaseChecker
{
const array US_STATES = [
'US-AK', 'US-AL', 'US-AR', 'US-AZ', 'US-CA', 'US-CO', 'US-CT', 'US-DC',
'US-DE', 'US-FL', 'US-GA', 'US-HI', 'US-IA', 'US-ID', 'US-IL', 'US-IN',
'US-KS', 'US-KY', 'US-LA', 'US-MA', 'US-MD', 'US-ME', 'US-MI', 'US-MN',
'US-MO', 'US-MS', 'US-MT', 'US-NC', 'US-ND', 'US-NE', 'US-NH', 'US-NJ',
'US-NM', 'US-NV', 'US-NY', 'US-OH', 'US-OK', 'US-OR', 'US-PA', 'US-RI',
'US-SC', 'US-SD', 'US-TN', 'US-TX', 'US-UT', 'US-VA', 'US-VT', 'US-WA',
'US-WI', 'US-WV', 'US-WY',
];
const array AUSTRALIAN_STATES = [
'AU-ACT', 'AU-NSW', 'AU-NT', 'AU-QLD', 'AU-SA', 'AU-TAS', 'AU-VIC', 'AU-WA',
];
const array CHINESE_PROVINCES = [
'CN-11', 'CN-12', 'CN-13', 'CN-14', 'CN-15', 'CN-21', 'CN-22', 'CN-23',
'CN-31', 'CN-32', 'CN-33', 'CN-34', 'CN-35', 'CN-36', 'CN-37', 'CN-41',
'CN-42', 'CN-43', 'CN-44', 'CN-45', 'CN-46', 'CN-50', 'CN-51', 'CN-52',
'CN-53', 'CN-54', 'CN-61', 'CN-62', 'CN-63', 'CN-64', 'CN-65',
];
const array BRAZILIAN_STATES = [
'BR-AC', 'BR-AL', 'BR-AM', 'BR-AP', 'BR-BA', 'BR-CE', 'BR-DF', 'BR-ES',
'BR-GO', 'BR-MA', 'BR-MG', 'BR-MS', 'BR-MT', 'BR-PA', 'BR-PB', 'BR-PE',
'BR-PI', 'BR-PR', 'BR-RJ', 'BR-RN', 'BR-RO', 'BR-RR', 'BR-RS', 'BR-SC',
'BR-SE', 'BR-SP', 'BR-TO',
];
const array CANADIAN_PROVINCES = [
'CA-AB', 'CA-BC', 'CA-MB', 'CA-NB', 'CA-NL', 'CA-NS', 'CA-NT',
'CA-NU', 'CA-ON', 'CA-PE', 'CA-QC', 'CA-SK', 'CA-YT',
];
public function check(): void
{
$flights = $this->flights();
$airlineLetters = $flights
->filter(fn($f) => $f->airline?->IATA_code !== null)
->map(fn($f) => strtoupper($f->airline->IATA_code[0]))
->filter(fn(UserFlight $f) => $f->airline?->IATA_code !== null)
->map(fn(UserFlight $f) => strtoupper($f->airline->IATA_code[0]))
->filter(fn($letter) => ctype_alpha($letter))
->unique()
->count();
$this->awardProgress($airlineLetters, 'fun_challenges.airline_alphabet');
// --- Visit the Alphabet ---
// Collect first letters from both departure and arrival airport IATA codes
$airportLetters = $flights
->flatMap(fn($f) => [
->flatMap(fn(UserFlight $f) => [
$f->departureAirport?->iata_code,
$f->arrivalAirport?->iata_code,
])
@@ -33,5 +66,70 @@ class FunChallengesChecker extends BaseChecker
->count();
$this->awardProgress($airportLetters, 'fun_challenges.airport_alphabet');
// --- US States ---
$visitedUsStates = $flights
->flatMap(fn(UserFlight $f) => [
$f->departureAirport?->region?->code,
$f->arrivalAirport?->region?->code,
])
->filter()
->filter(fn($code) => in_array($code, self::US_STATES))
->unique()
->count();
$this->awardProgress($visitedUsStates, 'fun_challenges.us_states');
// --- Australian States ---
$visitedAustralianStates = $flights
->flatMap(fn(UserFlight $f) => [
$f->departureAirport?->region?->code,
$f->arrivalAirport?->region?->code,
])
->filter()
->filter(fn($code) => in_array($code, self::AUSTRALIAN_STATES))
->unique()
->count();
$this->awardProgress($visitedAustralianStates, 'fun_challenges.australian_states');
// --- Chinese Provinces ---
$visitedChineseProvinces = $flights
->flatMap(fn(UserFlight $f) => [
$f->departureAirport?->region?->code,
$f->arrivalAirport?->region?->code,
])
->filter()
->filter(fn($code) => in_array($code, self::CHINESE_PROVINCES))
->unique()
->count();
$this->awardProgress($visitedChineseProvinces, 'fun_challenges.chinese_provinces');
// --- Brazilian States ---
$visitedBrazilianStates = $flights
->flatMap(fn(UserFlight $f) => [
$f->departureAirport?->region?->code,
$f->arrivalAirport?->region?->code,
])
->filter()
->filter(fn($code) => in_array($code, self::BRAZILIAN_STATES))
->unique()
->count();
$this->awardProgress($visitedBrazilianStates, 'fun_challenges.brazilian_states');
// --- Canadian Provinces ---
$visitedCanadianProvinces = $flights
->flatMap(fn(UserFlight $f) => [
$f->departureAirport?->region?->code,
$f->arrivalAirport?->region?->code,
])
->filter()
->filter(fn($code) => in_array($code, self::CANADIAN_PROVINCES))
->unique()
->count();
$this->awardProgress($visitedCanadianProvinces, 'fun_challenges.canadian_provinces');
}
}
@@ -71,6 +71,7 @@ class GeneralFlyingChecker extends BaseChecker
// --- Progressive achievements ---
$this->awardProgress($count,'general_flying.10_flights');
$this->awardProgress($count,'general_flying.50_flights');
$this->awardProgress($count,'general_flying.100_flights');
$this->awardProgress($count,'general_flying.500_flights');
$this->awardProgress($count,'general_flying.1000_flights');
+1
View File
@@ -7,6 +7,7 @@ use Illuminate\Foundation\Configuration\Middleware;
return Application::configure(basePath: dirname(__DIR__))
->withRouting(
web: __DIR__.'/../routes/web.php',
api: __DIR__.'/../routes/api.php',
commands: __DIR__.'/../routes/console.php',
health: '/up',
)
+2 -2
View File
@@ -10,12 +10,12 @@
"license": "MIT",
"require": {
"php": "^8.4",
"ext-pdo": "*",
"inertiajs/inertia-laravel": "^2.0",
"laravel/framework": "^13.0",
"laravel/sanctum": "^4.0",
"laravel/tinker": "^3.0",
"tightenco/ziggy": "^2.0",
"ext-pdo": "*"
"tightenco/ziggy": "^2.0"
},
"require-dev": {
"fakerphp/faker": "^1.23",
Generated
+3 -2
View File
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "1378206c681cc15470824af157a889be",
"content-hash": "0e560320885031dd36bb08bb44fe05d4",
"packages": [
{
"name": "brick/math",
@@ -9369,7 +9369,8 @@
"prefer-stable": true,
"prefer-lowest": false,
"platform": {
"php": "^8.3"
"php": "^8.4",
"ext-pdo": "*"
},
"platform-dev": {},
"plugin-api-version": "2.9.0"
+84
View File
@@ -0,0 +1,84 @@
<?php
use Laravel\Sanctum\Sanctum;
return [
/*
|--------------------------------------------------------------------------
| Stateful Domains
|--------------------------------------------------------------------------
|
| Requests from the following domains / hosts will receive stateful API
| authentication cookies. Typically, these should include your local
| and production domains which access your API via a frontend SPA.
|
*/
'stateful' => explode(',', env('SANCTUM_STATEFUL_DOMAINS', sprintf(
'%s%s',
'localhost,localhost:3000,127.0.0.1,127.0.0.1:8000,::1',
Sanctum::currentApplicationUrlWithPort(),
// Sanctum::currentRequestHost(),
))),
/*
|--------------------------------------------------------------------------
| Sanctum Guards
|--------------------------------------------------------------------------
|
| This array contains the authentication guards that will be checked when
| Sanctum is trying to authenticate a request. If none of these guards
| are able to authenticate the request, Sanctum will use the bearer
| token that's present on an incoming request for authentication.
|
*/
'guard' => ['web'],
/*
|--------------------------------------------------------------------------
| Expiration Minutes
|--------------------------------------------------------------------------
|
| This value controls the number of minutes until an issued token will be
| considered expired. This will override any values set in the token's
| "expires_at" attribute, but first-party sessions are not affected.
|
*/
'expiration' => null,
/*
|--------------------------------------------------------------------------
| Token Prefix
|--------------------------------------------------------------------------
|
| Sanctum can prefix new tokens in order to take advantage of numerous
| security scanning initiatives maintained by open source platforms
| that notify developers if they commit tokens into repositories.
|
| See: https://docs.github.com/en/code-security/secret-scanning/about-secret-scanning
|
*/
'token_prefix' => env('SANCTUM_TOKEN_PREFIX', ''),
/*
|--------------------------------------------------------------------------
| Sanctum Middleware
|--------------------------------------------------------------------------
|
| When authenticating your first-party SPA with Sanctum you may need to
| customize some of the middleware Sanctum uses while processing the
| request. You may change the middleware listed below as required.
|
*/
'middleware' => [
'authenticate_session' => Laravel\Sanctum\Http\Middleware\AuthenticateSession::class,
'encrypt_cookies' => Illuminate\Cookie\Middleware\EncryptCookies::class,
'validate_csrf_token' => Illuminate\Foundation\Http\Middleware\ValidateCsrfToken::class,
],
];
@@ -47,14 +47,14 @@ return new class extends Migration
[
'internal_name' => 'expensive',
'name' => 'Expensive',
'description' => 'It might be hard, but it will be easier if you have a lot of money!',
'description' => 'Not necessarily difficult, but it might cost you a bit.',
'created_at' => now(),
'updated_at' => now(),
],
[
'internal_name' => 'near_impossible',
'name' => 'Near-Impossible',
'description' => 'You will actively have to try to get this achievement and they may be very few ways to go about it.',
'description' => 'You will actively have to try to get this achievement and ther may be very few ways to go about it.',
'created_at' => now(),
'updated_at' => now(),
],
@@ -337,6 +337,66 @@ return new class extends Migration
'achievement_category_id' => $generalFlying,
'achievement_difficulty_id'=> $easy,
],
[
'internal_name' => 'general_flying.10_flights',
'name' => 'Frequent Flyer in Training',
'short_description' => 'Log 10 flights.',
'long_description' => '',
'icon' => $icon,
'progressive' => true,
'threshold' => 10,
'difficulty_description' => null,
'achievement_category_id' => $generalFlying,
'achievement_difficulty_id'=> $easy,
],
[
'internal_name' => 'general_flying.50_flights',
'name' => 'Certified Frequent Flyer',
'short_description' => 'Log 50 flights.',
'long_description' => '',
'icon' => $icon,
'progressive' => true,
'threshold' => 50,
'difficulty_description' => null,
'achievement_category_id' => $generalFlying,
'achievement_difficulty_id'=> $moderate,
],
[
'internal_name' => 'general_flying.100_flights',
'name' => 'Century in the Sky',
'short_description' => 'Log 100 flights.',
'long_description' => '',
'icon' => $icon,
'progressive' => true,
'threshold' => 100,
'difficulty_description' => null,
'achievement_category_id' => $generalFlying,
'achievement_difficulty_id'=> $moderate,
],
[
'internal_name' => 'general_flying.500_flights',
'name' => 'The 500 Club',
'short_description' => 'Log 500 flights.',
'long_description' => '',
'icon' => $icon,
'progressive' => true,
'threshold' => 500,
'difficulty_description' => null,
'achievement_category_id' => $generalFlying,
'achievement_difficulty_id'=> $hard,
],
[
'internal_name' => 'general_flying.1000_flights',
'name' => 'Skybound for Life',
'short_description' => 'Log 1,000 flights.',
'long_description' => '',
'icon' => $icon,
'progressive' => true,
'threshold' => 1000,
'difficulty_description' => null,
'achievement_category_id' => $generalFlying,
'achievement_difficulty_id'=> $nearImposs,
],
[
'internal_name' => 'general_flying.domestic_flight',
'name' => 'Home Turf',
@@ -436,7 +496,7 @@ return new class extends Migration
[
'internal_name' => 'general_flying.domestic_two_countries',
'name' => 'Local Explorer',
'short_description' => 'Take domestic flights in two different countries.',
'short_description' => 'Take a domestic flight in two different countries.',
'long_description' => '',
'icon' => $icon,
'progressive' => false,
@@ -445,54 +505,6 @@ return new class extends Migration
'achievement_category_id' => $generalFlying,
'achievement_difficulty_id'=> $moderate,
],
[
'internal_name' => 'general_flying.10_flights',
'name' => 'Frequent Flyer in Training',
'short_description' => 'Log 10 flights.',
'long_description' => '',
'icon' => $icon,
'progressive' => true,
'threshold' => 10,
'difficulty_description' => null,
'achievement_category_id' => $generalFlying,
'achievement_difficulty_id'=> $easy,
],
[
'internal_name' => 'general_flying.100_flights',
'name' => 'Century in the Sky',
'short_description' => 'Log 100 flights.',
'long_description' => '',
'icon' => $icon,
'progressive' => true,
'threshold' => 100,
'difficulty_description' => null,
'achievement_category_id' => $generalFlying,
'achievement_difficulty_id'=> $moderate,
],
[
'internal_name' => 'general_flying.500_flights',
'name' => 'The 500 Club',
'short_description' => 'Log 500 flights.',
'long_description' => '',
'icon' => $icon,
'progressive' => true,
'threshold' => 500,
'difficulty_description' => null,
'achievement_category_id' => $generalFlying,
'achievement_difficulty_id'=> $hard,
],
[
'internal_name' => 'general_flying.1000_flights',
'name' => 'Skybound for Life',
'short_description' => 'Log 1,000 flights.',
'long_description' => '',
'icon' => $icon,
'progressive' => true,
'threshold' => 1000,
'difficulty_description' => null,
'achievement_category_id' => $generalFlying,
'achievement_difficulty_id'=> $expensive,
],
// -----------------------------------------------------------
// Countries & Continents
@@ -745,6 +757,42 @@ return new class extends Migration
// -----------------------------------------------------------
// Airlines & Alliances
// -----------------------------------------------------------
[
'internal_name' => 'airlines_alliances.us3',
'name' => 'Stars, Stripes & Status',
'short_description' => 'Fly the big 3 US Airlines (Delta, American and United)',
'long_description' => '',
'icon' => $icon,
'progressive' => true,
'threshold' => 3,
'difficulty_description' => null,
'achievement_category_id' => $airlinesAndAlliances,
'achievement_difficulty_id'=> $moderate,
],
[
'internal_name' => 'airlines_alliances.me3',
'name' => 'Gulf Goals',
'short_description' => 'Fly with the Middle East 3 (Etihad, Emirates and Qatar Airways)',
'long_description' => '',
'icon' => $icon,
'progressive' => true,
'threshold' => 3,
'difficulty_description' => null,
'achievement_category_id' => $airlinesAndAlliances,
'achievement_difficulty_id'=> $hard,
],
[
'internal_name' => 'airlines_alliances.cn3',
'name' => 'Three Kingdoms of the Sky',
'short_description' => 'Fly with the Chinese Big 3 Airlines (China Eastern, China Southern and Air China)',
'long_description' => '',
'icon' => $icon,
'progressive' => true,
'threshold' => 3,
'difficulty_description' => null,
'achievement_category_id' => $airlinesAndAlliances,
'achievement_difficulty_id'=> $moderate,
],
[
'internal_name' => 'airlines_alliances.all_skyteam',
'name' => 'Team Player',
@@ -821,6 +869,66 @@ return new class extends Migration
'achievement_category_id' => $funChallenges,
'achievement_difficulty_id' => $nearImposs,
],
[
'internal_name' => 'fun_challenges.brazilian_states',
'name' => 'The 27 Club',
'short_description' => 'Visit all Brazilian States. Plus the Distrito Federal!',
'long_description' => '',
'icon' => $icon,
'progressive' => true,
'threshold' => 27,
'difficulty_description' => '',
'achievement_category_id' => $funChallenges,
'achievement_difficulty_id' => $hard,
],
[
'internal_name' => 'fun_challenges.us_states',
'name' => 'The Big Five-O',
'short_description' => 'Fly to all 50 US States plus the District of Colombia',
'long_description' => '',
'icon' => $icon,
'progressive' => true,
'threshold' => 51,
'difficulty_description' => 'Hard at the best of times. Harder when nobody is flying to Delaware',
'achievement_category_id' => $funChallenges,
'achievement_difficulty_id' => $hard,
],
[
'internal_name' => 'fun_challenges.australian_states',
'name' => 'Yeah Nah, Been There',
'short_description' => 'Fly to all Australian States and Territories',
'long_description' => '',
'icon' => $icon,
'progressive' => true,
'threshold' => 8,
'difficulty_description' => 'Only counting internal territories - the NT and ACT.',
'achievement_category_id' => $funChallenges,
'achievement_difficulty_id' => $hard,
],
[
'internal_name' => 'fun_challenges.canadian_provinces',
'name' => 'All done, eh?',
'short_description' => 'Fly to all 10 provinces and 3 territories of Canada',
'long_description' => '',
'icon' => $icon,
'progressive' => true,
'threshold' => 13,
'difficulty_description' => 'Hard at the best of times. Harder when nobody is flying to Delaware',
'achievement_category_id' => $funChallenges,
'achievement_difficulty_id' => $hard,
],
[
'internal_name' => 'fun_challenges.chinese_provinces',
'name' => 'Province of Mind',
'short_description' => 'Fly to all Chinese Provinces and Autonomous Zones',
'long_description' => '',
'icon' => $icon,
'progressive' => true,
'threshold' => 31,
'difficulty_description' => 'Cities like Tianjin, Shanghai and Beijing are their own zones! Flights that are treated as domestic Chinese destinations only - excluding Macau, Hong Kong and Taiwan.',
'achievement_category_id' => $funChallenges,
'achievement_difficulty_id' => $hard,
],
// ---------------------------------------------------------------
// Countries & Continents
@@ -0,0 +1,33 @@
<?php
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::create('personal_access_tokens', function (Blueprint $table) {
$table->id();
$table->morphs('tokenable');
$table->text('name');
$table->string('token', 64)->unique();
$table->text('abilities')->nullable();
$table->timestamp('last_used_at')->nullable();
$table->timestamp('expires_at')->nullable()->index();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('personal_access_tokens');
}
};
+161
View File
@@ -0,0 +1,161 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
role="img"
aria-hidden="true"
class=""
viewBox="1.5 1.5 20.965001 20.965001"
version="1.1"
id="svg12"
sodipodi:docname="oneworld.svg"
width="20.965"
height="20.965"
inkscape:version="1.4.2 (f4327f4, 2025-05-13)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/">
<sodipodi:namedview
id="namedview12"
pagecolor="#ffffff"
bordercolor="#000000"
borderopacity="0.25"
inkscape:showpageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1"
inkscape:zoom="56.032429"
inkscape:cx="10.485"
inkscape:cy="11.912744"
inkscape:window-width="3440"
inkscape:window-height="1377"
inkscape:window-x="2552"
inkscape:window-y="668"
inkscape:window-maximized="1"
inkscape:current-layer="g12" />
<title
id="title1">Oneworld</title>
<desc
id="desc1">Logo image for Oneworld Alliance</desc>
<defs
id="defs10">
<radialGradient
id="oneworld_svg__a"
cx="4.7300806"
cy="3.5899644"
r="32.226063"
fx="4.7300806"
fy="3.5899644"
gradientUnits="userSpaceOnUse">
<stop
offset="0"
stop-color="#fff"
stop-opacity=".5"
id="stop1" />
<stop
offset=".283"
stop-color="#adabd3"
stop-opacity=".595"
id="stop2" />
<stop
offset=".58"
stop-color="#5c58a8"
stop-opacity=".695"
id="stop3" />
<stop
offset=".791"
stop-color="#2a248c"
stop-opacity=".766"
id="stop4" />
<stop
offset="1"
stop-color="#161082"
stop-opacity=".8"
id="stop5" />
</radialGradient>
<radialGradient
id="oneworld_svg__b"
cx="4.0963526"
cy="3.1614058"
r="15.415633"
fx="4.0963526"
fy="3.1614058"
gradientUnits="userSpaceOnUse">
<stop
offset="0"
stop-color="#fff"
stop-opacity=".9"
id="stop6" />
<stop
offset=".283"
stop-color="#adabd3"
stop-opacity=".615"
id="stop7" />
<stop
offset=".58"
stop-color="#5c58a8"
stop-opacity=".316"
id="stop8" />
<stop
offset=".791"
stop-color="#2a248c"
stop-opacity=".104"
id="stop9" />
<stop
offset="1"
stop-color="#161082"
stop-opacity="0"
id="stop10" />
</radialGradient>
</defs>
<g
fill="none"
fill-rule="evenodd"
transform="translate(1.5,1.5)"
id="g12">
<path
d="m 0,10.483 c 0,5.78 4.7,10.482 10.483,10.482 5.781,0 10.482,-4.7 10.482,-10.482 C 20.965,4.7 16.262,0 10.483,0 4.703,0 0,4.7 0,10.483 Z m 1.07,0 c 0,-5.192 4.222,-9.414 9.413,-9.414 5.19,0 9.412,4.223 9.412,9.414 0,5.19 -4.222,9.412 -9.412,9.412 -5.191,0 -9.414,-4.222 -9.414,-9.412 z"
fill="#ffffff"
fill-rule="nonzero"
id="path10" />
<circle
cx="10.483"
cy="10.483"
fill="#161082"
r="9.9020004"
id="circle10" />
<circle
cx="9.9519997"
cy="9.9519997"
fill="url(#oneworld_svg__a)"
opacity="0.5"
r="9.9020004"
transform="translate(0.531,0.531)"
id="circle11"
style="fill:url(#oneworld_svg__a)" />
<circle
cx="9.9519997"
cy="9.9519997"
fill="url(#oneworld_svg__b)"
r="9.9020004"
transform="translate(0.531,0.531)"
id="circle12"
style="fill:url(#oneworld_svg__b)" />
<path
d="m 7.762,10.571 c 0.044,-0.266 0.223,-0.446 0.49,-0.446 0.268,0 0.446,0.225 0.446,0.446 z m 1.65,0.402 C 9.456,10.215 9.055,9.59 8.252,9.59 c -0.67,0 -1.204,0.49 -1.204,1.206 0,0.757 0.49,1.203 1.248,1.203 0.491,0 0.982,-0.224 1.116,-0.757 h -0.67 c -0.088,0.177 -0.222,0.266 -0.4,0.266 -0.313,0 -0.492,-0.223 -0.492,-0.535 z m 9.233,0.803 c 0.58,0 0.803,-0.49 0.803,-0.981 0,-0.491 -0.224,-0.982 -0.803,-0.982 -0.535,0 -0.758,0.49 -0.758,0.982 0,0.492 0.223,0.981 0.758,0.981 m 1.071,0.178 h -0.268 v -0.446 c -0.134,0.313 -0.49,0.491 -0.803,0.491 -0.67,0 -1.025,-0.58 -1.025,-1.204 0,-0.625 0.312,-1.205 1.025,-1.205 0.357,0 0.669,0.18 0.803,0.49 V 8.788 h 0.267 v 3.167 M 9.546,9.68 h 0.312 l 0.58,1.964 0.535,-1.964 h 0.312 l 0.536,1.964 0.58,-1.964 h 0.356 l -0.713,2.275 h -0.313 l -0.579,-1.917 -0.536,1.917 h -0.312 z m 5.532,1.116 c 0,0.669 -0.358,1.204 -1.072,1.204 -0.713,0 -1.07,-0.535 -1.07,-1.204 0,-0.669 0.357,-1.205 1.07,-1.205 0.67,0.045 1.07,0.58 1.07,1.206 m -1.873,0 c 0,0.49 0.268,0.98 0.803,0.98 0.536,0 0.803,-0.49 0.803,-0.981 0,-0.491 -0.267,-0.982 -0.803,-0.982 -0.535,0.045 -0.803,0.535 -0.803,0.982 M 15.478,9.68 h 0.268 v 0.536 a 0.872,0.872 0 0 1 0.847,-0.58 v 0.267 c -0.49,-0.044 -0.847,0.358 -0.847,0.804 v 1.204 H 15.479 V 9.68 m 1.427,-0.848 h 0.312 v 3.122 H 16.95 V 8.832 Z M 2.275,10.795 c 0,-0.267 0.09,-0.625 0.446,-0.625 0.356,0 0.446,0.357 0.446,0.625 0,0.268 -0.09,0.624 -0.446,0.624 -0.356,0 -0.446,-0.312 -0.446,-0.624 m -0.758,0 c 0,0.669 0.491,1.204 1.204,1.204 0.714,0 1.205,-0.49 1.205,-1.204 C 3.926,10.125 3.435,9.59 2.72,9.59 2.007,9.635 1.516,10.125 1.516,10.796 M 4.327,9.679 H 5.041 V 9.992 C 5.174,9.768 5.487,9.635 5.754,9.635 c 0.758,0 0.803,0.535 0.803,0.892 v 1.427 H 5.8 v -1.07 c 0,-0.313 0.043,-0.624 -0.358,-0.624 -0.267,0 -0.401,0.223 -0.401,0.49 V 12 H 4.326 V 9.677"
fill="#ffffff"
fill-rule="nonzero"
id="path12" />
</g>
<metadata
id="metadata12">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:title>Oneworld</dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
</svg>

After

Width:  |  Height:  |  Size: 6.0 KiB

+21
View File
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg id="Layer_1" xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 2500 2500">
<!-- Generator: Adobe Illustrator 30.0.0, SVG Export Plug-In . SVG Version: 2.1.1 Build 123) -->
<defs>
<style>
.st0 {
fill: #fff;
}
.st0, .st1 {
fill-rule: evenodd;
}
.st1 {
fill: #234b8d;
}
</style>
</defs>
<path class="st1" d="M1943.82,160.51l-13.42-6.04,3.32-7.39,36.25,16.32-3.32,7.39-13.42-6.04-17.78,39.49-9.38-4.24,17.76-39.48h0ZM1977.09,166.36l14.81,7.24-6.11,40.37.13.06,28.07-29.64,14.85,7.22-22.55,46.19-8.88-4.33,18.61-38.11-.12-.06-31.06,32.04-8.86-4.32,6.17-44.19-.22.06-18.55,37.98-8.85-4.33,22.55-46.19h0ZM2086.54,566.21l-1.01,1.18c175.83,176.66,291.56,414.88,310.31,683.03,41.36,592.28-405.1,1106-997.4,1147.4-278.41,19.51-539.37-68.88-742.13-229.5l-1.08,1.22c210.41,196.19,498.51,307.98,808.2,286.37,592.23-41.44,1038.8-555.14,997.32-1147.42-20.89-299.41-162.63-561.55-374.22-742.27h0ZM181.16,1788.56c-34.1,19.03-41.88,47.81-24.24,92.03,16.12,40.4,41.49,57.88,68.56,47.09,21.65-8.66,25.36-27.38,16.28-75.99l-3.88-18.69c-8.75-47.81-10.27-68.39-4.57-88.91,5.6-22.96,18.87-38.12,38.96-46.13,48.73-19.45,94.73,10.49,122.06,78.96,29.56,73.99,13.67,129.67-43.98,153.67l-14.41-36.12c40.06-17.54,50.18-55.1,28.81-108.67-17.54-43.77-45.5-63.2-74.81-51.48-23.59,9.43-29.22,31.36-20.52,81.16l3.4,20.82,3.28,18.42c6.25,36.96,7,49.99,3.41,65.7-4.7,19.64-17.34,34.05-37.47,42.07-45.6,18.21-89.49-8.66-114.13-70.32-26.63-66.74-12.39-116.35,38.97-139.3l14.28,35.68h0ZM150.76,1400.44l163.06-137.4,1.13,50.82-138.19,114.39,44.84,49.38,96.97-2.15.88,39.84-277.19,6.16-.91-39.83,109.06-2.43,14.97.08,14.18-.29-9.4-9.86-9.38-9.87-122.85-132.36-1.17-52.67,114,126.18h0ZM273.49,971.14l106.84,37.53-13.19,37.57-106.82-37.53-191.51,57.75,16.1-45.8,118.89-33.23,14.68-4.05c5.93-1.83,9.66-2.44,20.14-4.59-9.36-11.08-11.5-13.76-21.32-27.35l-73.32-99.31,15.28-43.64,114.22,162.64h0ZM461.11,462.26l-58.61,71.61,174.9,143.19-42.04,51.4-174.94-143.21-58.33,71.2-39.62-32.46,159.01-194.13,39.62,32.41ZM835.24,199.45l-139.93,81.84,29.87,51.05,128.48-75.13,23.93,40.96-128.44,75.13,34.47,58.93,142.68-83.45,25.87,44.21-200.05,116.95-140.01-239.33,197.32-115.35,25.8,44.19h0ZM1371.98,307.15l-72.63,4.66-35.85-59.89-111.72,17.82-15.63,68.3-69.15,17.79,72.93-303.03,68.32-10.86,163.73,265.21ZM1213.36,164.24c-15.15-25.41-21.13-36.68-29.84-56.41-2.45,19.79-5.15,34.56-11.79,63.02l-11.5,52.84,80.52-12.81-27.38-46.64ZM1817.31,395.9l-58.36-22.24,22.17-82.41c2.48-9.66,6.06-22.93,10.89-39.71,4.59-17.35,8.59-30.91,11.67-40.84,3.45-11.18,6.99-22.74,10.64-34.68l6.61-19.78c-16.34,28-22.83,37.91-37.79,60.65-6.36,9.95-12.31,18.3-17.09,25.23l-78.7,110.18-50.49-13.27-15.78-132.47c-1.12-6.71-1.78-16.39-2.68-29.51-1.01-17.52-1.88-30.65-2.26-39.79-.43-7.44-.32-18.61-.18-33.6l-6.91,33.47c-8.16,36.57-11.85,52.4-22.88,96.02l-23.07,89.27-61.33-9.62,69.38-271.28,93.32,18.08,13.13,128.27c3.45,30.18,3.93,55.26,2.66,91.06,10.49-20.44,14.24-27.24,26.26-45.99,8.03-12.55,15.07-23.15,21.4-32.72l72.98-104.77,88.45,30.04-72.01,270.43h0Z"/>
<path class="st1" d="M1287.38,929.91c-33.76,29.48-100.27,93.38-164.64,155.17l-72.94,69.88c-59-10.71-118.84-16.04-178.8-15.93-135.13,0-258.84,37.16-315.14,94.67-21.57,22.07-32.23,46-31.74,71.19,1.41,65.25,76.2,98.21,99.04,106.79,119.94,44.71,220.56,31.74,326.29-42.2,58.51-40.96,128.76-106.55,183.48-159.07,42.71,9.81,91.15,22.41,143.17,37.66l48.05,14.11c-62.19,61.05-126.08,125.65-185.36,177.93l-4.5,3.96c-82.38,72.68-141.95,125.21-227.98,144.31-60.58,13.48-103.49.61-117.66-8.05-1.21.21-3.26,2.81-3.26,2.81,49.8,40.96,96.94,64.21,178.06,57.17,77.25-6.69,166.44-55.33,257.75-140.7l123.16-120.93,86.25-85.67c0,.45,174.4,51.14,174.4,51.14,1.39.4,3.29.91,3.29.91-1.89.05-108.01,104.98-108.01,104.98l-92.81,92.25c-94.91,92.28-146.62,140.11-202.06,179.4-91.83,65.08-170.19,98.97-239.53,103.6-35.76,2.39-87.49-.1-130.66-25.43-1.91-.35-4.46,1.97-4.46,1.97,46.79,40.27,104.3,88.21,203.2,85.44,111.89-3.16,210.88-57,365.11-198.7,70.35-64.55,140.19-136.79,201.86-200.5l114.6-116.14c75.54,16.8,142.93,23.49,217.48,22.01,108.73-2.1,201.46-54.14,202.63-113.54.91-43.93-35.16-67.34-56.72-81.32-17.78-11.62-66.52-38.6-133.65-38.6-81.39,0-166.35,35.93-252.43,106.77l-57.46,50.56c.61-.27-21.02-5.8-21.02-5.8l-159.54-44.65c47.04-43.95,87.17-81.63,123.29-113.76,87.25-77.62,183.91-109.52,240.29-113.17,41.04-2.66,112.85.93,142.37,21.8,1.32-.26,3.29-3.23,3.29-3.23-78.53-67.2-146.49-76.08-202.65-76.08s-143.76,17.61-252.15,101.64c-44.3,34.27-101.81,91.57-161.89,152.21,0-.48-80.76-24.84-80.76-24.84l-19.48-6.16s-84.69-25.65-84.84-25.67c1.91-.08,48.43-45.59,48.43-45.59,57.12-56.06,111.12-109.02,153.22-144.5,153.08-128.71,249.43-145.55,316.37-145.83,73.38-.27,131.67,14.82,173.29,44.95,1.27-.21,3.16-2.94,3.16-2.94-85.98-77.77-147.74-102.6-254.51-103.49-93.63-.67-205.54,51.54-314.92,147.18h0ZM686,1388.72c-49.71-3.4-73.88-23.5-73.88-61.55,0-5.12,3.2-126.43,281.22-140.4,31.74-1.56,67.16-2.59,121.03,3.53-2.19.14-31.37,26.95-31.37,26.95l-17.39,15.76c-67.12,60.78-179.29,162.51-279.62,155.71h0ZM1810.85,1290.12c79.95-53.79,146.57-82.58,187.85-81.14,24.59.89,53.76,8.29,53.76,38.51s-29.44,57.12-87.47,77.74c-50.79,18.13-128.74,22.8-213.77,13.2,23.42-21.17,42.96-37.07,59.62-48.31h0Z"/>
</svg>

After

Width:  |  Height:  |  Size: 5.2 KiB

+38
View File
@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg id="Layer_1" xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 83.94 79.84">
<!-- Generator: Adobe Illustrator 30.0.0, SVG Export Plug-In . SVG Version: 2.1.1 Build 123) -->
<defs>
<style>
.st0 {
fill: #999b9d;
}
.st0, .st1, .st2 {
fill-rule: evenodd;
}
.st1 {
fill: #c9cbcd;
}
.st2 {
fill: #5b5c5e;
}
</style>
</defs>
<path class="st1" d="M20.54,22.2c2.97-4.12,6.27-8.09,9.9-11.85,3.65-3.77,7.5-7.23,11.53-10.35l-4.31,17.29-17.12,4.91h0Z"/>
<path class="st2" d="M50.48,29.66c-5.06-.51-10.14-1.39-15.22-2.65-5.09-1.27-10.01-2.88-14.73-4.81l17.13-4.91,12.82,12.38h0Z"/>
<path class="st0" d="M41.97,0c2.08,4.64,3.87,9.48,5.31,14.5,1.45,5.05,2.51,10.11,3.2,15.16l-12.82-12.38L41.97,0h0Z"/>
<path class="st0" d="M14.49,57.73c-3-4.1-5.75-8.46-8.21-13.08-2.47-4.63-4.56-9.37-6.28-14.17l15.11,9.44-.62,17.8h0Z"/>
<path class="st2" d="M30.84,31.57c-2.05,4.65-4.45,9.22-7.22,13.65-2.78,4.45-5.83,8.63-9.13,12.52l.62-17.81,15.73-8.36h0Z"/>
<path class="st1" d="M0,30.49c5.05-.55,10.21-.75,15.43-.57,5.25.18,10.39.74,15.41,1.65l-15.73,8.36L0,30.49H0Z"/>
<path class="st2" d="M46.41,74.47c-4.83,1.59-9.83,2.86-14.98,3.76-5.17.91-10.32,1.44-15.41,1.59l13.65-11.45,16.74,6.09h0Z"/>
<path class="st0" d="M26.58,50.83c3.79,3.39,7.39,7.08,10.75,11.09,3.38,4.02,6.4,8.22,9.09,12.55l-16.74-6.1-3.09-17.54h0Z"/>
<path class="st1" d="M16.02,79.82c1.04-4.97,2.44-9.94,4.23-14.85,1.8-4.93,3.91-9.65,6.33-14.15l3.09,17.55-13.65,11.45h0Z"/>
<path class="st0" d="M72.19,49.28c.02,5.08-.32,10.23-1.05,15.41-.73,5.2-1.82,10.26-3.25,15.15l-6.67-16.52,10.97-14.04h0Z"/>
<path class="st1" d="M43.58,60.83c4.39-2.56,9.02-4.84,13.87-6.8,4.87-1.97,9.79-3.55,14.74-4.76l-10.97,14.04-17.64-2.48h0Z"/>
<path class="st2" d="M67.9,79.84c-4.41-2.52-8.7-5.39-12.82-8.61-4.14-3.23-7.97-6.7-11.5-10.39l17.65,2.48,6.67,16.52h0Z"/>
<path class="st0" d="M56.2,16.97c4.84,1.55,9.63,3.47,14.33,5.76,4.72,2.3,9.19,4.9,13.41,7.77l-17.77,1.24-9.96-14.77h0Z"/>
<path class="st1" d="M58.36,47.76c-1.08-4.97-1.81-10.07-2.18-15.29-.37-5.24-.35-10.41.03-15.49l9.96,14.77-7.81,16.01h0Z"/>
<path class="st2" d="M83.94,30.5c-3.76,3.41-7.82,6.6-12.15,9.53-4.35,2.94-8.84,5.51-13.43,7.72l7.81-16.01,17.77-1.24h0Z"/>
</svg>

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.
+41
View File
@@ -111,6 +111,12 @@ body {
color: #c49dff;
}
.class-premium_economy-global {
background: rgba(75, 32, 137, 0.35);
border: 1px solid rgba(180, 130, 255, 0.25);
color: #c49dff;
}
/* ── Business: Gold ── */
.class-business-global {
background: rgba(184, 134, 11, 0.15);
@@ -205,3 +211,38 @@ body {
color: #445566;
}
.difficulty-easy-global {
background: rgba(34, 139, 34, 0.2);
border: 1px solid rgba(100, 200, 100, 0.25);
color: #7ec87e;
}
.difficulty-moderate-global {
background: rgba(30, 100, 200, 0.2);
border: 1px solid rgba(80, 150, 255, 0.25);
color: #7eb8ff;
}
.difficulty-hard-global {
background: rgba(200, 80, 30, 0.2);
border: 1px solid rgba(255, 130, 80, 0.25);
color: #ff9b6a;
}
.difficulty-expensive-global {
background: rgba(180, 60, 180, 0.2);
border: 1px solid rgba(220, 120, 220, 0.25);
color: #df8fdf;
}
.difficulty-near-impossible-global {
background: rgba(160, 20, 20, 0.25);
border: 1px solid rgba(220, 60, 60, 0.3);
color: #e87070;
}
.difficulty-impossible-global {
background: rgba(10, 10, 10, 0.5);
border: 1px solid rgba(120, 120, 140, 0.3);
color: #888899;
}
@@ -0,0 +1,198 @@
<!-- AchievementCard.vue -->
<script setup lang="ts">
import {Achievement, BadgeVariant, UserAchievement} from "@/Types/types";
import {computed} from "vue";
import InlineBadge from "@/Components/FlightsGoneBy/InlineBadge.vue";
import GlassTooltip from "@/Components/FlightsGoneBy/GlassTooltip.vue";
const props = defineProps<{
achievement: Achievement
userAchievement?: UserAchievement
}>()
const progress = computed(() => {
if (!props.achievement.progressive || !props.achievement.threshold) return null
const current = props.userAchievement?.progress ?? 0
return {
current,
threshold: props.achievement.threshold,
percentage: Math.min(Math.round((current / props.achievement.threshold) * 100), 100)
}
})
const unlocked = computed(() => {
if (!props.userAchievement) return false
if (props.achievement.progressive) return (progress.value?.percentage ?? 0) >= 100
return true
})
const difficultyVariant = computed(() => {
switch (props.achievement.difficulty?.internal_name) {
case 'easy': return 'easy'
case 'moderate': return 'moderate'
case 'hard': return 'hard'
case 'expensive': return 'expensive'
case 'near_impossible': return 'near-impossible'
case 'impossible': return 'impossible'
default: return 'economy'
}
})
</script>
<template>
<v-card
class="achievement-card"
:class="{ locked: !unlocked }"
rounded="lg"
elevation="2"
>
<v-card-text>
<div class="achievement-inner">
<div class="achievement-icon-wrap" :class="{ unlocked }">
<v-icon
icon="mdi-trophy"
:color="unlocked ? 'amber' : 'grey'"
size="28"
/>
</div>
<div class="achievement-content">
<div class="achievement-header">
<span class="achievement-name">{{ achievement.name }}</span>
<GlassTooltip>
<template #activator="{ props: tooltipProps }">
<span v-bind="tooltipProps" style="display:inline-flex">
<InlineBadge type="difficulty" :variant="difficultyVariant">
{{ achievement.difficulty?.name }}&nbsp;
<v-icon icon="mdi-help-circle-outline" size="12" />
</InlineBadge>
</span>
</template>
<div class="difficulty-tooltip">
<InlineBadge type="difficulty" :variant="difficultyVariant">
{{ achievement.difficulty?.name }}
</InlineBadge>
<p class="difficulty-description">{{ achievement.difficulty?.description }}</p>
<p v-if="achievement.difficulty_description" class="difficulty-description specific">
{{ achievement.difficulty_description }}
</p>
</div>
</GlassTooltip>
</div>
<p class="achievement-description">{{ achievement.short_description }}</p>
<template v-if="achievement.progressive && progress">
<div class="progress-label">
<span>{{ Math.min(progress.current, progress.threshold) }} / {{ progress.threshold }}</span>
<span>{{ progress.percentage }}%</span>
</div>
<v-progress-linear
:model-value="progress.percentage"
:color="unlocked ? 'amber' : 'grey'"
rounded
height="6"
bg-color="rgba(255,255,255,0.1)"
/>
</template>
</div>
</div>
</v-card-text>
</v-card>
</template>
<style scoped>
.achievement-card {
transition: opacity 0.2s ease, transform 0.2s ease;
}
.achievement-card.locked {
opacity: 0.45;
}
.achievement-card:hover {
opacity: 1;
transform: translateY(-1px);
}
.achievement-inner {
display: flex;
gap: 1rem;
align-items: flex-start;
}
.achievement-icon-wrap {
display: flex;
align-items: center;
justify-content: center;
width: 48px;
height: 48px;
border-radius: 50%;
background: rgba(255, 255, 255, 0.05);
flex-shrink: 0;
}
.achievement-icon-wrap.unlocked {
background: rgba(255, 193, 7, 0.15);
}
.achievement-content {
flex: 1;
display: flex;
flex-direction: column;
gap: 0.35rem;
}
.achievement-header {
display: flex;
align-items: center;
gap: 0.5rem;
flex-wrap: wrap;
}
.achievement-name {
font-weight: 600;
font-size: 0.95rem;
}
.achievement-description {
font-size: 0.82rem;
opacity: 0.75;
margin: 0;
}
.progress-label {
display: flex;
justify-content: space-between;
font-size: 0.75rem;
opacity: 0.6;
}
.difficulty-tooltip {
display: flex;
flex-direction: column;
gap: 0.4rem;
max-width: 240px;
}
.difficulty-description {
margin: 0;
font-size: 0.78rem;
line-height: 1.4;
opacity: 0.8;
}
.difficulty-description.specific {
display: flex;
align-items: flex-start;
gap: 0.3rem;
opacity: 0.65;
font-style: italic;
padding-top: 0.25rem;
border-top: 1px solid rgba(255, 255, 255, 0.1);
}
</style>
@@ -4,6 +4,7 @@ import {computed} from "vue";
import {usePage} from "@inertiajs/vue3";
import GlassTooltip from "@/Components/FlightsGoneBy/GlassTooltip.vue";
import InlineBadge from "@/Components/FlightsGoneBy/InlineBadge.vue";
import AllianceLogo from "@/Components/FlightsGoneBy/AllianceLogo.vue";
const page = usePage<SharedProps>().props;
@@ -39,6 +40,7 @@ const size = computed(() => props.size ? props.size + 'px' : '30px');
<div v-if="airline.IATA_code || airline.ICAO_code" class="codes">
<InlineBadge v-if="airline.IATA_code" variant="generic">{{ airline.IATA_code }}</InlineBadge>
<InlineBadge v-if="airline.ICAO_code" variant="generic">{{ airline.ICAO_code }}</InlineBadge>
<AllianceLogo v-if="airline?.alliance" :alliance="airline?.alliance" size="24" />
</div>
</div>
<div class="tooltip-divider"></div>
@@ -0,0 +1,32 @@
<script setup lang="ts">
import {Airline, Alliance, SharedProps} from "@/Types/types";
import {computed} from "vue";
import {usePage} from "@inertiajs/vue3";
import GlassTooltip from "@/Components/FlightsGoneBy/GlassTooltip.vue";
import InlineBadge from "@/Components/FlightsGoneBy/InlineBadge.vue";
const page = usePage<SharedProps>().props;
const props = defineProps<{
alliance: Alliance;
size?: number | string;
}>();
const logoUrl = computed(() => `url('/img/alliances/${props.alliance.internal_name}.svg')`);
const size = computed(() => props.size ? props.size + 'px' : '30px');
</script>
<template>
<span class="alliance-logo"></span>
</template>
<style scoped>
span.alliance-logo {
width: v-bind(size);
height: v-bind(size);
background-image: v-bind(logoUrl);
background-size: contain;
background-repeat: no-repeat;
display: inline-block;
}
</style>
@@ -12,6 +12,7 @@ import {FlightStats} from "@/Composables/useFlightStats";
import GlassTooltip from "@/Components/FlightsGoneBy/GlassTooltip.vue";
import CrewTooltip from "@/Components/FlightsGoneBy/CrewTooltip.vue";
import {Link, router} from "@inertiajs/vue3";
import AllianceLogo from "@/Components/FlightsGoneBy/AllianceLogo.vue";
const props = defineProps<{
flightStats: FlightStats
@@ -11,6 +11,7 @@ import {computed} from "vue";
import {Link} from "@inertiajs/vue3";
import FlightUpdatedFeedItem from "@/Components/FlightsGoneBy/Feed/FlightUpdatedFeedItem.vue";
import FlightCancelledFeedItem from "@/Components/FlightsGoneBy/Feed/FlightCancelledFeedItem.vue";
import FlightImportedFeedItem from "@/Components/FlightsGoneBy/Feed/FlightImportedFeedItem.vue";
const props = defineProps<{
action: UserAction
@@ -30,6 +31,7 @@ const badgeVariant = computed(() => {
switch (props.action.type) {
case 'flight_booked': return 'generic'
case 'flight_logged': return 'generic'
case 'flight_imported': return 'economy'
case 'flight_updated': return 'economy'
case 'flight_cancelled': return 'crew'
default: return 'economy'
@@ -69,6 +71,7 @@ function timeAgo(dateStr: string): string {
</div>
<div class="card-content">
<FlightBookedFeedItem v-if="action.type == 'flight_booked' || action.type == 'flight_logged'" :flight="(action.data as UserActionFlightBookedData).flight" ></FlightBookedFeedItem>
<FlightImportedFeedItem v-if="action.type == 'flight_imported'" :flight="(action.data as UserActionFlightBookedData).flight" ></FlightImportedFeedItem>
<FlightUpdatedFeedItem v-if="action.type == 'flight_updated'" :data="(action.data as UserActionFlightUpdatedData)" ></FlightUpdatedFeedItem>
<FlightCancelledFeedItem v-if="action.type == 'flight_cancelled'" :data="(action.data as UserActionFlightCancelledData)" flight=""></FlightCancelledFeedItem>
</div>
@@ -0,0 +1,48 @@
<script setup lang="ts">
import {Flight, UserActionFlightCancelledData} from "@/Types/types";
import AirportToolTip from "@/Components/FlightsGoneBy/AirportToolTip.vue";
import AirlineLogo from "@/Components/FlightsGoneBy/AirlineLogo.vue";
import FlightClassBadge from "@/Components/FlightsGoneBy/FlightClassBadge.vue";
import AircraftToolTip from "@/Components/FlightsGoneBy/AircraftToolTip.vue";
import BoardingPass from "@/Components/FlightsGoneBy/BoardingPass.vue";
const props = defineProps<{
flight: Flight
}>()
</script>
<template>
<div class="flight-booked">
<div class="imported-flight">
<span v-if="flight.flight_number" class="flight-summary">
<AirlineLogo :airline="flight.airline" />
<span>Historical flight <strong>{{ flight.flight_number }}</strong> on {{ flight.departure_date_display }} at {{ flight.departure_time_display }} imported from MyFlightRadar24</span>
</span>
<span v-else class="flight-summary">
<AirlineLogo :airline="flight.airline" />
<span>Historical flight from <b>{{ flight.departure_airport.municipality }} ({{ flight.departure_airport.display_code }}) {{ flight.arrival_airport.municipality }} ({{ flight.arrival_airport.display_code }})</b> on {{ flight.departure_date_display }} at {{ flight.departure_time_display }} imported from MyFlightRadar24</span>
</span>
</div>
</div>
</template>
<style scoped>
.imported-flight {
padding: 0.75rem 1.25rem;
}
.flight-summary {
display: flex;
align-items: center;
gap: 0.5rem;
font-size: 0.875rem;
color: #9ca3af;
}
.flight-summary strong {
color: #f9fafb;
font-weight: 600;
}
</style>
@@ -1,13 +1,16 @@
<script setup lang="ts">
import {BadgeVariant} from "@/Types/types";
defineProps<{
withDefaults(defineProps<{
variant?: BadgeVariant
}>();
type?: 'class' | 'difficulty'
}>(), {
type: 'class'
})
</script>
<template>
<span v-if="variant !== 'unspecified'" class="class-badge" :class="variant ? `class-${variant}-global` : 'class-economy-global'">
<span v-if="variant !== 'unspecified'" class="class-badge" :class="variant ? `${type}-${variant}-global` : 'class-economy-global'">
<slot />
</span>
</template>
@@ -5,7 +5,8 @@ import type { Flight, User, SharedProps } from "@/Types/types";
const props = defineProps<{
user: User
flights: Flight[]
flightCount?: number
achievementCount?: number
isFollowing?: boolean
}>()
@@ -55,8 +56,8 @@ const follow = async () => {
</div>
<div class="board-count">
<span class="count-number">{{ flights.length }}</span>
<span class="count-label">FLIGHTS</span>
<span class="count-number">{{ flightCount ?? achievementCount }}</span>
<span class="count-label">{{flightCount ? 'Flights' : 'Achievements'}}</span>
</div>
</div>
@@ -149,5 +150,6 @@ const follow = async () => {
font-size: 0.65rem;
letter-spacing: 0.18em;
color: #556;
text-transform: uppercase;
}
</style>
@@ -1,18 +1,24 @@
<script setup lang="ts">
import {Flight, User} from "@/Types/types";
import ProfileHeader from "@/Components/FlightsGoneBy/ProfileHeader.vue";
import PlaneLoader from "@/Components/FlightsGoneBy/PlaneLoader.vue";
defineProps<{
user: User
flights: Flight[]
flightCount?: number
achievementCount? : number
isFollowing: boolean
loading: boolean
}>()
</script>
<template>
<div class="board-wrapper">
<ProfileHeader :is-following="isFollowing" :user="user" :flights="flights" />
<slot />
<ProfileHeader :is-following="isFollowing" :user="user" :flightCount="flightCount" />
<div v-if="loading" class="loading-state">
<PlaneLoader />
</div>
<slot v-else />
</div>
</template>
@@ -24,6 +30,27 @@ defineProps<{
width: 100%;
}
.loading-state {
display: flex;
justify-content: center;
align-items: center;
min-height: 50dvh;
}
.spinner {
display: block;
width: 2.5rem;
height: 2.5rem;
border: 3px solid rgba(255, 255, 255, 0.2);
border-top-color: white;
border-radius: 50%;
animation: spin 0.7s linear infinite;
}
@keyframes spin {
to { transform: rotate(360deg); }
}
@media (max-width: 1200px) {
.board-wrapper {
padding: 1em 0.25em;
@@ -1,22 +1,41 @@
<script setup lang="ts">
import {ProfileView} from "@/Types/types";
import {ProfileView, User} from "@/Types/types";
import {router, usePage} from "@inertiajs/vue3";
import {computed} from "vue";
defineProps<{
activeView: string;
const props = defineProps<{
activeView: ProfileView;
user: User
}>()
const emit = defineEmits<{
'update:activeView': [view: ProfileView]
}>()
const page = usePage()
const isAchievementsPage = computed(() => page.component === 'UserAchievements'
)
function navigateTo(view: ProfileView) {
if (isAchievementsPage.value) {
const routeMap: Record<string, string> = {
map: route('profile.map', { user: props.user.name }),
board: route('profile.departure-board', { user: props.user.name }),
passes: route('profile.boarding-passes', { user: props.user.name }),
}
router.visit(routeMap[view])
} else {
emit('update:activeView', view)
}
}
</script>
<template>
<div class="view-toolbar">
<button
class="view-btn"
:class="{ active: activeView === 'map' }"
@click="emit('update:activeView', 'map')"
@click="navigateTo('map')"
>
<span class="view-btn-icon mdi mdi-earth"></span>
<span class="view-btn-label">MAP</span>
@@ -24,18 +43,26 @@ const emit = defineEmits<{
<button
class="view-btn"
:class="{ active: activeView === 'board' }"
@click="emit('update:activeView', 'board')"
@click="navigateTo('board')"
>
<span class="view-btn-icon mdi mdi-table"></span>
<span class="view-btn-label">DEPARTURE BOARD</span>
<span class="view-btn-label">Departure Board</span>
</button>
<button
class="view-btn"
:class="{ active: activeView === 'passes' }"
@click="emit('update:activeView', 'passes')"
@click="navigateTo('passes')"
>
<span class="view-btn-icon mdi mdi-ticket"></span>
<span class="view-btn-label">BOARDING PASSES</span>
<span class="view-btn-label">Boarding Passes</span>
</button>
<button
class="view-btn"
:class="{ active: activeView === 'achievements' }"
@click="router.visit(route('profile.achievements', { user: user.name }))"
>
<span class="view-btn-icon mdi mdi-trophy"></span>
<span class="view-btn-label">Achievements</span>
</button>
</div>
</template>
@@ -87,4 +114,8 @@ const emit = defineEmits<{
font-size: 0.8rem;
opacity: 0.8;
}
.view-btn-label {
text-transform: uppercase;
}
</style>
+91 -4
View File
@@ -3,17 +3,48 @@ import MainHeader from "@/Components/FlightsGoneBy/MainHeader.vue";
import MainFooter from "@/Components/FlightsGoneBy/MainFooter.vue";
import Radar from "@/Components/FlightsGoneBy/Radar.vue";
import { usePage, router } from "@inertiajs/vue3";
import { ref } from "vue";
import {SharedProps} from "@/Types/types";
import { ref, watch } from "vue";
import { SharedProps, Notification } from "@/Types/types";
import axios from "axios";
const page = usePage<SharedProps>().props;
const transitionKey = ref(0);
router.on('success', () => {
const seenNotificationIds = ref<Set<number>>(new Set())
const achievementSound = new Audio('/sounds/seatBelt.wav')
function handleNewNotifications(notifications: Notification[]) {
if (!notifications?.length) return
const unseen = notifications.filter(n => !seenNotificationIds.value.has(n.id))
if (!unseen.length) return
unseen.forEach(n => seenNotificationIds.value.add(n.id))
activeToasts.value.push(...unseen)
achievementSound.play().catch(() => {})
}
// ── Toasts ────────────────────────────────────────────────────────────────────
const activeToasts = ref<Notification[]>([])
async function dismissToast(notification: Notification) {
activeToasts.value = activeToasts.value.filter(n => n.id !== notification.id)
await axios.patch(`/notifications/${notification.id}/read`)
}
console.log(page.achievement_notifications)
watch(
() => page.achievement_notifications,
handleNewNotifications,
{ immediate: true }
)
router.on('success', (event) => {
transitionKey.value++;
handleNewNotifications(event.detail.page.props.achievement_notifications as Notification[] ?? [])
});
</script>
<template>
<Radar>
<div class="layoutContainer">
@@ -25,9 +56,65 @@ router.on('success', () => {
</Transition>
<MainFooter :key="transitionKey" />
</div>
<div class="toast-stack">
<TransitionGroup name="toast">
<v-card
v-for="notification in activeToasts"
:key="notification.id"
class="toast-card glass"
rounded="lg"
elevation="4"
max-width="360"
>
<v-card-text class="d-flex align-center ga-3">
<v-icon icon="mdi-trophy" color="amber" size="32" />
<div>
<div class="text-subtitle-2 font-weight-bold">{{ notification.title }}</div>
<div class="text-body-2 text-medium-emphasis">{{ notification.body }}</div>
</div>
<v-btn
icon="mdi-close"
variant="text"
size="small"
class="ml-auto"
@click="dismissToast(notification)"
/>
</v-card-text>
</v-card>
</TransitionGroup>
</div>
</Radar>
</template>
<style scoped>
.toast-stack {
position: fixed;
bottom: 1.5rem;
right: 1.5rem;
display: flex;
flex-direction: column;
gap: 0.75rem;
z-index: 9999;
max-height: 50dvh;
overflow-y: scroll;
scrollbar-width: none;
}
.toast-stack::-webkit-scrollbar {
display: none;
}
.toast-card {
flex-shrink: 0;
background: rgb(var(--v-theme-surface)) !important;
}
.toast-enter-from { opacity: 0; transform: translateX(100%); }
.toast-leave-to { opacity: 0; transform: translateX(100%); }
.toast-enter-active,
.toast-leave-active { transition: all 0.3s ease; }
</style>
<style scoped>
.layoutContainer {
display: flex;
+1 -1
View File
@@ -26,7 +26,7 @@ const props = defineProps<{
dep_time: string
arr_time: string
duration: string
airline_options: { value: number, title: string }[]
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 }[]
+146
View File
@@ -0,0 +1,146 @@
<script setup lang="ts">
import {computed} from "vue"
import ProfileLayout from "@/Components/FlightsGoneBy/ProfileLayout.vue"
import ProfileViewSwitcher from "@/Components/FlightsGoneBy/ProfileViewSwitcher.vue"
import AchievementCard from "@/Components/FlightsGoneBy/AchievementCard.vue"
import {Achievement, User, UserAchievement} from "@/Types/types"
import { Head } from "@inertiajs/vue3";
import MainLayout from "@/Layouts/MainLayout.vue";
defineOptions({ layout: MainLayout })
const props = defineProps<{
user: User
canEdit: boolean
isFollowing: boolean
achievements: Record<string, Achievement[]>
userAchievements: Record<number, UserAchievement>
}>()
const totalAchievements = computed(() =>
Object.values(props.achievements).reduce((sum, group) => sum + group.length, 0)
)
const unlockedCount = computed(() =>
Object.values(props.achievements)
.flat()
.filter(a => {
const ua = props.userAchievements[a.id]
if (!ua) return false
if (!a.progressive || !a.threshold) return true
return (ua.progress ?? 0) >= a.threshold
}).length
)
</script>
<template>
<Head :title="`${user.name}'s Achievements`" />
<ProfileLayout
:user="user"
:achievementCount="unlockedCount"
:is-following="isFollowing"
:loading="false"
>
<ProfileViewSwitcher active-view="achievements" :user="user" />
<div class="achievements-page">
<div class="achievements-summary">
<span class="summary-text">
{{ unlockedCount }} / {{ totalAchievements }} achievements unlocked
</span>
<v-progress-linear
:model-value="Math.round((unlockedCount / totalAchievements) * 100)"
color="amber"
rounded
height="6"
bg-color="rgba(255,255,255,0.1)"
/>
</div>
<div
v-for="(categoryAchievements, categoryName) in achievements"
:key="categoryName"
class="achievement-category"
>
<div class="category-header">
<h2 class="category-name">{{ categoryName }}</h2>
<span class="category-count">
{{ categoryAchievements.filter(a => userAchievements[a.id]).length }}
/ {{ categoryAchievements.length }}
</span>
</div>
<div class="achievement-grid">
<AchievementCard
v-for="achievement in categoryAchievements"
:key="achievement.id"
:achievement="achievement"
:user-achievement="userAchievements[achievement.id]"
/>
</div>
</div>
</div>
</ProfileLayout>
</template>
<style scoped>
.achievements-page {
width: 100%;
max-width: 1200px;
margin: 0 auto;
padding: 1.5rem 1rem;
display: flex;
flex-direction: column;
gap: 2.5rem;
}
.achievements-summary {
display: flex;
flex-direction: column;
gap: 0.5rem;
}
.summary-text {
font-size: 0.9rem;
opacity: 0.7;
}
.achievement-category {
display: flex;
flex-direction: column;
gap: 1rem;
}
.category-header {
display: flex;
align-items: center;
justify-content: space-between;
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
padding-bottom: 0.5rem;
}
.category-name {
font-size: 1.1rem;
font-weight: 700;
letter-spacing: 0.05em;
text-transform: uppercase;
opacity: 0.9;
}
.category-count {
font-size: 0.85rem;
opacity: 0.5;
}
.achievement-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
gap: 0.75rem;
}
@media (max-width: 600px) {
.achievement-grid {
grid-template-columns: 1fr;
}
}
</style>
+27 -9
View File
@@ -1,9 +1,9 @@
<script setup lang="ts">
import MainLayout from "@/Layouts/MainLayout.vue";
import { Head } from '@inertiajs/vue3'
import {ref, computed, watchEffect} from 'vue'
import {Head, router} from '@inertiajs/vue3'
import {computed, onMounted, ref, watchEffect} from 'vue'
import axios from 'axios'
import {Flight, ProfileView, User} from "@/Types/types"
import { router } from '@inertiajs/vue3'
import {useFlightStats} from "@/Composables/useFlightStats"
import ProfileViewSwitcher from "@/Components/FlightsGoneBy/ProfileViewSwitcher.vue"
import ProfileLayout from "@/Components/FlightsGoneBy/ProfileLayout.vue"
@@ -15,13 +15,27 @@ defineOptions({ layout: MainLayout })
const props = defineProps<{
user: User
flights: Flight[]
canEdit: boolean
selectedFlightId?: number | null
initialView?: ProfileView
isFollowing: boolean
flight_api_url: string
}>()
// ── Flights state ─────────────────────────────────────────────────────────────
const flights = ref<Flight[]>([])
const flightsLoading = ref(true)
onMounted(async () => {
try {
const response = await axios.get(props.flight_api_url)
flights.value = response.data
} finally {
flightsLoading.value = false
}
})
const localSelectedFlightId = ref(props.selectedFlightId ?? null)
// ── Filter state ──────────────────────────────────────────────────────────────
@@ -70,8 +84,7 @@ function matchesFilters(f: Flight): boolean {
}
const filteredFlights = computed(() => {
const result = props.flights.filter(matchesFilters)
return result
return flights.value.filter(matchesFilters)
})
const stats = useFlightStats(filteredFlights)
@@ -92,13 +105,18 @@ watchEffect(() => {
// ── View switching ────────────────────────────────────────────────────────────
const activeView = ref<ProfileView>(props.initialView ?? 'board')
const routeNames = {
const routeNames: Record<Exclude<ProfileView, 'achievements'>, string> = {
map: 'profile.map',
board: 'profile.departure-board',
passes: 'profile.boarding-passes',
} as const
function switchView(view: ProfileView) {
if (view === 'achievements') {
router.visit(route('profile.achievements', { user: props.user.name }))
return
}
const flightId = view === 'board' ? localSelectedFlightId.value : null
localSelectedFlightId.value = null
activeView.value = view
@@ -115,8 +133,8 @@ function switchView(view: ProfileView) {
<template>
<Head :title="`${user.name}'s Flights`" />
<ProfileLayout :is-following="isFollowing" :flights="flights" :user="user">
<ProfileViewSwitcher :active-view="activeView" @update:active-view="switchView" />
<ProfileLayout :is-following="isFollowing" :flightCount="flights.length" :user="user" :loading="flightsLoading">
<ProfileViewSwitcher :user="user" :active-view="activeView" @update:active-view="switchView" />
<DepartureBoard v-if="activeView === 'board'" :flight-id="localSelectedFlightId" :flight-stats="stats" :canEdit="canEdit" />
<BoardingPasses v-if="activeView === 'passes'" :flight-stats="stats" :canEdit="canEdit" />
<FlightMapAndCharts
+70 -3
View File
@@ -8,9 +8,9 @@ declare module '@vue/runtime-core' {
}
}
export type ProfileView = 'map' | 'board' | 'passes' ;
export type ProfileView = 'map' | 'board' | 'passes' | 'achievements' ;
export type ChartType = "line" | "area" | "bar" | "pie" | "donut" | "radialBar" | "scatter" | "bubble" | "heatmap" | "candlestick" | "boxPlot" | "radar" | "polarArea" | "rangeBar" | "rangeArea" | "treemap" | undefined
export type BadgeVariant = 'first' | 'business' | 'premium' | 'economy' | 'private' | 'unspecified' | 'generic' | 'general_aviation' | 'crew'
export type BadgeVariant = 'first' | 'business' | 'premium' | 'economy' | 'private' | 'unspecified' | 'generic' | 'general_aviation' | 'crew' | "easy" | "moderate" | "hard" | "expensive" | "near-impossible" | "impossible"
export interface User {
id: number
@@ -19,7 +19,7 @@ export interface User {
email_verified_at: string | null
}
export type UserActionType = "flight_cancelled" | "flight_booked" | "flight_updated" | "flight_logged" | "flight_deleted"
export type UserActionType = "flight_cancelled" | "flight_booked" | "flight_updated" | "flight_logged" | "flight_deleted" | "flight_imported"
export type UserActionDataKey = "field" | "from" | "to"
export type UserActionFlightBookedData = {
@@ -39,6 +39,12 @@ export type UserActionFlightUpdatedData = {
export type UserActionChange = {field: string, from: string, to: string}
export type UserActionData = UserActionFlightBookedData | UserActionFlightCancelledData | UserActionFlightUpdatedData
export interface Alliance {
id: number
name: string
internal_name: string
}
export interface UserAction {
id: number
user_id: number
@@ -57,6 +63,65 @@ export type SharedProps = import('@inertiajs/core').PageProps & {
isLoggedIn: boolean
},
logo_api_url: string
achievement_notifications: Notification[]
}
export interface AchievementDifficulty {
id: number
internal_name: string
name: string
description: string
created_at: string | null
updated_at: string | null
}
export interface AchievementCategory {
id: number
internal_name: string
name: string
description: string
created_at: string | null
updated_at: string | null
}
export interface Achievement {
id: number
name: string
internal_name: string
icon: string
short_description: string
long_description: string
progressive: boolean
difficulty_description: string | null
threshold: number | null
achievement_category_id: number
achievement_difficulty_id: number
category?: AchievementCategory
difficulty?: AchievementDifficulty
}
export interface UserAchievement {
id: number
user_id: number
achievement_id: number
progress: number | null
achievement?: Achievement
created_at: string | null
updated_at: string | null
}
export interface Notification {
id: number
user_id: number
title: string
body: string
url: string | null
is_achievement: boolean
achievement_id: number | null
achievement?: Achievement | null
read_at: string | null
expires_at: string | null
created_at: string | null
updated_at: string | null
}
export interface Region {
@@ -121,6 +186,8 @@ export interface Airline {
country?: Country
display_name: string
logo_url: string
alliance_id: number | null,
alliance?: Alliance,
}
export interface Aircraft {
+8
View File
@@ -0,0 +1,8 @@
<?php
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
Route::get('/user', function (Request $request) {
return $request->user();
})->middleware('auth:sanctum');
+6
View File
@@ -1,5 +1,6 @@
<?php
use App\Http\Controllers\AchievementController;
use App\Http\Controllers\Api\AirlineApiController;
use App\Http\Controllers\Api\UserApiController;
use App\Http\Controllers\FeedController;
@@ -7,6 +8,7 @@ use App\Http\Controllers\FlightController;
use App\Http\Controllers\FlightImportController;
use App\Http\Controllers\FlightProfileController;
use App\Http\Controllers\LogoController;
use App\Http\Controllers\NotificationController;
use App\Http\Controllers\ProfileController;
use App\Http\Controllers\SearchController;
use App\Http\Controllers\UserController;
@@ -65,6 +67,8 @@ Route::domain(config('app.domain'))->group(
Route::post('/u/{user}/follow', [UserController::class, 'follow'])->name('profile.follow');
Route::patch('/notifications/{notification}/read', [NotificationController::class, 'markRead']);
Route::get('/feed', [FeedController::class, 'view'])->name('feed');
});
@@ -76,12 +80,14 @@ Route::domain(config('app.domain'))->group(
Route::get('/search/aircraft', [SearchController::class, 'aircraft'])->name('search.aircraft');
Route::get('/search/airports', [SearchController::class, 'airports'])->name('search.airports');
Route::get('/data/user/{username}/flights', [UserApiController::class, 'flights']);
Route::get('/u/{user}', [FlightProfileController::class, 'view'])->name('profile.view');
Route::get('/u/{user}/map', [FlightProfileController::class, 'map'])->name('profile.map');
Route::get('/u/{user}/departure-board/{flight?}', [FlightProfileController::class, 'departureBoard'])
->name('profile.departure-board');
Route::get('/u/{user}/boarding-passes', [FlightProfileController::class, 'boardingPasses'])->name('profile.boarding-passes');
Route::get('/{user}/achievements', [AchievementController::class, 'index'])->name('profile.achievements');
require __DIR__.'/auth.php';