Pridani stranky pro verejny prehled letu s danym kopilotem

This commit is contained in:
Michal Kváček
2023-11-02 09:03:12 +01:00
parent 40f21d159e
commit 6b1e220d42
9 changed files with 79 additions and 12 deletions
@@ -0,0 +1,53 @@
<script setup>
import {useRoute} from "vue-router";
import {copilot, fetchCopilot, loading as copilotLoading} from "src/composables/objects/copilot";
import {fetchUser, user as pilot, loading as pilotLoading} from "src/composables/objects/user";
import {onMounted} from "vue";
import FlightsList from "components/flights/FlightsList.vue";
import {useAppStore} from "stores/App";
import BasicListSkeleton from "components/basicSkeletons/BasicListSkeleton.vue";
const $route = useRoute();
const copilotId = parseInt($route.params.id);
const props = defineProps({
loggedUser: {
type: Object,
required: false
},
username: {
type: String,
required: true
}
});
onMounted(() => {
Promise.all([
fetchUser(props.username),
fetchCopilot(copilotId, props.username)
]).then(() => {
useAppStore().setPageTitle(`${pilot.value.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: pilot.value.name}
]);
});
});
</script>
<template>
<BasicListSkeleton v-if="copilotLoading || pilotLoading" class="q-mb-md"/>
<template v-else>
<h3>Společné lety</h3>
<FlightsList
:items="copilot.flights"
:route-detail="{name: 'publicFlightDetail', params: {username: username}}"
class="q-mb-md"
/>
</template>
</template>
@@ -43,7 +43,10 @@ watch(flight, (newVal) => {
</q-img>
<q-card-section>
<FlightBasicInfo :flight="flight" :show-copilots="false"/>
<FlightBasicInfo
:flight="flight"
:copilot-detail-route="{name: 'publicCopilotDetail', params: {username: routeParams.username}}"
/>
<article class="q-my-lg" v-html="flight.description"/>
@@ -19,7 +19,6 @@ const props = defineProps({
}
});
// TODO: onmounted presunout do child komponent, stejne jako fetch dat
onMounted(() => {
fetchUser(props.username).then(user => {
useAppStore().setPageTitle(user.publicUsername);