fix(front): errors in user profile

This commit is contained in:
ArneBo 2025-02-12 11:15:24 +01:00
parent 48c9ffd2f8
commit 0bf0609bc5
2 changed files with 17 additions and 12 deletions

View File

@ -1,22 +1,27 @@
<script setup lang="ts"> <script setup lang="ts">
import type { Actor } from '~/types' import type { Actor } from '~/types'
import { ref } from 'vue' import { ref, computed } from 'vue'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import { useStore } from '~/store'
import PlaylistWidget from '~/components/playlists/Widget.vue' import PlaylistWidget from '~/components/playlists/Widget.vue'
import TrackWidget from '~/components/audio/track/Widget.vue' import TrackWidget from '~/components/audio/track/Widget.vue'
import AlbumWidget from '~/components/album/Widget.vue' import AlbumWidget from '~/components/album/Widget.vue'
import RadioButton from '~/components/radios/Button.vue' import RadioButton from '~/components/radios/Button.vue'
import Layout from '~/components/ui/Layout.vue'
interface Props { interface Props {
object: Actor object?: Actor
} }
defineProps<Props>() defineProps<Props>()
const recentActivity = ref(0) const recentActivity = ref(0)
const store = useStore()
const qualityFilters = computed(() => store.getters['instance/qualityFilters'])
const { t } = useI18n() const { t } = useI18n()
</script> </script>
@ -26,7 +31,7 @@ const { t } = useI18n()
v-if="recentActivity > 0" v-if="recentActivity > 0"
class="right floated" class="right floated"
type="account" type="account"
:object-id="{username: object.preferred_username, fullUsername: object.full_username}" :object?-id="{username: object?.preferred_username, fullUsername: object?.full_username}"
:client-only="true" :client-only="true"
/> />
<track-widget <track-widget
@ -42,7 +47,7 @@ const { t } = useI18n()
<track-widget <track-widget
:url="'favorites/tracks/'" :url="'favorites/tracks/'"
:filters="{scope: 'actor:${object.full_username}', ordering: '-creation_date'}" :filters="{scope: 'actor:${object?.full_username}', ordering: '-creation_date'}"
> >
<template #title> <template #title>
{{ t('components.library.Home.header.recentlyFavorited') }} {{ t('components.library.Home.header.recentlyFavorited') }}
@ -51,7 +56,7 @@ const { t } = useI18n()
<playlist-widget <playlist-widget
:url="'playlists/'" :url="'playlists/'"
:filters="{scope: `actor:${object.full_username}`, playable: true, ordering: '-modification_date'}" :filters="{scope: `actor:${object?.full_username}`, playable: true, ordering: '-modification_date'}"
> >
<template #title> <template #title>
{{ t('views.auth.ProfileActivity.header.playlists') }} {{ t('views.auth.ProfileActivity.header.playlists') }}

View File

@ -17,7 +17,7 @@ interface Events {
} }
interface Props { interface Props {
object: Actor object: Actor | null
} }
const store = useStore() const store = useStore()
@ -41,10 +41,10 @@ const createForm = ref()
<section> <section>
<div v-if="store.getters['ui/layoutVersion'] === 'small'"> <div v-if="store.getters['ui/layoutVersion'] === 'small'">
<rendered-description <rendered-description
:content="object.summary" :content="object?.summary"
:field-name="'summary'" :field-name="'summary'"
:update-url="`users/${store.state.auth.username}/`" :update-url="`users/${store.state.auth.username}/`"
:can-update="store.state.auth.authenticated && object.full_username === store.state.auth.fullUsername" :can-update="store.state.auth.authenticated && object?.full_username === store.state.auth.fullUsername"
@updated="emit('updated', $event)" @updated="emit('updated', $event)"
/> />
<div class="ui hidden divider" /> <div class="ui hidden divider" />
@ -53,7 +53,7 @@ const createForm = ref()
<h2 class="ui with-actions header"> <h2 class="ui with-actions header">
{{ t('views.auth.ProfileOverview.header.channels') }} {{ t('views.auth.ProfileOverview.header.channels') }}
<div <div
v-if="store.state.auth.authenticated && object.full_username === store.state.auth.fullUsername" v-if="store.state.auth.authenticated && object?.full_username === store.state.auth.fullUsername"
class="actions" class="actions"
> >
<a <a
@ -65,11 +65,11 @@ const createForm = ref()
</a> </a>
</div> </div>
</h2> </h2>
<channels-widget :filters="{scope: `actor:${object.full_username}`}" /> <channels-widget :filters="{scope: `actor:${object?.full_username}`}" />
<h2 class="ui with-actions header"> <h2 class="ui with-actions header">
{{ t('views.auth.ProfileOverview.header.libraries') }} {{ t('views.auth.ProfileOverview.header.libraries') }}
<div <div
v-if="store.state.auth.authenticated && object.full_username === store.state.auth.fullUsername" v-if="store.state.auth.authenticated && object?.full_username === store.state.auth.fullUsername"
class="actions" class="actions"
> >
<router-link :to="{name: 'content.libraries.index'}"> <router-link :to="{name: 'content.libraries.index'}">
@ -78,7 +78,7 @@ const createForm = ref()
</router-link> </router-link>
</div> </div>
</h2> </h2>
<library-widget :url="`federation/actors/${object.full_username}/libraries/`"> <library-widget :url="`federation/actors/${object?.full_username}/libraries/`">
<template #title> <template #title>
{{ t('views.auth.ProfileOverview.header.sharedLibraries') }} {{ t('views.auth.ProfileOverview.header.sharedLibraries') }}
</template> </template>