Verejna cast, hezci 404ka, refaktoring
This commit is contained in:
@@ -1,12 +1,11 @@
|
||||
<template>
|
||||
<div class="fullscreen bg-blue text-white text-center q-pa-md flex flex-center">
|
||||
<div class="fullscreen text-center q-pa-md flex flex-center">
|
||||
<div>
|
||||
<div style="font-size: 30vh">
|
||||
404
|
||||
</div>
|
||||
|
||||
<div class="text-h2" style="opacity:.4">
|
||||
Oops. Nothing here...
|
||||
<q-img src="/plane-crash.svg" width="75%" />
|
||||
|
||||
<div style="font-size: 20vh">
|
||||
404
|
||||
</div>
|
||||
|
||||
<q-btn
|
||||
@@ -14,8 +13,8 @@
|
||||
color="white"
|
||||
text-color="blue"
|
||||
unelevated
|
||||
to="/"
|
||||
label="Go Home"
|
||||
:to="{name: 'homepage'}"
|
||||
label="Zpět na titulní stranu"
|
||||
no-caps
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -1,28 +1,24 @@
|
||||
<script setup>
|
||||
import {useRoute, useRouter} from "vue-router";
|
||||
import {computed, onMounted, ref, watch} from "vue";
|
||||
import {onMounted, watch} from "vue";
|
||||
import FlightDetailSkeleton from "components/flights/FlightDetailSkeleton.vue";
|
||||
import {fetchFlight, flight, flightName, handleDeleteFlight, loading} from "src/composables/objects/flight";
|
||||
import {useAppStore} from "stores/App";
|
||||
import FlightBasicInfo from "components/flights/FlightBasicInfo.vue";
|
||||
import {useQuasar} from "quasar";
|
||||
import {copyToClipboard, useQuasar} from "quasar";
|
||||
import {successObject} from "src/composables/dialog";
|
||||
import MapWithMarkers from "components/map/MapWithMarkers.vue";
|
||||
import FAB from "components/FAB.vue";
|
||||
import PhotoDetail from "components/photos/PhotoDetail.vue";
|
||||
import {useFlightsStore} from "stores/Flights";
|
||||
import PhotoCarousel from "components/flights/PhotoCarousel.vue";
|
||||
import FlightTrackMap from "components/flights/FlightTrackMap.vue";
|
||||
import {useUserStore} from "stores/User";
|
||||
|
||||
|
||||
const $q = useQuasar();
|
||||
const $router = useRouter();
|
||||
const displayedPhoto = ref(null);
|
||||
const flightId = parseInt(useRoute().params.id);
|
||||
|
||||
onMounted(() => {
|
||||
fetchFlight(flightId).then(() => {
|
||||
if (flight.value.photos.length === 0) return;
|
||||
displayedPhoto.value = flight.value.coverPhoto.url || flight.value.photos[0].url;
|
||||
})
|
||||
fetchFlight(flightId);
|
||||
})
|
||||
|
||||
watch(flight, (newVal) => {
|
||||
@@ -43,62 +39,29 @@ const handleDeleteAndRedirect = () => {
|
||||
})
|
||||
}
|
||||
|
||||
const trackWithGPS = computed(() => {
|
||||
return flight.value.track.filter(poi => poi.pointOfInterest.gpsLatitude && poi.pointOfInterest.gpsLongitude)
|
||||
});
|
||||
|
||||
const pointsOfInterests = computed(() => {
|
||||
const path = [{
|
||||
label: flight.value.takeoffAirport.name,
|
||||
position:
|
||||
{
|
||||
lat: flight.value.takeoffAirport.gpsLatitude,
|
||||
lng: flight.value.takeoffAirport.gpsLongitude
|
||||
}
|
||||
}];
|
||||
|
||||
for (const poi of trackWithGPS.value) {
|
||||
path.push({
|
||||
label: poi.pointOfInterest.name,
|
||||
position: {lat: poi.pointOfInterest.gpsLatitude, lng: poi.pointOfInterest.gpsLongitude}
|
||||
});
|
||||
}
|
||||
|
||||
path.push({
|
||||
label: flight.value.takeoffAirport.name,
|
||||
position: {
|
||||
lat: flight.value.landingAirport.gpsLatitude,
|
||||
lng: flight.value.landingAirport.gpsLongitude
|
||||
}
|
||||
});
|
||||
|
||||
return path;
|
||||
});
|
||||
|
||||
const openPhotoDetail = ref(false);
|
||||
const photoData = ref(null);
|
||||
const openDetail = ({photo, idx, allPhotos}) => {
|
||||
openPhotoDetail.value = true;
|
||||
photoData.value = {photo, idx, allPhotos}
|
||||
}
|
||||
const mapPhotos = computed(() => {
|
||||
return flight.value.photos.filter(photo => photo.gpsLatitude && photo.gpsLongitude)
|
||||
});
|
||||
|
||||
const displayMap = computed(() => {
|
||||
return (
|
||||
!!flight.value.gpsTrackUrl ||
|
||||
mapPhotos.value.length > 0 ||
|
||||
trackWithGPS.value.length > 0 ||
|
||||
flight.value.landingAirport.id !== flight.value.takeoffAirport.id
|
||||
)
|
||||
});
|
||||
|
||||
const togglePublicVisibility = () => {
|
||||
useFlightsStore().update(flightId, {isPublic: !flight.value.isPublic}).then(() => {
|
||||
$q.notify(successObject("Uspesne nastaveno"));
|
||||
})
|
||||
}
|
||||
const newVisibility = !flight.value.isPublic;
|
||||
useFlightsStore()
|
||||
.update(flightId, {isPublic: newVisibility})
|
||||
.then((updatedFlight) => {
|
||||
flight.value = updatedFlight;
|
||||
$q.notify(successObject(newVisibility ? "Úspěšně publikováno" : "Úspěšně skryto"));
|
||||
});
|
||||
};
|
||||
|
||||
const copyLinkToClipboard = () => {
|
||||
const loggedUser = useUserStore().user;
|
||||
const url = $router.resolve({
|
||||
name: "publicFlightDetail",
|
||||
params: {id: flightId, username: loggedUser.publicUsername}
|
||||
});
|
||||
copyToClipboard(window.location.origin + url.href).then(() => {
|
||||
$q.notify(successObject("Odkaz zkopírován"))
|
||||
});
|
||||
;
|
||||
};
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
@@ -107,63 +70,43 @@ const togglePublicVisibility = () => {
|
||||
|
||||
<template v-else>
|
||||
<q-card class="q-mx-md q-my-md flight-detail-card">
|
||||
<q-carousel
|
||||
v-if="flight.photos.length > 0"
|
||||
animated
|
||||
v-model="displayedPhoto"
|
||||
arrows
|
||||
swipeable
|
||||
height="auto"
|
||||
infinite
|
||||
>
|
||||
<q-carousel-slide style="padding: 0" v-for="(photo, idx) in flight.photos" :key="photo.url" :name="photo.url">
|
||||
<q-img :src="photo.url" @click="openDetail({photo, idx, allPhotos: flight.photos})"/>
|
||||
</q-carousel-slide>
|
||||
</q-carousel>
|
||||
<PhotoCarousel :cover-photo-url="flight.coverPhoto?.url" :photos="flight.photos"/>
|
||||
|
||||
<q-card-actions class="q-my-md">
|
||||
<div class="col-grow">
|
||||
<q-btn
|
||||
flat
|
||||
:to="{name: 'flightEdit', params:{id: flight.id}}"
|
||||
icon="edit"
|
||||
text-color="primary"
|
||||
label="Upravit"
|
||||
/>
|
||||
|
||||
<q-btn
|
||||
@click="togglePublicVisibility"
|
||||
:icon="flight.isPublic ? 'visibility_off' : 'visibility'"
|
||||
flat
|
||||
:label="flight.isPublic ? 'Skrýt' : 'Zveřejnit'"
|
||||
/>
|
||||
|
||||
<q-btn
|
||||
icon="link"
|
||||
@click="copyLinkToClipboard()"
|
||||
flat
|
||||
v-if="flight.isPublic"
|
||||
label="Získat odkaz"
|
||||
/>
|
||||
</div>
|
||||
<q-btn @click="handleDeleteAndRedirect" icon="delete" flat text-color="red" label="Smazat"/>
|
||||
</q-card-actions>
|
||||
|
||||
<q-card-section>
|
||||
<FlightBasicInfo :flight="flight"/>
|
||||
|
||||
<article class="q-my-lg" v-html="flight.description"/>
|
||||
|
||||
<MapWithMarkers
|
||||
v-if="displayMap"
|
||||
style="width: 100%; height: 500px;"
|
||||
:gpx-track-url="flight.gpxTrackUrl"
|
||||
:markers="pointsOfInterests"
|
||||
:photos="mapPhotos"
|
||||
/>
|
||||
<FlightTrackMap :flight="flight"/>
|
||||
</q-card-section>
|
||||
|
||||
<q-card-actions align="right">
|
||||
<q-btn @click="togglePublicVisibility" :icon="flight.isPublic ? 'visibility' : 'visibility_off'" rounded flat text-color="primary">
|
||||
<q-tooltip>
|
||||
|
||||
{{ flight.isPublic ? 'je verejny' : 'neni verejny'}}
|
||||
|
||||
</q-tooltip>
|
||||
</q-btn>
|
||||
|
||||
<q-btn @click="handleDeleteAndRedirect" icon="delete" rounded flat text-color="red"/>
|
||||
</q-card-actions>
|
||||
</q-card>
|
||||
|
||||
<PhotoDetail
|
||||
v-if="photoData"
|
||||
v-model="openPhotoDetail"
|
||||
:photo="photoData.photo"
|
||||
:photos="photoData.allPhotos"
|
||||
:opened-index="photoData.idx"
|
||||
/>
|
||||
|
||||
<FAB :router-link="{name: 'flightEdit', params:{id: flight.id}}" mode="edit"/>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
<style>
|
||||
.flight-detail-card {
|
||||
width: 100%;
|
||||
max-width: 700px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,9 +1,50 @@
|
||||
<script setup>
|
||||
import {onMounted, watch} from "vue";
|
||||
import {fetchFlight, flight, flightName, loading} from "src/composables/objects/flight";
|
||||
import {useRoute} from "vue-router";
|
||||
import PhotoCarousel from "components/flights/PhotoCarousel.vue";
|
||||
import FlightTrackMap from "components/flights/FlightTrackMap.vue";
|
||||
import FlightBasicInfo from "components/flights/FlightBasicInfo.vue";
|
||||
import {useAppStore} from "stores/App";
|
||||
import FlightDetailSkeleton from "components/flights/FlightDetailSkeleton.vue";
|
||||
|
||||
const routeParams = useRoute().params
|
||||
|
||||
onMounted(() => {
|
||||
fetchFlight(routeParams.id, routeParams.username);
|
||||
})
|
||||
|
||||
watch(flight, (newVal) => {
|
||||
const flightNameFormatted = flightName(newVal);
|
||||
useAppStore().setPageTitle(flightNameFormatted);
|
||||
useAppStore().setBreadcrumbs([
|
||||
{to: {name: "publicProfileDetail", params: {username: routeParams.username}}, label: `@${routeParams.username}`},
|
||||
{label: flightNameFormatted}
|
||||
]);
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
Detail letu
|
||||
</div>
|
||||
|
||||
<FlightDetailSkeleton v-if="loading || !flight"/>
|
||||
|
||||
<template v-else>
|
||||
|
||||
<q-banner class="bg-warning text-white q-mx-md q-my-md" v-if="!flight.isPublic">
|
||||
Pozor! Tento let není publikován a nebude tak dostupný pro ostatní!
|
||||
</q-banner>
|
||||
|
||||
|
||||
<q-card class="q-mx-md q-my-md flight-detail-card">
|
||||
<PhotoCarousel :cover-photo-url="flight.coverPhoto.url" :photos="flight.photos"/>
|
||||
<q-card-section>
|
||||
<FlightBasicInfo :flight="flight"/>
|
||||
|
||||
<article class="q-my-lg" v-html="flight.description"/>
|
||||
|
||||
<FlightTrackMap :flight="flight"/>
|
||||
</q-card-section>
|
||||
</q-card>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
@@ -3,8 +3,9 @@
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<h1>Pochlub se svým polétáním!</h1>
|
||||
|
||||
<router-link :to='{"name": "login"}'>Login</router-link>
|
||||
<router-link :to='{"name": "registration"}'>Register</router-link>
|
||||
|
||||
<p>Létáš? Kam si archivuješ fotky a trasy? Polétání.cz je aplikace pro sdílení informací o tvých výletech vzduchem.</p>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -17,7 +17,7 @@ const logUser = () => {
|
||||
<template>
|
||||
<q-page class="window-height window-width row justify-center">
|
||||
<q-card square style="width:95%; max-width: 450px; height:400px;" class="q-mt-lg">
|
||||
<q-card-section class="bg-accent">
|
||||
<q-card-section class="bg-primary">
|
||||
<h4 class="text-h5 q-my-md text-white">Login</h4>
|
||||
</q-card-section>
|
||||
<q-card-section>
|
||||
@@ -36,10 +36,10 @@ const logUser = () => {
|
||||
</q-card-section>
|
||||
|
||||
<q-card-actions class="q-px-lg">
|
||||
<q-btn unelevated size="lg" class="full-width" label="Sign In" @click.prevent="logUser()"/>
|
||||
<q-btn unelevated size="lg" class="full-width" label="Přihlásit se" @click.prevent="logUser()"/>
|
||||
</q-card-actions>
|
||||
<q-card-section class="text-center q-pa-sm">
|
||||
<p class="text-grey-6">Forgot your password?</p>
|
||||
<router-link :to="{name: 'forgottenPassword'}" class="text-grey-6">Zapomenuté heslo</router-link>
|
||||
</q-card-section>
|
||||
</q-card>
|
||||
|
||||
|
||||
@@ -45,13 +45,11 @@ const flights = storeToRefs(useFlightsStore()).items;
|
||||
</q-banner>
|
||||
|
||||
<template v-else>
|
||||
<h3>Lety</h3>
|
||||
|
||||
<FlightsList
|
||||
:items="flights"
|
||||
:displayVisibilityInfo="false"
|
||||
:route-detail="{name: 'publicFlightDetail', params: {username: username}}"
|
||||
/>
|
||||
<FlightsList
|
||||
:items="flights"
|
||||
:displayVisibilityInfo="loggedUser.id === pilot.id"
|
||||
:route-detail="{name: 'publicFlightDetail', params: {username: username}}"
|
||||
/>
|
||||
</template>
|
||||
|
||||
</div>
|
||||
@@ -63,10 +61,11 @@ const flights = storeToRefs(useFlightsStore()).items;
|
||||
</div>
|
||||
|
||||
<h3>{{ pilot.name }}</h3>
|
||||
<div class="text-subtitle1">
|
||||
Registrován: {{ formatDatetime(pilot.createdAt, FORMAT_DATE) }}
|
||||
</div>
|
||||
|
||||
<div class="q-my-lg" v-html="pilot.description"/>
|
||||
|
||||
Registrován: {{ formatDatetime(pilot.createdAt, FORMAT_DATE) }}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -37,43 +37,37 @@ const registerUser = () => {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<q-page
|
||||
class="window-height window-width row justify-center items-center"
|
||||
>
|
||||
<div class="column q-pa-lg">
|
||||
<div class="row">
|
||||
<q-card square class="shadow-24" style="width:300px;height:485px;">
|
||||
<q-card-section class="bg-deep-purple-7">
|
||||
<h4 class="text-h5 text-white q-my-md">Registration</h4>
|
||||
</q-card-section>
|
||||
<q-card-section>
|
||||
<q-form class="q-px-sm q-pt-xl q-pb-lg" @submit.prevent="registerUser">
|
||||
<q-input square clearable v-model="name" type="text" label="Name">
|
||||
<template v-slot:prepend>
|
||||
<q-icon name="person"/>
|
||||
</template>
|
||||
</q-input>
|
||||
<q-page class="row justify-center">
|
||||
<q-card style="width:95%; max-width: 450px; height: 500px" >
|
||||
<q-card-section class="bg-primary">
|
||||
<h4 class="text-h5 text-white q-my-md">Registrace</h4>
|
||||
</q-card-section>
|
||||
<q-card-section>
|
||||
<q-form class="q-px-sm q-pt-xl q-pb-lg" @submit.prevent="registerUser">
|
||||
<q-input square clearable v-model="name" type="text" label="Name">
|
||||
<template v-slot:prepend>
|
||||
<q-icon name="person"/>
|
||||
</template>
|
||||
</q-input>
|
||||
|
||||
<q-input square clearable v-model="email" type="email" label="E-mail">
|
||||
<template v-slot:prepend>
|
||||
<q-icon name="email"/>
|
||||
</template>
|
||||
</q-input>
|
||||
<q-input square clearable v-model="password" type="password" label="Password">
|
||||
<template v-slot:prepend>
|
||||
<q-icon name="lock"/>
|
||||
</template>
|
||||
</q-input>
|
||||
</q-form>
|
||||
</q-card-section>
|
||||
<q-card-actions class="q-px-lg">
|
||||
<q-btn @click="registerUser" unelevated size="lg" color="purple-4" class="full-width text-white" label="Get Started"/>
|
||||
</q-card-actions>
|
||||
<q-card-section class="text-center q-pa-sm">
|
||||
<router-link :to="{name: 'login'}" class="text-grey-6">Return to login</router-link>
|
||||
</q-card-section>
|
||||
</q-card>
|
||||
</div>
|
||||
</div>
|
||||
<q-input square clearable v-model="email" type="email" label="E-mail">
|
||||
<template v-slot:prepend>
|
||||
<q-icon name="email"/>
|
||||
</template>
|
||||
</q-input>
|
||||
<q-input square clearable v-model="password" type="password" label="Password">
|
||||
<template v-slot:prepend>
|
||||
<q-icon name="lock"/>
|
||||
</template>
|
||||
</q-input>
|
||||
</q-form>
|
||||
</q-card-section>
|
||||
<q-card-actions class="q-px-lg">
|
||||
<q-btn @click="registerUser" unelevated size="lg" class="full-width" label="Registrovat"/>
|
||||
</q-card-actions>
|
||||
<q-card-section class="text-center q-pa-sm">
|
||||
<router-link :to="{name: 'login'}" class="text-grey-6">Zpět na login</router-link>
|
||||
</q-card-section>
|
||||
</q-card>
|
||||
</q-page>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user