Added favorites link to user menu.

This commit is contained in:
DebaucheryLibrarian 2021-09-12 00:33:24 +02:00
parent c21bd8b01e
commit 73a9a11aa6
2 changed files with 23 additions and 14 deletions

View File

@ -1,28 +1,26 @@
<template> <template>
<div class="menu"> <div class="menu">
<ul class="menu-items noselect"> <ul class="menu-items noselect">
<router-link <RouterLink
v-if="login && me" v-if="login && me"
:to="{ name: 'user', params: { username: me.username } }" :to="{ name: 'user', params: { username: me.username } }"
class="menu-username" class="menu-username"
>{{ me.username }}</router-link> >{{ me.username }}</RouterLink>
<router-link <RouterLink
v-if="me && favorites"
:to="{ name: 'stash', params: { stashId: favorites.id, range: 'scenes', pageNumber: 1 } }"
class="menu-item"
><Icon icon="heart7" />Favorites</RouterLink>
<RouterLink
v-else-if="login" v-else-if="login"
:to="{ name: 'login', query: { ref: $route.path } }" :to="{ name: 'login', query: { ref: $route.path } }"
class="menu-item" class="menu-item"
@click.stop @click.stop
> >
<Icon icon="enter2" />Log in <Icon icon="enter2" />Log in
</router-link> </RouterLink>
<li
v-if="login && me"
class="menu-item"
@click.stop="$store.dispatch('logout')"
>
<Icon icon="exit2" />Log out
</li>
<li <li
v-show="!sfw" v-show="!sfw"
@ -74,6 +72,14 @@
> >
<Icon icon="filter" />Filters <Icon icon="filter" />Filters
</li> </li>
<li
v-if="login && me"
class="menu-item"
@click.stop="$store.dispatch('logout')"
>
<Icon icon="exit2" />Log out
</li>
</ul> </ul>
</div> </div>
</template> </template>
@ -97,6 +103,10 @@ function signup(state) {
return state.auth.signup; return state.auth.signup;
} }
function favorites() {
return this.me?.stashes.find(stash => stash.primary);
}
function me(state) { function me(state) {
return state.auth.user; return state.auth.user;
} }
@ -118,6 +128,7 @@ export default {
theme, theme,
me, me,
}), }),
favorites,
}, },
emits: ['showFilters'], emits: ['showFilters'],
methods: { methods: {

View File

@ -114,8 +114,6 @@ async function fetchStash() {
limit: this.limit, limit: this.limit,
}); });
console.log(this.stash.movies);
this.isMine = this.stash.user?.id === this.$store.state.auth.user?.id; this.isMine = this.stash.user?.id === this.$store.state.auth.user?.id;
if (this.$route.params.range === 'scenes') { if (this.$route.params.range === 'scenes') {