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

View File

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