Add albums cover, fix left bar icon

This commit is contained in:
2020-09-16 11:41:34 +03:00
parent 9482f7e359
commit fd9e23622f
6 changed files with 67 additions and 20 deletions

View File

@@ -1,11 +1,9 @@
<template>
<div>
<LeftBlock
title="HOME"
description="kreorg photos"
picture="/pictures/home.jpg"
:leftPanelClosed="leftPanelClosed"></LeftBlock>
:title="title"
:description="description"
:picture="picture"></LeftBlock>
</div>
</template>
@@ -13,6 +11,9 @@
import 'reflect-metadata';
import { Vue, Component, Prop } from 'vue-property-decorator';
import { StoreType } from '@/store';
import { IAlbum } from '@/store/albums/state';
import LeftBlock from '@/components/LeftBlock.vue';
@@ -23,7 +24,37 @@ import LeftBlock from '@/components/LeftBlock.vue';
}
})
export default class AlbumPage extends Vue {
@Prop({required: true}) public readonly leftPanelClosed!: boolean;
get album(): IAlbum | null {
const albums = (this.$store as StoreType).state.albums.albums;
if (albums === null)
return null;
const album = albums.filter(item => item.folderName === this.$route.params.name);
if (album.length === 0)
return null;
return album[0];
}
get title(): string {
if (this.album === null)
return '';
return this.album.name;
}
get description(): string {
if (this.album === null)
return '';
return this.album.description;
}
get picture(): string {
if (this.album === null)
return '';
return `/pictures/albums/${this.album.folderName}/${this.album.coverFileName}`
}
}
</script>