Bugfixing infinite scrollu u seznamu letu, novy vzhled detailu letu
This commit is contained in:
@@ -0,0 +1,59 @@
|
|||||||
|
<script setup>
|
||||||
|
import {FORMAT_DATE, formatDatetime} from "src/composables/datetimeUtils";
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
flight: {type: Object, required: true},
|
||||||
|
pilot: {type: Object, required: true},
|
||||||
|
routeDetail: {type: Object, required: true},
|
||||||
|
})
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="flight-header-info">
|
||||||
|
<h2 class="text-h4">
|
||||||
|
<router-link :to="routeDetail" v-if="routeDetail">
|
||||||
|
{{ flight.name }}
|
||||||
|
</router-link>
|
||||||
|
<span v-else>{{ flight.name }}</span>
|
||||||
|
</h2>
|
||||||
|
|
||||||
|
<div class="q-my-lg">
|
||||||
|
{{ formatDatetime(flight.takeoffDatetime, FORMAT_DATE) }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<span v-for="(turnPoint, i) in flight.turnPoints">
|
||||||
|
{{ turnPoint.pointOfInterest.name }}
|
||||||
|
<span v-if="i < Object.keys(flight.turnPoints).length - 1" class="q-mx-md"> •</span>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="q-my-lg">
|
||||||
|
<router-link :to="{name: 'publicAircraftDetail', params: {callSign: flight.aircraft.callSign}}">
|
||||||
|
{{ flight.aircraft.callSign }}
|
||||||
|
</router-link>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="q-my-lg" v-if="flight.description !== ''">
|
||||||
|
<div v-html="flight.description"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<slot class="q-my-lg" name="default"></slot>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
.flight-header-info a {
|
||||||
|
|
||||||
|
&, &:visited {
|
||||||
|
color: #e6f5ff;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
color: #c2d2dd;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -3,8 +3,6 @@ import {minutesToHumanReadable} from "src/composables/datetimeUtils";
|
|||||||
import {flightName} from "src/composables/flight";
|
import {flightName} from "src/composables/flight";
|
||||||
import AvatarFromPhoto from "components/avatars/AvatarFromPhoto.vue";
|
import AvatarFromPhoto from "components/avatars/AvatarFromPhoto.vue";
|
||||||
import {useInfiniteScroll} from "src/composables/pagination";
|
import {useInfiniteScroll} from "src/composables/pagination";
|
||||||
import {useQuasar} from "quasar";
|
|
||||||
import {computed} from "vue";
|
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
items: {
|
items: {
|
||||||
@@ -27,8 +25,6 @@ const routeDetail = (flight) => {
|
|||||||
else
|
else
|
||||||
return {name: "flightDetail", params: {id: flight.id}}
|
return {name: "flightDetail", params: {id: flight.id}}
|
||||||
};
|
};
|
||||||
|
|
||||||
const $q = useQuasar()
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -44,8 +40,6 @@ const $q = useQuasar()
|
|||||||
clickable
|
clickable
|
||||||
:to="routeDetail(flight)"
|
:to="routeDetail(flight)"
|
||||||
>
|
>
|
||||||
|
|
||||||
|
|
||||||
<q-item-section avatar class="gt-xs">
|
<q-item-section avatar class="gt-xs">
|
||||||
<AvatarFromPhoto :size="120" v-if="flight.titlePhoto" :src="flight.titlePhoto.thumbnailUrl"/>
|
<AvatarFromPhoto :size="120" v-if="flight.titlePhoto" :src="flight.titlePhoto.thumbnailUrl"/>
|
||||||
<q-avatar v-else size="120px" icon="flight" text-color="grey-7" color="grey-4"></q-avatar>
|
<q-avatar v-else size="120px" icon="flight" text-color="grey-7" color="grey-4"></q-avatar>
|
||||||
|
|||||||
+19
-5
@@ -1,7 +1,7 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import {ref} from "vue";
|
import {ref} from "vue";
|
||||||
import {flightName} from "src/composables/flight";
|
import FlightHeaderInfo from "components/flights/FlightHeaderInfo.vue";
|
||||||
import LatestFlightSliderInfo from "components/flights/slider/LatestFlightSliderInfo.vue";
|
import AvatarFromPhoto from "components/avatars/AvatarFromPhoto.vue";
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
items: {
|
items: {
|
||||||
@@ -37,11 +37,25 @@ const slide = ref(0);
|
|||||||
height="400px"
|
height="400px"
|
||||||
v-if="flight.titlePhoto"
|
v-if="flight.titlePhoto"
|
||||||
>
|
>
|
||||||
<div class="absolute-bottom">
|
<div class="absolute-full">
|
||||||
<LatestFlightSliderInfo :flight="flight"/>
|
<FlightHeaderInfo
|
||||||
|
:route-detail="{name: 'publicFlightDetailNew', params: {username: flight.pilot.publicUsername, flightSlug: flight.urlSlug}}"
|
||||||
|
:pilot="flight.pilot"
|
||||||
|
:flight="flight"
|
||||||
|
>
|
||||||
|
|
||||||
|
<div class="absolute-bottom-right">
|
||||||
|
<router-link
|
||||||
|
class="q-pa-lg"
|
||||||
|
:to="{name: 'publicProfileDetail', params: {username: flight.pilot.publicUsername}}"
|
||||||
|
>
|
||||||
|
{{ flight.pilot.publicUsername }}
|
||||||
|
</router-link>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</FlightHeaderInfo>
|
||||||
</div>
|
</div>
|
||||||
</q-img>
|
</q-img>
|
||||||
<LatestFlightSliderInfo v-else :flight="flight" text-color="primary"/>
|
|
||||||
</q-carousel-slide>
|
</q-carousel-slide>
|
||||||
</q-carousel>
|
</q-carousel>
|
||||||
</div>
|
</div>
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
<script setup>
|
|
||||||
import {flightName} from "src/composables/flight";
|
|
||||||
|
|
||||||
const props = defineProps({
|
|
||||||
flight: {
|
|
||||||
type: Object,
|
|
||||||
required: true
|
|
||||||
},
|
|
||||||
textColor: {
|
|
||||||
type: String,
|
|
||||||
required: false,
|
|
||||||
default: "white"
|
|
||||||
}
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<div class="text-h4">
|
|
||||||
<router-link
|
|
||||||
:class="`text-${props.textColor}`"
|
|
||||||
:to="{name: 'publicFlightDetail', params: {username: flight.pilot.publicUsername, flightSlug: flight.urlSlug}}"
|
|
||||||
>
|
|
||||||
{{ flightName(flight) }}
|
|
||||||
</router-link>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<router-link
|
|
||||||
:class="`text-${props.textColor}`"
|
|
||||||
:to="{name: 'publicProfileDetail', params: {username: flight.pilot.publicUsername}}"
|
|
||||||
>
|
|
||||||
@{{ flight.pilot.publicUsername }}
|
|
||||||
</router-link>
|
|
||||||
</template>
|
|
||||||
@@ -75,7 +75,7 @@ watch(() => [openedPhoto.value, $lightbox.value], () => {
|
|||||||
<div
|
<div
|
||||||
v-for="photo in photos" :key="photo.id"
|
v-for="photo in photos" :key="photo.id"
|
||||||
style="min-height: 100px"
|
style="min-height: 100px"
|
||||||
class="col-6 col-sm-4 col-md-4 col-lg-3 q-pa-sm"
|
class="col-6 col-sm-4 col-md-4 col-lg-2 q-pa-sm"
|
||||||
>
|
>
|
||||||
<a
|
<a
|
||||||
:data-pswp-src="photo.url"
|
:data-pswp-src="photo.url"
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ export const commonKeywords = [
|
|||||||
|
|
||||||
|
|
||||||
export const aircraftKeywords = (aircraft) => {
|
export const aircraftKeywords = (aircraft) => {
|
||||||
return [aircraft.organization?.name, aircraft.callSign, aircraft.manufacturer, aircraft.model]
|
return ["letadlo", "letoun", aircraft.organization?.name, aircraft.callSign, aircraft.manufacturer, aircraft.model]
|
||||||
};
|
};
|
||||||
|
|
||||||
export const flightEventKeywords = (event) => {
|
export const flightEventKeywords = (event) => {
|
||||||
|
|||||||
@@ -11,33 +11,36 @@ export const usePagination = ({fetchFunction, itemsPerPage = 10}) => {
|
|||||||
const filters = ref({});
|
const filters = ref({});
|
||||||
const hasMoreData = ref(true)
|
const hasMoreData = ref(true)
|
||||||
|
|
||||||
|
const isQueryRunning = ref(false)
|
||||||
|
|
||||||
const loadFirstPage = () => {
|
const loadFirstPage = () => {
|
||||||
paginationOffset.value = 0
|
paginationOffset.value = 0
|
||||||
|
isQueryRunning.value = true
|
||||||
return fetchFunction({
|
return fetchFunction({
|
||||||
...filters.value,
|
...filters.value, limit: paginationLimit.value, offset: 0, appendItems: false
|
||||||
limit: paginationLimit.value,
|
|
||||||
offset: 0,
|
|
||||||
appendItems: false
|
|
||||||
}).then((data) => {
|
}).then((data) => {
|
||||||
console.log("first page", data, data.length, paginationLimit.value)
|
|
||||||
paginationOffset.value += paginationLimit.value;
|
paginationOffset.value += paginationLimit.value;
|
||||||
hasMoreData.value = data.length === paginationLimit.value;
|
hasMoreData.value = data.length === paginationLimit.value;
|
||||||
})
|
})
|
||||||
|
.finally(() => {
|
||||||
|
isQueryRunning.value = false
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const loadPage = (index, done) => {
|
const loadPage = (index, done) => {
|
||||||
return fetchFunction({
|
if (isQueryRunning.value) return
|
||||||
...filters.value,
|
|
||||||
appendItems: true,
|
|
||||||
limit: paginationLimit.value,
|
|
||||||
offset: paginationOffset.value,
|
|
||||||
}).then((data) => {
|
|
||||||
console.log("load page", data, data.length, paginationOffset.value, paginationLimit.value)
|
|
||||||
|
|
||||||
|
isQueryRunning.value = true
|
||||||
|
return fetchFunction({
|
||||||
|
...filters.value, appendItems: true, limit: paginationLimit.value, offset: paginationOffset.value,
|
||||||
|
}).then((data) => {
|
||||||
paginationOffset.value += paginationLimit.value;
|
paginationOffset.value += paginationLimit.value;
|
||||||
hasMoreData.value = data.length === paginationLimit.value;
|
hasMoreData.value = data.length === paginationLimit.value;
|
||||||
if (done) done()
|
if (done) done()
|
||||||
})
|
})
|
||||||
|
.finally(() => {
|
||||||
|
isQueryRunning.value = false
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleFiltersChanged = (newFilters) => {
|
const handleFiltersChanged = (newFilters) => {
|
||||||
@@ -65,9 +68,7 @@ export const useInfiniteScroll = (emits, props) => {
|
|||||||
const emitsDef = ["load-more"]
|
const emitsDef = ["load-more"]
|
||||||
const propsDef = {
|
const propsDef = {
|
||||||
hasMoreData: {
|
hasMoreData: {
|
||||||
type: Boolean,
|
type: Boolean, required: false, default: true
|
||||||
required: false,
|
|
||||||
default: true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
import gql from "graphql-tag";
|
import gql from "graphql-tag";
|
||||||
|
|
||||||
export const FRAGMENT_AIRCRAFT_BASIC_INFO = gql`
|
export const FRAGMENT_AIRCRAFT_BASIC_INFO = gql`
|
||||||
fragment aircraftBasicInfo on Aircraft {
|
fragment aircraftBasicInfo on Aircraft {
|
||||||
id
|
|
||||||
callSign
|
|
||||||
manufacturer
|
|
||||||
|
|
||||||
organization {
|
|
||||||
id
|
id
|
||||||
name
|
callSign
|
||||||
|
manufacturer
|
||||||
|
|
||||||
|
organization {
|
||||||
|
id
|
||||||
|
name
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
`;
|
`;
|
||||||
|
|||||||
@@ -1,5 +1,17 @@
|
|||||||
import gql from "graphql-tag";
|
import gql from "graphql-tag";
|
||||||
|
|
||||||
|
export const FRAGMENT_AIRPORT_LIST_INFO = gql`
|
||||||
|
fragment airportListInfo on Airport {
|
||||||
|
id
|
||||||
|
name
|
||||||
|
icaoCode
|
||||||
|
gpsLatitude
|
||||||
|
gpsLongitude
|
||||||
|
elevation
|
||||||
|
iconUrl
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
export const FRAGMENT_AIRPORT_INFO = gql`
|
export const FRAGMENT_AIRPORT_INFO = gql`
|
||||||
fragment airportInfo on Airport {
|
fragment airportInfo on Airport {
|
||||||
id
|
id
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import gql from "graphql-tag";
|
import gql from "graphql-tag";
|
||||||
import {FRAGMENT_AIRPORT_INFO} from "src/graphql/fragments/airport";
|
import {FRAGMENT_AIRPORT_LIST_INFO} from "src/graphql/fragments/airport";
|
||||||
import {FRAGMENT_AIRCRAFT_BASIC_INFO} from "src/graphql/fragments/aircraft_basic";
|
import {FRAGMENT_AIRCRAFT_BASIC_INFO} from "src/graphql/fragments/aircraft_basic";
|
||||||
|
|
||||||
export const FRAGMENT_FLIGHT_LIST_INFO = gql`
|
export const FRAGMENT_FLIGHT_LIST_INFO = gql`
|
||||||
@@ -33,11 +33,11 @@ fragment flightListInfo on Flight {
|
|||||||
}
|
}
|
||||||
|
|
||||||
takeoffAirport {
|
takeoffAirport {
|
||||||
...airportInfo
|
...airportListInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
landingAirport {
|
landingAirport {
|
||||||
...airportInfo
|
...airportListInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
aircraft {
|
aircraft {
|
||||||
@@ -45,7 +45,7 @@ fragment flightListInfo on Flight {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
${FRAGMENT_AIRPORT_INFO}
|
${FRAGMENT_AIRPORT_LIST_INFO}
|
||||||
${FRAGMENT_AIRCRAFT_BASIC_INFO}
|
${FRAGMENT_AIRCRAFT_BASIC_INFO}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
import {useMeta} from "quasar";
|
import {useMeta} from "quasar";
|
||||||
import {metaData} from "src/composables/meta";
|
import {metaData} from "src/composables/meta";
|
||||||
import AppFooter from "components/AppFooter.vue";
|
import AppFooter from "components/AppFooter.vue";
|
||||||
import LatestFlightsSlider from "components/flights/slider/LatestFlightsSlider.vue";
|
import LatestFlightsSlider from "components/flights/LatestFlightsSlider.vue";
|
||||||
import {onMounted} from "vue";
|
import {onMounted} from "vue";
|
||||||
import {useFlightsStore} from "stores/Flights";
|
import {useFlightsStore} from "stores/Flights";
|
||||||
import {storeToRefs} from "pinia";
|
import {storeToRefs} from "pinia";
|
||||||
|
|||||||
@@ -28,27 +28,24 @@ import {homepageBreadcrumbs} from "src/composables/breadcrumbs";
|
|||||||
|
|
||||||
const {aircraft, isQueryRunning} = storeToRefs(useAircraftsStore());
|
const {aircraft, isQueryRunning} = storeToRefs(useAircraftsStore());
|
||||||
const {photos, isQueryRunning: arePhotosLoading} = storeToRefs(usePhotosStore());
|
const {photos, isQueryRunning: arePhotosLoading} = storeToRefs(usePhotosStore());
|
||||||
const {flights, totalItemsCount, isQueryRunning: areFlightsLoading} = storeToRefs(useFlightsStore());
|
const {flights, isQueryRunning: areFlightsLoading} = storeToRefs(useFlightsStore());
|
||||||
|
|
||||||
useAppStore().setPageTitle(aircraft.value.callSign);
|
useAppStore().setPageTitle(aircraft.value.callSign);
|
||||||
useMeta(() => metaData({
|
useMeta(() => metaData({
|
||||||
title: aircraft.value.callSign,
|
title: aircraft.value.callSign,
|
||||||
image: aircraft.value.titleImage?.url,
|
image: aircraft.value.titleImage?.url,
|
||||||
keywords: [
|
keywords: aircraftKeywords(aircraft.value),
|
||||||
"letadlo", ...aircraftKeywords(aircraft.value)
|
|
||||||
],
|
|
||||||
description: aircraft.value.description || `Detail letadla ${aircraft.value.callSign}.`
|
description: aircraft.value.description || `Detail letadla ${aircraft.value.callSign}.`
|
||||||
}));
|
}));
|
||||||
useAppStore().setBreadcrumbs([
|
useAppStore().setBreadcrumbs([
|
||||||
...homepageBreadcrumbs(),
|
...homepageBreadcrumbs(),
|
||||||
{label: "Letadla"},
|
{label: "Letadla"},
|
||||||
{label: aircraft.value.callSign}
|
{label: aircraft.value.callSign}
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const {filters, loadPage, paginationLimit} = usePagination({fetchFunction: useFlightsStore().fetchPublic});
|
const {handleFiltersChanged, hasMoreData, loadPage} = usePagination({fetchFunction: useFlightsStore().fetchPublic});
|
||||||
filters.value = {aircraftId: aircraft.value.id};
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
loadPage(false);
|
handleFiltersChanged({aircraftId: aircraft.value.id})
|
||||||
usePhotosStore().fetchPublic({aircraftId: aircraft.value.id});
|
usePhotosStore().fetchPublic({aircraftId: aircraft.value.id});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
@@ -74,10 +71,9 @@ onMounted(() => {
|
|||||||
<FlightsList
|
<FlightsList
|
||||||
v-else
|
v-else
|
||||||
:items="flights"
|
:items="flights"
|
||||||
:total-items-count="totalItemsCount"
|
|
||||||
:is-query-running="areFlightsLoading"
|
:is-query-running="areFlightsLoading"
|
||||||
:items-per-page="paginationLimit"
|
:has-more-data="hasMoreData"
|
||||||
@load-more="loadPage(true)"
|
@load-more="loadPage($event.index, $event.done)"
|
||||||
:public="true"
|
:public="true"
|
||||||
/>
|
/>
|
||||||
</q-card-section>
|
</q-card-section>
|
||||||
|
|||||||
@@ -39,46 +39,41 @@ useMeta(() => metaData({
|
|||||||
description: event.value.description
|
description: event.value.description
|
||||||
}))
|
}))
|
||||||
|
|
||||||
const {filters, loadPage, paginationLimit} = usePagination({fetchFunction: useFlightsStore().fetchPublic});
|
const {loadPage, hasMoreData, handleFiltersChanged} = usePagination({fetchFunction: useFlightsStore().fetchPublic});
|
||||||
filters.value = {username: props.pilot.publicUsername, eventId: event.value.id};
|
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
loadPage(false);
|
handleFiltersChanged({username: props.pilot.publicUsername, eventId: event.value.id})
|
||||||
})
|
})
|
||||||
|
|
||||||
const {flights, totalItemsCount, isQueryRunning: areFlightsLoading} = storeToRefs(useFlightsStore());
|
const {flights, isQueryRunning: areFlightsLoading} = storeToRefs(useFlightsStore());
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<EventDetailSkeleton v-if="isQueryRunning || !event"/>
|
||||||
<EventDetailSkeleton v-if="isQueryRunning || !event"/>
|
|
||||||
|
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<EventBasicInfo :event="event"/>
|
<EventBasicInfo :event="event"/>
|
||||||
|
|
||||||
<article class="q-my-lg" v-html="event.description"/>
|
<article class="q-my-lg" v-html="event.description"/>
|
||||||
|
|
||||||
<q-no-ssr>
|
<q-no-ssr>
|
||||||
<EventFlightsMap :event-url-slug="event.urlSlug" :only-public="true"/>
|
<!-- <EventFlightsMap :event-url-slug="event.urlSlug" :only-public="true"/>-->
|
||||||
</q-no-ssr>
|
</q-no-ssr>
|
||||||
|
|
||||||
<h3>Lety</h3>
|
<h3>Lety</h3>
|
||||||
|
|
||||||
<q-banner v-if="event.flights.length === 0" class="bg-light-blue text-white">
|
<q-banner v-if="flights.length === 0" class="bg-light-blue text-white">
|
||||||
Zatím tu nemáš uložené žádné lety.
|
Zatím tu nemáš uložené žádné lety.
|
||||||
</q-banner>
|
</q-banner>
|
||||||
|
|
||||||
<FlightsListSkeleton :items="paginationLimit" v-if="areFlightsLoading && flights?.length === 0"/>
|
<FlightsListSkeleton v-if="areFlightsLoading && flights?.length === 0"/>
|
||||||
|
|
||||||
<FlightsList
|
<FlightsList
|
||||||
v-else
|
v-else
|
||||||
:items="flights"
|
:items="flights"
|
||||||
:total-items-count="totalItemsCount"
|
:public="true"
|
||||||
:is-query-running="areFlightsLoading"
|
:has-more-data="hasMoreData"
|
||||||
:items-per-page="paginationLimit"
|
@load-more="loadPage($event.index, $event.done)"
|
||||||
:public="true"
|
/>
|
||||||
@load-more="loadPage(true)"
|
</template>
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -35,6 +35,8 @@ import {useAirportsStore} from "stores/Airports";
|
|||||||
import {useFlightPlansStore} from "stores/FlightPlans";
|
import {useFlightPlansStore} from "stores/FlightPlans";
|
||||||
import {FORMAT_DATE, formatDatetime} from "src/composables/datetimeUtils";
|
import {FORMAT_DATE, formatDatetime} from "src/composables/datetimeUtils";
|
||||||
import AvatarFromPhoto from "components/avatars/AvatarFromPhoto.vue";
|
import AvatarFromPhoto from "components/avatars/AvatarFromPhoto.vue";
|
||||||
|
import BreadcrumbsNavigation from "components/navigation/BreadcrumbsNavigation.vue";
|
||||||
|
import {publicFlightBreadcrumbs} from "src/composables/breadcrumbs";
|
||||||
|
|
||||||
const {isQueryRunning, flight} = storeToRefs(useFlightsStore());
|
const {isQueryRunning, flight} = storeToRefs(useFlightsStore());
|
||||||
|
|
||||||
@@ -58,7 +60,9 @@ const flightNameFormatted = flightName(flight.value);
|
|||||||
const event = computed(() => flight.value.event);
|
const event = computed(() => flight.value.event);
|
||||||
|
|
||||||
useAppStore().setPageTitle(flightNameFormatted);
|
useAppStore().setPageTitle(flightNameFormatted);
|
||||||
useAppStore().setBreadcrumbs([])//publicFlightBreadcrumbs(pilot.value, flight.value, event.value, false));
|
useAppStore().setBreadcrumbs(publicFlightBreadcrumbs(pilot.value, flight.value, event.value, false));
|
||||||
|
const {breadcrumbs} = storeToRefs(useAppStore());
|
||||||
|
|
||||||
|
|
||||||
useMeta(() => metaData({
|
useMeta(() => metaData({
|
||||||
title: `${flightNameFormatted} - ${pilot.value.name}`,
|
title: `${flightNameFormatted} - ${pilot.value.name}`,
|
||||||
@@ -74,62 +78,58 @@ useMeta(() => metaData({
|
|||||||
));
|
));
|
||||||
|
|
||||||
|
|
||||||
const contentTabs = ref()
|
const titleImageBottomAnchor = ref()
|
||||||
const scrollToContent = () => {
|
const scrollToContent = () => {
|
||||||
contentTabs.value.$el.scrollIntoView({behavior: "smooth"});
|
console.log(titleImageBottomAnchor.value)
|
||||||
|
if (!titleImageBottomAnchor.value) {
|
||||||
|
console.log("nemam anchor")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
titleImageBottomAnchor.value.scrollIntoView({behavior: "smooth"});
|
||||||
}
|
}
|
||||||
|
|
||||||
const tab = ref("photos")
|
const tab = ref("photos")
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<q-img :src="flight.titlePhoto.url" style="height: 85vh" fit="cover">
|
<q-img :src="flight.titlePhoto.url" style="height: 100vh" fit="cover">
|
||||||
<div class="absolute-full flex flex-center text-center">
|
<div class="absolute-full">
|
||||||
<div>
|
<div style="height: 20vh; opacity: 0.4">
|
||||||
<h2 class="text-h4">{{ flight.name }}</h2>
|
<BreadcrumbsNavigation :items="breadcrumbs || []"/>
|
||||||
|
</div>
|
||||||
<div class="q-my-lg">
|
<div class="flex flex-center text-center">
|
||||||
{{ formatDatetime(flight.takeoffDatetime, FORMAT_DATE) }}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<span v-for="(turnPoint, i) in flight.turnPoints">
|
<FlightHeaderInfo :pilot="pilot" :flight="flight">
|
||||||
{{ turnPoint.pointOfInterest.name }}
|
<div class="absolute-bottom">
|
||||||
<span v-if="i < Object.keys(flight.turnPoints).length - 1" class="q-mx-md"> •</span>
|
<div class="row">
|
||||||
</span>
|
<div class="offset-2 col-grow">
|
||||||
</div>
|
<q-tabs
|
||||||
|
v-model="tab"
|
||||||
<div v-if="flight.description !== ''">
|
>
|
||||||
{{ flight.description }}
|
<q-tab @click="scrollToContent" class="q-px-xl" :ripple="false" name="photos" icon="image" label="Fotky" v-if="flightPhotos.length > 0"/>
|
||||||
</div>
|
<q-tab @click="scrollToContent" class="q-px-xl" :ripple="false" name="info" icon="alarm" label="Info"/>
|
||||||
|
<q-tab @click="scrollToContent" class="q-px-xl" :ripple="false" name="track" icon="route" label="Trasa" v-if="flightPlan || flight.track"/>
|
||||||
<div>
|
</q-tabs>
|
||||||
<q-btn dense text icon="arrow_downward" size="lg" class="q-my-lg" @click="scrollToContent">Detail letu</q-btn>
|
</div>
|
||||||
</div>
|
<div class="col-2">
|
||||||
|
<q-btn class="q-ma-md" :to="{name: 'publicFlightDetail', params: {username: pilot.publicUsername}}">
|
||||||
<div class="absolute-bottom-right">
|
<AvatarFromPhoto :size="32" class="q-mr-sm" :src="pilot.avatarImageUrl"/>
|
||||||
<q-btn class="q-ma-md" :to="{name: 'publicProfileDetail', params: {username: pilot.publicUsername}}">
|
{{ pilot.name }}
|
||||||
<AvatarFromPhoto :size="32" class="q-mr-sm" :src="pilot.avatarImageUrl"/>
|
</q-btn>
|
||||||
{{ pilot.name }}
|
</div>
|
||||||
</q-btn>
|
</div>
|
||||||
|
</div>
|
||||||
|
</FlightHeaderInfo>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="absolute-bottom" ref="titleImageBottomAnchor"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</q-img>
|
</q-img>
|
||||||
|
|
||||||
|
|
||||||
<q-tabs
|
|
||||||
ref="contentTabs"
|
|
||||||
v-model="tab"
|
|
||||||
align="justify"
|
|
||||||
class="q-mt-md"
|
|
||||||
>
|
|
||||||
<q-tab :ripple="false" name="photos" icon="image" label="Fotky" v-if="flightPhotos.length > 0"/>
|
|
||||||
<q-tab :ripple="false" name="info" icon="alarm" label="Info"/>
|
|
||||||
<q-tab :ripple="false" name="track" icon="route" label="Trasa" v-if="flightPlan || flight.track"/>
|
|
||||||
</q-tabs>
|
|
||||||
|
|
||||||
<q-tab-panels v-model="tab" style="min-height: 80vh">
|
<q-tab-panels v-model="tab" style="min-height: 80vh">
|
||||||
<q-tab-panel name="photos">
|
<q-tab-panel name="photos">
|
||||||
<q-inner-loading v-if="arePhotosLoading"/>
|
<q-inner-loading v-if="arePhotosLoading"/>
|
||||||
|
|||||||
@@ -28,19 +28,18 @@ useMeta(() => metaData({
|
|||||||
useAppStore().setPageTitle(props.pilot.publicUsername);
|
useAppStore().setPageTitle(props.pilot.publicUsername);
|
||||||
useAppStore().setBreadcrumbs(publicProfileBreadcrumbs(props.pilot, false))
|
useAppStore().setBreadcrumbs(publicProfileBreadcrumbs(props.pilot, false))
|
||||||
|
|
||||||
const {filters, loadPage, paginationLimit} = usePagination({fetchFunction: useFlightsStore().fetchPublic});
|
const {loadPage, handleFiltersChanged} = usePagination({fetchFunction: useFlightsStore().fetchPublic});
|
||||||
filters.value = {username: props.pilot.publicUsername};
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
loadPage(false);
|
handleFiltersChanged({username: props.pilot.publicUsername})
|
||||||
});
|
});
|
||||||
|
|
||||||
const {flights, totalItemsCount, isQueryRunning: areFlightsLoading} = storeToRefs(useFlightsStore());
|
const {flights, isQueryRunning: areFlightsLoading} = storeToRefs(useFlightsStore());
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<PublicFlightEventSwitcher :username="pilot?.publicUsername"/>
|
<PublicFlightEventSwitcher :username="pilot?.publicUsername"/>
|
||||||
|
|
||||||
<FlightsListSkeleton :items="paginationLimit" v-if="areFlightsLoading && flights?.length === 0"/>
|
<FlightsListSkeleton v-if="areFlightsLoading && flights?.length === 0"/>
|
||||||
|
|
||||||
<q-banner class="bg-primary text-white" v-else-if="!areFlightsLoading && flights.length === 0">
|
<q-banner class="bg-primary text-white" v-else-if="!areFlightsLoading && flights.length === 0">
|
||||||
Tento pilot zatím nepublikoval žádný let.
|
Tento pilot zatím nepublikoval žádný let.
|
||||||
@@ -49,9 +48,6 @@ const {flights, totalItemsCount, isQueryRunning: areFlightsLoading} = storeToRef
|
|||||||
<FlightsList
|
<FlightsList
|
||||||
v-else
|
v-else
|
||||||
:items="flights"
|
:items="flights"
|
||||||
:total-items-count="totalItemsCount"
|
|
||||||
:is-query-running="areFlightsLoading"
|
|
||||||
:items-per-page="paginationLimit"
|
|
||||||
:public="true"
|
:public="true"
|
||||||
@load-more="loadPage(true)"
|
@load-more="loadPage(true)"
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -41,11 +41,11 @@ useAppStore().setBreadcrumbs([
|
|||||||
{label: pointOfInterest.value.name}
|
{label: pointOfInterest.value.name}
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const {filters, loadPage, paginationLimit} = usePagination({fetchFunction: useFlightsStore().fetchPublic});
|
const {loadPage, handleFiltersChanged, hasMoreData} = usePagination({fetchFunction: useFlightsStore().fetchPublic});
|
||||||
filters.value = {pointOfInterestId: pointOfInterest.value.id};
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
usePhotosStore().fetchPublic({pointOfInterestId: pointOfInterest.value.id});
|
usePhotosStore().fetchPublic({pointOfInterestId: pointOfInterest.value.id});
|
||||||
loadPage(false);
|
handleFiltersChanged({pointOfInterestId: pointOfInterest.value.id});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -79,7 +79,8 @@ onMounted(() => {
|
|||||||
:is-query-running="areFlightsLoading"
|
:is-query-running="areFlightsLoading"
|
||||||
:items-per-page="paginationLimit"
|
:items-per-page="paginationLimit"
|
||||||
:public="true"
|
:public="true"
|
||||||
@load-more="loadPage(true)"
|
:has-more-data="hasMoreData"
|
||||||
|
@load-more="loadPage($event.index, $event.done)"
|
||||||
/>
|
/>
|
||||||
</q-card-section>
|
</q-card-section>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
Reference in New Issue
Block a user