knowyt/client/src/components/TopBar.vue

84 lines
1.9 KiB
Vue
Raw Normal View History

<template>
2022-08-06 11:06:51 +00:00
<div v-if="user.name" class="topbar__container">
<div class="topbar__username">
2022-08-06 11:06:51 +00:00
{{ user.name }}
</div>
<div class="topbar__separator" />
<div class="topbar__actionbar">
2022-08-06 11:06:51 +00:00
<div v-if="user.isAdmin" class="topbar__actionbar__admin">
Admin
</div>
<div v-if="user.isGamemaster" class="topbar__actionbar__gamemaster">
Collect Quotes | Start | Continue | Idle | Finish
</div>
<div v-else class="topbar__actionbar__user">
{{ game.name }}
</div>
</div>
<div class="topbar__separator" />
<div class="topbar__logout-button-container">
<Button class="topbar__logout-button" :border="false" @click="actionLogout">Logout</Button>
</div>
</div>
</template>
<script setup lang="ts">
import { useRouter } from '#app'
import useAuth from '@/composables/useAuth';
import { useUserinfoStore } from "@/stores/UserinfoStore"
2022-08-06 11:06:51 +00:00
import { useGameinfoStore } from "@/stores/GameinfoStore"
2022-08-06 11:06:51 +00:00
const user = useUserinfoStore()
const game = useGameinfoStore()
const actionLogout = async () => {
await useAuth().logout()
useRouter().push('/')
}
</script>
<style lang="scss">
@import '~/assets/css/components';
.topbar {
&__container {
display: flex;
width: 100%;
height: 64px;
align-items: center;
background-color: $topbar-background-color;
font-size: 16px;
font-family: $font-primary;
font-weight: bold;
}
&__username,
&__logout-button-container {
width: 128px;
padding: 0 16px;
text-align: center;
color: $text-primary-color;
}
&__actionbar {
flex-grow: 1;
}
&__separator {
width: 1px;
height: calc(64px - 2 * 16px);
margin: 16px 0;
background-color: $topbar-separator-color;
}
&__logout-button {
color: $text-primary-color;
font-size: 16px;
font-family: $font-primary;
&:hover {
color: $text-primary-hover-color;
}
}
}
</style>