2018-10-14 19:44:30 +09:00
|
|
|
<template>
|
2018-10-15 05:28:35 +09:00
|
|
|
<div class="header" :class="navbar">
|
|
|
|
<div class="body">
|
|
|
|
<div class="post">
|
2018-11-09 03:44:35 +09:00
|
|
|
<button @click="post" :title="$t('title')"><fa icon="pencil-alt"/></button>
|
2018-10-14 19:44:30 +09:00
|
|
|
</div>
|
|
|
|
|
2018-10-15 05:28:35 +09:00
|
|
|
<div class="nav" v-if="$store.getters.isSignedIn">
|
2018-10-19 11:10:49 +09:00
|
|
|
<template v-if="$store.state.device.deckDefault">
|
|
|
|
<div class="deck" :class="{ active: $route.name == 'deck' || $route.name == 'index' }" @click="goToTop">
|
2018-11-06 01:40:11 +09:00
|
|
|
<router-link to="/"><fa icon="columns"/></router-link>
|
2018-10-19 11:10:49 +09:00
|
|
|
</div>
|
|
|
|
<div class="home" :class="{ active: $route.name == 'home' }" @click="goToTop">
|
2018-11-06 01:40:11 +09:00
|
|
|
<router-link to="/home"><fa icon="home"/></router-link>
|
2018-10-19 11:10:49 +09:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
<template v-else>
|
|
|
|
<div class="home" :class="{ active: $route.name == 'home' || $route.name == 'index' }" @click="goToTop">
|
2018-11-06 01:40:11 +09:00
|
|
|
<router-link to="/"><fa icon="home"/></router-link>
|
2018-10-19 11:10:49 +09:00
|
|
|
</div>
|
|
|
|
<div class="deck" :class="{ active: $route.name == 'deck' }" @click="goToTop">
|
2018-11-06 01:40:11 +09:00
|
|
|
<router-link to="/deck"><fa icon="columns"/></router-link>
|
2018-10-19 11:10:49 +09:00
|
|
|
</div>
|
|
|
|
</template>
|
2018-10-15 05:28:35 +09:00
|
|
|
<div class="messaging">
|
2018-11-06 01:40:11 +09:00
|
|
|
<a @click="messaging"><fa icon="comments"/><template v-if="hasUnreadMessagingMessage"><fa icon="circle"/></template></a>
|
2018-10-15 05:28:35 +09:00
|
|
|
</div>
|
|
|
|
<div class="game">
|
2018-11-06 01:40:11 +09:00
|
|
|
<a @click="game"><fa icon="gamepad"/><template v-if="hasGameInvitations"><fa icon="circle"/></template></a>
|
2018-10-15 05:28:35 +09:00
|
|
|
</div>
|
2018-10-14 19:44:30 +09:00
|
|
|
</div>
|
2018-10-15 05:18:39 +09:00
|
|
|
|
2018-10-15 05:28:35 +09:00
|
|
|
<div class="nav bottom" v-if="$store.getters.isSignedIn">
|
|
|
|
<div>
|
2018-11-06 01:40:11 +09:00
|
|
|
<a @click="drive"><fa icon="cloud"/></a>
|
2018-10-15 05:28:35 +09:00
|
|
|
</div>
|
|
|
|
<div ref="notificationsButton" :class="{ active: showNotifications }">
|
2018-11-06 01:40:11 +09:00
|
|
|
<a @click="notifications"><fa :icon="['far', 'bell']"/></a>
|
2018-10-15 05:18:39 +09:00
|
|
|
</div>
|
|
|
|
<div>
|
2018-11-06 01:40:11 +09:00
|
|
|
<a @click="settings"><fa icon="cog"/></a>
|
2018-10-15 05:18:39 +09:00
|
|
|
</div>
|
2018-10-15 05:28:35 +09:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="account">
|
|
|
|
<router-link :to="`/@${ $store.state.i.username }`">
|
|
|
|
<mk-avatar class="avatar" :user="$store.state.i"/>
|
|
|
|
</router-link>
|
|
|
|
|
|
|
|
<div class="nav menu">
|
|
|
|
<div class="signout">
|
2018-11-06 01:40:11 +09:00
|
|
|
<a @click="signout"><fa icon="power-off"/></a>
|
2018-10-15 05:28:35 +09:00
|
|
|
</div>
|
|
|
|
<div>
|
2018-11-06 01:40:11 +09:00
|
|
|
<router-link to="/i/favorites"><fa icon="star"/></router-link>
|
2018-10-15 05:28:35 +09:00
|
|
|
</div>
|
|
|
|
<div v-if="($store.state.i.isLocked || $store.state.i.carefulBot)">
|
2018-11-06 01:40:11 +09:00
|
|
|
<a @click="followRequests"><fa :icon="['far', 'envelope']"/><i v-if="$store.state.i.pendingReceivedFollowRequestsCount">{{ $store.state.i.pendingReceivedFollowRequestsCount }}</i></a>
|
2018-10-15 05:28:35 +09:00
|
|
|
</div>
|
2018-10-15 05:18:39 +09:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2018-10-15 05:28:35 +09:00
|
|
|
<div class="nav dark">
|
|
|
|
<div>
|
2018-11-06 01:40:11 +09:00
|
|
|
<a @click="dark"><template v-if="$store.state.device.darkmode"><fa icon="moon"/></template><template v-else><fa :icon="['far', 'moon']"/></template></a>
|
2018-10-15 05:28:35 +09:00
|
|
|
</div>
|
2018-10-15 05:18:39 +09:00
|
|
|
</div>
|
2018-10-14 19:44:30 +09:00
|
|
|
</div>
|
2018-10-15 05:18:39 +09:00
|
|
|
|
2018-10-15 05:28:35 +09:00
|
|
|
<transition :name="`slide-${navbar}`">
|
|
|
|
<div class="notifications" v-if="showNotifications" ref="notifications" :class="navbar">
|
2018-10-15 05:18:39 +09:00
|
|
|
<mk-notifications/>
|
|
|
|
</div>
|
|
|
|
</transition>
|
2018-10-14 19:44:30 +09:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import Vue from 'vue';
|
2018-11-09 03:44:35 +09:00
|
|
|
import i18n from '../../../i18n';
|
2018-10-14 19:44:30 +09:00
|
|
|
import MkUserListsWindow from './user-lists-window.vue';
|
|
|
|
import MkFollowRequestsWindow from './received-follow-requests-window.vue';
|
|
|
|
import MkSettingsWindow from './settings-window.vue';
|
|
|
|
import MkDriveWindow from './drive-window.vue';
|
|
|
|
import MkMessagingWindow from './messaging-window.vue';
|
|
|
|
import MkGameWindow from './game-window.vue';
|
2018-10-15 05:18:39 +09:00
|
|
|
import contains from '../../../common/scripts/contains';
|
2018-10-14 19:44:30 +09:00
|
|
|
|
|
|
|
export default Vue.extend({
|
2018-11-09 03:44:35 +09:00
|
|
|
i18n: i18n('desktop/views/components/ui.sidebar.vue'),
|
2018-10-14 19:44:30 +09:00
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
hasGameInvitations: false,
|
2018-10-15 05:18:39 +09:00
|
|
|
connection: null,
|
|
|
|
showNotifications: false
|
2018-10-14 19:44:30 +09:00
|
|
|
};
|
|
|
|
},
|
|
|
|
|
|
|
|
computed: {
|
|
|
|
hasUnreadMessagingMessage(): boolean {
|
|
|
|
return this.$store.getters.isSignedIn && this.$store.state.i.hasUnreadMessagingMessage;
|
2018-10-15 05:28:35 +09:00
|
|
|
},
|
|
|
|
|
|
|
|
navbar(): string {
|
|
|
|
return this.$store.state.device.navbar;
|
|
|
|
},
|
2018-10-14 19:44:30 +09:00
|
|
|
},
|
|
|
|
|
|
|
|
mounted() {
|
|
|
|
if (this.$store.getters.isSignedIn) {
|
2018-11-09 08:13:34 +09:00
|
|
|
this.connection = this.$root.stream.useSharedConnection('main');
|
2018-10-14 19:44:30 +09:00
|
|
|
|
|
|
|
this.connection.on('reversiInvited', this.onReversiInvited);
|
|
|
|
this.connection.on('reversi_no_invites', this.onReversiNoInvites);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
beforeDestroy() {
|
|
|
|
if (this.$store.getters.isSignedIn) {
|
|
|
|
this.connection.dispose();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
onReversiInvited() {
|
|
|
|
this.hasGameInvitations = true;
|
|
|
|
},
|
|
|
|
|
|
|
|
onReversiNoInvites() {
|
|
|
|
this.hasGameInvitations = false;
|
|
|
|
},
|
|
|
|
|
|
|
|
messaging() {
|
2018-11-09 08:13:34 +09:00
|
|
|
this.$root.new(MkMessagingWindow);
|
2018-10-14 19:44:30 +09:00
|
|
|
},
|
|
|
|
|
|
|
|
game() {
|
2018-11-09 08:13:34 +09:00
|
|
|
this.$root.new(MkGameWindow);
|
2018-10-14 19:44:30 +09:00
|
|
|
},
|
|
|
|
|
|
|
|
post() {
|
2018-11-09 08:26:32 +09:00
|
|
|
this.$root.apis.post();
|
2018-10-14 19:44:30 +09:00
|
|
|
},
|
|
|
|
|
|
|
|
drive() {
|
2018-11-09 08:13:34 +09:00
|
|
|
this.$root.new(MkDriveWindow);
|
2018-10-14 19:44:30 +09:00
|
|
|
},
|
|
|
|
|
|
|
|
list() {
|
2018-11-09 08:13:34 +09:00
|
|
|
const w = this.$root.new(MkUserListsWindow);
|
2018-10-14 19:44:30 +09:00
|
|
|
w.$once('choosen', list => {
|
|
|
|
this.$router.push(`i/lists/${ list.id }`);
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
followRequests() {
|
2018-11-09 08:13:34 +09:00
|
|
|
this.$root.new(MkFollowRequestsWindow);
|
2018-10-14 19:44:30 +09:00
|
|
|
},
|
|
|
|
|
|
|
|
settings() {
|
2018-11-09 08:13:34 +09:00
|
|
|
this.$root.new(MkSettingsWindow);
|
2018-10-14 19:44:30 +09:00
|
|
|
},
|
|
|
|
|
|
|
|
signout() {
|
2018-11-09 08:13:34 +09:00
|
|
|
this.$root.os.signout();
|
2018-10-14 19:44:30 +09:00
|
|
|
},
|
|
|
|
|
2018-10-15 05:18:39 +09:00
|
|
|
notifications() {
|
|
|
|
this.showNotifications ? this.closeNotifications() : this.openNotifications();
|
|
|
|
},
|
|
|
|
|
|
|
|
openNotifications() {
|
|
|
|
this.showNotifications = true;
|
|
|
|
Array.from(document.querySelectorAll('body *')).forEach(el => {
|
|
|
|
el.addEventListener('mousedown', this.onMousedown);
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
closeNotifications() {
|
|
|
|
this.showNotifications = false;
|
|
|
|
Array.from(document.querySelectorAll('body *')).forEach(el => {
|
|
|
|
el.removeEventListener('mousedown', this.onMousedown);
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
onMousedown(e) {
|
|
|
|
e.preventDefault();
|
|
|
|
if (
|
|
|
|
!contains(this.$refs.notifications, e.target) &&
|
|
|
|
this.$refs.notifications != e.target &&
|
|
|
|
!contains(this.$refs.notificationsButton, e.target) &&
|
|
|
|
this.$refs.notificationsButton != e.target
|
|
|
|
) {
|
|
|
|
this.closeNotifications();
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
},
|
|
|
|
|
2018-10-14 19:44:30 +09:00
|
|
|
dark() {
|
|
|
|
this.$store.commit('device/set', {
|
|
|
|
key: 'darkmode',
|
|
|
|
value: !this.$store.state.device.darkmode
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
goToTop() {
|
|
|
|
window.scrollTo({
|
|
|
|
top: 0,
|
|
|
|
behavior: 'smooth'
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="stylus" scoped>
|
|
|
|
.header
|
|
|
|
$width = 68px
|
|
|
|
|
|
|
|
position fixed
|
|
|
|
top 0
|
|
|
|
z-index 1000
|
|
|
|
width $width
|
|
|
|
height 100%
|
|
|
|
|
|
|
|
&.left
|
|
|
|
left 0
|
2018-10-15 05:28:35 +09:00
|
|
|
box-shadow var(--shadowRight)
|
2018-10-14 19:44:30 +09:00
|
|
|
|
|
|
|
&.right
|
|
|
|
right 0
|
2018-10-15 05:28:35 +09:00
|
|
|
box-shadow var(--shadowLeft)
|
2018-10-14 19:44:30 +09:00
|
|
|
|
2018-10-15 05:28:35 +09:00
|
|
|
> .body
|
|
|
|
position fixed
|
|
|
|
top 0
|
|
|
|
z-index 1
|
2018-10-14 19:44:30 +09:00
|
|
|
width $width
|
2018-10-15 05:28:35 +09:00
|
|
|
height 100%
|
|
|
|
background var(--desktopHeaderBg)
|
2018-10-14 19:44:30 +09:00
|
|
|
|
2018-10-15 05:28:35 +09:00
|
|
|
> .post
|
|
|
|
width $width
|
|
|
|
height $width
|
|
|
|
padding 12px
|
2018-10-15 05:18:39 +09:00
|
|
|
|
2018-10-15 05:28:35 +09:00
|
|
|
> button
|
|
|
|
display inline-block
|
|
|
|
margin 0
|
|
|
|
padding 0
|
|
|
|
height 100%
|
|
|
|
width 100%
|
|
|
|
font-size 1.2em
|
|
|
|
font-weight normal
|
|
|
|
text-decoration none
|
|
|
|
color var(--primaryForeground)
|
|
|
|
background var(--primary) !important
|
|
|
|
outline none
|
|
|
|
border none
|
|
|
|
border-radius 100%
|
|
|
|
transition background 0.1s ease
|
|
|
|
cursor pointer
|
|
|
|
|
|
|
|
*
|
|
|
|
pointer-events none
|
2018-10-15 05:18:39 +09:00
|
|
|
|
|
|
|
&:hover
|
2018-10-15 05:28:35 +09:00
|
|
|
background var(--primaryLighten10) !important
|
2018-10-15 05:18:39 +09:00
|
|
|
|
|
|
|
&:active
|
2018-10-15 05:28:35 +09:00
|
|
|
background var(--primaryDarken10) !important
|
|
|
|
transition background 0s ease
|
2018-10-15 05:18:39 +09:00
|
|
|
|
2018-10-15 05:28:35 +09:00
|
|
|
> .nav.bottom
|
|
|
|
position absolute
|
|
|
|
bottom 128px
|
|
|
|
left 0
|
2018-10-14 19:44:30 +09:00
|
|
|
|
2018-10-15 05:28:35 +09:00
|
|
|
> .account
|
2018-10-15 05:18:39 +09:00
|
|
|
position absolute
|
|
|
|
bottom 64px
|
|
|
|
left 0
|
2018-10-15 05:28:35 +09:00
|
|
|
width $width
|
|
|
|
height $width
|
|
|
|
padding 14px
|
2018-10-15 05:18:39 +09:00
|
|
|
|
|
|
|
> .menu
|
2018-10-15 05:28:35 +09:00
|
|
|
display none
|
|
|
|
position absolute
|
|
|
|
bottom 64px
|
|
|
|
left 0
|
|
|
|
background var(--desktopHeaderBg)
|
2018-10-15 05:18:39 +09:00
|
|
|
|
2018-10-15 05:28:35 +09:00
|
|
|
&:hover
|
|
|
|
> .menu
|
|
|
|
display block
|
2018-10-14 19:44:30 +09:00
|
|
|
|
2018-10-15 05:28:35 +09:00
|
|
|
> *:not(.menu)
|
|
|
|
display block
|
2018-10-14 19:44:30 +09:00
|
|
|
width 100%
|
|
|
|
height 100%
|
|
|
|
|
2018-10-15 05:28:35 +09:00
|
|
|
> .avatar
|
|
|
|
pointer-events none
|
|
|
|
width 100%
|
|
|
|
height 100%
|
|
|
|
|
|
|
|
> .dark
|
|
|
|
position absolute
|
|
|
|
bottom 0
|
|
|
|
left 0
|
|
|
|
width $width
|
|
|
|
height $width
|
2018-10-15 05:18:39 +09:00
|
|
|
|
|
|
|
> .notifications
|
|
|
|
position fixed
|
|
|
|
top 0
|
|
|
|
width 350px
|
|
|
|
height 100%
|
|
|
|
overflow auto
|
|
|
|
background var(--face)
|
|
|
|
|
2018-10-15 05:28:35 +09:00
|
|
|
&.left
|
|
|
|
left $width
|
|
|
|
box-shadow var(--shadowRight)
|
|
|
|
|
|
|
|
&.right
|
|
|
|
right $width
|
|
|
|
box-shadow var(--shadowLeft)
|
|
|
|
|
|
|
|
.nav
|
|
|
|
> *
|
|
|
|
> *
|
|
|
|
display block
|
|
|
|
width $width
|
|
|
|
line-height 52px
|
|
|
|
text-align center
|
|
|
|
font-size 18px
|
|
|
|
color var(--desktopHeaderFg)
|
|
|
|
|
|
|
|
&:hover
|
|
|
|
background rgba(0, 0, 0, 0.05)
|
|
|
|
color var(--desktopHeaderHoverFg)
|
|
|
|
text-decoration none
|
|
|
|
|
|
|
|
&:active
|
|
|
|
background rgba(0, 0, 0, 0.1)
|
|
|
|
|
|
|
|
&.left
|
|
|
|
.nav
|
|
|
|
> *
|
|
|
|
&.active
|
|
|
|
box-shadow -4px 0 var(--primary) inset
|
|
|
|
|
|
|
|
&.right
|
|
|
|
.nav
|
|
|
|
> *
|
|
|
|
&.active
|
|
|
|
box-shadow 4px 0 var(--primary) inset
|
|
|
|
|
|
|
|
.slide-left-enter-active,
|
|
|
|
.slide-left-leave-active {
|
2018-10-15 05:18:39 +09:00
|
|
|
transition: all 0.2s ease;
|
|
|
|
}
|
|
|
|
|
2018-10-15 05:28:35 +09:00
|
|
|
.slide-left-enter, .slide-left-leave-to {
|
2018-10-15 05:18:39 +09:00
|
|
|
transform: translateX(-16px);
|
|
|
|
opacity: 0;
|
|
|
|
}
|
2018-10-15 05:28:35 +09:00
|
|
|
|
|
|
|
.slide-right-enter-active,
|
|
|
|
.slide-right-leave-active {
|
|
|
|
transition: all 0.2s ease;
|
|
|
|
}
|
|
|
|
|
|
|
|
.slide-right-enter, .slide-right-leave-to {
|
|
|
|
transform: translateX(16px);
|
|
|
|
opacity: 0;
|
|
|
|
}
|
2018-10-14 19:44:30 +09:00
|
|
|
</style>
|