neko/client/src/components/header.vue

179 lines
3.8 KiB
Vue
Raw Normal View History

2020-01-23 15:23:26 +00:00
<template>
<div class="header">
<div class="neko">
2020-02-01 20:35:48 +00:00
<img src="@/assets/images/logo.svg" alt="n.eko" />
2020-01-23 15:23:26 +00:00
<span><b>n</b>.eko</span>
</div>
<ul class="menu">
<li>
<i
:class="[{ disabled: !admin }, { 'fa-lock-open': !locked }, { 'fa-lock': locked }, 'fas', 'lock']"
@click="toggleLock"
2020-02-12 00:02:51 +00:00
v-tooltip="{
2020-04-05 02:57:22 +00:00
content: admin
? locked
? $t('room.unlock')
: $t('room.lock')
: locked
2021-04-04 15:06:22 +02:00
? $t('room.locked')
: $t('room.unlocked'),
2020-02-12 00:02:51 +00:00
placement: 'bottom',
offset: 5,
boundariesElement: 'body',
delay: { show: 300, hide: 100 },
}"
2020-01-23 15:23:26 +00:00
/>
</li>
<li>
2021-07-17 12:38:12 +02:00
<span v-if="showBadge" class="badge">&bull;</span>
2020-01-23 15:23:26 +00:00
<i class="fas fa-bars toggle" @click="toggleMenu" />
</li>
</ul>
</div>
</template>
<style lang="scss" scoped>
.header {
flex: 1;
display: flex;
flex-direction: row;
align-items: center;
.neko {
flex: 1;
display: flex;
justify-content: flex-start;
align-items: center;
width: 150px;
margin-left: 20px;
img {
display: block;
float: left;
height: 30px;
margin-right: 10px;
}
span {
font-size: 30px;
line-height: 30px;
b {
font-weight: 900;
}
}
}
.menu {
justify-self: flex-end;
margin-right: 10px;
white-space: nowrap;
li {
display: inline-block;
margin-right: 10px;
i {
display: block;
width: 30px;
height: 30px;
text-align: center;
line-height: 32px;
border-radius: 3px;
cursor: pointer;
}
.disabled {
cursor: default;
opacity: 0.8;
}
.fa-lock {
color: rgba($color: $style-error, $alpha: 0.5);
}
.toggle {
background: $background-primary;
}
2021-07-17 12:38:12 +02:00
.badge {
position: absolute;
background: red;
font-weight: bold;
font-size: 1.25em;
border-radius: 50%;
width: 20px;
height: 20px;
text-align: center;
line-height: 20px;
pointer-events: none;
transform: translate(-50%, -25%) scale(1);
box-shadow: 0 0 0 0 rgba(0, 0, 0, 1);
animation: badger-pulse 2s infinite;
}
@keyframes badger-pulse {
0% {
transform: translate(-50%, -25%) scale(0.85);
box-shadow: 0 0 0 0 rgba(0, 0, 0, 0.7);
}
70% {
transform: translate(-50%, -25%) scale(1);
box-shadow: 0 0 0 10px rgba(0, 0, 0, 0);
}
100% {
transform: translate(-50%, -25%) scale(0.85);
box-shadow: 0 0 0 0 rgba(0, 0, 0, 0);
}
}
2020-01-23 15:23:26 +00:00
}
}
}
</style>
<script lang="ts">
import { Component, Ref, Watch, Vue } from 'vue-property-decorator'
@Component({ name: 'neko-settings' })
export default class extends Vue {
get admin() {
return this.$accessor.user.admin
}
get locked() {
return this.$accessor.locked
}
2021-07-17 12:38:12 +02:00
get side() {
return this.$accessor.client.side
}
get texts() {
return this.$accessor.chat.texts
}
get showBadge() {
return !this.side && this.readTexts != this.texts
}
readTexts: number = 0
2020-01-23 15:23:26 +00:00
toggleMenu() {
this.$accessor.client.toggleSide()
2021-07-17 12:38:12 +02:00
this.readTexts = this.texts
2020-01-23 15:23:26 +00:00
}
toggleLock() {
if (this.admin) {
if (this.locked) {
2020-02-11 23:51:57 +00:00
this.$accessor.unlock()
2020-01-23 15:23:26 +00:00
} else {
2020-02-11 23:51:57 +00:00
this.$accessor.lock()
2020-01-23 15:23:26 +00:00
}
}
}
}
</script>