2023-05-28 22:54:17 +00:00
|
|
|
<template>
|
|
|
|
<div class="container">
|
|
|
|
<header class="header">
|
|
|
|
<a href="/">
|
|
|
|
<h1 class="title">
|
|
|
|
<div
|
|
|
|
class="logo"
|
|
|
|
v-html="logo"
|
|
|
|
/>shack
|
|
|
|
</h1>
|
|
|
|
</a>
|
|
|
|
|
|
|
|
<div class="search">
|
|
|
|
<input
|
|
|
|
type="search"
|
|
|
|
class="input"
|
|
|
|
placeholder="Search the shack"
|
|
|
|
>
|
|
|
|
</div>
|
|
|
|
|
2023-06-25 21:50:08 +00:00
|
|
|
<div class="actions">
|
|
|
|
<VDropdown>
|
|
|
|
<button class="button">Explore</button>
|
|
|
|
|
|
|
|
<template #popper>
|
|
|
|
<ul class="tooltip nolist">
|
|
|
|
<li class="tooltip-item">
|
|
|
|
<a
|
|
|
|
href="/shelf/create"
|
|
|
|
class="menu-item"
|
|
|
|
>
|
|
|
|
<button class="button button-submit">New shelf</button>
|
|
|
|
</a>
|
|
|
|
</li>
|
|
|
|
|
|
|
|
<li
|
|
|
|
v-for="shelf in shelves"
|
|
|
|
:key="shelf.id"
|
|
|
|
class="tooltip-item"
|
|
|
|
>
|
|
|
|
<a
|
|
|
|
:href="`/s/${shelf.slug}`"
|
|
|
|
class="link shelf"
|
|
|
|
>s/{{ shelf.slug }}</a>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</template>
|
|
|
|
</VDropdown>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<VDropdown v-if="me">
|
|
|
|
<span class="userpanel">{{ me.username }}</span>
|
|
|
|
|
|
|
|
<template #popper>
|
|
|
|
<ul class="tooltip nolist">
|
|
|
|
<li>
|
|
|
|
<a
|
|
|
|
:href="`/user/${me.username}`"
|
|
|
|
class="link menu-item"
|
|
|
|
>Profile</a>
|
|
|
|
</li>
|
|
|
|
|
|
|
|
<li class="menu-item">
|
|
|
|
<button
|
|
|
|
class="button"
|
|
|
|
@click="logout"
|
|
|
|
>Log out</button>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</template>
|
|
|
|
</VDropdown>
|
|
|
|
|
|
|
|
<a
|
|
|
|
v-else
|
|
|
|
href="/account/login"
|
|
|
|
class="link userpanel"
|
|
|
|
>Log in</a>
|
2023-05-28 22:54:17 +00:00
|
|
|
</header>
|
|
|
|
|
|
|
|
<div class="content-container">
|
|
|
|
<slot />
|
2023-06-05 23:30:46 +00:00
|
|
|
<footer class="footer">shack {{ version }}</footer>
|
2023-05-28 22:54:17 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script setup>
|
2023-06-11 03:32:02 +00:00
|
|
|
import logo from '../assets/img/logo.svg?raw'; // eslint-disable-line import/no-unresolved
|
2023-05-28 22:54:17 +00:00
|
|
|
import { del } from '../assets/js/api';
|
2023-06-25 17:52:00 +00:00
|
|
|
import { navigate } from '../assets/js/navigate';
|
2023-06-11 03:32:02 +00:00
|
|
|
import { usePageContext } from './usePageContext';
|
2023-05-28 22:54:17 +00:00
|
|
|
|
2023-06-25 21:50:08 +00:00
|
|
|
const { pageData, me } = usePageContext();
|
|
|
|
const { shelves } = pageData;
|
|
|
|
|
2023-05-28 22:54:17 +00:00
|
|
|
const version = CLIENT_VERSION;
|
|
|
|
|
|
|
|
async function logout() {
|
2023-06-25 17:52:00 +00:00
|
|
|
await del('/session');
|
|
|
|
navigate('/account/login');
|
2023-05-28 22:54:17 +00:00
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style>
|
2023-06-25 21:50:08 +00:00
|
|
|
.content {
|
|
|
|
display: flex;
|
|
|
|
flex-grow: 1;
|
|
|
|
flex-direction: column;
|
|
|
|
padding: 1rem;
|
|
|
|
}
|
|
|
|
|
2023-05-28 22:54:17 +00:00
|
|
|
.logo svg {
|
|
|
|
height: 100%;
|
|
|
|
width: auto;
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
.container {
|
|
|
|
height: 100%;
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
background: var(--background-dark-10);
|
|
|
|
}
|
|
|
|
|
|
|
|
.content-container {
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
flex-grow: 1;
|
|
|
|
overflow-y: auto;
|
|
|
|
}
|
|
|
|
|
|
|
|
.header {
|
|
|
|
display: flex;
|
2023-06-25 21:50:08 +00:00
|
|
|
align-items: center;
|
2023-05-28 22:54:17 +00:00
|
|
|
flex-shrink: 0;
|
|
|
|
background: var(--background);
|
|
|
|
box-shadow: 0 0 3px var(--shadow-weak-10);
|
|
|
|
overflow: hidden;
|
|
|
|
}
|
|
|
|
|
|
|
|
.logo {
|
|
|
|
width: auto;
|
|
|
|
height: 1.75rem;
|
|
|
|
fill: var(--primary);
|
|
|
|
margin: .75rem .5rem 1rem 1rem;
|
|
|
|
}
|
|
|
|
|
|
|
|
.title {
|
|
|
|
font-size: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
.search {
|
|
|
|
display: flex;
|
|
|
|
flex-grow: 1;
|
|
|
|
align-items: center;
|
|
|
|
margin: 0 1rem;
|
|
|
|
|
|
|
|
.input {
|
|
|
|
flex-grow: 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-06-25 21:50:08 +00:00
|
|
|
.actions {
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
}
|
|
|
|
|
2023-05-28 22:54:17 +00:00
|
|
|
.userpanel {
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
padding: 1rem;
|
|
|
|
font-weight: bold;
|
2023-06-25 21:50:08 +00:00
|
|
|
cursor: pointer;
|
|
|
|
}
|
|
|
|
|
|
|
|
.tooltip {
|
|
|
|
width: 10rem;
|
|
|
|
padding-bottom: .25rem;
|
|
|
|
|
|
|
|
.button {
|
|
|
|
width: 100%;
|
|
|
|
}
|
|
|
|
|
|
|
|
.shelf {
|
|
|
|
display: block;
|
|
|
|
box-sizing: border-box;
|
|
|
|
padding: .25rem .5rem;
|
|
|
|
}
|
2023-05-28 22:54:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.footer {
|
|
|
|
padding: .5rem 1rem;
|
|
|
|
color: var(--shadow);
|
|
|
|
text-align: center;
|
|
|
|
}
|
|
|
|
</style>
|