pleroma-fe/src/components/side_drawer/side_drawer.vue

307 lines
7.5 KiB
Vue
Raw Normal View History

<template>
2019-07-05 07:17:44 +00:00
<div
class="side-drawer-container"
:class="{ 'side-drawer-container-closed': closed, 'side-drawer-container-open': !closed }"
>
2019-07-05 07:17:44 +00:00
<div
class="side-drawer-darken"
:class="{ 'side-drawer-darken-closed': closed}"
/>
<div
class="side-drawer"
2018-12-23 18:14:40 +00:00
:class="{'side-drawer-closed': closed}"
@touchstart="touchStart"
@touchmove="touchMove"
2018-12-23 18:14:40 +00:00
>
2019-07-05 07:17:44 +00:00
<div
class="side-drawer-heading"
@click="toggleDrawer"
>
<UserCard
v-if="currentUser"
:user="currentUser"
:hide-bio="true"
/>
<div
v-else
class="side-drawer-logo-wrapper"
>
<img :src="logo">
<span v-if="!hideSitename">{{ sitename }}</span>
</div>
</div>
<ul>
2019-07-05 07:17:44 +00:00
<li
v-if="!currentUser"
@click="toggleDrawer"
>
<router-link :to="{ name: 'login' }">
2019-11-30 17:30:25 +00:00
<i class="button-icon icon-login" /> {{ $t("login.login") }}
</router-link>
2018-12-20 20:20:04 +00:00
</li>
2019-07-05 07:17:44 +00:00
<li
v-if="currentUser"
@click="toggleDrawer"
>
<router-link :to="{ name: 'dms', params: { username: currentUser.screen_name } }">
2019-11-30 17:30:25 +00:00
<i class="button-icon icon-mail-alt" /> {{ $t("nav.dms") }}
</router-link>
</li>
2019-07-05 07:17:44 +00:00
<li
v-if="currentUser"
@click="toggleDrawer"
>
<router-link :to="{ name: 'interactions', params: { username: currentUser.screen_name } }">
2019-11-30 17:30:25 +00:00
<i class="button-icon icon-bell-alt" /> {{ $t("nav.interactions") }}
</router-link>
</li>
</ul>
<ul>
2019-07-05 07:17:44 +00:00
<li
v-if="currentUser"
@click="toggleDrawer"
>
<router-link :to="{ name: 'friends' }">
2019-11-30 17:30:25 +00:00
<i class="button-icon icon-home-2" /> {{ $t("nav.timeline") }}
</router-link>
</li>
2019-07-05 07:17:44 +00:00
<li
v-if="currentUser && currentUser.locked"
@click="toggleDrawer"
>
<router-link to="/friend-requests">
2019-11-30 17:30:25 +00:00
<i class="button-icon icon-user-plus" /> {{ $t("nav.friend_requests") }}
2019-07-05 07:17:44 +00:00
<span
v-if="followRequestCount > 0"
class="badge follow-request-count"
>
{{ followRequestCount }}
</span>
</router-link>
</li>
2019-12-12 19:46:07 +00:00
<li
v-if="currentUser || !privateMode"
@click="toggleDrawer"
>
2019-07-05 07:17:44 +00:00
<router-link to="/main/public">
2019-11-30 17:30:25 +00:00
<i class="button-icon icon-users" /> {{ $t("nav.public_tl") }}
</router-link>
</li>
2019-12-12 19:46:07 +00:00
<li
v-if="federating && !privateMode"
2019-12-12 19:46:07 +00:00
@click="toggleDrawer"
>
2019-07-05 07:17:44 +00:00
<router-link to="/main/all">
2019-11-30 17:30:25 +00:00
<i class="button-icon icon-globe" /> {{ $t("nav.twkn") }}
</router-link>
</li>
2019-07-05 07:17:44 +00:00
<li
v-if="currentUser && chat"
@click="toggleDrawer"
>
<router-link :to="{ name: 'chat' }">
2019-11-30 17:30:25 +00:00
<i class="button-icon icon-chat" /> {{ $t("nav.chat") }}
</router-link>
</li>
</ul>
<ul>
2019-12-12 19:46:07 +00:00
<li
v-if="currentUser || !privateMode"
@click="toggleDrawer"
>
2019-07-15 16:42:27 +00:00
<router-link :to="{ name: 'search' }">
2019-11-30 17:30:25 +00:00
<i class="button-icon icon-search" /> {{ $t("nav.search") }}
</router-link>
</li>
2019-07-05 07:17:44 +00:00
<li
v-if="currentUser && suggestionsEnabled"
@click="toggleDrawer"
>
2019-01-16 02:33:08 +00:00
<router-link :to="{ name: 'who-to-follow' }">
2019-11-30 17:30:25 +00:00
<i class="button-icon icon-user-plus" /> {{ $t("nav.who_to_follow") }}
2019-01-16 02:33:08 +00:00
</router-link>
</li>
<li @click="toggleDrawer">
2019-01-16 02:33:08 +00:00
<router-link :to="{ name: 'settings' }">
2019-11-30 17:30:25 +00:00
<i class="button-icon icon-cog" /> {{ $t("settings.settings") }}
2018-12-22 15:32:07 +00:00
</router-link>
</li>
<li @click="toggleDrawer">
<router-link :to="{ name: 'about'}">
2019-11-30 17:30:25 +00:00
<i class="button-icon icon-info-circled" /> {{ $t("nav.about") }}
</router-link>
</li>
2019-09-14 17:53:03 +00:00
<li
v-if="currentUser && currentUser.role === 'admin'"
@click="toggleDrawer"
>
2019-09-16 12:03:10 +00:00
<a
2019-10-02 17:28:16 +00:00
href="/pleroma/admin/#/login-pleroma"
2019-09-16 12:03:10 +00:00
target="_blank"
>
2019-11-30 17:30:25 +00:00
<i class="button-icon icon-gauge" /> {{ $t("nav.administration") }}
2019-09-14 17:53:03 +00:00
</a>
</li>
2019-07-05 07:17:44 +00:00
<li
v-if="currentUser"
@click="toggleDrawer"
>
<a
href="#"
@click="doLogout"
>
2019-11-30 17:30:25 +00:00
<i class="button-icon icon-logout" /> {{ $t("login.logout") }}
2018-12-22 15:32:07 +00:00
</a>
</li>
</ul>
</div>
2019-07-05 07:17:44 +00:00
<div
class="side-drawer-click-outside"
:class="{'side-drawer-click-outside-closed': closed}"
2019-07-05 07:17:44 +00:00
@click.stop.prevent="toggleDrawer"
/>
</div>
</template>
<script src="./side_drawer.js" ></script>
<style lang="scss">
@import '../../_variables.scss';
2018-12-20 20:20:04 +00:00
.side-drawer-container {
position: fixed;
z-index: 1000;
top: 0;
left: 0;
width: 100%;
height: 100%;
display: flex;
align-items: stretch;
transition-duration: 0s;
transition-property: transform;
2018-12-20 20:20:04 +00:00
}
.side-drawer-container-open {
transform: translate(0%);
}
.side-drawer-container-closed {
transition-delay: 0.35s;
transform: translate(-100%);
}
.side-drawer-darken {
top: 0;
left: 0;
width: 100vw;
height: 100vh;
position: fixed;
z-index: -1;
transition: 0.35s;
transition-property: background-color;
background-color: rgba(0, 0, 0, 0.5);
2018-12-20 20:20:04 +00:00
}
.side-drawer-darken-closed {
background-color: rgba(0, 0, 0, 0);
2018-12-20 20:20:04 +00:00
}
.side-drawer-click-outside {
flex: 1 1 100%;
}
.side-drawer {
overflow-x: hidden;
transition-timing-function: cubic-bezier(0, 1, 0.5, 1);
transition: 0.35s;
transition-property: transform;
2018-12-20 20:20:04 +00:00
margin: 0 0 0 -100px;
padding: 0 0 1em 100px;
width: 80%;
max-width: 20em;
flex: 0 0 80%;
box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.6);
box-shadow: var(--panelShadow);
background-color: $fallback--bg;
2020-01-23 22:02:16 +00:00
background-color: var(--popover, $fallback--bg);
color: $fallback--link;
color: var(--popoverText, $fallback--link);
--faint: var(--popoverFaintText, $fallback--faint);
--faintLink: var(--popoverFaintLink, $fallback--faint);
--icon: var(--popoverIcon, $fallback--icon);
.button-icon:before {
width: 1.1em;
}
2019-02-04 18:34:07 +00:00
}
2019-02-04 18:34:07 +00:00
.side-drawer-logo-wrapper {
display: flex;
align-items: center;
padding: 0.85em;
2019-02-04 18:34:07 +00:00
img {
flex: none;
height: 50px;
margin-right: 0.85em;
}
2019-02-04 18:34:07 +00:00
span {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
2018-12-20 20:20:04 +00:00
}
.side-drawer-click-outside-closed {
flex: 0 0 0;
}
.side-drawer-closed {
transform: translate(-100%);
}
.side-drawer-heading {
background: transparent;
flex-direction: column;
align-items: stretch;
display: flex;
padding: 0;
margin: 0;
}
.side-drawer ul {
list-style: none;
margin: 0;
padding: 0;
border-bottom: 1px solid;
border-color: $fallback--border;
border-color: var(--border, $fallback--border);
margin: 0.2em 0;
}
.side-drawer ul:last-child {
border: 0;
}
.side-drawer li {
padding: 0;
a {
display: block;
padding: 0.5em 0.85em;
&:hover {
background-color: $fallback--lightBg;
2020-01-13 18:40:16 +00:00
background-color: var(--selectedMenu, $fallback--lightBg);
color: $fallback--text;
2020-01-13 18:40:16 +00:00
color: var(--selectedMenuText, $fallback--text);
--faint: var(--selectedMenuFaintText, $fallback--faint);
--faintLink: var(--selectedMenuFaintLink, $fallback--faint);
--icon: var(--selectedMenuIcon, $fallback--icon);
}
}
}
</style>