2022-04-15 14:24:30 +00:00
|
|
|
<template>
|
2022-04-15 17:00:08 +00:00
|
|
|
<header id="mainHeader">
|
2022-05-07 08:12:16 +00:00
|
|
|
<h1 class="brand">Koel</h1>
|
2022-04-24 08:29:14 +00:00
|
|
|
<span class="hamburger" role="button" title="Show or hide the sidebar" @click="toggleSidebar">
|
2022-04-15 14:24:30 +00:00
|
|
|
<i class="fa fa-bars"></i>
|
|
|
|
</span>
|
2022-04-24 08:29:14 +00:00
|
|
|
<span class="magnifier" role="button" title="Show or hide the search form" @click="toggleSearchForm">
|
2022-04-15 14:24:30 +00:00
|
|
|
<i class="fa fa-search"></i>
|
|
|
|
</span>
|
2022-05-07 08:12:16 +00:00
|
|
|
<SearchForm v-if="showSearchForm"/>
|
2022-04-15 14:24:30 +00:00
|
|
|
<div class="header-right">
|
2022-05-07 08:12:16 +00:00
|
|
|
<UserBadge/>
|
2022-04-15 17:00:08 +00:00
|
|
|
<button
|
|
|
|
class="about control"
|
|
|
|
data-testid="about-btn"
|
2022-04-24 08:29:14 +00:00
|
|
|
title="About Koel"
|
|
|
|
type="button"
|
|
|
|
@click.prevent="showAboutDialog"
|
2022-04-15 17:00:08 +00:00
|
|
|
>
|
2022-05-07 08:12:16 +00:00
|
|
|
<span v-if="shouldNotifyNewVersion" class="new-version" data-testid="new-version">
|
2022-04-30 14:05:02 +00:00
|
|
|
{{ latestVersion }} available!
|
2022-04-15 14:24:30 +00:00
|
|
|
</span>
|
|
|
|
<i v-else class="fa fa-info-circle"></i>
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
</header>
|
|
|
|
</template>
|
|
|
|
|
2022-04-15 17:00:08 +00:00
|
|
|
<script lang="ts" setup>
|
2022-05-15 15:25:02 +00:00
|
|
|
import isMobile from 'ismobilejs'
|
2022-05-07 08:12:16 +00:00
|
|
|
import { defineAsyncComponent, ref } from 'vue'
|
2022-04-15 17:00:08 +00:00
|
|
|
import { eventBus } from '@/utils'
|
2022-04-30 14:05:02 +00:00
|
|
|
import { useNewVersionNotification } from '@/composables'
|
2022-04-15 14:24:30 +00:00
|
|
|
|
2022-04-24 20:23:20 +00:00
|
|
|
const SearchForm = defineAsyncComponent(() => import('@/components/ui/SearchForm.vue'))
|
2022-04-23 21:48:19 +00:00
|
|
|
const UserBadge = defineAsyncComponent(() => import('@/components/user/UserBadge.vue'))
|
2022-04-15 14:24:30 +00:00
|
|
|
|
2022-05-07 08:12:16 +00:00
|
|
|
const showSearchForm = ref(!isMobile.any)
|
2022-04-30 14:05:02 +00:00
|
|
|
const { shouldNotifyNewVersion, latestVersion } = useNewVersionNotification()
|
2022-04-15 17:00:08 +00:00
|
|
|
|
|
|
|
const toggleSidebar = () => eventBus.emit('TOGGLE_SIDEBAR')
|
2022-05-07 08:12:16 +00:00
|
|
|
const toggleSearchForm = () => (showSearchForm.value = !showSearchForm.value)
|
2022-04-24 08:29:14 +00:00
|
|
|
const showAboutDialog = () => eventBus.emit('MODAL_SHOW_ABOUT_KOEL')
|
2022-04-15 14:24:30 +00:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
#mainHeader {
|
|
|
|
height: var(--header-height);
|
|
|
|
background: var(--color-bg-secondary);
|
|
|
|
display: flex;
|
|
|
|
box-shadow: 0 0 2px 0 rgba(0, 0, 0, .4);
|
|
|
|
|
|
|
|
h1.brand {
|
|
|
|
flex: 1;
|
|
|
|
font-size: 1.7rem;
|
|
|
|
font-weight: var(--font-weight-thin);
|
|
|
|
opacity: 0;
|
|
|
|
line-height: var(--header-height);
|
|
|
|
text-align: center;
|
|
|
|
}
|
|
|
|
|
|
|
|
.hamburger, .magnifier {
|
|
|
|
font-size: 1.4rem;
|
|
|
|
flex: 0 0 48px;
|
|
|
|
order: -1;
|
|
|
|
line-height: var(--header-height);
|
|
|
|
text-align: center;
|
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
.header-right {
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
flex: 1;
|
|
|
|
justify-content: flex-end;
|
|
|
|
|
|
|
|
.about {
|
|
|
|
height: 100%;
|
|
|
|
@include vertical-center();
|
|
|
|
padding: 16px;
|
|
|
|
border-left: 1px solid rgba(255, 255, 255, .1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@media only screen and (max-width: 667px) {
|
|
|
|
display: flex;
|
|
|
|
align-content: stretch;
|
2022-05-07 08:12:16 +00:00
|
|
|
justify-content: flex-start;
|
2022-04-15 14:24:30 +00:00
|
|
|
|
|
|
|
.hamburger, .magnifier {
|
|
|
|
display: inline-block;
|
|
|
|
}
|
|
|
|
|
|
|
|
h1.brand {
|
|
|
|
opacity: 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|