Refaktoring verejneho profilu, pridani zobrazeni udalosti
This commit is contained in:
@@ -1,11 +1,7 @@
|
||||
<script setup>
|
||||
import {FORMAT_DATE, formatDatetime} from "src/composables/datetimeUtils";
|
||||
import {onMounted} from "vue";
|
||||
import {useRoute} from "vue-router";
|
||||
import FlightsListSkeleton from "components/flights/FlightsListSkeleton.vue";
|
||||
import FlightsList from "components/flights/FlightsList.vue";
|
||||
import AvatarFromPhoto from "components/avatars/AvatarFromPhoto.vue";
|
||||
import {fetchFlights, flights, loading as flightsLoading} from "src/composables/objects/flight";
|
||||
import {fetchFlights} from "src/composables/objects/flight";
|
||||
import {fetchUser, user as pilot, loading as pilotLoading} from "src/composables/objects/user";
|
||||
import PublicProfileSkeleton from "components/profile/PublicProfileSkeleton.vue";
|
||||
import {storeToRefs} from "pinia";
|
||||
@@ -15,40 +11,16 @@ import PilotProfileCard from "components/profile/PilotProfileCard.vue";
|
||||
|
||||
const loggedUser = storeToRefs(useUserStore()).user;
|
||||
const username = useRoute().params.username;
|
||||
onMounted(() => {
|
||||
fetchUser(username).then(user => {
|
||||
useAppStore().setPageTitle(user.publicUsername);
|
||||
useAppStore().setBreadcrumbs([
|
||||
{to: {name: 'homepage'}, label: "Polétání.cz"},
|
||||
{label: `@${user.publicUsername}`},
|
||||
])
|
||||
})
|
||||
fetchFlights(username);
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="row">
|
||||
<div class="col-12 col-md-8">
|
||||
<FlightsListSkeleton v-if="flightsLoading"/>
|
||||
|
||||
<q-banner class="bg-primary text-white" v-else-if="!flightsLoading && flights.length === 0">
|
||||
Tento pilot zatím nepublikoval žádný let.
|
||||
</q-banner>
|
||||
|
||||
<template v-else>
|
||||
<FlightsList
|
||||
:items="flights"
|
||||
:displayVisibilityInfo="loggedUser.id === pilot.id"
|
||||
:route-detail="{name: 'publicFlightDetail', params: {username: username}}"
|
||||
class="q-mb-md"
|
||||
/>
|
||||
</template>
|
||||
<router-view :logged-user="loggedUser" :username="username"/>
|
||||
</div>
|
||||
<div class="col-12 col-md-4">
|
||||
<PublicProfileSkeleton v-if="pilotLoading"/>
|
||||
|
||||
<PilotProfileCard v-else :pilot="pilot" />
|
||||
<PilotProfileCard v-else :pilot="pilot"/>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user