Vylepseni SSR, pridani meta informaci, zatim dost WIP

This commit is contained in:
Michal Kváček
2023-11-28 11:35:53 +01:00
parent 86605ad53e
commit 11cc6ad107
28 changed files with 371 additions and 403 deletions
@@ -2,42 +2,40 @@
import FlightsListSkeleton from "components/flights/FlightsListSkeleton.vue";
import FlightsList from "components/flights/FlightsList.vue";
import PublicFlightEventSwitcher from "components/navigation/PublicFlightEventSwitcher.vue";
import {onMounted} from "vue";
import {useAppStore} from "stores/App";
import {useUserStore} from "stores/User";
import {useFlightsStore} from "stores/Flights";
import {storeToRefs} from "pinia";
import {commonKeywords, metaData} from "src/composables/meta";
import {useMeta} from "quasar";
import {useUserStore} from "stores/User";
const props = defineProps({
loggedUser: {
pilot: {
type: Object,
required: false
},
username: {
type: String,
required: true
required: true,
}
});
onMounted(() => {
useUserStore().fetchPublicUserDetail(props.username).then(user => {
useAppStore().setPageTitle(user.publicUsername);
useAppStore().setBreadcrumbs([
{to: {name: 'homepage'}, label: "Polétání.cz"},
{label: `@${user.publicUsername}`},
])
})
useMeta(() => metaData({
title: `${props.pilot.publicUsername} - Lety`,
keywords: [...commonKeywords, "pilot", props.pilot.publicUsername, props.pilot.name],
description: `Výlety publikované pilotem ${props.pilot.name}. ${props.pilot.publicUsername}: ${props.pilot.description}`,
image: props.pilot.titleImageUrl
}));
useFlightsStore().fetch(props.username);
});
useAppStore().setPageTitle(props.pilot.publicUsername);
useAppStore().setBreadcrumbs([
{to: {name: 'homepage'}, label: "Polétání.cz"},
{label: `@${props.pilot.publicUsername}`},
])
useFlightsStore().fetch(props.pilot.publicUsername);
const {flights, isQueryRunning: areFlightsLoading} = storeToRefs(useFlightsStore());
const {publicUser: pilot} = storeToRefs(useUserStore());
const loggedUser = storeToRefs(useUserStore()).user;
</script>
<template>
<PublicFlightEventSwitcher :username="username" />
<PublicFlightEventSwitcher :username="pilot?.publicUsername"/>
<FlightsListSkeleton v-if="areFlightsLoading"/>
@@ -48,8 +46,8 @@ const {publicUser: pilot} = storeToRefs(useUserStore());
<template v-else>
<FlightsList
:items="flights"
:displayVisibilityInfo="loggedUser.id === pilot.id"
:route-detail="{name: 'publicFlightDetail', params: {username: username}}"
:displayVisibilityInfo="loggedUser?.id === pilot?.id"
:route-detail="{name: 'publicFlightDetail', params: {username: pilot?.publicUsername}}"
class="q-mb-md"
/>
</template>