From fd9e23622f8ba6594065239994ea5f7cba7ccfc1 Mon Sep 17 00:00:00 2001 From: kurbezz Date: Wed, 16 Sep 2020 11:41:34 +0300 Subject: [PATCH] Add albums cover, fix left bar icon --- src/App.vue | 17 ++++++++------ src/components/LeftBlock.vue | 16 ++++++++++---- src/store/albums/actions.ts | 3 +++ src/store/albums/state.ts | 1 + src/views/Album.vue | 43 +++++++++++++++++++++++++++++++----- src/views/Home.vue | 7 +++--- 6 files changed, 67 insertions(+), 20 deletions(-) diff --git a/src/App.vue b/src/App.vue index 7a0036a..2560344 100644 --- a/src/App.vue +++ b/src/App.vue @@ -28,8 +28,7 @@ + style="min-height: 100vh"/> @@ -37,7 +36,7 @@ diff --git a/src/components/LeftBlock.vue b/src/components/LeftBlock.vue index 28cecd3..9399518 100644 --- a/src/components/LeftBlock.vue +++ b/src/components/LeftBlock.vue @@ -10,9 +10,15 @@ diff --git a/src/store/albums/actions.ts b/src/store/albums/actions.ts index 8374419..80f2cd6 100644 --- a/src/store/albums/actions.ts +++ b/src/store/albums/actions.ts @@ -15,6 +15,7 @@ export default class AlbumsActions extends Actions< name: 'Test', description: 'Test description', protected: false, + coverFileName: 'p (1).jpg', folderName: 'test', files: [ @@ -30,6 +31,7 @@ export default class AlbumsActions extends Actions< name: 'Test 2', description: 'Test 2 description', protected: false, + coverFileName: 'p (1).jpg', folderName: 'test2', files: [ @@ -44,6 +46,7 @@ export default class AlbumsActions extends Actions< name: 'Test 3', description: 'Test 3 description', protected: false, + coverFileName: 'p (1).jpg', folderName: 'test3', files: [ diff --git a/src/store/albums/state.ts b/src/store/albums/state.ts index 4836a93..ea6477d 100644 --- a/src/store/albums/state.ts +++ b/src/store/albums/state.ts @@ -1,6 +1,7 @@ export interface IAlbum { name: string; description: string; + coverFileName: string; protected: boolean; folderName: string; diff --git a/src/views/Album.vue b/src/views/Album.vue index 33af64f..a8a6482 100644 --- a/src/views/Album.vue +++ b/src/views/Album.vue @@ -1,11 +1,9 @@ @@ -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}` + } } diff --git a/src/views/Home.vue b/src/views/Home.vue index db46f56..26d1675 100644 --- a/src/views/Home.vue +++ b/src/views/Home.vue @@ -1,6 +1,9 @@