diff --git a/public/plane-crash.svg b/public/plane-crash.svg new file mode 100644 index 0000000..87174c6 --- /dev/null +++ b/public/plane-crash.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/App.vue b/src/App.vue index 98240ae..7e98841 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,3 +1,25 @@ + + diff --git a/src/components/flights/FlightTrackMap.vue b/src/components/flights/FlightTrackMap.vue new file mode 100644 index 0000000..e0279e2 --- /dev/null +++ b/src/components/flights/FlightTrackMap.vue @@ -0,0 +1,69 @@ + + + diff --git a/src/components/flights/FlightsList.vue b/src/components/flights/FlightsList.vue index 95d6ddf..0f06b53 100644 --- a/src/components/flights/FlightsList.vue +++ b/src/components/flights/FlightsList.vue @@ -18,7 +18,7 @@ const props = defineProps({ displayVisibilityInfo: { type: Boolean, required: false, - default: false + default: true } }); @@ -33,12 +33,12 @@ const props = defineProps({ :to="{name: routeDetail.name, params:{...routeDetail.params, id: flight.id}}" > - -
+ +
- {{ flightName(flight) }} +
{{ flightName(flight) }}
{{ formatDatetime(flight.takeoffDatetime) }} diff --git a/src/components/flights/PhotoCarousel.vue b/src/components/flights/PhotoCarousel.vue new file mode 100644 index 0000000..5c22461 --- /dev/null +++ b/src/components/flights/PhotoCarousel.vue @@ -0,0 +1,52 @@ + + + diff --git a/src/components/flights/form/FlightFormBasic.vue b/src/components/flights/form/FlightFormBasic.vue index 3c01512..792a8ac 100644 --- a/src/components/flights/form/FlightFormBasic.vue +++ b/src/components/flights/form/FlightFormBasic.vue @@ -21,6 +21,7 @@ const props = defineProps({ } } ) + const formData = reactive({ aircraft: null, takeoffAirport: null, @@ -28,89 +29,107 @@ const formData = reactive({ takeoffDatetime: null, landingDatetime: null, landings: 1, + isPublic: false, name: "", description: "", -}) - -const recalculateDuration = (data) => { - const diff = data.landingDatetime - data.takeoffDatetime; - data.durationTotal = diff / 1000 / 60; -} - -watch(() => [formData.takeoffDatetime, formData.landingDatetime], () => recalculateDuration(formData)) +}); const rules = {}; -const isMounted = ref(false); -// tohle je blby ohack kvuli tomu, ze DatetimeInput se renderuje jeste pred mounted a do props nedostane hodnotu -// modelu. A neumi se s tim smirit... -onMounted(() => { - if (props.flight) { - setDefaultData(formData, props.flight); - formData.aircraft = {id: formData.aircraft.id, name: formData.aircraft.callSign}; - formData.takeoffAirport = {id: formData.takeoffAirport.id, name: formData.takeoffAirport.name} - formData.landingAirport = {id: formData.landingAirport.id, name: formData.landingAirport.name} +watch(() => props.flight, (newVal) => { + if (newVal) { + setDefaultData(formData, newVal); + formData.aircraft = {id: newVal.aircraft.id, name: newVal.aircraft.callSign}; + formData.takeoffAirport = {id: newVal.takeoffAirport.id, name: newVal.takeoffAirport.name} + formData.landingAirport = {id: newVal.landingAirport.id, name: newVal.landingAirport.name} } - isMounted.value = true; -}); +}, {immediate: true}); const aircrafts = computed(() => { return props.aircrafts.map(a => ({id: a.id, name: a.callSign})); }); +watch(() => formData.takeoffDatetime, () => { + if (!formData.landingDatetime) { + formData.landingDatetime = formData.takeoffDatetime; + } +}); watch(() => formData.takeoffAirport, () => { if (!formData.landingAirport) { formData.landingAirport = {...formData.takeoffAirport}; } }); -