forked from DebaucheryLibrarian/traxxx
190 lines
3.0 KiB
Vue
Executable File
190 lines
3.0 KiB
Vue
Executable File
<template>
|
|
<div class="menu">
|
|
<ul class="menu-items noselect">
|
|
<RouterLink
|
|
v-if="login && me"
|
|
:to="{ name: 'user', params: { username: me.username } }"
|
|
class="menu-username"
|
|
>{{ me.username }}</RouterLink>
|
|
|
|
<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"
|
|
:to="{ name: 'login', query: { ref: $route.path } }"
|
|
class="menu-item"
|
|
@click.stop
|
|
>
|
|
<Icon icon="enter2" />Log in
|
|
</RouterLink>
|
|
|
|
<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="events.emit('toggleSettings', true)"
|
|
>
|
|
<Icon icon="cog" />Settings
|
|
</li>
|
|
|
|
<li
|
|
v-if="login && me"
|
|
class="menu-item"
|
|
@click.stop="$store.dispatch('logout')"
|
|
>
|
|
<Icon icon="exit2" />Log out
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import { mapState } from 'vuex';
|
|
|
|
function sfw(state) {
|
|
return state.ui.sfw;
|
|
}
|
|
|
|
function theme(state) {
|
|
return state.ui.theme;
|
|
}
|
|
|
|
function login(state) {
|
|
return state.auth.login;
|
|
}
|
|
|
|
function signup(state) {
|
|
return state.auth.signup;
|
|
}
|
|
|
|
function favorites() {
|
|
return this.me?.stashes.find((stash) => stash.primary);
|
|
}
|
|
|
|
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({
|
|
login,
|
|
signup,
|
|
sfw,
|
|
theme,
|
|
me,
|
|
}),
|
|
favorites,
|
|
},
|
|
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;
|
|
color: var(--text);
|
|
text-decoration: none;
|
|
|
|
.icon {
|
|
fill: var(--shadow);
|
|
margin: 0 1rem 0 0;
|
|
}
|
|
|
|
&.disabled {
|
|
color: var(--shadow-weak);
|
|
cursor: default;
|
|
|
|
.icon {
|
|
fill: var(--shadow-weak);
|
|
}
|
|
}
|
|
|
|
&:hover:not(.disabled) {
|
|
cursor: pointer;
|
|
color: var(--primary);
|
|
|
|
.icon {
|
|
fill: var(--primary);
|
|
}
|
|
}
|
|
}
|
|
|
|
.menu-username {
|
|
display: block;
|
|
font-weight: bold;
|
|
color: var(--shadow-strong);
|
|
font-size: .9rem;
|
|
padding: .75rem 1rem;
|
|
border-bottom: solid 1px var(--shadow-hint);
|
|
text-align: center;
|
|
text-decoration: none;
|
|
}
|
|
</style>
|