2023-12-30 05:29:53 +00:00
|
|
|
<template>
|
|
|
|
<header class="header">
|
|
|
|
<nav class="nav">
|
2024-02-22 04:08:06 +00:00
|
|
|
<Link href="/">
|
|
|
|
<h1 class="title">
|
|
|
|
<div
|
|
|
|
class="logo"
|
|
|
|
v-html="logo"
|
|
|
|
/>
|
|
|
|
</h1>
|
|
|
|
</Link>
|
|
|
|
|
2023-12-30 05:29:53 +00:00
|
|
|
<ul class="nav-list nolist">
|
2024-02-29 04:24:34 +00:00
|
|
|
<!--
|
2023-12-30 05:29:53 +00:00
|
|
|
<li class="nav-item">
|
|
|
|
<Link
|
|
|
|
class="link"
|
2024-02-27 00:51:14 +00:00
|
|
|
:class="{ active: activePage === 'updates' }"
|
2023-12-30 05:29:53 +00:00
|
|
|
href="/updates"
|
|
|
|
>Updates</Link>
|
|
|
|
</li>
|
2024-02-29 04:24:34 +00:00
|
|
|
-->
|
2023-12-30 05:29:53 +00:00
|
|
|
|
|
|
|
<li class="nav-item">
|
|
|
|
<Link
|
|
|
|
class="link"
|
2024-02-27 00:51:14 +00:00
|
|
|
:class="{ active: activePage === 'actors' }"
|
2023-12-30 05:29:53 +00:00
|
|
|
href="/actors"
|
|
|
|
>Actors</Link>
|
|
|
|
</li>
|
|
|
|
|
|
|
|
<li class="nav-item">
|
|
|
|
<Link
|
|
|
|
class="link"
|
2024-02-27 00:51:14 +00:00
|
|
|
:class="{ active: activePage === 'channels' }"
|
2023-12-30 05:29:53 +00:00
|
|
|
href="/channels"
|
|
|
|
>Channels</Link>
|
|
|
|
</li>
|
|
|
|
|
|
|
|
<li class="nav-item">
|
|
|
|
<Link
|
|
|
|
class="link"
|
2024-02-27 00:51:14 +00:00
|
|
|
:class="{ active: activePage === 'tags' }"
|
2023-12-30 05:29:53 +00:00
|
|
|
href="/tags"
|
|
|
|
>Tags</Link>
|
|
|
|
</li>
|
|
|
|
|
|
|
|
<li class="nav-item">
|
|
|
|
<Link
|
|
|
|
class="link"
|
2024-02-27 00:51:14 +00:00
|
|
|
:class="{ active: activePage === 'movies' }"
|
2023-12-30 05:29:53 +00:00
|
|
|
href="/movies"
|
|
|
|
>Movies</Link>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</nav>
|
2024-02-22 04:08:06 +00:00
|
|
|
|
2024-02-29 04:08:54 +00:00
|
|
|
<div class="header-section">
|
|
|
|
<form
|
|
|
|
class="search"
|
2024-02-29 04:24:34 +00:00
|
|
|
:class="{ focused: searchFocused }"
|
2024-02-29 04:08:54 +00:00
|
|
|
@submit.prevent="search"
|
2024-02-22 04:08:06 +00:00
|
|
|
>
|
2024-02-29 04:08:54 +00:00
|
|
|
<input
|
|
|
|
v-model="query"
|
|
|
|
type="search"
|
|
|
|
placeholder="Search"
|
|
|
|
class="input"
|
2024-02-29 04:24:34 +00:00
|
|
|
@focus="searchFocused = true"
|
|
|
|
@blur="searchFocused = false"
|
2024-02-29 04:08:54 +00:00
|
|
|
>
|
2024-02-22 04:08:06 +00:00
|
|
|
|
2024-02-29 04:24:34 +00:00
|
|
|
<button class="search-button">
|
|
|
|
<Icon icon="search" />
|
|
|
|
</button>
|
2024-02-29 04:08:54 +00:00
|
|
|
</form>
|
|
|
|
|
|
|
|
<VDropdown
|
|
|
|
v-if="user"
|
|
|
|
:triggers="['click']"
|
2024-03-03 01:33:35 +00:00
|
|
|
:prevent-overflow="true"
|
2024-02-29 04:08:54 +00:00
|
|
|
>
|
|
|
|
<div class="userpanel">
|
|
|
|
<img
|
|
|
|
:src="user.avatar"
|
|
|
|
class="avatar"
|
|
|
|
>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<template #popper>
|
|
|
|
<div class="menu">
|
|
|
|
<a
|
|
|
|
:href="`/user/${user.username}`"
|
2024-03-03 01:33:35 +00:00
|
|
|
class="menu-header ellipsis"
|
2024-02-29 04:08:54 +00:00
|
|
|
>{{ user.username }}</a>
|
|
|
|
|
|
|
|
<ul class="menu-list nolist">
|
2024-03-03 01:33:35 +00:00
|
|
|
<li class="menu-item">
|
|
|
|
<a
|
|
|
|
:href="`/user/${user.username}`"
|
|
|
|
class="menu-button nolink"
|
|
|
|
>
|
|
|
|
<Icon icon="vcard" />
|
|
|
|
View profile
|
|
|
|
</a>
|
|
|
|
</li>
|
|
|
|
|
2024-02-29 04:08:54 +00:00
|
|
|
<li
|
2024-03-03 01:33:35 +00:00
|
|
|
class="menu-button menu-item logout"
|
2024-02-29 04:08:54 +00:00
|
|
|
@click="logout"
|
|
|
|
><Icon icon="exit2" />Log out</li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</VDropdown>
|
|
|
|
|
|
|
|
<div
|
|
|
|
v-else
|
|
|
|
class="userpanel"
|
|
|
|
>
|
|
|
|
<a
|
|
|
|
:href="`/login?r=${encodeURIComponent(currentPath)}`"
|
|
|
|
class="login button button-submit"
|
|
|
|
>Log in</a>
|
|
|
|
</div>
|
|
|
|
</div>
|
2023-12-30 05:29:53 +00:00
|
|
|
</header>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script setup>
|
2024-02-27 00:51:14 +00:00
|
|
|
import { ref, computed, inject } from 'vue';
|
2024-02-22 04:08:06 +00:00
|
|
|
import navigate from '#/src/navigate.js';
|
2024-02-29 04:08:54 +00:00
|
|
|
import { del } from '#/src/api.js';
|
2024-02-22 04:08:06 +00:00
|
|
|
|
2023-12-30 05:29:53 +00:00
|
|
|
import logo from '../../assets/img/logo.svg?raw'; // eslint-disable-line import/no-unresolved
|
2024-02-22 04:08:06 +00:00
|
|
|
|
|
|
|
const pageContext = inject('pageContext');
|
2024-02-29 04:08:54 +00:00
|
|
|
|
|
|
|
const user = pageContext.user;
|
2024-02-22 04:08:06 +00:00
|
|
|
const query = ref(pageContext.urlParsed.search.q || '');
|
2024-02-29 04:24:34 +00:00
|
|
|
const searchFocused = ref(false);
|
2024-02-22 04:08:06 +00:00
|
|
|
|
2024-02-27 00:51:14 +00:00
|
|
|
const activePage = computed(() => pageContext.urlParsed.pathname.split('/')[1]);
|
2024-02-29 04:08:54 +00:00
|
|
|
const currentPath = `${pageContext.urlParsed.pathnameOriginal}${pageContext.urlParsed.searchOriginal || ''}`;
|
2024-02-27 00:51:14 +00:00
|
|
|
|
2024-02-22 04:08:06 +00:00
|
|
|
function search() {
|
|
|
|
navigate('/search', { q: query.value }, { redirect: true });
|
|
|
|
}
|
2024-02-29 04:08:54 +00:00
|
|
|
|
|
|
|
async function logout() {
|
|
|
|
del('/session');
|
2024-02-29 05:00:12 +00:00
|
|
|
navigate('/login', null, { redirect: true });
|
2024-02-29 04:08:54 +00:00
|
|
|
}
|
2023-12-30 05:29:53 +00:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
.header {
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
2024-02-22 04:08:06 +00:00
|
|
|
justify-content: space-between;
|
2024-01-05 23:30:30 +00:00
|
|
|
z-index: 1000; /* make sure shadow shows up above content */
|
2023-12-30 05:29:53 +00:00
|
|
|
box-shadow: 0 0 3px var(--shadow-weak-10);
|
|
|
|
}
|
|
|
|
|
|
|
|
.title {
|
|
|
|
margin: 0;
|
|
|
|
display: inline-block;
|
|
|
|
}
|
|
|
|
|
|
|
|
.logo {
|
|
|
|
display: flex;
|
|
|
|
width: 8rem;
|
|
|
|
height: 3rem;
|
2024-01-03 01:52:41 +00:00
|
|
|
box-sizing: border-box;
|
2023-12-30 05:29:53 +00:00
|
|
|
padding: .75rem;
|
|
|
|
margin-right: 1rem;
|
|
|
|
fill: var(--primary);
|
|
|
|
}
|
|
|
|
|
|
|
|
.nav {
|
2024-02-22 04:08:06 +00:00
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
2023-12-30 05:29:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.nav-item .link {
|
|
|
|
font-size: .9rem;
|
|
|
|
color: var(--shadow-strong-10);
|
2024-01-03 01:52:41 +00:00
|
|
|
box-sizing: border-box;
|
2023-12-30 05:29:53 +00:00
|
|
|
padding: 1rem;
|
|
|
|
height: 100%;
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
text-decoration: none;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.link {
|
|
|
|
font-weight: bold;
|
|
|
|
|
|
|
|
&.active {
|
|
|
|
color: var(--primary);
|
|
|
|
}
|
|
|
|
}
|
2024-02-22 04:08:06 +00:00
|
|
|
|
2024-02-29 04:08:54 +00:00
|
|
|
.header-section {
|
2024-02-22 04:08:06 +00:00
|
|
|
height: 100%;
|
2024-02-29 04:08:54 +00:00
|
|
|
display: flex;
|
2024-02-29 04:24:34 +00:00
|
|
|
align-items: center;
|
2024-02-29 04:08:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.search {
|
2024-02-29 04:24:34 +00:00
|
|
|
height: 2rem;
|
2024-02-22 04:08:06 +00:00
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
2024-02-29 04:24:34 +00:00
|
|
|
border-radius: 1rem;
|
2024-03-03 01:33:35 +00:00
|
|
|
background: var(--background-dark-10);
|
|
|
|
box-shadow: inset 0 0 3px var(--shadow-weak-40);
|
2024-02-22 04:08:06 +00:00
|
|
|
|
|
|
|
.input {
|
2024-02-29 04:24:34 +00:00
|
|
|
padding: .5rem 0 .5rem 1rem;
|
|
|
|
border: none;
|
2024-02-29 04:08:54 +00:00
|
|
|
margin: 0;
|
2024-02-29 04:24:34 +00:00
|
|
|
background: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
.search-button {
|
|
|
|
padding: 0;
|
|
|
|
border: none;
|
|
|
|
background: none;
|
2024-02-22 04:08:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.icon {
|
2024-02-29 04:24:34 +00:00
|
|
|
height: 100%;
|
|
|
|
padding: 0 .75rem 0 .5rem;
|
2024-02-22 04:08:06 +00:00
|
|
|
fill: var(--shadow-weak-10);
|
|
|
|
}
|
|
|
|
|
2024-02-29 04:24:34 +00:00
|
|
|
&.focused {
|
2024-03-03 01:33:35 +00:00
|
|
|
/*
|
2024-02-29 04:24:34 +00:00
|
|
|
border: solid 1px var(--primary-light-10);
|
2024-03-03 01:33:35 +00:00
|
|
|
*/
|
|
|
|
box-shadow: inset 0 0 3px var(--shadow-weak-30);
|
2024-02-29 04:24:34 +00:00
|
|
|
|
|
|
|
.icon {
|
|
|
|
fill: var(--primary);
|
|
|
|
cursor: pointer;
|
|
|
|
}
|
2024-02-22 04:08:06 +00:00
|
|
|
}
|
|
|
|
}
|
2024-02-29 04:08:54 +00:00
|
|
|
|
|
|
|
.userpanel {
|
|
|
|
height: 100%;
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
2024-02-29 04:24:34 +00:00
|
|
|
padding: 0 1rem 0 1.5rem;
|
2024-02-29 04:08:54 +00:00
|
|
|
font-size: 0;
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
|
|
&:hover .avatar {
|
|
|
|
box-shadow: 0 0 3px var(--shadow-weak-10);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.avatar {
|
|
|
|
width: 2rem;
|
|
|
|
height: 2rem;
|
|
|
|
border-radius: .25rem;
|
|
|
|
object-fit: cover;
|
|
|
|
}
|
|
|
|
|
|
|
|
.login {
|
|
|
|
text-decoration: none;
|
|
|
|
}
|
|
|
|
|
2024-03-03 01:33:35 +00:00
|
|
|
.menu {
|
|
|
|
overflow: hidden;
|
|
|
|
}
|
|
|
|
|
2024-02-29 04:08:54 +00:00
|
|
|
.menu-header {
|
|
|
|
display: flex;
|
|
|
|
padding: .75rem 1rem;
|
|
|
|
border-bottom: solid 1px var(--shadow-weak-30);
|
|
|
|
color: var(--shadow-strong-30);
|
|
|
|
text-decoration: none;
|
|
|
|
font-weight: bold;
|
|
|
|
}
|
|
|
|
|
|
|
|
.menu-item {
|
2024-03-03 01:33:35 +00:00
|
|
|
display: block;
|
|
|
|
}
|
|
|
|
|
|
|
|
.menu-button {
|
2024-02-29 04:08:54 +00:00
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
2024-03-03 01:33:35 +00:00
|
|
|
padding: .5rem .5rem .5rem .75rem;
|
2024-02-29 04:08:54 +00:00
|
|
|
|
|
|
|
.icon {
|
|
|
|
fill: var(--shadow);
|
2024-03-03 01:33:35 +00:00
|
|
|
margin-right: .75rem;
|
|
|
|
transform: translateY(-1px);
|
2024-02-29 04:08:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
background: var(--shadow-weak-30);
|
|
|
|
cursor: pointer;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.logout {
|
|
|
|
.icon {
|
|
|
|
fill: var(--error);
|
|
|
|
}
|
|
|
|
}
|
2023-12-30 05:29:53 +00:00
|
|
|
</style>
|