2021-03-14 03:54:43 +00:00
|
|
|
<template>
|
|
|
|
<div class="menu">
|
|
|
|
<ul class="menu-items noselect">
|
2021-09-11 22:33:24 +00:00
|
|
|
<RouterLink
|
2021-06-27 22:05:24 +00:00
|
|
|
v-if="login && me"
|
2021-03-14 03:54:43 +00:00
|
|
|
:to="{ name: 'user', params: { username: me.username } }"
|
|
|
|
class="menu-username"
|
2021-09-11 22:33:24 +00:00
|
|
|
>{{ me.username }}</RouterLink>
|
2021-03-14 03:54:43 +00:00
|
|
|
|
2021-09-11 22:33:24 +00:00
|
|
|
<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
|
2021-06-27 22:05:24 +00:00
|
|
|
v-else-if="login"
|
2021-03-16 01:31:23 +00:00
|
|
|
:to="{ name: 'login', query: { ref: $route.path } }"
|
2021-03-14 03:54:43 +00:00
|
|
|
class="menu-item"
|
|
|
|
@click.stop
|
|
|
|
>
|
|
|
|
<Icon icon="enter2" />Log in
|
2021-09-11 22:33:24 +00:00
|
|
|
</RouterLink>
|
2021-03-14 03:54:43 +00:00
|
|
|
|
|
|
|
<li
|
|
|
|
v-show="!sfw"
|
|
|
|
class="menu-item"
|
|
|
|
@click.stop="setSfw(true)"
|
|
|
|
>
|
|
|
|
<Icon
|
|
|
|
icon="flower"
|
|
|
|
class="toggle noselect"
|
|
|
|
/>Safe mode
|
|
|
|
</li>
|
|
|
|
|
|
|
|
<li
|
|
|
|
v-show="sfw"
|
|
|
|
class="menu-item"
|
|
|
|
@click.stop="setSfw(false)"
|
|
|
|
>
|
|
|
|
<Icon
|
|
|
|
icon="fire"
|
|
|
|
class="toggle noselect"
|
|
|
|
/>Filth mode
|
|
|
|
</li>
|
|
|
|
|
|
|
|
<li
|
|
|
|
v-show="theme === 'light'"
|
|
|
|
class="menu-item"
|
|
|
|
@click.stop="setTheme('dark')"
|
|
|
|
>
|
|
|
|
<Icon
|
|
|
|
icon="moon"
|
|
|
|
class="toggle noselect"
|
|
|
|
/>Dark theme
|
|
|
|
</li>
|
|
|
|
|
|
|
|
<li
|
|
|
|
v-show="theme === 'dark'"
|
|
|
|
class="menu-item"
|
|
|
|
@click.stop="setTheme('light')"
|
|
|
|
>
|
|
|
|
<Icon
|
|
|
|
icon="sun"
|
|
|
|
class="toggle noselect"
|
|
|
|
/>Light theme
|
|
|
|
</li>
|
|
|
|
|
|
|
|
<li
|
|
|
|
class="menu-item"
|
|
|
|
@click="$emit('showFilters', true)"
|
|
|
|
>
|
|
|
|
<Icon icon="filter" />Filters
|
|
|
|
</li>
|
2021-09-11 22:33:24 +00:00
|
|
|
|
|
|
|
<li
|
|
|
|
v-if="login && me"
|
|
|
|
class="menu-item"
|
|
|
|
@click.stop="$store.dispatch('logout')"
|
|
|
|
>
|
|
|
|
<Icon icon="exit2" />Log out
|
|
|
|
</li>
|
2021-03-14 03:54:43 +00:00
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import { mapState } from 'vuex';
|
|
|
|
|
|
|
|
function sfw(state) {
|
|
|
|
return state.ui.sfw;
|
|
|
|
}
|
|
|
|
|
|
|
|
function theme(state) {
|
|
|
|
return state.ui.theme;
|
|
|
|
}
|
|
|
|
|
2021-06-27 22:05:24 +00:00
|
|
|
function login(state) {
|
|
|
|
return state.auth.login;
|
|
|
|
}
|
|
|
|
|
|
|
|
function signup(state) {
|
|
|
|
return state.auth.signup;
|
2021-03-16 03:12:05 +00:00
|
|
|
}
|
|
|
|
|
2021-09-11 22:33:24 +00:00
|
|
|
function favorites() {
|
|
|
|
return this.me?.stashes.find(stash => stash.primary);
|
|
|
|
}
|
|
|
|
|
2021-03-14 03:54:43 +00:00
|
|
|
function me(state) {
|
|
|
|
return state.auth.user;
|
|
|
|
}
|
|
|
|
|
|
|
|
function setTheme(newTheme) {
|
|
|
|
this.$store.dispatch('setTheme', newTheme);
|
|
|
|
}
|
|
|
|
|
|
|
|
function setSfw(enabled) {
|
|
|
|
this.$store.dispatch('setSfw', enabled);
|
|
|
|
}
|
|
|
|
|
|
|
|
export default {
|
|
|
|
computed: {
|
|
|
|
...mapState({
|
2021-06-27 22:05:24 +00:00
|
|
|
login,
|
|
|
|
signup,
|
2021-03-14 03:54:43 +00:00
|
|
|
sfw,
|
|
|
|
theme,
|
|
|
|
me,
|
|
|
|
}),
|
2021-09-11 22:33:24 +00:00
|
|
|
favorites,
|
2021-03-14 03:54:43 +00:00
|
|
|
},
|
2021-03-18 18:44:23 +00:00
|
|
|
emits: ['showFilters'],
|
2021-03-14 03:54:43 +00:00
|
|
|
methods: {
|
|
|
|
setSfw,
|
|
|
|
setTheme,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
@import 'breakpoints';
|
|
|
|
|
|
|
|
.menu-items {
|
|
|
|
list-style: none;
|
|
|
|
padding: 0;
|
|
|
|
margin: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
.menu-item {
|
|
|
|
display: flex;
|
|
|
|
padding: .75rem 1rem .75rem .75rem;
|
2021-03-23 19:37:20 +00:00
|
|
|
color: var(--text);
|
2021-03-14 03:54:43 +00:00
|
|
|
text-decoration: none;
|
|
|
|
|
|
|
|
.icon {
|
2021-03-23 19:37:20 +00:00
|
|
|
fill: var(--shadow);
|
2021-03-14 03:54:43 +00:00
|
|
|
margin: 0 1rem 0 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
&.disabled {
|
2021-03-23 19:37:20 +00:00
|
|
|
color: var(--shadow-weak);
|
2021-03-14 03:54:43 +00:00
|
|
|
cursor: default;
|
|
|
|
|
|
|
|
.icon {
|
2021-03-23 19:37:20 +00:00
|
|
|
fill: var(--shadow-weak);
|
2021-03-14 03:54:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
&:hover:not(.disabled) {
|
|
|
|
cursor: pointer;
|
|
|
|
color: var(--primary);
|
|
|
|
|
|
|
|
.icon {
|
|
|
|
fill: var(--primary);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.menu-username {
|
|
|
|
display: block;
|
|
|
|
font-weight: bold;
|
2021-03-23 19:37:20 +00:00
|
|
|
color: var(--shadow-strong);
|
2021-03-14 03:54:43 +00:00
|
|
|
font-size: .9rem;
|
|
|
|
padding: .75rem 1rem;
|
2021-03-23 19:37:20 +00:00
|
|
|
border-bottom: solid 1px var(--shadow-hint);
|
2021-03-14 03:54:43 +00:00
|
|
|
text-align: center;
|
|
|
|
text-decoration: none;
|
|
|
|
}
|
|
|
|
</style>
|