ffplayout/components/Menu.vue

129 lines
4.6 KiB
Vue
Raw Normal View History

2020-04-15 12:10:34 -04:00
<template>
<div>
<div class="menu">
2023-01-11 04:54:25 -05:00
<nav class="navbar navbar-expand-sm fixed-top custom-nav">
<div class="container-fluid">
<NuxtLink class="navbar-brand p-2" href="/"
><img
src="~/assets/images/ffplayout-small.png"
class="img-fluid"
alt="Logo"
width="30"
height="30"
/></NuxtLink>
<button
class="navbar-toggler"
type="button"
data-bs-toggle="collapse"
data-bs-target="#navbarNavDropdown"
aria-controls="navbarNavDropdown"
aria-expanded="false"
aria-label="Toggle navigation"
>
<span class="navbar-toggler-icon"> </span>
</button>
<div class="collapse navbar-collapse justify-content-end" id="navbarNavDropdown">
<ul class="navbar-nav">
2023-11-16 09:45:46 -05:00
<li class="nav-item">
<NuxtLink class="btn btn-primary btn-sm" to="/">Home</NuxtLink>
</li>
2023-01-11 04:54:25 -05:00
<li class="nav-item">
<NuxtLink class="btn btn-primary btn-sm" to="/player">Player</NuxtLink>
</li>
<li class="nav-item">
<NuxtLink class="btn btn-primary btn-sm" to="/media">Media</NuxtLink>
</li>
<li class="nav-item">
<NuxtLink class="btn btn-primary btn-sm" to="/message">Message</NuxtLink>
</li>
<li class="nav-item">
<NuxtLink class="btn btn-primary btn-sm" to="/logging">Logging</NuxtLink>
</li>
<li v-if="authStore.role.toLowerCase() == 'admin'" class="nav-item">
2023-01-11 04:54:25 -05:00
<NuxtLink class="btn btn-primary btn-sm" to="/configure">Configure</NuxtLink>
</li>
<li v-if="configStore.configGui.length > 1" class="nav-item dropdown">
&nbsp;
<a
class="btn btn-primary btn-sm dropdown-toggle"
href="#"
role="button"
data-bs-toggle="dropdown"
aria-expanded="false"
>
{{ configStore.configGui[configStore.configID].name }}
</a>
<ul class="dropdown-menu dropdown-menu-dark dropdown-menu-end">
<li v-for="(channel, index) in configStore.configGui" :key="index">
<a class="dropdown-item" @click="selectChannel(index)">{{ channel.name }}</a>
</li>
</ul>
&nbsp;
</li>
<li class="nav-item">
<a class="btn btn-primary btn-sm" @click="logout()">Logout</a>
</li>
</ul>
</div>
</div>
</nav>
2020-04-15 12:10:34 -04:00
</div>
</div>
</template>
2023-01-11 04:54:25 -05:00
<script setup lang="ts">
const authStore = useAuth()
const configStore = useConfig()
const router = useRouter()
2020-04-15 12:10:34 -04:00
2023-01-11 04:54:25 -05:00
function logout() {
authStore.removeToken()
router.push({ path: '/' })
}
2023-01-11 04:54:25 -05:00
function selectChannel(index: number) {
configStore.configID = index
2023-01-11 04:54:25 -05:00
configStore.getPlayoutConfig()
2020-04-15 12:10:34 -04:00
}
</script>
2023-01-11 04:54:25 -05:00
<style lang="scss">
2020-04-15 12:10:34 -04:00
.menu {
width: 100%;
2023-01-11 04:54:25 -05:00
height: 60px;
2020-04-15 12:10:34 -04:00
margin: 0;
2023-01-11 04:54:25 -05:00
div {
padding: 0.3em;
}
}
2023-01-11 04:54:25 -05:00
.custom-nav {
background-color: $bg-primary;
}
2023-01-11 04:54:25 -05:00
.nav-item .btn {
position: relative;
}
2023-01-11 04:54:25 -05:00
.router-link-exact-active::after {
background: $accent;
content: ' ';
width: 100%;
height: 2px;
position: absolute;
display: block;
left: 0;
right: 0;
border-radius: 1px;
2020-04-15 12:10:34 -04:00
}
2023-01-11 04:54:25 -05:00
@media (max-width: 575px) {
.nav-item .btn {
width: 100%;
text-align: left;
margin-bottom: .3em;
}
}
2020-04-15 12:10:34 -04:00
</style>