2020-07-10 20:13:11 -05:00
|
|
|
<template>
|
|
|
|
<div class="mvcprjjd">
|
|
|
|
<transition name="nav-back">
|
2020-07-12 04:14:59 -05:00
|
|
|
<div class="nav-back _modalBg"
|
2020-07-10 20:13:11 -05:00
|
|
|
v-if="showing"
|
|
|
|
@click="showing = false"
|
2020-10-17 06:12:00 -05:00
|
|
|
@touchstart.passive="showing = false"
|
2020-07-10 20:13:11 -05:00
|
|
|
></div>
|
|
|
|
</transition>
|
|
|
|
|
|
|
|
<transition name="nav">
|
2020-07-31 20:53:23 -05:00
|
|
|
<nav class="nav" :class="{ iconOnly, hidden }" v-show="showing">
|
2020-07-10 20:13:11 -05:00
|
|
|
<div>
|
2021-09-20 14:13:54 -05:00
|
|
|
<button class="item _button account" @click="openAccountMenu" v-click-anime>
|
2020-12-18 19:55:52 -06:00
|
|
|
<MkAvatar :user="$i" class="avatar"/><MkAcct class="text" :user="$i"/>
|
2020-07-10 20:13:11 -05:00
|
|
|
</button>
|
2021-09-20 14:13:54 -05:00
|
|
|
<MkA class="item index" active-class="active" to="/" exact v-click-anime>
|
2021-04-20 09:22:59 -05:00
|
|
|
<i class="fas fa-home fa-fw"></i><span class="text">{{ $ts.timeline }}</span>
|
2020-10-24 11:21:41 -05:00
|
|
|
</MkA>
|
2020-07-10 20:13:11 -05:00
|
|
|
<template v-for="item in menu">
|
|
|
|
<div v-if="item === '-'" class="divider"></div>
|
2021-09-21 07:04:59 -05:00
|
|
|
<component v-else-if="menuDef[item] && (menuDef[item].show !== false)" :is="menuDef[item].to ? 'MkA' : 'button'" class="item _button" :class="[item, { active: menuDef[item].active }]" active-class="active" v-on="menuDef[item].action ? { click: menuDef[item].action } : {}" :to="menuDef[item].to" v-click-anime>
|
2021-04-20 09:22:59 -05:00
|
|
|
<i class="fa-fw" :class="menuDef[item].icon"></i><span class="text">{{ $ts[menuDef[item].title] }}</span>
|
|
|
|
<span v-if="menuDef[item].indicated" class="indicator"><i class="fas fa-circle"></i></span>
|
2020-07-10 20:13:11 -05:00
|
|
|
</component>
|
|
|
|
</template>
|
|
|
|
<div class="divider"></div>
|
2021-10-22 03:37:51 -05:00
|
|
|
<MkA v-if="$i.isAdmin || $i.isModerator" class="item" active-class="active" to="/admin" v-click-anime>
|
2021-10-24 06:16:55 -05:00
|
|
|
<i class="fas fa-door-open fa-fw"></i><span class="text">{{ $ts.controlPanel }}</span>
|
2021-04-22 08:29:33 -05:00
|
|
|
</MkA>
|
2021-09-20 14:13:54 -05:00
|
|
|
<button class="item _button" @click="more" v-click-anime>
|
2021-04-20 09:22:59 -05:00
|
|
|
<i class="fa fa-ellipsis-h fa-fw"></i><span class="text">{{ $ts.more }}</span>
|
|
|
|
<span v-if="otherNavItemIndicated" class="indicator"><i class="fas fa-circle"></i></span>
|
2020-07-10 20:13:11 -05:00
|
|
|
</button>
|
2021-09-20 14:13:54 -05:00
|
|
|
<MkA class="item" active-class="active" to="/settings" v-click-anime>
|
2021-04-20 09:22:59 -05:00
|
|
|
<i class="fas fa-cog fa-fw"></i><span class="text">{{ $ts.settings }}</span>
|
2020-10-24 11:21:41 -05:00
|
|
|
</MkA>
|
2021-10-27 10:57:49 -05:00
|
|
|
<button class="item _button post" @click="post" data-cy-open-post-form>
|
2021-04-20 09:22:59 -05:00
|
|
|
<i class="fas fa-pencil-alt fa-fw"></i><span class="text">{{ $ts.note }}</span>
|
2020-12-26 19:42:38 -06:00
|
|
|
</button>
|
2020-07-10 20:13:11 -05:00
|
|
|
</div>
|
|
|
|
</nav>
|
|
|
|
</transition>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2020-10-17 06:12:00 -05:00
|
|
|
import { defineComponent } from 'vue';
|
2021-03-23 03:30:14 -05:00
|
|
|
import { host } from '@client/config';
|
|
|
|
import { search } from '@client/scripts/search';
|
|
|
|
import * as os from '@client/os';
|
2021-07-18 21:36:35 -05:00
|
|
|
import { menuDef } from '@client/menu';
|
2021-10-10 01:19:16 -05:00
|
|
|
import { openAccountMenu } from '@client/account';
|
2020-07-10 20:13:11 -05:00
|
|
|
|
2020-10-17 06:12:00 -05:00
|
|
|
export default defineComponent({
|
2021-02-14 07:26:07 -06:00
|
|
|
props: {
|
|
|
|
defaultHidden: {
|
|
|
|
type: Boolean,
|
|
|
|
required: false,
|
|
|
|
default: false,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2020-07-10 20:13:11 -05:00
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
host: host,
|
|
|
|
showing: false,
|
|
|
|
accounts: [],
|
|
|
|
connection: null,
|
2021-07-18 21:36:35 -05:00
|
|
|
menuDef: menuDef,
|
2020-07-31 20:53:23 -05:00
|
|
|
iconOnly: false,
|
2021-02-14 07:26:07 -06:00
|
|
|
hidden: this.defaultHidden,
|
2020-07-10 20:13:11 -05:00
|
|
|
};
|
|
|
|
},
|
|
|
|
|
|
|
|
computed: {
|
|
|
|
menu(): string[] {
|
2020-12-18 19:55:52 -06:00
|
|
|
return this.$store.state.menu;
|
2020-07-10 20:13:11 -05:00
|
|
|
},
|
|
|
|
|
|
|
|
otherNavItemIndicated(): boolean {
|
|
|
|
for (const def in this.menuDef) {
|
|
|
|
if (this.menu.includes(def)) continue;
|
|
|
|
if (this.menuDef[def].indicated) return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
watch: {
|
|
|
|
$route(to, from) {
|
|
|
|
this.showing = false;
|
|
|
|
},
|
2020-07-31 20:53:23 -05:00
|
|
|
|
2021-07-18 21:36:35 -05:00
|
|
|
'$store.reactiveState.menuDisplay.value'() {
|
2020-07-31 20:53:23 -05:00
|
|
|
this.calcViewState();
|
|
|
|
},
|
|
|
|
|
|
|
|
iconOnly() {
|
|
|
|
this.$nextTick(() => {
|
|
|
|
this.$emit('change-view-mode');
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
hidden() {
|
|
|
|
this.$nextTick(() => {
|
|
|
|
this.$emit('change-view-mode');
|
|
|
|
});
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
created() {
|
|
|
|
window.addEventListener('resize', this.calcViewState);
|
|
|
|
this.calcViewState();
|
2020-07-10 20:13:11 -05:00
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
2020-07-31 20:53:23 -05:00
|
|
|
calcViewState() {
|
2021-07-18 21:36:35 -05:00
|
|
|
this.iconOnly = (window.innerWidth <= 1279) || (this.$store.state.menuDisplay === 'sideIcon');
|
2021-02-14 07:26:07 -06:00
|
|
|
if (!this.defaultHidden) {
|
|
|
|
this.hidden = (window.innerWidth <= 650);
|
|
|
|
}
|
2020-07-31 20:53:23 -05:00
|
|
|
},
|
|
|
|
|
2020-07-10 20:13:11 -05:00
|
|
|
show() {
|
|
|
|
this.showing = true;
|
|
|
|
},
|
|
|
|
|
2020-12-26 19:42:38 -06:00
|
|
|
post() {
|
|
|
|
os.post();
|
|
|
|
},
|
|
|
|
|
2020-07-10 20:13:11 -05:00
|
|
|
search() {
|
2021-01-03 08:58:24 -06:00
|
|
|
search();
|
2020-07-10 20:13:11 -05:00
|
|
|
},
|
|
|
|
|
|
|
|
more(ev) {
|
2021-04-09 22:40:50 -05:00
|
|
|
os.popup(import('@client/components/launch-pad.vue'), {}, {
|
2020-11-17 07:52:07 -06:00
|
|
|
}, 'closed');
|
2020-07-10 20:13:11 -05:00
|
|
|
},
|
|
|
|
|
2021-10-10 01:19:16 -05:00
|
|
|
openAccountMenu,
|
2020-07-10 20:13:11 -05:00
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.nav-enter-active,
|
|
|
|
.nav-leave-active {
|
|
|
|
opacity: 1;
|
|
|
|
transform: translateX(0);
|
|
|
|
transition: transform 300ms cubic-bezier(0.23, 1, 0.32, 1), opacity 300ms cubic-bezier(0.23, 1, 0.32, 1);
|
|
|
|
}
|
2020-10-17 06:12:00 -05:00
|
|
|
.nav-enter-from,
|
2020-07-10 20:13:11 -05:00
|
|
|
.nav-leave-active {
|
|
|
|
opacity: 0;
|
|
|
|
transform: translateX(-240px);
|
|
|
|
}
|
|
|
|
|
|
|
|
.nav-back-enter-active,
|
|
|
|
.nav-back-leave-active {
|
|
|
|
opacity: 1;
|
|
|
|
transition: opacity 300ms cubic-bezier(0.23, 1, 0.32, 1);
|
|
|
|
}
|
2020-10-17 06:12:00 -05:00
|
|
|
.nav-back-enter-from,
|
2020-07-10 20:13:11 -05:00
|
|
|
.nav-back-leave-active {
|
|
|
|
opacity: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
.mvcprjjd {
|
|
|
|
$ui-font-size: 1em; // TODO: どこかに集約したい
|
2020-07-31 20:53:23 -05:00
|
|
|
$nav-width: 250px;
|
2020-12-11 22:09:40 -06:00
|
|
|
$nav-icon-only-width: 86px;
|
2020-07-10 20:13:11 -05:00
|
|
|
|
|
|
|
> .nav-back {
|
|
|
|
z-index: 1001;
|
|
|
|
}
|
|
|
|
|
|
|
|
> .nav {
|
|
|
|
$avatar-size: 32px;
|
|
|
|
$avatar-margin: 8px;
|
|
|
|
|
|
|
|
flex: 0 0 $nav-width;
|
|
|
|
width: $nav-width;
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
2020-07-31 20:53:23 -05:00
|
|
|
&.iconOnly {
|
2020-07-10 20:13:11 -05:00
|
|
|
flex: 0 0 $nav-icon-only-width;
|
|
|
|
width: $nav-icon-only-width;
|
2020-07-31 20:53:23 -05:00
|
|
|
|
|
|
|
&:not(.hidden) {
|
|
|
|
> div {
|
|
|
|
width: $nav-icon-only-width;
|
|
|
|
|
|
|
|
> .divider {
|
|
|
|
margin: 8px auto;
|
|
|
|
width: calc(100% - 32px);
|
|
|
|
}
|
|
|
|
|
|
|
|
> .item {
|
|
|
|
padding-left: 0;
|
2021-09-22 07:42:07 -05:00
|
|
|
padding: 18px 0;
|
2020-07-31 20:53:23 -05:00
|
|
|
width: 100%;
|
|
|
|
text-align: center;
|
2020-08-01 02:39:48 -05:00
|
|
|
font-size: $ui-font-size * 1.1;
|
2021-09-20 12:01:25 -05:00
|
|
|
line-height: initial;
|
2020-07-31 20:53:23 -05:00
|
|
|
|
2021-04-20 09:22:59 -05:00
|
|
|
> i,
|
2020-07-31 20:53:23 -05:00
|
|
|
> .avatar {
|
2021-09-20 12:01:25 -05:00
|
|
|
display: block;
|
|
|
|
margin: 0 auto;
|
2020-07-31 20:53:23 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
> i {
|
2021-09-20 12:01:25 -05:00
|
|
|
opacity: 0.7;
|
2020-07-31 20:53:23 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
> .text {
|
2021-09-22 07:42:07 -05:00
|
|
|
display: none;
|
2021-09-20 12:01:25 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
&:hover, &.active {
|
|
|
|
> i, > .text {
|
|
|
|
opacity: 1;
|
|
|
|
}
|
2020-07-31 20:53:23 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
&:first-child {
|
|
|
|
margin-bottom: 8px;
|
|
|
|
}
|
|
|
|
|
|
|
|
&:last-child {
|
|
|
|
margin-top: 8px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-07-10 20:13:11 -05:00
|
|
|
}
|
|
|
|
|
2020-07-31 20:53:23 -05:00
|
|
|
&.hidden {
|
2020-07-10 20:13:11 -05:00
|
|
|
position: fixed;
|
|
|
|
top: 0;
|
|
|
|
left: 0;
|
|
|
|
z-index: 1001;
|
|
|
|
}
|
|
|
|
|
2020-07-31 20:53:23 -05:00
|
|
|
&:not(.hidden) {
|
2020-07-10 20:13:11 -05:00
|
|
|
display: block !important;
|
|
|
|
}
|
|
|
|
|
|
|
|
> div {
|
|
|
|
position: fixed;
|
|
|
|
top: 0;
|
|
|
|
left: 0;
|
|
|
|
z-index: 1001;
|
|
|
|
width: $nav-width;
|
2020-07-15 04:22:19 -05:00
|
|
|
// ほんとは単に 100vh と書きたいところだが... https://css-tricks.com/the-trick-to-viewport-units-on-mobile/
|
|
|
|
height: calc(var(--vh, 1vh) * 100);
|
2020-07-10 20:13:11 -05:00
|
|
|
box-sizing: border-box;
|
|
|
|
overflow: auto;
|
2021-09-20 14:13:54 -05:00
|
|
|
overflow-x: clip;
|
2020-07-10 20:13:11 -05:00
|
|
|
background: var(--navBg);
|
|
|
|
|
|
|
|
> .divider {
|
2021-09-20 12:01:25 -05:00
|
|
|
margin: 16px 16px;
|
2021-04-09 22:40:50 -05:00
|
|
|
border-top: solid 0.5px var(--divider);
|
2020-07-10 20:13:11 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
> .item {
|
|
|
|
position: relative;
|
|
|
|
display: block;
|
2020-10-31 22:32:34 -05:00
|
|
|
padding-left: 24px;
|
2020-07-10 20:13:11 -05:00
|
|
|
font-size: $ui-font-size;
|
2021-09-20 12:01:25 -05:00
|
|
|
line-height: 2.85rem;
|
2020-07-10 20:13:11 -05:00
|
|
|
text-overflow: ellipsis;
|
2021-03-02 07:57:16 -06:00
|
|
|
overflow: hidden;
|
2020-07-10 20:13:11 -05:00
|
|
|
white-space: nowrap;
|
|
|
|
width: 100%;
|
|
|
|
text-align: left;
|
|
|
|
box-sizing: border-box;
|
|
|
|
color: var(--navFg);
|
|
|
|
|
2021-04-20 09:22:59 -05:00
|
|
|
> i {
|
2021-09-20 12:01:25 -05:00
|
|
|
position: relative;
|
2020-07-10 20:13:11 -05:00
|
|
|
width: 32px;
|
|
|
|
}
|
|
|
|
|
2021-04-20 09:22:59 -05:00
|
|
|
> i,
|
2020-07-10 20:13:11 -05:00
|
|
|
> .avatar {
|
|
|
|
margin-right: $avatar-margin;
|
|
|
|
}
|
|
|
|
|
|
|
|
> .avatar {
|
|
|
|
width: $avatar-size;
|
|
|
|
height: $avatar-size;
|
|
|
|
vertical-align: middle;
|
|
|
|
}
|
|
|
|
|
2021-04-20 09:22:59 -05:00
|
|
|
> .indicator {
|
2020-07-10 20:13:11 -05:00
|
|
|
position: absolute;
|
|
|
|
top: 0;
|
|
|
|
left: 20px;
|
|
|
|
color: var(--navIndicator);
|
|
|
|
font-size: 8px;
|
|
|
|
animation: blink 1s infinite;
|
|
|
|
}
|
|
|
|
|
2021-09-20 12:01:25 -05:00
|
|
|
> .text {
|
|
|
|
position: relative;
|
|
|
|
font-size: 0.9em;
|
|
|
|
}
|
|
|
|
|
2020-07-10 20:13:11 -05:00
|
|
|
&:hover {
|
|
|
|
text-decoration: none;
|
|
|
|
color: var(--navHoverFg);
|
|
|
|
}
|
|
|
|
|
|
|
|
&.active {
|
|
|
|
color: var(--navActive);
|
|
|
|
}
|
|
|
|
|
2021-09-20 12:01:25 -05:00
|
|
|
&:hover, &.active {
|
|
|
|
&:before {
|
|
|
|
content: "";
|
|
|
|
display: block;
|
2021-09-20 14:09:28 -05:00
|
|
|
width: calc(100% - 24px);
|
2021-09-20 12:01:25 -05:00
|
|
|
height: 100%;
|
|
|
|
margin: auto;
|
|
|
|
position: absolute;
|
|
|
|
top: 0;
|
|
|
|
left: 0;
|
|
|
|
right: 0;
|
|
|
|
bottom: 0;
|
2021-09-29 10:50:45 -05:00
|
|
|
border-radius: 999px;
|
2021-09-20 12:01:25 -05:00
|
|
|
background: var(--accentedBg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-07-10 20:13:11 -05:00
|
|
|
&:first-child, &:last-child {
|
|
|
|
position: sticky;
|
|
|
|
z-index: 1;
|
|
|
|
padding-top: 8px;
|
|
|
|
padding-bottom: 8px;
|
|
|
|
background: var(--X14);
|
2021-08-11 08:34:45 -05:00
|
|
|
-webkit-backdrop-filter: var(--blur, blur(8px));
|
|
|
|
backdrop-filter: var(--blur, blur(8px));
|
2020-07-10 20:13:11 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
&:first-child {
|
|
|
|
top: 0;
|
2021-09-20 12:01:25 -05:00
|
|
|
|
|
|
|
&:hover, &.active {
|
|
|
|
&:before {
|
|
|
|
content: none;
|
|
|
|
}
|
|
|
|
}
|
2020-07-10 20:13:11 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
&:last-child {
|
|
|
|
bottom: 0;
|
2021-09-20 12:01:25 -05:00
|
|
|
color: var(--fgOnAccent);
|
|
|
|
|
|
|
|
&:before {
|
|
|
|
content: "";
|
|
|
|
display: block;
|
|
|
|
width: calc(100% - 20px);
|
|
|
|
height: calc(100% - 20px);
|
|
|
|
margin: auto;
|
|
|
|
position: absolute;
|
|
|
|
top: 0;
|
|
|
|
left: 0;
|
|
|
|
right: 0;
|
|
|
|
bottom: 0;
|
|
|
|
border-radius: 999px;
|
2021-10-13 11:27:45 -05:00
|
|
|
background: linear-gradient(90deg, var(--buttonGradateA), var(--buttonGradateB));
|
2021-09-20 12:01:25 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
&:hover, &.active {
|
|
|
|
&:before {
|
|
|
|
background: var(--accentLighten);
|
|
|
|
}
|
|
|
|
}
|
2020-07-10 20:13:11 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|