fix(front): consistent header on track detail

This commit is contained in:
ArneBo 2025-04-09 14:56:05 +02:00
parent 8d775fc5ed
commit 378455b0eb
2 changed files with 260 additions and 268 deletions

View File

@ -18,6 +18,7 @@ import TrackPlaylistIcon from '~/components/playlists/TrackPlaylistIcon.vue'
import EmbedWizard from '~/components/audio/EmbedWizard.vue' import EmbedWizard from '~/components/audio/EmbedWizard.vue'
import HumanDuration from '~/components/common/HumanDuration.vue' import HumanDuration from '~/components/common/HumanDuration.vue'
import Layout from '~/components/ui/Layout.vue' import Layout from '~/components/ui/Layout.vue'
import Header from '~/components/ui/Header.vue'
import Loader from '~/components/ui/Loader.vue' import Loader from '~/components/ui/Loader.vue'
import Modal from '~/components/ui/Modal.vue' import Modal from '~/components/ui/Modal.vue'
import PlayButton from '~/components/audio/PlayButton.vue' import PlayButton from '~/components/audio/PlayButton.vue'
@ -153,16 +154,24 @@ watch(showDeleteModal, (newValue) => {
</script> </script>
<template> <template>
<Layout
stack
main
>
<Loader <Loader
v-if="isLoading" v-if="isLoading"
v-title="labels.title" v-title="labels.title"
/> />
<template v-if="track"> <Header
<Layout flex> v-if="track"
:h1="track.title"
:action="{
text: labels.download,
to: downloadUrl,
solid: true,
primary: true,
icon: 'bi-download',
lowHeight: true
}"
page-heading
>
<template #image>
<img <img
v-if="track.cover" v-if="track.cover"
v-lazy="store.getters['instance/absoluteUrl'](track.cover.urls.large_square_crop)" v-lazy="store.getters['instance/absoluteUrl'](track.cover.urls.large_square_crop)"
@ -181,32 +190,7 @@ watch(showDeleteModal, (newValue) => {
class="channel-image" class="channel-image"
src="../../assets/audio/default-cover.png" src="../../assets/audio/default-cover.png"
> >
</template>
<Layout
stack
style="flex: 1; gap: 8px;"
>
<Layout
flex
no-gap
style="align-items: baseline;"
>
<h1 style="margin-top: 64px; margin-bottom: 8px;">
{{ track.title }}
</h1>
<Spacer grow />
<Button
v-if="upload"
:aria-label="labels.download"
:to="downloadUrl"
target="_blank"
primary
icon="bi-download"
:title="labels.download"
>
{{ labels.download }}
</Button>
</Layout>
<artist-credit-label <artist-credit-label
:artist-credit="track.artist_credit" :artist-credit="track.artist_credit"
/> />
@ -230,6 +214,7 @@ watch(showDeleteModal, (newValue) => {
class="vibrant" class="vibrant"
split split
:track="track" :track="track"
low-height
/> />
<Spacer <Spacer
@ -240,14 +225,19 @@ watch(showDeleteModal, (newValue) => {
<TrackFavoriteIcon <TrackFavoriteIcon
v-if="store.state.auth.authenticated" v-if="store.state.auth.authenticated"
:track="track" :track="track"
square-small
/> />
<TrackPlaylistIcon <TrackPlaylistIcon
v-if="store.state.auth.authenticated" v-if="store.state.auth.authenticated"
:track="track" :track="track"
square-small
/> />
<Popover v-model="open"> <Popover v-model="open">
<template #default="{ toggleOpen }"> <template #default="{ toggleOpen }">
<OptionsButton @click="toggleOpen" /> <OptionsButton
is-square-small
@click="toggleOpen"
/>
</template> </template>
<template #items> <template #items>
<PopoverItem <PopoverItem
@ -341,34 +331,32 @@ watch(showDeleteModal, (newValue) => {
</template> </template>
</Popover> </Popover>
</Layout> </Layout>
</Layout> </Header>
</Layout>
<hr> <hr>
<Layout <Layout
flex flex
gap-8 gap-8
> >
<span v-if="track.attributed_to"> <span v-if="track?.attributed_to">
{{ t('components.library.TrackBase.subtitle.with-uploader') }} {{ t('components.library.TrackBase.subtitle.with-uploader') }}
</span> </span>
<span v-else> <span v-else>
{{ t('components.library.TrackBase.subtitle.without-uploader') }} {{ t('components.library.TrackBase.subtitle.without-uploader') }}
</span> </span>
<ActorLink <ActorLink
v-if="track.attributed_to" v-if="track?.attributed_to"
:actor="track.attributed_to" :actor="track?.attributed_to"
:avatar="false" :avatar="false"
/> />
<time <time
:title="track.creation_date" :title="track?.creation_date"
:datetime="track.creation_date" :datetime="track?.creation_date"
> >
{{ momentFormat(new Date(track.creation_date), 'LL') }} {{ track?.creation_date ? momentFormat(new Date(track.creation_date), 'LL') : '' }}
</time> </time>
</Layout> </Layout>
<Spacer :size="16" /> <Spacer :size="64" />
<Modal <Modal
v-if="isEmbedable" v-if="isEmbedable"
@ -376,7 +364,7 @@ watch(showDeleteModal, (newValue) => {
:title="t('components.library.TrackBase.modal.embed.header')" :title="t('components.library.TrackBase.modal.embed.header')"
> >
<embed-wizard <embed-wizard
:id="track.id" :id="track?.id || undefined"
type="track" type="track"
/> />
@ -425,11 +413,16 @@ watch(showDeleteModal, (newValue) => {
@libraries-loaded="libraries = $event" @libraries-loaded="libraries = $event"
/> />
</template> </template>
</Layout>
</template>
<style scoped> <style lang="scss" scoped>
.meta { .meta {
line-height: 48px; font-size: 15px;
line-height: 32px;
@include light-theme {
color: var(--fw-gray-700);
}
@include dark-theme {
color: var(--fw-gray-500);
}
} }
</style> </style>

View File

@ -147,7 +147,6 @@ const trackDetails: {
flex flex
style="gap: 24px;" style="gap: 24px;"
> >
<Spacer />
<Layout <Layout
stack stack
style="flex: 1; gap: 0;" style="flex: 1; gap: 0;"