Archived
2
0
This repository has been archived on 2024-06-24. You can view files and clone it, but cannot push or open issues or pull requests.
neko-custom/client/src/components/header.vue

130 lines
2.5 KiB
Vue
Raw Normal View History

2020-01-24 04:23:26 +13:00
<template>
<div class="header">
<div class="neko">
2020-02-02 09:35:48 +13:00
<img src="@/assets/images/logo.svg" alt="n.eko" />
2020-01-24 04:23:26 +13: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 13:02:51 +13:00
v-tooltip="{
2020-04-05 14:57:22 +12:00
content: admin
? locked
? $t('room.unlock')
: $t('room.lock')
: locked
? $t('room.unlocked')
: $t('room.locked'),
2020-02-12 13:02:51 +13:00
placement: 'bottom',
offset: 5,
boundariesElement: 'body',
delay: { show: 300, hide: 100 },
}"
2020-01-24 04:23:26 +13:00
/>
</li>
<li>
<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;
}
}
}
}
</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
}
toggleMenu() {
this.$accessor.client.toggleSide()
}
toggleLock() {
if (this.admin) {
if (this.locked) {
2020-02-12 12:51:57 +13:00
this.$accessor.unlock()
2020-01-24 04:23:26 +13:00
} else {
2020-02-12 12:51:57 +13:00
this.$accessor.lock()
2020-01-24 04:23:26 +13:00
}
}
}
}
</script>