56 lines
1.5 KiB
Vue
56 lines
1.5 KiB
Vue
<script setup>
|
|
import FlightsListSkeleton from "components/flights/FlightsListSkeleton.vue";
|
|
import EventsList from "components/event/EventsList.vue";
|
|
import {onMounted, watch} from "vue";
|
|
import PublicFlightEventSwitcher from "components/navigation/PublicFlightEventSwitcher.vue";
|
|
import {useAppStore} from "stores/App";
|
|
import {useEventsStore} from "stores/Events";
|
|
import {storeToRefs} from "pinia";
|
|
|
|
const props = defineProps({
|
|
loggedUser: {
|
|
type: Object,
|
|
required: false
|
|
},
|
|
username: {
|
|
type: String,
|
|
required: true
|
|
}
|
|
});
|
|
|
|
watch(() => props.username, () => {
|
|
}, {immediate: true});
|
|
|
|
onMounted(() => {
|
|
// const eventNameFormatted = eventName(newVal);
|
|
useAppStore().setPageTitle(`${props.username}`);
|
|
useAppStore().setBreadcrumbs([
|
|
{to: {name: 'homepage'}, label: "Polétání.cz"},
|
|
{to: {name: "publicProfileDetail", params: {username: props.username}}, label: `@${props.username}`},
|
|
{label: "Události"}
|
|
]);
|
|
useEventsStore().fetch(props.username);
|
|
}
|
|
);
|
|
|
|
const {isQueryRunning, events} = storeToRefs(useEventsStore());
|
|
</script>
|
|
|
|
<template>
|
|
<PublicFlightEventSwitcher :username="username"/>
|
|
|
|
<FlightsListSkeleton v-if="isQueryRunning"/>
|
|
|
|
<q-banner class="bg-primary text-white" v-else-if="!isQueryRunning && events.length === 0">
|
|
Tento pilot zatím nepublikoval žádnou udalost.
|
|
</q-banner>
|
|
|
|
<template v-else>
|
|
<EventsList
|
|
:items="events"
|
|
:route-detail="{name: 'publicEventDetail', params: {username: username}}"
|
|
class="q-mb-md"
|
|
/>
|
|
</template>
|
|
</template>
|