Session api token validation
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
import {computed, ref} from "vue";
|
||||
import {Flight, User} from "@/Types/types";
|
||||
import {router} from "@inertiajs/vue3";
|
||||
import { copyToClipboard } from "@/Composables/useClipboard";
|
||||
|
||||
defineProps<{
|
||||
profileUser: User
|
||||
@@ -21,6 +22,21 @@ const showDeleteDialog = computed({
|
||||
set: (val) => { if (!val) flightToDelete.value = null }
|
||||
})
|
||||
|
||||
function copyFlightToClipboard(flight: Flight) {
|
||||
const dep = `${flight.departure_airport.display_code} (${flight.departure_airport.municipality})`
|
||||
const arr = `${flight.arrival_airport.display_code} (${flight.arrival_airport.municipality})`
|
||||
const times = `${flight.departure_time_display} → ${flight.arrival_time_display}`
|
||||
const dayDiff = flight.arrival_day_difference !== 0
|
||||
? `(${flight.arrival_day_difference > 0 ? '+' : ''}${flight.arrival_day_difference})`
|
||||
: ''
|
||||
const airline = flight.airline?.display_name
|
||||
const aircraft = flight.aircraft?.display_name
|
||||
const reg = flight.aircraft_registration ? `(${flight.aircraft_registration})` : ''
|
||||
const text = `${airline} | ${dep} → ${arr} ${dayDiff} | ${times} · ${flight.departure_date_display} | ${aircraft} ${reg}`
|
||||
copyToClipboard(text)
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -40,6 +56,11 @@ const showDeleteDialog = computed({
|
||||
title="View Details"
|
||||
:href="route('profile.flight', { userFlight: flight.id, user: profileUser.name })"
|
||||
/>
|
||||
<v-list-item
|
||||
prepend-icon="mdi-content-copy"
|
||||
title="Copy to Clipboard"
|
||||
@click="copyFlightToClipboard(flight)"
|
||||
/>
|
||||
<v-list-item v-if="canEdit"
|
||||
prepend-icon="mdi-pencil-outline"
|
||||
title="Edit"
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<script setup lang="ts">
|
||||
import MainLayout from "@/Layouts/MainLayout.vue"
|
||||
import { Head, router } from '@inertiajs/vue3'
|
||||
import { computed, ref, watchEffect } from 'vue'
|
||||
import { Flight, ProfileView, RegionRange, User, FlightRange, FlightScope } from "@/Types/types"
|
||||
import {Head, router, usePage} from '@inertiajs/vue3'
|
||||
import {computed, ref, watch, watchEffect} from 'vue'
|
||||
import {Flight, ProfileView, RegionRange, User, FlightRange, FlightScope, SharedProps} from "@/Types/types"
|
||||
import { useFlightStats } from "@/Composables/useFlightStats"
|
||||
import ProfileViewSwitcher from "@/Components/FlightsGoneBy/ProfileViewSwitcher.vue"
|
||||
import ProfileLayout from "@/Components/FlightsGoneBy/ProfileLayout.vue"
|
||||
@@ -11,9 +11,13 @@ import BoardingPasses from "@/Components/FlightsGoneBy/BoardingPasses.vue"
|
||||
import FlightMapAndCharts from "@/Components/FlightsGoneBy/FlightMapAndCharts.vue"
|
||||
import FlightFilter from "@/Components/FlightsGoneBy/FlightFilter.vue"
|
||||
import { useFlights } from "@/Composables/useFlights"
|
||||
import {useUpdateSetting} from "@/Composables/useUpdateSetting";
|
||||
|
||||
defineOptions({ layout: MainLayout })
|
||||
|
||||
const {updateSetting} = useUpdateSetting()
|
||||
const page = usePage<SharedProps>().props
|
||||
|
||||
const props = defineProps<{
|
||||
user: User
|
||||
canEdit: boolean
|
||||
@@ -24,6 +28,13 @@ const props = defineProps<{
|
||||
flightCount: number
|
||||
}>()
|
||||
|
||||
const hideFilters = ref(page.auth?.user?.resolved_settings?.hide_map_filters ?? false)
|
||||
|
||||
watch(hideFilters, (value) => {
|
||||
updateSetting('hide_map_filters', value).catch(() => {})
|
||||
})
|
||||
|
||||
|
||||
// ── Flights state ─────────────────────────────────────────────────────────────
|
||||
|
||||
const { flights, flightsLoading } = useFlights(`/internal/user/${props.user.name}/flights`)
|
||||
@@ -31,8 +42,6 @@ const localSelectedFlightId = ref(props.selectedFlightId ?? null)
|
||||
|
||||
// ── Filter state ──────────────────────────────────────────────────────────────
|
||||
|
||||
const filtersOpen = ref(window.innerWidth >= 1024)
|
||||
|
||||
const selectedYears = ref<number[]>([])
|
||||
const selectedAirlines = ref<number[]>([])
|
||||
const selectedAlliances = ref<number[]>([])
|
||||
@@ -162,7 +171,7 @@ const routeNames: Record<Exclude<ProfileView, 'achievements'>, string> = {
|
||||
} as const
|
||||
|
||||
function toggleFilters(e: MouseEvent) {
|
||||
filtersOpen.value = !filtersOpen.value
|
||||
hideFilters.value = !hideFilters.value
|
||||
;(e.currentTarget as HTMLButtonElement).blur()
|
||||
}
|
||||
|
||||
@@ -193,7 +202,7 @@ function switchView(view: ProfileView) {
|
||||
<ProfileViewSwitcher :user="user" :active-view="activeView" @update:active-view="switchView" />
|
||||
<button
|
||||
class="filter-toggle"
|
||||
:class="{ active: filtersOpen || activeFilterCount > 0 }"
|
||||
:class="{ active: !hideFilters || activeFilterCount > 0 }"
|
||||
@click="toggleFilters"
|
||||
>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
||||
@@ -204,7 +213,7 @@ function switchView(view: ProfileView) {
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div v-show="filtersOpen" class="filter-panel">
|
||||
<div v-show="!hideFilters" class="filter-panel">
|
||||
<FlightFilter :flights="flights" @change="onFiltersChange" />
|
||||
</div>
|
||||
|
||||
|
||||
Vendored
+1
@@ -29,6 +29,7 @@ export interface UserSettings {
|
||||
departure_board_columns: string[]
|
||||
show_map_legend: boolean
|
||||
hide_impossible_achievements: boolean
|
||||
hide_map_filters: boolean
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user