{{ photo.name }}
diff --git a/src/components/photos/PhotosEditorList.vue b/src/components/photos/PhotosEditorList.vue
index 4fc1344..d131a63 100644
--- a/src/components/photos/PhotosEditorList.vue
+++ b/src/components/photos/PhotosEditorList.vue
@@ -3,24 +3,29 @@ import {computed, onMounted, reactive, ref, watch} from "vue";
import {useQuasar} from "quasar";
import {confirmObject} from "src/composables/dialog";
-const $q = useQuasar();
-
-
const props = defineProps({
photos: {
type: Array
},
-});
-
-const batchEdit = ref({});
-
-onMounted(() => {
- for (const photo of props.photos) {
- batchEdit.value[photo.id] = false;
+ titlePhoto: {
+ type: Object,
+ },
+ showActions: {
+ type: Boolean,
+ required: false,
+ default: true
}
});
-const emits = defineEmits(["edit", "delete", "batch-edit", "batch-rotate"])
+const $q = useQuasar();
+
+
+const batchEdit = ref({});
+for (const photo of props.photos) {
+ batchEdit.value[photo.id] = false;
+}
+
+const emits = defineEmits(["edit", "delete", "set-title-photo", "batch-edit", "batch-rotate"])
const openEdit = (photo) => {
emits("edit", photo);
@@ -29,20 +34,20 @@ const openEdit = (photo) => {
const confirmPhotoDelete = (id) => {
$q.dialog(confirmObject("Opravdu chces smazat tuto fotku?"))
- .onOk(() => {
- emits("delete", id);
- });
+ .onOk(() => {
+ emits("delete", id);
+ });
}
const confirmBatchPhotoDelete = () => {
$q.dialog(confirmObject("Opravdu chces smazat vybrané fotky?"))
- .onOk(() => {
- for (const id in batchEdit.value) {
- if (!batchEdit.value[id]) continue;
- emits("delete", parseInt(id));
- batchEdit.value[id] = false;
- }
- });
+ .onOk(() => {
+ for (const id in batchEdit.value) {
+ if (!batchEdit.value[id]) continue;
+ emits("delete", parseInt(id));
+ batchEdit.value[id] = false;
+ }
+ });
}
const handleImageClick = (photo, idx) => {
@@ -108,6 +113,10 @@ const batchOptionsProps = computed(() => ({
class: "q-ml-lg",
disable: !isBatchEditAllowed.value
}));
+
+const setFlightCover = (titlePhoto) => {
+ emits("set-title-photo", titlePhoto);
+}
@@ -115,6 +124,15 @@ const batchOptionsProps = computed(() => ({
+
+
+
+
{{ photo.name }}
@@ -125,24 +143,26 @@ const batchOptionsProps = computed(() => ({
-
+
-
+
+
+
-
-
+
+
-
+
-
+
diff --git a/src/components/photos/TitlePhotoWithGallery.vue b/src/components/photos/TitlePhotoWithGallery.vue
new file mode 100644
index 0000000..a0413e5
--- /dev/null
+++ b/src/components/photos/TitlePhotoWithGallery.vue
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
diff --git a/src/css/quasar.variables.scss b/src/css/quasar.variables.scss
index 0c57e61..30a19c1 100644
--- a/src/css/quasar.variables.scss
+++ b/src/css/quasar.variables.scss
@@ -12,7 +12,7 @@
// to match your app's branding.
// Tip: Use the "Theme Builder" on Quasar's documentation website.
-$primary : #87c8ec; //#1976D2;
+$primary : #469ccc; //#1976D2;
$secondary : #26A69A;
$accent : #9C27B0;
diff --git a/src/graphql/fragments/aircraft.js b/src/graphql/fragments/aircraft.js
index 5ebd0d2..1c362f7 100644
--- a/src/graphql/fragments/aircraft.js
+++ b/src/graphql/fragments/aircraft.js
@@ -1,4 +1,6 @@
import gql from "graphql-tag";
+import {FRAGMENT_PHOTO_FULL_INFO} from "src/graphql/fragments/photo";
+import {FRAGMENT_FLIGHT_LIST_INFO} from "src/graphql/fragments/flight_list";
export const FRAGMENT_AIRCRAFT_FULL_INFO = gql`
fragment aircraftFullInfo on Aircraft {
@@ -7,9 +9,15 @@ fragment aircraftFullInfo on Aircraft {
model
description
manufacturer
- photoUrl
seats
+
createdById
+ isPublic
+
+ titlePhoto {
+ id
+ url
+ }
organization {
id
@@ -18,15 +26,24 @@ fragment aircraftFullInfo on Aircraft {
}
`;
-export const FRAGMENT_AIRCRAFT_BASIC_INFO = gql`
-fragment aircraftBasicInfo on Aircraft {
- id
- callSign
- manufacturer
+export const FRAGMENT_AIRCRAFT_FULL_PRIVATE_INFO = gql`
+fragment aircraftFullPrivateInfo on Aircraft {
+ ...aircraftFullInfo
+ photos {
+ ...photoFullInfo
- organization {
- id
- name
- }
+ copilots {
+ id
+ name
+ }
+ }
+
+ flights {
+ ...flightListInfo
+ }
}
+
+${FRAGMENT_AIRCRAFT_FULL_INFO}
+${FRAGMENT_PHOTO_FULL_INFO}
+${FRAGMENT_FLIGHT_LIST_INFO}
`;
diff --git a/src/graphql/fragments/aircraft_basic.js b/src/graphql/fragments/aircraft_basic.js
new file mode 100644
index 0000000..ec00e16
--- /dev/null
+++ b/src/graphql/fragments/aircraft_basic.js
@@ -0,0 +1,14 @@
+import gql from "graphql-tag";
+
+export const FRAGMENT_AIRCRAFT_BASIC_INFO = gql`
+fragment aircraftBasicInfo on Aircraft {
+ id
+ callSign
+ manufacturer
+
+ organization {
+ id
+ name
+ }
+}
+`;
diff --git a/src/graphql/fragments/copilot.js b/src/graphql/fragments/copilot.js
index 4d454b1..21bca89 100644
--- a/src/graphql/fragments/copilot.js
+++ b/src/graphql/fragments/copilot.js
@@ -11,5 +11,10 @@ export const FRAGMENT_COPILOT_FULL_INFO = gql`
fragment copilotFullInfo on Copilot {
id
name
+
+ titlePhoto {
+ id
+ url
+ }
}
`;
diff --git a/src/graphql/fragments/flight.js b/src/graphql/fragments/flight.js
index 2cde488..aec3731 100644
--- a/src/graphql/fragments/flight.js
+++ b/src/graphql/fragments/flight.js
@@ -28,15 +28,28 @@ fragment flightFullInfo on Flight {
durationMinCalculated
isPublic
- coverPhoto {
+ titlePhoto {
thumbnailUrl
url
+ id
}
takeoffAirport {
...airportInfo
}
+ landingAirport {
+ ...airportInfo
+ }
+
+ landingWeatherInfo {
+ ...weatherFullInfo
+ }
+
+ takeoffWeatherInfo {
+ ...weatherFullInfo
+ }
+
copilots {
id
name
@@ -73,30 +86,30 @@ fragment flightFullInfo on Flight {
landingDuration
}
- landingAirport {
- ...airportInfo
- }
-
- landingWeatherInfo {
- ...weatherFullInfo
- }
-
- takeoffWeatherInfo {
- ...weatherFullInfo
- }
-
aircraft {
...aircraftFullInfo
}
-
- photos {
- ...photoFullInfo
- }
}
-
-${FRAGMENT_PHOTO_FULL_INFO}
${FRAGMENT_AIRCRAFT_FULL_INFO}
${FRAGMENT_AIRPORT_INFO}
${FRAGMENT_POI_FULL_INFO}
${FRAGMENT_WEATHER_FULL_INFO}
`;
+
+
+export const FRAGMENT_FLIGHT_FULL_PRIVATE_INFO = gql`
+fragment flightFullPrivateInfo on Flight {
+ ...flightFullInfo
+ photos {
+ ...photoFullInfo
+
+ copilots {
+ id
+ name
+ }
+ }
+}
+
+${FRAGMENT_FLIGHT_FULL_INFO}
+${FRAGMENT_PHOTO_FULL_INFO}
+ `;
diff --git a/src/graphql/fragments/flight_list.js b/src/graphql/fragments/flight_list.js
index b0a03f4..2e5eb25 100644
--- a/src/graphql/fragments/flight_list.js
+++ b/src/graphql/fragments/flight_list.js
@@ -1,6 +1,6 @@
import gql from "graphql-tag";
import {FRAGMENT_AIRPORT_INFO} from "src/graphql/fragments/airport";
-import {FRAGMENT_AIRCRAFT_BASIC_INFO} from "src/graphql/fragments/aircraft";
+import {FRAGMENT_AIRCRAFT_BASIC_INFO} from "src/graphql/fragments/aircraft_basic";
export const FRAGMENT_FLIGHT_LIST_INFO = gql`
fragment flightListInfo on Flight {
@@ -11,13 +11,15 @@ fragment flightListInfo on Flight {
durationMinCalculated
isPublic
- coverPhoto {
+ titlePhoto {
thumbnailUrl
}
track {
pointOfInterest {
+ id
name
+ isPublic
}
airport {
icaoCode
diff --git a/src/graphql/fragments/organization.js b/src/graphql/fragments/organization.js
index edf2409..d83478b 100644
--- a/src/graphql/fragments/organization.js
+++ b/src/graphql/fragments/organization.js
@@ -1,5 +1,5 @@
import gql from "graphql-tag";
-import {FRAGMENT_AIRCRAFT_BASIC_INFO} from "src/graphql/fragments/aircraft";
+import {FRAGMENT_AIRCRAFT_BASIC_INFO} from "src/graphql/fragments/aircraft_basic";
export const FRAGMENT_ORGANIZATION_LIST_INFO = gql`
fragment organizationListInfo on Organization {
diff --git a/src/graphql/fragments/photo.js b/src/graphql/fragments/photo.js
index fbf2749..2c20bc0 100644
--- a/src/graphql/fragments/photo.js
+++ b/src/graphql/fragments/photo.js
@@ -9,10 +9,7 @@ export const FRAGMENT_PHOTO_FULL_INFO = gql`
name
description
flightId
- pointOfInterest {
- id
- name
- }
+ isAircraft
width
height
isFlightCover
@@ -21,4 +18,8 @@ export const FRAGMENT_PHOTO_FULL_INFO = gql`
gpsAltitude
terrainElevation
exposedAt
+ copilots {
+ id
+ name
+ }
}`;
diff --git a/src/graphql/fragments/poi.js b/src/graphql/fragments/poi.js
index ac8f1a6..ef7421d 100644
--- a/src/graphql/fragments/poi.js
+++ b/src/graphql/fragments/poi.js
@@ -1,6 +1,8 @@
import gql from "graphql-tag";
+import {FRAGMENT_PHOTO_FULL_INFO} from "src/graphql/fragments/photo";
import {FRAGMENT_FLIGHT_LIST_INFO} from "src/graphql/fragments/flight_list";
+
export const FRAGMENT_POI_LIST_INFO = gql`
fragment pointOfInterestListInfo on PointOfInterest {
id
@@ -22,20 +24,37 @@ fragment pointOfInterestFullInfo on PointOfInterest {
gpsLatitude
gpsLongitude
createdById
+
+ titlePhoto {
+ id
+ url
+ }
+
type {
id
name
}
- flights {
- ...flightListInfo
- }
- photos {
- thumbnailUrl
- url
- name
- description
- }
+}
+`;
+
+export const FRAGMENT_POI_FULL_PRIVATE_INFO = gql`
+fragment pointOfInterestFullPrivateInfo on PointOfInterest {
+ ...pointOfInterestFullInfo
+ flights {
+ ...flightListInfo
+ }
+
+ photos {
+ ...photoFullInfo
+
+ copilots {
+ id
+ name
+ }
+ }
}
+${FRAGMENT_POI_FULL_INFO}
+${FRAGMENT_PHOTO_FULL_INFO}
${FRAGMENT_FLIGHT_LIST_INFO}
`;
diff --git a/src/graphql/mutations/aircrafts.js b/src/graphql/mutations/aircrafts.js
index c33f0de..39b513f 100644
--- a/src/graphql/mutations/aircrafts.js
+++ b/src/graphql/mutations/aircrafts.js
@@ -1,24 +1,24 @@
import gql from "graphql-tag";
-import {FRAGMENT_AIRCRAFT_FULL_INFO} from "src/graphql/fragments/aircraft";
+import {FRAGMENT_AIRCRAFT_FULL_PRIVATE_INFO} from "src/graphql/fragments/aircraft";
export const CREATE_AIRCRAFT = gql`
mutation createAircraft($input: CreateAircraftInput!) {
createAircraft(input: $input) {
- ...aircraftFullInfo
+ ...aircraftFullPrivateInfo
}
}
- ${FRAGMENT_AIRCRAFT_FULL_INFO}
+ ${FRAGMENT_AIRCRAFT_FULL_PRIVATE_INFO}
`;
export const EDIT_AIRCRAFT = gql`
mutation editAircraft($id: Int!, $input: EditAircraftInput!) {
editAircraft(id: $id, input: $input) {
- ...aircraftFullInfo
+ ...aircraftFullPrivateInfo
}
}
- ${FRAGMENT_AIRCRAFT_FULL_INFO}
+ ${FRAGMENT_AIRCRAFT_FULL_PRIVATE_INFO}
`;
export const DELETE_AIRCRAFT = gql`
mutation deleteAircraft($id: Int!) {
diff --git a/src/graphql/mutations/flight.js b/src/graphql/mutations/flight.js
index b6425f7..d4d0ad6 100644
--- a/src/graphql/mutations/flight.js
+++ b/src/graphql/mutations/flight.js
@@ -1,23 +1,23 @@
import gql from "graphql-tag";
-import {FRAGMENT_FLIGHT_FULL_INFO} from "src/graphql/fragments/flight";
+import {FRAGMENT_FLIGHT_FULL_PRIVATE_INFO} from "src/graphql/fragments/flight";
export const CREATE_FLIGHT = gql`
mutation createFlight($input: CreateFlightInput!) {
createFlight(input: $input) {
- ...flightFullInfo
+ ...flightFullPrivateInfo
}
}
- ${FRAGMENT_FLIGHT_FULL_INFO}
+ ${FRAGMENT_FLIGHT_FULL_PRIVATE_INFO}
`;
export const EDIT_FLIGHT = gql`
mutation editFlight($id: Int!, $input: EditFlightInput!) {
editFlight(id: $id, input: $input) {
- ...flightFullInfo
+ ...flightFullPrivateInfo
}
}
- ${FRAGMENT_FLIGHT_FULL_INFO}
+ ${FRAGMENT_FLIGHT_FULL_PRIVATE_INFO}
`;
diff --git a/src/graphql/mutations/poi.js b/src/graphql/mutations/poi.js
index ab44170..887f534 100644
--- a/src/graphql/mutations/poi.js
+++ b/src/graphql/mutations/poi.js
@@ -1,22 +1,22 @@
import gql from "graphql-tag";
-import {FRAGMENT_POI_FULL_INFO, FRAGMENT_POI_LIST_INFO} from "src/graphql/fragments/poi";
+import {FRAGMENT_POI_FULL_PRIVATE_INFO} from "src/graphql/fragments/poi";
export const CREATE_POI = gql`
mutation createPointOfInterest($input: CreatePointOfInterestInput!) {
createPointOfInterest(input: $input) {
- ...pointOfInterestFullInfo
+ ...pointOfInterestFullPrivateInfo
}
}
- ${FRAGMENT_POI_FULL_INFO}
+ ${FRAGMENT_POI_FULL_PRIVATE_INFO}
`;
export const EDIT_POI = gql`
mutation editPointOfInterest($id: Int!, $input: EditPointOfInterestInput!) {
editPointOfInterest(id: $id, input: $input) {
- ...pointOfInterestFullInfo
+ ...pointOfInterestFullPrivateInfo
}
}
- ${FRAGMENT_POI_FULL_INFO}
+ ${FRAGMENT_POI_FULL_PRIVATE_INFO}
`;
diff --git a/src/graphql/queries/aircrafts.js b/src/graphql/queries/aircrafts.js
index fa5553a..9416347 100644
--- a/src/graphql/queries/aircrafts.js
+++ b/src/graphql/queries/aircrafts.js
@@ -1,6 +1,5 @@
import gql from "graphql-tag";
-import {FRAGMENT_AIRCRAFT_FULL_INFO} from "src/graphql/fragments/aircraft";
-import {FRAGMENT_FLIGHT_LIST_INFO} from "src/graphql/fragments/flight_list";
+import {FRAGMENT_AIRCRAFT_FULL_INFO, FRAGMENT_AIRCRAFT_FULL_PRIVATE_INFO} from "src/graphql/fragments/aircraft";
export const AIRCRAFTS_LIST = gql`
query AircraftsList {
@@ -16,14 +15,17 @@ ${FRAGMENT_AIRCRAFT_FULL_INFO}
export const AIRCRAFT_DETAIL = gql`
query AircraftDetail($id: Int!) {
aircraft(id: $id) {
+ ...aircraftFullPrivateInfo
+ }
+}
+${FRAGMENT_AIRCRAFT_FULL_PRIVATE_INFO}
+`;
+
+export const AIRCRAFT_PUBLIC_DETAIL = gql`
+query AircraftDetail($id: Int!) {
+ aircraft(id: $id, public: true) {
...aircraftFullInfo
-
- flights {
- ...flightListInfo
- }
-
}
}
${FRAGMENT_AIRCRAFT_FULL_INFO}
-${FRAGMENT_FLIGHT_LIST_INFO}
`;
diff --git a/src/graphql/queries/copilots.js b/src/graphql/queries/copilots.js
index 517fd3a..29b1e4b 100644
--- a/src/graphql/queries/copilots.js
+++ b/src/graphql/queries/copilots.js
@@ -1,6 +1,7 @@
import gql from "graphql-tag";
import {FRAGMENT_FLIGHT_LIST_INFO} from "src/graphql/fragments/flight_list";
import {FRAGMENT_COPILOT_FULL_INFO, FRAGMENT_COPILOT_LIST_INFO} from "src/graphql/fragments/copilot";
+import {FRAGMENT_PHOTO_FULL_INFO} from "src/graphql/fragments/photo";
export const COPILOTS_LIST = gql`
query copilotsList {
@@ -17,12 +18,27 @@ query copilot($id: Int!, $pilotUsername: String) {
copilot(id: $id, pilotUsername: $pilotUsername) {
...copilotFullInfo
+ photos {
+ ...photoFullInfo
+ }
+
flights {
...flightListInfo
}
}
}
+${FRAGMENT_PHOTO_FULL_INFO}
${FRAGMENT_COPILOT_FULL_INFO}
${FRAGMENT_FLIGHT_LIST_INFO}
`;
+
+export const COPILOT_PUBLIC_DETAIL = gql`
+query copilot($id: Int!, $pilotUsername: String) {
+ copilot(id: $id, pilotUsername: $pilotUsername) {
+ ...copilotFullInfo
+ }
+}
+
+${FRAGMENT_COPILOT_FULL_INFO}
+`;
diff --git a/src/graphql/queries/event.js b/src/graphql/queries/event.js
index 6ecddee..b0dfd63 100644
--- a/src/graphql/queries/event.js
+++ b/src/graphql/queries/event.js
@@ -8,7 +8,7 @@ query eventsList($username: String) {
...eventListInfo
flights {
- coverPhoto {
+ titlePhoto {
thumbnailUrl
}
}
diff --git a/src/graphql/queries/flights.js b/src/graphql/queries/flights.js
index 8c9489c..66ff632 100644
--- a/src/graphql/queries/flights.js
+++ b/src/graphql/queries/flights.js
@@ -1,19 +1,44 @@
import gql from "graphql-tag";
-import {FRAGMENT_FLIGHT_FULL_INFO} from "src/graphql/fragments/flight";
+import {FRAGMENT_FLIGHT_FULL_INFO, FRAGMENT_FLIGHT_FULL_PRIVATE_INFO} from "src/graphql/fragments/flight";
import {FRAGMENT_FLIGHT_LIST_INFO} from "src/graphql/fragments/flight_list";
+import {FRAGMENT_PHOTO_FULL_INFO} from "src/graphql/fragments/photo";
export const FLIGHTS_LIST = gql`
-query FlightsList($username: String) {
- flights(username: $username) {
+query FlightsList {
+ flights {
...flightListInfo
}
}
${FRAGMENT_FLIGHT_LIST_INFO}
`;
+export const FLIGHTS_PUBLIC_LIST = gql`
+query FlightsPublicList($username: String, $aircraftId: Int, $copilotId: Int, $pointOfInterestId: Int) {
+ flights(username: $username, aircraftId: $aircraftId, copilotId: $copilotId, pointOfInterestId: $pointOfInterestId, public: true) {
+ ...flightListInfo
+
+ pilot {
+ id
+ publicUsername
+ }
+ }
+}
+${FRAGMENT_FLIGHT_LIST_INFO}
+`;
+
export const FLIGHT_DETAIL = gql`
query FlightDetail($id: Int!, $username: String) {
flight(id: $id, username: $username) {
+ ...flightFullPrivateInfo
+ }
+}
+
+${FRAGMENT_FLIGHT_FULL_PRIVATE_INFO}
+`;
+
+export const FLIGHT_PUBLIC_DETAIL = gql`
+query FlightPublicDetail($id: Int!, $username: String) {
+ flight(id: $id, username: $username, public: true) {
...flightFullInfo
}
}
diff --git a/src/graphql/queries/photo.js b/src/graphql/queries/photo.js
index df51a9d..c43a9f4 100644
--- a/src/graphql/queries/photo.js
+++ b/src/graphql/queries/photo.js
@@ -7,6 +7,15 @@ query photo($id: Int!) {
photo(id: $id) {
...photoFullInfo
+ pointOfInterest {
+ id
+ name
+ }
+ copilots {
+ id
+ name
+ }
+
adjustment {
contrast
saturation
@@ -28,3 +37,14 @@ query photo($id: Int!) {
${FRAGMENT_PHOTO_FULL_INFO}
${FRAGMENT_FLIGHT_LIST_INFO}
`;
+
+export const PHOTOS_PUBLIC_LIST = gql`
+query photos($flightId: Int, $pointOfInterestId: Int, $aircraftId: Int, $copilotId: Int) {
+ photos(public: true, flightId: $flightId, pointOfInterestId: $pointOfInterestId, aircraftId: $aircraftId, copilotId: $copilotId) {
+ ...photoFullInfo
+ }
+}
+
+${FRAGMENT_PHOTO_FULL_INFO}
+`;
+
diff --git a/src/graphql/queries/poi.js b/src/graphql/queries/poi.js
index 0e943c8..d0ebfd0 100644
--- a/src/graphql/queries/poi.js
+++ b/src/graphql/queries/poi.js
@@ -1,5 +1,5 @@
import gql from "graphql-tag";
-import {FRAGMENT_POI_FULL_INFO, FRAGMENT_POI_LIST_INFO} from "src/graphql/fragments/poi";
+import {FRAGMENT_POI_FULL_INFO, FRAGMENT_POI_FULL_PRIVATE_INFO, FRAGMENT_POI_LIST_INFO} from "src/graphql/fragments/poi";
export const POI_LIST = gql`
query poiList {
@@ -11,9 +11,29 @@ query poiList {
${FRAGMENT_POI_LIST_INFO}
`;
+export const POI_PUBLIC_LIST = gql`
+query poiList {
+ pointsOfInterest(public: true) {
+ ...pointOfInterestListInfo
+ }
+}
+
+${FRAGMENT_POI_LIST_INFO}
+`;
+
export const POI_DETAIL = gql`
query poiDetail($id: Int!) {
pointOfInterest(id: $id) {
+ ...pointOfInterestFullPrivateInfo
+ }
+}
+
+${FRAGMENT_POI_FULL_PRIVATE_INFO}
+`;
+
+export const POI_PUBLIC_DETAIL = gql`
+query poiDetail($id: Int!) {
+ pointOfInterest(id: $id, public: true) {
...pointOfInterestFullInfo
}
}
diff --git a/src/layouts/ProfileLayout.vue b/src/layouts/ProfileLayout.vue
index c99d30e..49eda5c 100644
--- a/src/layouts/ProfileLayout.vue
+++ b/src/layouts/ProfileLayout.vue
@@ -48,11 +48,12 @@ import {useUserStore} from "stores/User";
import {storeToRefs} from "pinia";
import BreadcrumbsNavigation from "components/navigation/BreadcrumbsNavigation.vue";
import {useAppStore} from "stores/App";
-import {useQuasar} from "quasar";
+import {useMeta, useQuasar} from "quasar";
import {useRouter} from "vue-router";
import {successObject} from "src/composables/dialog";
import SidebarNavigation from "components/navigation/SidebarNavigation.vue";
import TopMenuButton from "components/navigation/TopMenuButton.vue";
+import {metaData} from "src/composables/meta";
const $q = useQuasar();
const $router = useRouter();
@@ -69,6 +70,10 @@ onMounted(() => {
})
const {isQueryRunning, user} = storeToRefs(useUserStore());
+useMeta(() => metaData({
+ title: pageTitle.value
+}));
+
const logout = () => {
useUserStore().logout().then(() => {
$q.notify(successObject("Odhlášení bylo úspěšné"));
diff --git a/src/pages/profile/aircraft/AircraftDetailPage.vue b/src/pages/profile/aircraft/AircraftDetailPage.vue
index 38aa8d0..3e7536c 100644
--- a/src/pages/profile/aircraft/AircraftDetailPage.vue
+++ b/src/pages/profile/aircraft/AircraftDetailPage.vue
@@ -1,28 +1,33 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+ Lety
+
+ Zatím žádné lety.
+
+
+
+
+
-
- Lety
-
- Zatím žádné lety.
-
-
-
diff --git a/src/pages/profile/aircraft/EditAircraftPage.vue b/src/pages/profile/aircraft/EditAircraftPage.vue
index e5e70f3..7dfbebb 100644
--- a/src/pages/profile/aircraft/EditAircraftPage.vue
+++ b/src/pages/profile/aircraft/EditAircraftPage.vue
@@ -3,13 +3,17 @@ import AircraftForm from "components/aircrafts/AircraftForm.vue";
import {useAircraftsStore} from "stores/Aircrafts";
import {useRoute, useRouter} from "vue-router";
import {useQuasar} from "quasar";
-import {onMounted} from "vue";
+import {computed, onMounted} from "vue";
import AircraftEditSkeleton from "components/aircrafts/AircraftEditSkeleton.vue";
import {successObject} from "src/composables/dialog";
import {useAppStore} from "stores/App";
import AccessDeniedBanner from "components/banners/AccessDeniedBanner.vue";
import {storeToRefs} from "pinia";
import {useUserStore} from "stores/User";
+import POIForm from "components/poi/POIForm.vue";
+import POIEditSkeleton from "components/poi/POIEditSkeleton.vue";
+import PhotosEditorList from "components/photos/PhotosEditorList.vue";
+import {usePointsOfInterestStore} from "stores/PointsOfInterest";
const $router = useRouter();
@@ -36,25 +40,64 @@ onMounted(() => {
});
});
+const setTitlePhoto = (titlePhoto) => {
+ useAircraftsStore().update(aircraftId, {titlePhotoId: titlePhoto.id}).then(() => {
+ $q.notify(successObject("Úvodní fotka nastavena"));
+ })
+}
+
+const formStep = computed(() => useRoute().params.step || "basic");
-
-
-
-
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/pages/profile/copilot/CopilotDetailPage.vue b/src/pages/profile/copilot/CopilotDetailPage.vue
index 8ac73ee..d4dd692 100644
--- a/src/pages/profile/copilot/CopilotDetailPage.vue
+++ b/src/pages/profile/copilot/CopilotDetailPage.vue
@@ -1,12 +1,15 @@
- Společné lety
-
- Zatím tu nemáš uložené žádné společné lety.
-
+
+
+
+
+
+
+
+
+
+
+ Zatím tu nemáš žádné společné fotky. Po nahrání fotky můžeš označit tuto osobu a takto označené
+ fotografie se zobrazí v galerii.
+
-
+ Společné lety
+
+
+ Zatím tu nemáš uložené žádné společné lety.
+
+
+
+
+
+
+
-
diff --git a/src/pages/profile/event/EventDetailPage.vue b/src/pages/profile/event/EventDetailPage.vue
index 240e6b0..02f353d 100644
--- a/src/pages/profile/event/EventDetailPage.vue
+++ b/src/pages/profile/event/EventDetailPage.vue
@@ -49,7 +49,7 @@ const {isQueryRunning, event} = storeToRefs(useEventsStore());
Zatím tu nemáš uložené žádné lety.
-
+
diff --git a/src/pages/profile/flight/EditFlightPage.vue b/src/pages/profile/flight/EditFlightPage.vue
index 4e71349..d3d21a2 100644
--- a/src/pages/profile/flight/EditFlightPage.vue
+++ b/src/pages/profile/flight/EditFlightPage.vue
@@ -1,6 +1,6 @@
@@ -203,11 +212,11 @@ const handleBatchPhotoEdit = async (flightId, data) => {
@@ -217,43 +226,50 @@ const handleBatchPhotoEdit = async (flightId, data) => {
-
diff --git a/src/pages/profile/flight/FlightDetailPage.vue b/src/pages/profile/flight/FlightDetailPage.vue
index ec8627c..50f9c25 100644
--- a/src/pages/profile/flight/FlightDetailPage.vue
+++ b/src/pages/profile/flight/FlightDetailPage.vue
@@ -13,13 +13,15 @@ import {useUserStore} from "stores/User";
import {storeToRefs} from "pinia";
import BasicInfoBanner from "components/banners/BasicInfoBanner.vue";
import PhotoGallery from "components/photos/PhotoGallery.vue";
+import TitlePhotoWithGallery from "components/photos/TitlePhotoWithGallery.vue";
+import ContentCard from "components/ContentCard.vue";
const $q = useQuasar();
const $router = useRouter();
const flightId = parseInt(useRoute().params.id);
const loggedUser = storeToRefs(useUserStore()).user;
-onMounted(() => {flight.value
+onMounted(() => {
useFlightsStore().fetchDetail(flightId).then(f => {
const flightNameFormatted = flightName(f);
useAppStore().setPageTitle(flightNameFormatted);
@@ -40,7 +42,6 @@ const handleDeleteAndRedirect = () => {
});
}
-
const togglePublicVisibility = () => {
const newVisibility = !flight.value.isPublic;
useFlightsStore()
@@ -67,19 +68,14 @@ const {isQueryRunning, flight} = storeToRefs(useFlightsStore());
-
-
-
-
{{ flightName(flight) }}
-
-
+
-
+
@@ -93,53 +89,58 @@ const {isQueryRunning, flight} = storeToRefs(useFlightsStore());
/>
-
+
-
-
- Upravit informace
-
-
+
+
+
+ Upravit informace
+
+
-
- Upravit text
-
-
+
+ Upravit text
+
+
-
+
-
- Upravit fotky
-
-
- U tohoto letu nemáš nahrané žádné fotografie.
-
-
+
+ Upravit fotky
+
+
+ U tohoto letu nemáš nahrané žádné fotografie.
+
+
-
+
+
+
+ Upravit trasu
+
+
+ Nemáš nastavenou žádnou trasu.
+
+
+
+
+
-
- Upravit trasu
-
-
- Nemáš nastavenou žádnou trasu.
-
-
-
-
diff --git a/src/pages/profile/flight/FlightsPage.vue b/src/pages/profile/flight/FlightsPage.vue
index c5b4a60..c981c6e 100644
--- a/src/pages/profile/flight/FlightsPage.vue
+++ b/src/pages/profile/flight/FlightsPage.vue
@@ -32,7 +32,7 @@ const {flights, isQueryRunning} = storeToRefs(useFlightsStore());
Nemáš zaznamenaný žádný let.
-
+
diff --git a/src/pages/profile/flight/PhotoEditorPage.vue b/src/pages/profile/flight/PhotoEditorPage.vue
index 4268ca0..4f530f9 100644
--- a/src/pages/profile/flight/PhotoEditorPage.vue
+++ b/src/pages/profile/flight/PhotoEditorPage.vue
@@ -1,7 +1,7 @@
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/pages/profile/poi/PointOfInterestDetailPage.vue b/src/pages/profile/poi/PointOfInterestDetailPage.vue
index 834fda1..22dfcc0 100644
--- a/src/pages/profile/poi/PointOfInterestDetailPage.vue
+++ b/src/pages/profile/poi/PointOfInterestDetailPage.vue
@@ -1,5 +1,5 @@
-
-
-
- Tento bod nemá nastavenou polohu. Po nastavení polohy tu bude zobrazena mapa.
-
+
+
+
+
+
+
-
+
+
+
-
- Pokud přidáš toto místo k nějaké fotce, zobrazí se tu.
-
+
+
+ Tento bod nemá nastavenou polohu. Po nastavení polohy tu bude zobrazena mapa.
+
-
+
+
+ Pokud přidáš toto místo k nějaké fotce, zobrazí se tu.
+
-
+
+
+
+
-
diff --git a/src/pages/public/AircraftDetailPage.vue b/src/pages/public/AircraftDetailPage.vue
new file mode 100644
index 0000000..f902a68
--- /dev/null
+++ b/src/pages/public/AircraftDetailPage.vue
@@ -0,0 +1,72 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Lety
+
+
+
+
+
+
+
+
+
+
diff --git a/src/pages/public/PilotProfilePage.vue b/src/pages/public/PilotProfilePage.vue
index a4a5669..f143ca5 100644
--- a/src/pages/public/PilotProfilePage.vue
+++ b/src/pages/public/PilotProfilePage.vue
@@ -2,8 +2,8 @@
import {useUserStore} from "stores/User";
export default {
- preFetch({currentRoute}) {
- return useUserStore().fetchPublicUserDetail(currentRoute.params.username);
+ preFetch({store, currentRoute}) {
+ return useUserStore(store).fetchPublicUserDetail(currentRoute.params.username);
},
}
diff --git a/src/pages/public/PointOfInterestDetailPage.vue b/src/pages/public/PointOfInterestDetailPage.vue
new file mode 100644
index 0000000..35b3f4c
--- /dev/null
+++ b/src/pages/public/PointOfInterestDetailPage.vue
@@ -0,0 +1,64 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Lety
+
+
+
+
+
+
diff --git a/src/pages/public/PointsOfInterestMapPage.vue b/src/pages/public/PointsOfInterestMapPage.vue
new file mode 100644
index 0000000..c92a483
--- /dev/null
+++ b/src/pages/public/PointsOfInterestMapPage.vue
@@ -0,0 +1,7 @@
+
+
+
+ poi
+
diff --git a/src/pages/public/pilotProfile/CopilotDetailPage.vue b/src/pages/public/pilotProfile/CopilotDetailPage.vue
index e385dac..f3eeaa2 100644
--- a/src/pages/public/pilotProfile/CopilotDetailPage.vue
+++ b/src/pages/public/pilotProfile/CopilotDetailPage.vue
@@ -2,8 +2,8 @@
import {useCopilotsStore} from "stores/Copilots";
export default {
- preFetch({currentRoute}) {
- return useCopilotsStore().fetchDetail(currentRoute.params.id, currentRoute.params.username);
+ preFetch({store, currentRoute}) {
+ return useCopilotsStore(store).fetchPublicDetail(currentRoute.params.id, currentRoute.params.username);
}
}
@@ -13,6 +13,14 @@ import FlightsList from "components/flights/FlightsList.vue";
import {useAppStore} from "stores/App";
import BasicListSkeleton from "components/basicSkeletons/BasicListSkeleton.vue";
import {storeToRefs} from "pinia";
+import {onMounted} from "vue";
+import {useFlightsStore} from "stores/Flights";
+import {usePhotosStore} from "stores/Photos";
+import FlightsListSkeleton from "components/flights/FlightsListSkeleton.vue";
+import ContentCard from "components/ContentCard.vue";
+import PhotoGallery from "components/photos/PhotoGallery.vue";
+import {useMeta} from "quasar";
+import {metaData} from "src/composables/meta";
const props = defineProps({
pilot: {
@@ -22,25 +30,47 @@ const props = defineProps({
});
const {copilot, isQueryRunning} = storeToRefs(useCopilotsStore());
+const {flights, isQueryRunning: areFlightsLoading} = storeToRefs(useFlightsStore());
+const {photos, isQueryRunning: arePhotosLoading} = storeToRefs(usePhotosStore());
-useAppStore().setPageTitle(`${pilot.name} + ${copilot.value.name}`);
+useAppStore().setPageTitle(`${props.pilot.name} + ${copilot.value.name}`);
useAppStore().setBreadcrumbs([
{to: {name: 'homepage'}, label: "Polétání.cz"},
- {to: {name: "publicProfileDetail", params: {username: props.username}}, label: `@${props.username}`},
- {label: props.pilot.name}
+ {to: {name: "publicProfileDetail", params: {username: props.pilot.publicUsername}}, label: `@${props.pilot.publicUsername}`},
+ {label: copilot.value.name}
]);
+useMeta(() => metaData({
+ title: copilot.value.name,
+ keywords: ["kopilot", "výlet", "fotogalerie", copilot.value.name, "létání", "fotografie"],
+ description: `Společné polétání: ${props.pilot.name} + ${copilot.value.name}.`,
+ image: copilot.value.titleImage?.url
+}));
+
+useFlightsStore().fetchPublic({copilotId: copilot.value.id});
+usePhotosStore().fetchPublic({copilotId: copilot.value.id})
-
-
- Společné lety
-
-
+
+
+
+
+
+
+
+ Společné lety
+
+
+
+
+
+
+
diff --git a/src/pages/public/pilotProfile/EventDetailPage.vue b/src/pages/public/pilotProfile/EventDetailPage.vue
index d26dc65..6fb457b 100644
--- a/src/pages/public/pilotProfile/EventDetailPage.vue
+++ b/src/pages/public/pilotProfile/EventDetailPage.vue
@@ -66,8 +66,8 @@ watch(() => event.value, (newVal) => {
diff --git a/src/pages/public/pilotProfile/FlightDetailPage.vue b/src/pages/public/pilotProfile/FlightDetailPage.vue
index 32fe9fa..d925187 100644
--- a/src/pages/public/pilotProfile/FlightDetailPage.vue
+++ b/src/pages/public/pilotProfile/FlightDetailPage.vue
@@ -2,8 +2,8 @@
import {useFlightsStore} from "stores/Flights";
export default {
- preFetch({currentRoute}) {
- return useFlightsStore().fetchDetail(currentRoute.params.id, currentRoute.params.username)
+ preFetch({store, currentRoute}) {
+ return useFlightsStore(store).fetchPublicDetail(currentRoute.params.id, currentRoute.params.username)
}
}
@@ -19,12 +19,18 @@ import {useRoute} from "vue-router";
import {useUserStore} from "stores/User";
import {useMeta} from "quasar";
import {metaData} from "src/composables/meta";
+import ContentCard from "components/ContentCard.vue";
+import {usePhotosStore} from "stores/Photos";
+import {onMounted} from "vue";
const {isQueryRunning, flight} = storeToRefs(useFlightsStore());
const routeParams = useRoute().params;
const pilot = storeToRefs(useUserStore()).publicUser;
+usePhotosStore().fetchPublic({flightId: flight.value.id});
+const {isQueryRunning: arePhotosLoading, photos: flightPhotos} = storeToRefs(usePhotosStore());
+
const flightNameFormatted = flightName(flight.value);
useAppStore().setPageTitle(flightNameFormatted);
useAppStore().setBreadcrumbs([
@@ -37,40 +43,35 @@ useMeta(() => metaData({
title: `${flightNameFormatted} - ${pilot.value.name}`,
keywords: ["let", "výlet", "letadlo", pilot.value.name, flight.value.aircraft.callSign],
description: flight.description,
- image: flight.coverPhoto?.url
+ image: flight.titlePhoto?.url
}
-))
+));
-
-
- Pozor! Tento let není publikován a nebude tak dostupný pro ostatní!
-
-
-
-
-
-
{{ flightName(flight) }}
-
-
-
+
+
-
+
+
+
+
-
+
-
-
+
+
diff --git a/src/pages/public/pilotProfile/FlightsListPage.vue b/src/pages/public/pilotProfile/FlightsListPage.vue
index 19c9574..7b6ac8e 100644
--- a/src/pages/public/pilotProfile/FlightsListPage.vue
+++ b/src/pages/public/pilotProfile/FlightsListPage.vue
@@ -29,7 +29,7 @@ useAppStore().setBreadcrumbs([
{label: `@${props.pilot.publicUsername}`},
])
-useFlightsStore().fetch(props.pilot.publicUsername);
+useFlightsStore().fetchPublic({username: props.pilot.publicUsername});
const {flights, isQueryRunning: areFlightsLoading} = storeToRefs(useFlightsStore());
const loggedUser = storeToRefs(useUserStore()).user;
@@ -37,7 +37,7 @@ const loggedUser = storeToRefs(useUserStore()).user;
-
+
Tento pilot zatím nepublikoval žádný let.
@@ -46,8 +46,7 @@ const loggedUser = storeToRefs(useUserStore()).user;
diff --git a/src/router/routes.js b/src/router/routes.js
index 0156520..fb68769 100644
--- a/src/router/routes.js
+++ b/src/router/routes.js
@@ -23,6 +23,9 @@ const routes = [
{path: 'udalosti/:id', name: "publicEventDetail", component: () => import('pages/public/pilotProfile/EventDetailPage.vue')},
]
},
+ {path: 'letadlo/:id', name: "publicAircraftDetail", component: () => import('pages/public/AircraftDetailPage.vue')},
+ {path: 'mista', name: "publicPOIs", component: () => import('pages/public/PointsOfInterestMapPage.vue')},
+ {path: 'mista/:id', name: "publicPOIDetail", component: () => import('pages/public/PointOfInterestDetailPage.vue')},
]
},
@@ -41,7 +44,7 @@ const routes = [
{path: 'poi', name: "poi", component: () => import('pages/profile/poi/PointsOfInterestPage.vue')},
{path: 'poi/novy', name: "addPOI", component: () => import('pages/profile/poi/NewPointOfInterestPage.vue')},
{path: 'poi/:id', name: "poiDetail", component: () => import('pages/profile/poi/PointOfInterestDetailPage.vue')},
- {path: 'poi/:id/edit', name: "poiEdit", component: () => import('pages/profile/poi/EditPointOfInterestPage.vue')},
+ {path: 'poi/:id/edit/:step?', name: "poiEdit", component: () => import('pages/profile/poi/EditPointOfInterestPage.vue')},
{path: 'kopiloti', name: "copilots", component: () => import('pages/profile/copilot/CopilotsPage.vue')},
{path: 'kopiloti/novy', name: "addCopilot", component: () => import('pages/profile/copilot/NewCopilotPage.vue')},
{path: 'kopiloti/:id', name: "copilotDetail", component: () => import('pages/profile/copilot/CopilotDetailPage.vue')},
@@ -49,7 +52,7 @@ const routes = [
{path: 'letadla', name: "aircrafts", component: () => import('pages/profile/aircraft/AircraftsPage.vue')},
{path: 'letadla/nove', name: "addAircraft", component: () => import('pages/profile/aircraft/NewAircraftsPage.vue')},
{path: 'letadla/:id', name: "aircraftDetail", component: () => import('pages/profile/aircraft/AircraftDetailPage.vue')},
- {path: 'letadla/:id/edit', name: "aircraftEdit", component: () => import('pages/profile/aircraft/EditAircraftPage.vue')},
+ {path: 'letadla/:id/edit/:step?', name: "aircraftEdit", component: () => import('pages/profile/aircraft/EditAircraftPage.vue')},
{path: 'foto-editor/:id', name: "photoEditor", component: () => import("pages/profile/flight/PhotoEditorPage.vue")},
diff --git a/src/stores/Aircrafts.js b/src/stores/Aircrafts.js
index e57c2d1..77fb913 100644
--- a/src/stores/Aircrafts.js
+++ b/src/stores/Aircrafts.js
@@ -1,6 +1,6 @@
import {defineStore} from "pinia";
import {ref} from "vue";
-import {AIRCRAFT_DETAIL, AIRCRAFTS_LIST} from "src/graphql/queries/aircrafts";
+import {AIRCRAFT_DETAIL, AIRCRAFT_PUBLIC_DETAIL, AIRCRAFTS_LIST} from "src/graphql/queries/aircrafts";
import {deleteFromItems, mutate, query, updateInItems} from "stores/helpers";
import {CREATE_AIRCRAFT, EDIT_AIRCRAFT, DELETE_AIRCRAFT} from "src/graphql/mutations/aircrafts";
@@ -18,6 +18,14 @@ export const useAircraftsStore = defineStore('Aircrafts', () => {
}).then(item => aircraft.value = item);
};
+ const fetchPublicDetail = (id) => {
+ return query({
+ isQueryRunning,
+ query: AIRCRAFT_PUBLIC_DETAIL,
+ variables: {id, public: true},
+ }).then(item => aircraft.value = item);
+ };
+
const fetch = () => {
return query({
isQueryRunning,
@@ -38,7 +46,10 @@ export const useAircraftsStore = defineStore('Aircrafts', () => {
isMutationRunning,
mutation: EDIT_AIRCRAFT,
variables: {id, input}
- }).then(item => updateInItems(aircrafts.value, 'id', item))
+ }).then(item => {
+ updateInItems(aircrafts.value, 'id', item);
+ aircraft.value = item;
+ })
}
const destroy = (id) => {
@@ -51,7 +62,7 @@ export const useAircraftsStore = defineStore('Aircrafts', () => {
return {
aircrafts, aircraft, isQueryRunning, isMutationRunning, fetchDetail, fetch, create,
- update, destroy
+ update, destroy, fetchPublicDetail
}
}
);
diff --git a/src/stores/Copilots.js b/src/stores/Copilots.js
index eda45fa..82d139d 100644
--- a/src/stores/Copilots.js
+++ b/src/stores/Copilots.js
@@ -1,5 +1,5 @@
import {defineStore} from 'pinia'
-import {COPILOT_DETAIL, COPILOTS_LIST} from "src/graphql/queries/copilots";
+import {COPILOT_DETAIL, COPILOT_PUBLIC_DETAIL, COPILOTS_LIST} from "src/graphql/queries/copilots";
import {CREATE_COPILOT, EDIT_COPILOT} from "src/graphql/mutations/copilot";
import {mutate, query, updateInItems} from "stores/helpers";
import {ref} from "vue";
@@ -18,6 +18,14 @@ export const useCopilotsStore = defineStore('Copilots', () => {
}).then(item => copilot.value = item);
};
+ const fetchPublicDetail = (id, username) => {
+ return query({
+ isQueryRunning,
+ query: COPILOT_PUBLIC_DETAIL,
+ variables: {id, pilotUsername: username},
+ }).then(item => copilot.value = item);
+ };
+
const fetch = () => {
return query({
isQueryRunning,
@@ -43,6 +51,6 @@ export const useCopilotsStore = defineStore('Copilots', () => {
return {
copilot, copilots, isMutationRunning, isQueryRunning,
- fetch, fetchDetail, create, update
+ fetch, fetchDetail, create, update, fetchPublicDetail
}
})
diff --git a/src/stores/Flights.js b/src/stores/Flights.js
index c606d14..53e2a0b 100644
--- a/src/stores/Flights.js
+++ b/src/stores/Flights.js
@@ -1,5 +1,5 @@
import {defineStore} from 'pinia'
-import {FLIGHT_DETAIL, FLIGHTS_LIST} from "src/graphql/queries/flights";
+import {FLIGHT_DETAIL, FLIGHT_PUBLIC_DETAIL, FLIGHTS_LIST, FLIGHTS_PUBLIC_LIST} from "src/graphql/queries/flights";
import {EDIT_FLIGHT, CREATE_FLIGHT, DELETE_FLIGHT} from "src/graphql/mutations/flight";
import {deleteFromItems, mutate, query, updateInItems} from "stores/helpers";
import {ref} from "vue";
@@ -10,54 +10,56 @@ export const useFlightsStore = defineStore('Flights', () => {
const isMutationRunning = ref(false);
const isQueryRunning = ref(false);
- const fetchDetail = (id, username) => {
- return query({
- isQueryRunning,
- query: FLIGHT_DETAIL,
- variables: {username, id},
- }).then(item => flight.value = item);
- };
+ const fetchDetail = (id, username) => query({
+ isQueryRunning,
+ query: FLIGHT_DETAIL,
+ variables: {username, id},
+ }).then(item => flight.value = item);
- const fetch = (username = undefined) => {
- return query({
- isQueryRunning,
- query: FLIGHTS_LIST,
- variables: {username}
- }).then(items => flights.value = items);
- }
+ const fetchPublicDetail = (id, username) => query({
+ isQueryRunning,
+ query: FLIGHT_PUBLIC_DETAIL,
+ variables: {username, id}
+ }).then(item => flight.value = item);
+ const fetch = (username = undefined) => query({
+ isQueryRunning,
+ query: FLIGHTS_LIST,
+ variables: {username}
+ }).then(items => flights.value = items);
- const create = (input) => {
- return mutate({
- isMutationRunning,
- mutation: CREATE_FLIGHT,
- variables: {input},
- }).then(item => {
- flights.value.push(item);
- return item;
- })
- }
+ const fetchPublic = ({username, aircraftId, copilotId, pointOfInterestId}) => query({
+ isQueryRunning,
+ query: FLIGHTS_PUBLIC_LIST,
+ variables: {username, aircraftId, copilotId, pointOfInterestId}
+ }).then(items => flights.value = items);
- const update = (id, input) => {
- return mutate({
- isMutationRunning,
- mutation: EDIT_FLIGHT,
- variables: {id, input}
- }).then(item => {
- updateInItems(flights.value, 'id', item);
- flight.value = item;
- })
- }
+ const create = (input) => mutate({
+ isMutationRunning,
+ mutation: CREATE_FLIGHT,
+ variables: {input},
+ }).then(item => {
+ flights.value.push(item);
+ return item;
+ })
- const destroy = (id) => {
- return mutate({
- isMutationRunning,
- mutation: DELETE_FLIGHT,
- variables: {id}
- }).then(item => deleteFromItems(flights.value, 'id', item))
- }
+ const update = (id, input) => mutate({
+ isMutationRunning,
+ mutation: EDIT_FLIGHT,
+ variables: {id, input}
+ }).then(item => {
+ updateInItems(flights.value, 'id', item);
+ flight.value = item;
+ })
+
+ const destroy = (id) => mutate({
+ isMutationRunning,
+ mutation: DELETE_FLIGHT,
+ variables: {id}
+ }).then(item => deleteFromItems(flights.value, 'id', item))
return {
- flight, flights, isMutationRunning, isQueryRunning, fetchDetail, fetch, create, update, destroy
+ flight, flights, isMutationRunning, isQueryRunning, fetchDetail, fetchPublicDetail, fetch, create, update, destroy,
+ fetchPublic
}
});
diff --git a/src/stores/Photo.js b/src/stores/Photo.js
deleted file mode 100644
index ca46b63..0000000
--- a/src/stores/Photo.js
+++ /dev/null
@@ -1,79 +0,0 @@
-import {defineStore} from "pinia";
-import {ADJUST_PHOTO, CHANGE_PHOTO_ORIENTATION, DELETE_PHOTO, EDIT_PHOTO, UPLOAD_PHOTO} from "src/graphql/mutations/photo";
-import {PHOTO_DETAIL} from "src/graphql/queries/photo";
-import {ref} from "vue";
-import {mutate, query} from "stores/helpers";
-
-export const usePhotosStore = defineStore('Photos', () => {
- const photo = ref(null);
- const isMutationRunning = ref(false);
- const isQueryRunning = ref(false);
-
- const fetchDetail = (id) => query({
- isQueryRunning,
- query: PHOTO_DETAIL,
- variables: {id}
- }).then(item => photo.value = item);
-
- const upload = (flightId, input) => {
- if (!flightId) {
- console.error("No flightId specified for photo upload! Aborting");
- return;
- }
-
- input.flightId = flightId;
-
- if (!input.name) {
- input.name = "";
- }
-
- if (!input.description) {
- input.description = "";
- }
-
- // TODO: ^^ patri tohle do storu?
-
- return mutate({
- isMutationRunning,
- mutation: UPLOAD_PHOTO,
- variables: {input}
- })
- };
-
- const update = (id, input) => mutate({
- isMutationRunning,
- mutation: EDIT_PHOTO,
- variables: {id, input}
- }).then(item => {
- photo.value = item;
- return item;
- })
-
- const changeOrientation = (id, direction) => mutate({
- isMutationRunning,
- mutation: CHANGE_PHOTO_ORIENTATION,
- variables: {id, direction}
- }).then(item => {
- photo.value = item;
- return item;
- });
-
- const adjust = (id, adjustment) => mutate({
- isMutationRunning,
- mutation: ADJUST_PHOTO,
- variables: {id, adjustment}
- }).then(item => {
- photo.value = item;
- return item;
- });
-
- const destroy = (id) => mutate({
- isMutationRunning,
- mutation: DELETE_PHOTO,
- variables: {id}
- });
-
- return {
- photo, isMutationRunning, isQueryRunning, fetchDetail, upload, update, changeOrientation, adjust, destroy
- }
-});
diff --git a/src/stores/Photos.js b/src/stores/Photos.js
new file mode 100644
index 0000000..8f0cf63
--- /dev/null
+++ b/src/stores/Photos.js
@@ -0,0 +1,93 @@
+import {defineStore} from "pinia";
+import {ADJUST_PHOTO, CHANGE_PHOTO_ORIENTATION, DELETE_PHOTO, EDIT_PHOTO, UPLOAD_PHOTO} from "src/graphql/mutations/photo";
+import {PHOTOS_PUBLIC_LIST, PHOTO_DETAIL} from "src/graphql/queries/photo";
+import {ref} from "vue";
+import {mutate, query} from "stores/helpers";
+
+export const usePhotosStore = defineStore('Photos', () => {
+ const photo = ref(null);
+ const photos = ref([]);
+ const openedPhoto = ref(null);
+ const isMutationRunning = ref(false);
+ const isQueryRunning = ref(false);
+
+ const setOpenedPhoto = (photoObject) => {
+ openedPhoto.value = photoObject;
+ }
+
+ const fetchDetail = (id) => query({
+ isQueryRunning,
+ query: PHOTO_DETAIL,
+ variables: {id}
+ }).then(item => photo.value = item);
+
+ const fetchPublic = ({flightId, pointOfInterestId, aircraftId, copilotId}) => query({
+ isQueryRunning,
+ query: PHOTOS_PUBLIC_LIST,
+ variables: {flightId, pointOfInterestId, aircraftId, copilotId}
+ }).then(items => photos.value = items);
+
+ const upload = (flightId, input) => {
+ if (!flightId) {
+ console.error("No flightId specified for photo upload! Aborting");
+ return;
+ }
+
+ input.flightId = flightId;
+
+ if (!input.name) {
+ input.name = "";
+ }
+
+ if (!input.description) {
+ input.description = "";
+ }
+
+ // TODO: ^^ patri tohle do storu?
+
+ return mutate({
+ isMutationRunning,
+ mutation: UPLOAD_PHOTO,
+ variables: {input}
+ })
+ };
+
+ const update = (id, input) => mutate({
+ isMutationRunning,
+ mutation: EDIT_PHOTO,
+ variables: {id, input}
+ }).then(item => {
+ photo.value = item;
+ return item;
+ })
+
+ const changeOrientation = (id, direction) => mutate({
+ isMutationRunning,
+ mutation: CHANGE_PHOTO_ORIENTATION,
+ variables: {id, direction}
+ }).then(item => {
+ photo.value = item;
+ return item;
+ });
+
+ const adjust = (id, adjustment) => mutate({
+ isMutationRunning,
+ mutation: ADJUST_PHOTO,
+ variables: {id, adjustment}
+ }).then(item => {
+ photo.value = item;
+ return item;
+ });
+
+ const destroy = (id) => mutate({
+ isMutationRunning,
+ mutation: DELETE_PHOTO,
+ variables: {id}
+ });
+
+ return {
+ photo, photos, isMutationRunning, isQueryRunning, fetchDetail, fetchPublic, upload, update,
+ changeOrientation, adjust, destroy,
+ openedPhoto, setOpenedPhoto
+ }
+});
diff --git a/src/stores/PointsOfInterest.js b/src/stores/PointsOfInterest.js
index 5984309..6ae6b5f 100644
--- a/src/stores/PointsOfInterest.js
+++ b/src/stores/PointsOfInterest.js
@@ -1,49 +1,55 @@
import {defineStore} from 'pinia'
-import {POI_DETAIL, POI_LIST} from "src/graphql/queries/poi";
+import {POI_DETAIL, POI_LIST, POI_PUBLIC_DETAIL, POI_PUBLIC_LIST} from "src/graphql/queries/poi";
import {CREATE_POI, EDIT_POI} from "src/graphql/mutations/poi";
import {mutate, query, updateInItems} from "stores/helpers";
import {ref} from "vue";
export const usePointsOfInterestStore = defineStore('PointsOfInterest', () => {
+ const pointOfInterest = ref(null);
+ const pointsOfInterest = ref([]);
+ const isMutationRunning = ref(false);
+ const isQueryRunning = ref(false);
- const pointOfInterest = ref(null);
- const pointsOfInterest = ref([]);
- const isMutationRunning = ref(false);
- const isQueryRunning = ref(false);
+ const fetchDetail = (id) => query({
+ isQueryRunning,
+ query: POI_DETAIL,
+ variables: {id},
+ }).then(item => pointOfInterest.value = item);
- const fetchDetail = (id) => {
- return query({
- isQueryRunning,
- query: POI_DETAIL,
- variables: {id},
- }).then(item => pointOfInterest.value = item);
- };
+ const fetchPublicDetail = (id) => query({
+ isQueryRunning,
+ query: POI_PUBLIC_DETAIL,
+ variables: {id},
+ }).then(item => pointOfInterest.value = item);
- const fetch = () => {
- return query({
- isQueryRunning,
- query: POI_LIST,
- }).then(items => pointsOfInterest.value = items);
- }
+ const fetch = () => query({
+ isQueryRunning,
+ query: POI_LIST,
+ }).then(items => pointsOfInterest.value = items);
- const create = (input) => {
- return mutate({
- isMutationRunning,
- mutation: CREATE_POI,
- variables: {input},
- }).then(item => pointsOfInterest.value.push(item))
- }
+ const fetchPublic = () => query({
+ isQueryRunning,
+ query: POI_PUBLIC_LIST,
+ }).then(items => pointsOfInterest.value = items);
- const update = (id, input) => {
- return mutate({
- isMutationRunning,
- mutation: EDIT_POI,
- variables: {id, input}
- }).then(item => updateInItems(pointsOfInterest.value, 'id', item))
- }
+ const create = (input) => mutate({
+ isMutationRunning,
+ mutation: CREATE_POI,
+ variables: {input},
+ }).then(item => pointsOfInterest.value.push(item))
- return {
- pointOfInterest, pointsOfInterest, isMutationRunning, isQueryRunning, fetch, fetchDetail, create, update
- }
+ const update = (id, input) => mutate({
+ isMutationRunning,
+ mutation: EDIT_POI,
+ variables: {id, input}
+ }).then(item => {
+ updateInItems(pointsOfInterest.value, 'id', item);
+ pointOfInterest.value = item;
+ })
+
+ return {
+ pointOfInterest, pointsOfInterest, isMutationRunning, isQueryRunning, fetch, fetchPublic, fetchDetail,
+ fetchPublicDetail, create, update
+ }
})
diff --git a/src/stores/User.js b/src/stores/User.js
index 23b9a78..c318467 100644
--- a/src/stores/User.js
+++ b/src/stores/User.js
@@ -68,6 +68,7 @@ export const useUserStore = defineStore('LoggedUser', () => {
};
const getAccessToken = () => {
+ // TODO: https://dev.to/quasar/quasar-ssr-using-cookies-with-other-libs-services-4nkl
if (typeof localStorage === 'undefined') return null;
const tokenValidity = localStorage.getItem("accessTokenValidity");
diff --git a/src/stores/helpers.js b/src/stores/helpers.js
index 3ebbe37..d259423 100644
--- a/src/stores/helpers.js
+++ b/src/stores/helpers.js
@@ -22,7 +22,7 @@ export const query = ({isQueryRunning, query, variables, refreshUnauthorized}) =
variables.id = parseInt(variables.id);
}
- query._refreshUnauthorizedUser = refreshUnauthorized;
+ query._refreshUnauthorizedUser = typeof refreshUnauthorized === 'undefined' ? true : refreshUnauthorized;
isQueryRunning.value = true;
const queryName = query.definitions[0].selectionSet.selections[0].name.value;