2018-02-12 13:10:16 +01:00
|
|
|
<template>
|
2018-02-20 14:53:34 +01:00
|
|
|
<div class="nav">
|
2018-02-12 13:10:16 +01:00
|
|
|
<ul>
|
2018-05-27 06:49:09 +02:00
|
|
|
<template v-if="$store.getters.isSignedIn">
|
2019-02-14 21:08:59 +01:00
|
|
|
<template v-if="$store.state.device.deckMode">
|
|
|
|
<li class="deck active" @click="goToTop">
|
2018-11-08 19:44:35 +01:00
|
|
|
<router-link to="/"><fa icon="columns"/><p>{{ $t('deck') }}</p></router-link>
|
2018-10-19 04:10:49 +02:00
|
|
|
</li>
|
2019-02-14 21:08:59 +01:00
|
|
|
<li class="home">
|
|
|
|
<a @click="toggleDeckMode(false)"><fa icon="home"/><p>{{ $t('home') }}</p></a>
|
2018-10-19 04:10:49 +02:00
|
|
|
</li>
|
|
|
|
</template>
|
|
|
|
<template v-else>
|
2019-02-14 21:08:59 +01:00
|
|
|
<li class="home active" @click="goToTop">
|
2018-11-08 19:44:35 +01:00
|
|
|
<router-link to="/"><fa icon="home"/><p>{{ $t('home') }}</p></router-link>
|
2018-10-19 04:10:49 +02:00
|
|
|
</li>
|
2019-02-14 21:08:59 +01:00
|
|
|
<li class="deck">
|
|
|
|
<a @click="toggleDeckMode(true)"><fa icon="columns"/><p>{{ $t('deck') }}</p></a>
|
2018-10-19 04:10:49 +02:00
|
|
|
</li>
|
|
|
|
</template>
|
2018-02-12 13:10:16 +01:00
|
|
|
<li class="messaging">
|
|
|
|
<a @click="messaging">
|
2018-11-05 17:40:11 +01:00
|
|
|
<fa icon="comments"/>
|
2018-11-08 19:44:35 +01:00
|
|
|
<p>{{ $t('@.messaging') }}</p>
|
2018-11-05 17:40:11 +01:00
|
|
|
<template v-if="hasUnreadMessagingMessage"><fa icon="circle"/></template>
|
2018-02-12 13:10:16 +01:00
|
|
|
</a>
|
|
|
|
</li>
|
|
|
|
</template>
|
2019-02-14 22:31:03 +01:00
|
|
|
<li class="featured">
|
|
|
|
<router-link to="/featured"><fa :icon="faNewspaper"/><p>{{ $t('@.featured-notes') }}</p></router-link>
|
|
|
|
</li>
|
|
|
|
<li class="game">
|
|
|
|
<a @click="game">
|
|
|
|
<fa icon="gamepad"/>
|
|
|
|
<p>{{ $t('game') }}</p>
|
|
|
|
<template v-if="hasGameInvitations"><fa icon="circle"/></template>
|
|
|
|
</a>
|
|
|
|
</li>
|
2018-02-12 13:10:16 +01:00
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import Vue from 'vue';
|
2018-11-08 19:44:35 +01:00
|
|
|
import i18n from '../../../i18n';
|
2018-02-18 15:51:41 +01:00
|
|
|
import MkMessagingWindow from './messaging-window.vue';
|
2018-03-07 09:48:32 +01:00
|
|
|
import MkGameWindow from './game-window.vue';
|
2019-02-14 22:31:03 +01:00
|
|
|
import { faNewspaper } from '@fortawesome/free-solid-svg-icons';
|
2018-02-12 13:10:16 +01:00
|
|
|
|
|
|
|
export default Vue.extend({
|
2018-11-08 19:44:35 +01:00
|
|
|
i18n: i18n('desktop/views/components/ui.header.nav.vue'),
|
2018-02-12 13:10:16 +01:00
|
|
|
data() {
|
|
|
|
return {
|
2018-03-07 09:48:32 +01:00
|
|
|
hasGameInvitations: false,
|
2019-02-14 22:31:03 +01:00
|
|
|
connection: null,
|
|
|
|
faNewspaper
|
2018-02-12 13:10:16 +01:00
|
|
|
};
|
|
|
|
},
|
2018-05-28 19:31:32 +02:00
|
|
|
computed: {
|
|
|
|
hasUnreadMessagingMessage(): boolean {
|
|
|
|
return this.$store.getters.isSignedIn && this.$store.state.i.hasUnreadMessagingMessage;
|
|
|
|
}
|
|
|
|
},
|
2018-02-12 13:10:16 +01:00
|
|
|
mounted() {
|
2018-05-27 06:49:09 +02:00
|
|
|
if (this.$store.getters.isSignedIn) {
|
2018-11-09 00:13:34 +01:00
|
|
|
this.connection = this.$root.stream.useSharedConnection('main');
|
2018-02-12 13:10:16 +01:00
|
|
|
|
2018-10-07 04:06:17 +02:00
|
|
|
this.connection.on('reversiInvited', this.onReversiInvited);
|
2018-12-09 15:10:02 +01:00
|
|
|
this.connection.on('reversiNoInvites', this.onReversiNoInvites);
|
2018-02-12 13:10:16 +01:00
|
|
|
}
|
|
|
|
},
|
|
|
|
beforeDestroy() {
|
2018-05-27 06:49:09 +02:00
|
|
|
if (this.$store.getters.isSignedIn) {
|
2018-10-07 04:06:17 +02:00
|
|
|
this.connection.dispose();
|
2018-02-12 13:10:16 +01:00
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
2019-02-14 21:08:59 +01:00
|
|
|
toggleDeckMode(deck) {
|
|
|
|
this.$store.commit('device/set', { key: 'deckMode', value: deck });
|
|
|
|
location.reload();
|
|
|
|
},
|
|
|
|
|
2018-06-17 01:10:54 +02:00
|
|
|
onReversiInvited() {
|
2018-03-11 10:08:26 +01:00
|
|
|
this.hasGameInvitations = true;
|
|
|
|
},
|
|
|
|
|
2018-06-17 01:10:54 +02:00
|
|
|
onReversiNoInvites() {
|
2018-03-11 10:08:26 +01:00
|
|
|
this.hasGameInvitations = false;
|
2018-02-12 13:10:16 +01:00
|
|
|
},
|
|
|
|
|
|
|
|
messaging() {
|
2018-11-09 00:13:34 +01:00
|
|
|
this.$root.new(MkMessagingWindow);
|
2018-03-07 09:48:32 +01:00
|
|
|
},
|
|
|
|
|
|
|
|
game() {
|
2018-11-09 00:13:34 +01:00
|
|
|
this.$root.new(MkGameWindow);
|
2018-07-23 07:35:00 +02:00
|
|
|
},
|
|
|
|
|
2018-07-25 21:29:09 +02:00
|
|
|
goToTop() {
|
|
|
|
window.scrollTo({
|
|
|
|
top: 0,
|
|
|
|
behavior: 'smooth'
|
|
|
|
});
|
2018-02-12 13:10:16 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="stylus" scoped>
|
2018-09-27 08:19:11 +02:00
|
|
|
.nav
|
2018-02-12 13:10:16 +01:00
|
|
|
display inline-block
|
|
|
|
margin 0
|
|
|
|
padding 0
|
|
|
|
line-height 3rem
|
|
|
|
vertical-align top
|
|
|
|
|
|
|
|
> ul
|
|
|
|
display inline-block
|
|
|
|
margin 0
|
|
|
|
padding 0
|
|
|
|
vertical-align top
|
|
|
|
line-height 3rem
|
|
|
|
list-style none
|
|
|
|
|
|
|
|
> li
|
|
|
|
display inline-block
|
|
|
|
vertical-align top
|
|
|
|
height 48px
|
|
|
|
line-height 48px
|
|
|
|
|
|
|
|
&.active
|
|
|
|
> a
|
2018-09-26 13:19:35 +02:00
|
|
|
border-bottom solid 3px var(--primary)
|
2018-02-12 13:10:16 +01:00
|
|
|
|
|
|
|
> a
|
|
|
|
display inline-block
|
|
|
|
z-index 1
|
|
|
|
height 100%
|
|
|
|
padding 0 24px
|
|
|
|
font-size 13px
|
|
|
|
font-variant small-caps
|
2018-09-27 08:19:11 +02:00
|
|
|
color var(--desktopHeaderFg)
|
2018-02-12 13:10:16 +01:00
|
|
|
text-decoration none
|
|
|
|
transition none
|
|
|
|
cursor pointer
|
|
|
|
|
|
|
|
*
|
|
|
|
pointer-events none
|
|
|
|
|
|
|
|
&:hover
|
2018-09-27 08:19:11 +02:00
|
|
|
color var(--desktopHeaderHoverFg)
|
2018-02-12 13:10:16 +01:00
|
|
|
text-decoration none
|
|
|
|
|
2018-11-05 17:40:11 +01:00
|
|
|
> [data-icon]:first-child
|
2018-02-12 13:10:16 +01:00
|
|
|
margin-right 8px
|
|
|
|
|
2018-11-05 17:40:11 +01:00
|
|
|
> [data-icon]:last-child
|
2018-02-12 13:10:16 +01:00
|
|
|
margin-left 5px
|
|
|
|
font-size 10px
|
2018-12-30 17:15:32 +01:00
|
|
|
color var(--notificationIndicator)
|
2018-02-12 13:10:16 +01:00
|
|
|
|
|
|
|
@media (max-width 1100px)
|
|
|
|
margin-left -5px
|
|
|
|
|
|
|
|
> p
|
|
|
|
display inline
|
|
|
|
margin 0
|
|
|
|
|
|
|
|
@media (max-width 1100px)
|
|
|
|
display none
|
|
|
|
|
|
|
|
@media (max-width 700px)
|
|
|
|
padding 0 12px
|
|
|
|
|
|
|
|
</style>
|