2022-04-15 14:24:30 +00:00
|
|
|
<template>
|
2022-10-13 15:18:47 +00:00
|
|
|
<nav id="sidebar" :class="{ showing: mobileShowing }" class="side side-nav" v-koel-clickaway="closeIfMobile">
|
|
|
|
<SearchForm/>
|
2022-04-15 14:24:30 +00:00
|
|
|
<section class="music">
|
|
|
|
<h1>Your Music</h1>
|
|
|
|
|
|
|
|
<ul class="menu">
|
|
|
|
<li>
|
2022-10-09 08:55:58 +00:00
|
|
|
<a :class="['home', activeScreen === 'Home' ? 'active' : '']" href="#/home">
|
2022-07-15 07:23:55 +00:00
|
|
|
<icon :icon="faHome" fixed-width/>
|
|
|
|
Home
|
|
|
|
</a>
|
2022-04-15 14:24:30 +00:00
|
|
|
</li>
|
2022-09-12 11:11:56 +00:00
|
|
|
<li
|
|
|
|
:class="droppableToQueue && 'droppable'"
|
|
|
|
@dragleave="onQueueDragLeave"
|
|
|
|
@dragover="onQueueDragOver"
|
|
|
|
@drop="onQueueDrop"
|
|
|
|
>
|
2022-10-09 08:55:58 +00:00
|
|
|
<a :class="['queue', activeScreen === 'Queue' ? 'active' : '']" href="#/queue">
|
2022-07-15 07:23:55 +00:00
|
|
|
<icon :icon="faListOl" fixed-width/>
|
2022-04-24 08:29:14 +00:00
|
|
|
Current Queue
|
|
|
|
</a>
|
2022-04-15 14:24:30 +00:00
|
|
|
</li>
|
|
|
|
<li>
|
2022-10-09 08:55:58 +00:00
|
|
|
<a :class="['songs', activeScreen === 'Songs' ? 'active' : '']" href="#/songs">
|
2022-07-15 07:23:55 +00:00
|
|
|
<icon :icon="faMusic" fixed-width/>
|
|
|
|
All Songs
|
|
|
|
</a>
|
2022-04-15 14:24:30 +00:00
|
|
|
</li>
|
|
|
|
<li>
|
2022-10-09 08:55:58 +00:00
|
|
|
<a :class="['albums', activeScreen === 'Albums' ? 'active' : '']" href="#/albums">
|
2022-07-15 07:23:55 +00:00
|
|
|
<icon :icon="faCompactDisc" fixed-width/>
|
|
|
|
Albums
|
|
|
|
</a>
|
2022-04-15 14:24:30 +00:00
|
|
|
</li>
|
|
|
|
<li>
|
2022-10-09 08:55:58 +00:00
|
|
|
<a :class="['artists', activeScreen === 'Artists' ? 'active' : '']" href="#/artists">
|
2022-07-15 07:23:55 +00:00
|
|
|
<icon :icon="faMicrophone" fixed-width/>
|
|
|
|
Artists
|
|
|
|
</a>
|
2022-04-15 14:24:30 +00:00
|
|
|
</li>
|
2022-04-24 08:29:14 +00:00
|
|
|
<li v-if="useYouTube">
|
2022-10-09 08:55:58 +00:00
|
|
|
<a :class="['youtube', activeScreen === 'YouTube' ? 'active' : '']" href="#/youtube">
|
2022-07-15 07:23:55 +00:00
|
|
|
<icon :icon="faYoutube" fixed-width/>
|
|
|
|
YouTube Video
|
|
|
|
</a>
|
2022-04-15 14:24:30 +00:00
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</section>
|
|
|
|
|
2022-09-12 11:11:56 +00:00
|
|
|
<PlaylistList/>
|
2022-04-15 14:24:30 +00:00
|
|
|
|
2022-04-30 14:05:02 +00:00
|
|
|
<section v-if="isAdmin" class="manage">
|
2022-04-15 14:24:30 +00:00
|
|
|
<h1>Manage</h1>
|
|
|
|
|
|
|
|
<ul class="menu">
|
|
|
|
<li>
|
2022-10-09 08:55:58 +00:00
|
|
|
<a :class="['settings', activeScreen === 'Settings' ? 'active' : '']" href="#/settings">
|
2022-07-15 07:23:55 +00:00
|
|
|
<icon :icon="faTools" fixed-width/>
|
|
|
|
Settings
|
|
|
|
</a>
|
2022-04-15 14:24:30 +00:00
|
|
|
</li>
|
|
|
|
<li>
|
2022-10-09 08:55:58 +00:00
|
|
|
<a :class="['upload', activeScreen === 'Upload' ? 'active' : '']" href="#/upload">
|
2022-07-15 07:23:55 +00:00
|
|
|
<icon :icon="faUpload" fixed-width/>
|
|
|
|
Upload
|
|
|
|
</a>
|
2022-04-15 14:24:30 +00:00
|
|
|
</li>
|
|
|
|
<li>
|
2022-10-09 08:55:58 +00:00
|
|
|
<a :class="['users', activeScreen === 'Users' ? 'active' : '']" href="#/users">
|
2022-07-15 07:23:55 +00:00
|
|
|
<icon :icon="faUsers" fixed-width/>
|
|
|
|
Users
|
|
|
|
</a>
|
2022-04-15 14:24:30 +00:00
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</section>
|
|
|
|
</nav>
|
|
|
|
</template>
|
|
|
|
|
2022-04-15 17:00:08 +00:00
|
|
|
<script lang="ts" setup>
|
2022-07-15 07:23:55 +00:00
|
|
|
import {
|
|
|
|
faCompactDisc,
|
|
|
|
faHome,
|
|
|
|
faListOl,
|
|
|
|
faMicrophone,
|
|
|
|
faMusic,
|
|
|
|
faTools,
|
|
|
|
faUpload,
|
|
|
|
faUsers
|
|
|
|
} from '@fortawesome/free-solid-svg-icons'
|
|
|
|
import { faYoutube } from '@fortawesome/free-brands-svg-icons'
|
2022-07-07 18:05:46 +00:00
|
|
|
import { ref } from 'vue'
|
2022-09-12 11:11:56 +00:00
|
|
|
import { eventBus, requireInjection } from '@/utils'
|
2022-06-10 10:47:46 +00:00
|
|
|
import { queueStore } from '@/stores'
|
2022-09-03 08:32:09 +00:00
|
|
|
import { useAuthorization, useDroppable, useThirdPartyServices } from '@/composables'
|
2022-10-08 10:54:25 +00:00
|
|
|
import { RouterKey } from '@/symbols'
|
2022-04-15 14:24:30 +00:00
|
|
|
|
2022-07-07 18:05:46 +00:00
|
|
|
import PlaylistList from '@/components/playlist/PlaylistSidebarList.vue'
|
2022-10-13 15:18:47 +00:00
|
|
|
import SearchForm from '@/components/ui/SearchForm.vue'
|
2022-04-15 14:24:30 +00:00
|
|
|
|
2022-10-13 15:18:47 +00:00
|
|
|
const mobileShowing = ref(false)
|
2022-10-08 10:54:25 +00:00
|
|
|
const activeScreen = ref<ScreenName>()
|
2022-09-12 11:11:56 +00:00
|
|
|
const droppableToQueue = ref(false)
|
2022-09-03 08:32:09 +00:00
|
|
|
|
|
|
|
const { acceptsDrop, resolveDroppedSongs } = useDroppable(['songs', 'album', 'artist', 'playlist'])
|
2022-04-30 14:05:02 +00:00
|
|
|
const { useYouTube } = useThirdPartyServices()
|
|
|
|
const { isAdmin } = useAuthorization()
|
2022-04-15 14:24:30 +00:00
|
|
|
|
2022-09-03 08:32:09 +00:00
|
|
|
const onQueueDragOver = (event: DragEvent) => {
|
|
|
|
if (!acceptsDrop(event)) return false
|
|
|
|
|
|
|
|
event.preventDefault()
|
|
|
|
event.dataTransfer!.dropEffect = 'move'
|
2022-09-12 11:11:56 +00:00
|
|
|
droppableToQueue.value = true
|
2022-09-03 08:32:09 +00:00
|
|
|
}
|
|
|
|
|
2022-09-12 11:11:56 +00:00
|
|
|
const onQueueDragLeave = () => (droppableToQueue.value = false)
|
2022-09-03 08:32:09 +00:00
|
|
|
|
|
|
|
const onQueueDrop = async (event: DragEvent) => {
|
2022-09-12 11:11:56 +00:00
|
|
|
droppableToQueue.value = false
|
2022-09-03 08:32:09 +00:00
|
|
|
|
|
|
|
if (!acceptsDrop(event)) return false
|
|
|
|
|
|
|
|
event.preventDefault()
|
|
|
|
const songs = await resolveDroppedSongs(event) || []
|
2022-04-15 17:00:08 +00:00
|
|
|
songs.length && queueStore.queue(songs)
|
2022-04-15 14:24:30 +00:00
|
|
|
|
2022-04-15 17:00:08 +00:00
|
|
|
return false
|
|
|
|
}
|
2022-04-15 14:24:30 +00:00
|
|
|
|
2022-10-13 15:18:47 +00:00
|
|
|
const closeIfMobile = () => (mobileShowing.value = false)
|
|
|
|
|
2022-10-08 10:54:25 +00:00
|
|
|
const router = requireInjection(RouterKey)
|
|
|
|
|
|
|
|
router.onRouteChanged(route => {
|
2022-10-13 15:18:47 +00:00
|
|
|
mobileShowing.value = false
|
2022-10-08 10:54:25 +00:00
|
|
|
activeScreen.value = route.screen
|
|
|
|
})
|
2022-09-12 11:11:56 +00:00
|
|
|
|
2022-10-08 10:54:25 +00:00
|
|
|
eventBus.on({
|
2022-09-12 11:11:56 +00:00
|
|
|
/**
|
|
|
|
* Listen to toggle sidebar event to show or hide the sidebar.
|
2022-08-01 08:58:25 +00:00
|
|
|
* This should only be triggered on a mobile device.
|
|
|
|
*/
|
2022-10-13 15:18:47 +00:00
|
|
|
TOGGLE_SIDEBAR: () => (mobileShowing.value = !mobileShowing.value)
|
2022-04-15 14:24:30 +00:00
|
|
|
})
|
|
|
|
</script>
|
|
|
|
|
2022-08-10 14:56:01 +00:00
|
|
|
<style lang="scss" scoped>
|
|
|
|
nav {
|
2022-10-13 15:18:47 +00:00
|
|
|
width: var(--sidebar-width);
|
2022-04-15 14:24:30 +00:00
|
|
|
background-color: var(--color-bg-secondary);
|
2022-10-13 15:18:47 +00:00
|
|
|
padding: 2.05rem 1.5rem;
|
2022-04-15 14:24:30 +00:00
|
|
|
overflow: auto;
|
|
|
|
overflow-x: hidden;
|
|
|
|
-ms-overflow-style: -ms-autohiding-scrollbar;
|
|
|
|
|
|
|
|
> * + * {
|
|
|
|
margin-top: 2.25rem;
|
|
|
|
}
|
|
|
|
|
|
|
|
@media (hover: none) {
|
|
|
|
// Enable scroll with momentum on touch devices
|
|
|
|
overflow-y: scroll;
|
|
|
|
-webkit-overflow-scrolling: touch;
|
|
|
|
}
|
|
|
|
|
2022-09-03 08:32:09 +00:00
|
|
|
.droppable {
|
|
|
|
box-shadow: inset 0 0 0 1px var(--color-accent);
|
|
|
|
border-radius: 4px;
|
|
|
|
cursor: copy;
|
2022-04-15 14:24:30 +00:00
|
|
|
}
|
|
|
|
|
2022-08-01 08:58:25 +00:00
|
|
|
.queue > span {
|
|
|
|
display: flex;
|
|
|
|
align-items: baseline;
|
|
|
|
justify-content: space-between;
|
|
|
|
flex: 1;
|
|
|
|
}
|
|
|
|
|
2022-08-10 14:56:01 +00:00
|
|
|
::v-deep(h1) {
|
|
|
|
text-transform: uppercase;
|
|
|
|
letter-spacing: 1px;
|
|
|
|
margin-bottom: 12px;
|
|
|
|
}
|
|
|
|
|
2022-10-13 15:18:47 +00:00
|
|
|
::v-deep(a svg) {
|
|
|
|
opacity: .7;
|
|
|
|
}
|
|
|
|
|
2022-08-10 14:56:01 +00:00
|
|
|
::v-deep(a) {
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
gap: .7rem;
|
|
|
|
height: 36px;
|
|
|
|
line-height: 36px;
|
|
|
|
white-space: nowrap;
|
|
|
|
text-overflow: ellipsis;
|
2022-10-13 15:18:47 +00:00
|
|
|
position: relative;
|
2022-08-10 14:56:01 +00:00
|
|
|
|
2022-10-13 15:18:47 +00:00
|
|
|
&:active {
|
|
|
|
padding: 2px 0 0 2px;
|
2022-04-15 14:24:30 +00:00
|
|
|
}
|
|
|
|
|
2022-10-13 15:18:47 +00:00
|
|
|
&.active, &:hover {
|
|
|
|
color: var(--color-text-primary);
|
2022-04-15 14:24:30 +00:00
|
|
|
}
|
2022-08-10 14:56:01 +00:00
|
|
|
|
2022-10-13 15:18:47 +00:00
|
|
|
&.active {
|
|
|
|
&::before {
|
|
|
|
content: '';
|
|
|
|
position: absolute;
|
|
|
|
top: 25%;
|
|
|
|
right: -1.5rem;
|
|
|
|
width: 4px;
|
|
|
|
height: 50%;
|
|
|
|
background-color: var(--color-highlight);
|
|
|
|
box-shadow: 0 0 40px 10px var(--color-highlight);
|
|
|
|
border-radius: 9999rem;
|
|
|
|
}
|
2022-08-10 14:56:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
::v-deep(li li a) { // submenu items
|
2022-10-13 15:18:47 +00:00
|
|
|
padding-left: 11px;
|
|
|
|
|
|
|
|
&:active {
|
|
|
|
padding: 2px 0 0 13px;
|
|
|
|
}
|
2022-04-15 14:24:30 +00:00
|
|
|
}
|
|
|
|
|
2022-10-13 15:18:47 +00:00
|
|
|
@media screen and (max-width: 768px) {
|
2022-04-15 14:24:30 +00:00
|
|
|
@include themed-background();
|
2022-10-13 15:18:47 +00:00
|
|
|
transform: translateX(-100vw);
|
|
|
|
transition: transform .2s ease-in-out;
|
2022-04-15 14:24:30 +00:00
|
|
|
|
|
|
|
position: fixed;
|
|
|
|
width: 100%;
|
|
|
|
z-index: 99;
|
2022-10-13 15:18:47 +00:00
|
|
|
height: calc(100vh - var(--header-height));
|
2022-04-15 14:24:30 +00:00
|
|
|
|
|
|
|
&.showing {
|
2022-10-13 15:18:47 +00:00
|
|
|
transform: translateX(0);
|
2022-04-15 14:24:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|