2020-09-02 18:34:50 +00:00
|
|
|
<template>
|
|
|
|
<v-app dark>
|
|
|
|
<v-navigation-drawer
|
|
|
|
v-model="drawer"
|
|
|
|
:mini-variant="miniVariant"
|
|
|
|
:clipped="clipped"
|
|
|
|
fixed
|
|
|
|
app
|
|
|
|
>
|
|
|
|
<v-list>
|
|
|
|
<v-list-item
|
|
|
|
v-for="(item, i) in items"
|
|
|
|
:key="i"
|
|
|
|
:to="item.to"
|
|
|
|
router
|
|
|
|
exact
|
|
|
|
>
|
|
|
|
<v-list-item-action>
|
|
|
|
<v-icon>{{ item.icon }}</v-icon>
|
|
|
|
</v-list-item-action>
|
|
|
|
<v-list-item-content>
|
|
|
|
<v-list-item-title v-text="item.title" />
|
|
|
|
</v-list-item-content>
|
|
|
|
</v-list-item>
|
|
|
|
</v-list>
|
2020-09-03 23:10:19 +00:00
|
|
|
<v-divider></v-divider>
|
|
|
|
<v-list>
|
|
|
|
<v-list-item
|
|
|
|
v-for="(library, i) in libraries"
|
|
|
|
:key="i"
|
|
|
|
:to="library.to"
|
|
|
|
router
|
|
|
|
exact
|
|
|
|
>
|
|
|
|
<v-list-item-action>
|
|
|
|
<v-icon>{{ library.icon }}</v-icon>
|
|
|
|
</v-list-item-action>
|
|
|
|
<v-list-item-content>
|
|
|
|
<v-list-item-title v-text="library.title" />
|
|
|
|
</v-list-item-content>
|
|
|
|
</v-list-item>
|
|
|
|
</v-list>
|
|
|
|
<v-divider></v-divider>
|
|
|
|
<v-list>
|
|
|
|
<v-list-item
|
|
|
|
v-for="(item, i) in configItems"
|
|
|
|
:key="i"
|
|
|
|
:to="item.to"
|
|
|
|
router
|
|
|
|
exact
|
|
|
|
>
|
|
|
|
<v-list-item-action>
|
|
|
|
<v-icon>{{ item.icon }}</v-icon>
|
|
|
|
</v-list-item-action>
|
|
|
|
<v-list-item-content>
|
|
|
|
<v-list-item-title v-text="item.title" />
|
|
|
|
</v-list-item-content>
|
|
|
|
</v-list-item>
|
|
|
|
</v-list>
|
2020-09-02 18:34:50 +00:00
|
|
|
</v-navigation-drawer>
|
|
|
|
<v-app-bar :clipped-left="clipped" fixed app>
|
|
|
|
<v-app-bar-nav-icon @click.stop="drawer = !drawer" />
|
|
|
|
<v-btn icon @click.stop="miniVariant = !miniVariant">
|
|
|
|
<v-icon>mdi-{{ `chevron-${miniVariant ? 'right' : 'left'}` }}</v-icon>
|
|
|
|
</v-btn>
|
|
|
|
<v-toolbar-title v-text="title" />
|
|
|
|
<v-spacer />
|
2020-09-03 14:52:43 +00:00
|
|
|
<user-button v-if="$auth.loggedIn" />
|
2020-09-02 18:34:50 +00:00
|
|
|
</v-app-bar>
|
|
|
|
<v-main>
|
|
|
|
<v-container>
|
|
|
|
<nuxt />
|
|
|
|
</v-container>
|
|
|
|
</v-main>
|
2020-09-04 15:52:47 +00:00
|
|
|
<snackbar />
|
2020-09-02 18:34:50 +00:00
|
|
|
</v-app>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2020-09-04 15:28:33 +00:00
|
|
|
import Vue from 'vue';
|
2020-09-04 18:49:07 +00:00
|
|
|
import { BaseItemDto } from '~/api/api';
|
|
|
|
import { getLibraryIcon } from '~/utils/items';
|
2020-09-03 23:10:19 +00:00
|
|
|
|
|
|
|
interface NavigationDrawerItem {
|
|
|
|
icon: string | undefined | null;
|
|
|
|
title: string | undefined | null;
|
|
|
|
to: string;
|
|
|
|
}
|
2020-09-03 14:52:43 +00:00
|
|
|
|
2020-09-04 15:28:33 +00:00
|
|
|
export default Vue.extend({
|
2020-09-02 18:34:50 +00:00
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
items: [
|
|
|
|
{
|
|
|
|
icon: 'mdi-home',
|
|
|
|
title: 'Home',
|
|
|
|
to: '/'
|
|
|
|
}
|
|
|
|
],
|
2020-09-03 23:10:19 +00:00
|
|
|
configItems: [
|
|
|
|
{
|
|
|
|
icon: 'mdi-cog',
|
|
|
|
title: 'Settings',
|
|
|
|
to: '/settings'
|
|
|
|
}
|
|
|
|
],
|
|
|
|
clipped: true,
|
|
|
|
drawer: true,
|
|
|
|
libraries: {},
|
|
|
|
miniVariant: false,
|
2020-09-02 18:34:50 +00:00
|
|
|
title: 'Jellyfin'
|
|
|
|
};
|
2020-09-03 23:10:19 +00:00
|
|
|
},
|
|
|
|
async beforeMount() {
|
2020-09-04 12:53:43 +00:00
|
|
|
const userViewsRequest = await this.$userViewsApi.getUserViews({
|
2020-09-04 13:04:18 +00:00
|
|
|
userId: this.$auth.user.Id
|
2020-09-04 12:53:43 +00:00
|
|
|
});
|
2020-09-03 23:10:19 +00:00
|
|
|
|
2020-09-04 15:28:33 +00:00
|
|
|
let userViews: Array<NavigationDrawerItem> = [];
|
|
|
|
|
|
|
|
if (userViewsRequest.data.Items) {
|
|
|
|
userViews = userViewsRequest.data.Items.map(
|
|
|
|
(view: BaseItemDto): NavigationDrawerItem => {
|
|
|
|
return {
|
|
|
|
icon: getLibraryIcon(view.CollectionType),
|
|
|
|
title: view.Name,
|
|
|
|
to: `/library/${view.Id}`
|
|
|
|
};
|
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|
2020-09-03 23:10:19 +00:00
|
|
|
|
|
|
|
this.libraries = userViews;
|
2020-09-02 18:34:50 +00:00
|
|
|
}
|
2020-09-04 15:28:33 +00:00
|
|
|
});
|
2020-09-02 18:34:50 +00:00
|
|
|
</script>
|