refactor: more route check functions

Signed-off-by: Varun Patil <radialapps@gmail.com>
pull/767/head
Varun Patil 2023-07-29 10:02:45 -07:00
parent 6958a678b9
commit 2d54b502a9
3 changed files with 7 additions and 3 deletions

View File

@ -214,10 +214,10 @@ export default defineComponent({
isMonthView(): boolean {
if (this.$route.query.sort === 'timeline') return false;
if (this.$route.query.sort === 'album') return true;
return (
this.$route.query.sort === 'album' ||
(this.config.sort_album_month && (this.$route.name === 'albums' || this.$route.name === 'album-share')) ||
(this.config.sort_folder_month && this.$route.name === 'folders')
(this.config.sort_album_month && (this.routeIsAlbums || this.routeIsAlbumShare)) ||
(this.config.sort_folder_month && this.routeIsFolders)
);
},

View File

@ -46,6 +46,9 @@ export default defineComponent({
routeIsExplore(): boolean {
return this.$route.name === 'explore';
},
routeIsAlbumShare(): boolean {
return this.$route.name === 'album-share';
},
routeIsPublic(): boolean {
return this.$route.name?.endsWith('-share') ?? false;
},

View File

@ -22,6 +22,7 @@ declare module 'vue' {
routeIsMap: boolean;
routeIsTags: boolean;
routeIsExplore: boolean;
routeIsAlbumShare: boolean;
routeIsPublic: boolean;
}
}