feat(home-section): add link to library on section header

This commit is contained in:
MrTimscampi 2021-08-28 17:27:58 +02:00
parent 7632a24205
commit e3ef2c25a2
4 changed files with 18 additions and 6 deletions

View File

@ -9,6 +9,7 @@
:items="items"
:shape="section.shape"
:loading="loading"
:link="section.libraryId ? `/library/${section.libraryId}` : undefined"
/>
</client-only>
</template>

View File

@ -3,12 +3,16 @@
<skeleton-home-section v-if="loading" :card-shape="shape" />
<v-col v-show="items && items.length > 0" class="swiper-section">
<div class="d-flex ma-2">
<h1
<component
:is="link ? 'nuxt-link' : 'h1'"
:to="link ? link : null"
:tag="link ? 'h1' : null"
class="text-h6 text-sm-h5 font-weight-light header"
:class="{ 'header-white-mode': !$vuetify.theme.dark }"
:class="{ 'header-white-mode': !$vuetify.theme.dark, pointer: link }"
>
<span class="pl-4">{{ title }}</span>
</h1>
<v-icon v-if="link">mdi-chevron-right</v-icon>
</component>
<v-spacer />
<v-btn class="swiper-prev" icon>
<v-icon>mdi-arrow-left</v-icon>
@ -57,6 +61,10 @@ export default Vue.extend({
default(): string {
return getShapeFromItemType(this.items?.[0]?.Type);
}
},
link: {
type: String,
default: ''
}
},
data() {

View File

@ -98,7 +98,6 @@ export default Vue.extend({
case 'ondeck':
homeSections.push({
name: 'onDeck',
libraryId: '',
shape: CardShapes.Thumb,
type: 'ondeck'
});

View File

@ -12,7 +12,7 @@ import { CardShapes } from '~/utils/items';
export interface HomeSection {
name: string;
libraryName?: string | null;
libraryId: string;
libraryId?: string;
shape: CardShapes;
type: string;
}
@ -57,7 +57,11 @@ export const getters: GetterTree<HomeSectionState, AppState> = {
...state.upNext
];
case 'recentlyadded':
return state.latestMedia[section.libraryId];
if (section.libraryId) {
return state.latestMedia[section.libraryId];
}
return [];
default:
return [];
}