2022-04-15 14:24:30 +00:00
|
|
|
<template>
|
2022-12-15 16:31:52 +00:00
|
|
|
<aside :class="{ 'showing-pane': activeTab }">
|
2022-10-13 15:18:47 +00:00
|
|
|
<div class="controls">
|
|
|
|
<div class="top">
|
2022-12-02 16:17:37 +00:00
|
|
|
<SidebarMenuToggleButton class="burger" />
|
2022-12-15 17:16:36 +00:00
|
|
|
<ExtraDrawerTabHeader v-if="song" v-model="activeTab" />
|
2022-10-13 15:18:47 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="bottom">
|
2022-10-26 20:44:44 +00:00
|
|
|
<button
|
|
|
|
v-koel-tooltip.left
|
|
|
|
:title="shouldNotifyNewVersion ? 'New version available!' : 'About Koel'"
|
|
|
|
type="button"
|
|
|
|
@click.prevent="openAboutKoelModal"
|
|
|
|
>
|
2023-11-10 13:16:06 +00:00
|
|
|
<Icon :icon="faInfoCircle" />
|
2022-12-02 16:17:37 +00:00
|
|
|
<span v-if="shouldNotifyNewVersion" class="new-version-notification" />
|
2022-04-15 14:24:30 +00:00
|
|
|
</button>
|
2022-10-13 15:18:47 +00:00
|
|
|
|
2022-10-25 17:29:56 +00:00
|
|
|
<button v-koel-tooltip.left title="Log out" type="button" @click.prevent="logout">
|
2023-11-10 13:16:06 +00:00
|
|
|
<Icon :icon="faArrowRightFromBracket" />
|
2022-04-15 14:24:30 +00:00
|
|
|
</button>
|
|
|
|
|
2022-12-02 16:17:37 +00:00
|
|
|
<ProfileAvatar @click="onProfileLinkClick" />
|
2022-04-15 14:24:30 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2022-12-02 16:17:37 +00:00
|
|
|
<div v-if="song" v-show="activeTab" class="panes">
|
2022-10-13 15:18:47 +00:00
|
|
|
<div
|
2022-11-20 14:05:53 +00:00
|
|
|
v-show="activeTab === 'Lyrics'"
|
2022-10-13 15:18:47 +00:00
|
|
|
id="extraPanelLyrics"
|
|
|
|
aria-labelledby="extraTabLyrics"
|
|
|
|
role="tabpanel"
|
|
|
|
tabindex="0"
|
|
|
|
>
|
2022-12-02 16:17:37 +00:00
|
|
|
<LyricsPane :song="song" />
|
2022-10-13 15:18:47 +00:00
|
|
|
</div>
|
2022-04-15 14:24:30 +00:00
|
|
|
|
2022-10-13 15:18:47 +00:00
|
|
|
<div
|
2022-11-20 14:05:53 +00:00
|
|
|
v-show="activeTab === 'Artist'"
|
2022-10-13 15:18:47 +00:00
|
|
|
id="extraPanelArtist"
|
|
|
|
aria-labelledby="extraTabArtist"
|
|
|
|
role="tabpanel"
|
|
|
|
tabindex="0"
|
|
|
|
>
|
2022-12-02 16:17:37 +00:00
|
|
|
<ArtistInfo v-if="artist" :artist="artist" mode="aside" />
|
2022-10-13 15:18:47 +00:00
|
|
|
<span v-else>Loading…</span>
|
|
|
|
</div>
|
2022-07-07 18:05:46 +00:00
|
|
|
|
2022-10-13 15:18:47 +00:00
|
|
|
<div
|
2022-11-20 14:05:53 +00:00
|
|
|
v-show="activeTab === 'Album'"
|
2022-10-13 15:18:47 +00:00
|
|
|
id="extraPanelAlbum"
|
|
|
|
aria-labelledby="extraTabAlbum"
|
|
|
|
role="tabpanel"
|
|
|
|
tabindex="0"
|
|
|
|
>
|
2022-12-02 16:17:37 +00:00
|
|
|
<AlbumInfo v-if="album" :album="album" mode="aside" />
|
2022-10-13 15:18:47 +00:00
|
|
|
<span v-else>Loading…</span>
|
|
|
|
</div>
|
2022-04-15 14:24:30 +00:00
|
|
|
|
2022-10-13 15:18:47 +00:00
|
|
|
<div
|
2022-11-20 14:05:53 +00:00
|
|
|
v-show="activeTab === 'YouTube'"
|
2022-10-13 15:18:47 +00:00
|
|
|
id="extraPanelYouTube"
|
2022-12-15 16:31:52 +00:00
|
|
|
data-testid="extra-drawer-youtube"
|
2022-10-13 15:18:47 +00:00
|
|
|
aria-labelledby="extraTabYouTube"
|
|
|
|
role="tabpanel"
|
|
|
|
tabindex="0"
|
|
|
|
>
|
2022-12-02 16:17:37 +00:00
|
|
|
<YouTubeVideoList v-if="useYouTube && song" :song="song" />
|
2022-10-13 15:18:47 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2022-12-15 16:31:52 +00:00
|
|
|
</aside>
|
2022-10-13 15:18:47 +00:00
|
|
|
</template>
|
2022-04-15 17:00:08 +00:00
|
|
|
|
2022-10-13 15:18:47 +00:00
|
|
|
<script lang="ts" setup>
|
|
|
|
import isMobile from 'ismobilejs'
|
|
|
|
import { faArrowRightFromBracket, faInfoCircle } from '@fortawesome/free-solid-svg-icons'
|
2022-11-20 14:05:53 +00:00
|
|
|
import { defineAsyncComponent, onMounted, ref, watch } from 'vue'
|
|
|
|
import { albumStore, artistStore, preferenceStore } from '@/stores'
|
2022-10-26 20:44:44 +00:00
|
|
|
import { useAuthorization, useNewVersionNotification, useThirdPartyServices } from '@/composables'
|
2022-10-13 15:18:47 +00:00
|
|
|
import { eventBus, logger, requireInjection } from '@/utils'
|
|
|
|
import { CurrentSongKey } from '@/symbols'
|
|
|
|
|
|
|
|
import ProfileAvatar from '@/components/ui/ProfileAvatar.vue'
|
|
|
|
import SidebarMenuToggleButton from '@/components/ui/SidebarMenuToggleButton.vue'
|
|
|
|
|
|
|
|
const LyricsPane = defineAsyncComponent(() => import('@/components/ui/LyricsPane.vue'))
|
|
|
|
const ArtistInfo = defineAsyncComponent(() => import('@/components/artist/ArtistInfo.vue'))
|
|
|
|
const AlbumInfo = defineAsyncComponent(() => import('@/components/album/AlbumInfo.vue'))
|
|
|
|
const YouTubeVideoList = defineAsyncComponent(() => import('@/components/ui/YouTubeVideoList.vue'))
|
2022-12-15 17:16:36 +00:00
|
|
|
const ExtraDrawerTabHeader = defineAsyncComponent(() => import('@/components/ui/ExtraDrawerTabHeader.vue'))
|
2022-10-13 15:18:47 +00:00
|
|
|
|
|
|
|
const { currentUser } = useAuthorization()
|
2022-04-30 14:05:02 +00:00
|
|
|
const { useYouTube } = useThirdPartyServices()
|
2022-11-20 14:05:53 +00:00
|
|
|
const { shouldNotifyNewVersion } = useNewVersionNotification()
|
2022-04-30 14:05:02 +00:00
|
|
|
|
2022-10-13 15:18:47 +00:00
|
|
|
const song = requireInjection(CurrentSongKey, ref(null))
|
2022-11-20 14:05:53 +00:00
|
|
|
const activeTab = ref<ExtraPanelTab | null>(null)
|
2022-04-15 17:00:08 +00:00
|
|
|
|
2022-12-02 16:17:37 +00:00
|
|
|
const artist = ref<Artist>()
|
|
|
|
const album = ref<Album>()
|
2022-10-13 15:18:47 +00:00
|
|
|
|
|
|
|
watch(song, song => song && fetchSongInfo(song))
|
2022-11-20 14:05:53 +00:00
|
|
|
watch(activeTab, tab => (preferenceStore.activeExtraPanelTab = tab))
|
2022-04-15 17:00:08 +00:00
|
|
|
|
2022-04-25 16:13:18 +00:00
|
|
|
const fetchSongInfo = async (_song: Song) => {
|
2022-10-13 15:18:47 +00:00
|
|
|
song.value = _song
|
2022-12-02 16:17:37 +00:00
|
|
|
artist.value = undefined
|
|
|
|
album.value = undefined
|
2022-10-13 15:18:47 +00:00
|
|
|
|
2022-04-15 17:00:08 +00:00
|
|
|
try {
|
2022-06-10 10:47:46 +00:00
|
|
|
artist.value = await artistStore.resolve(_song.artist_id)
|
|
|
|
album.value = await albumStore.resolve(_song.album_id)
|
2022-10-13 15:18:47 +00:00
|
|
|
} catch (error) {
|
|
|
|
logger.log('Failed to fetch media information', error)
|
2022-04-15 17:00:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-10-13 15:18:47 +00:00
|
|
|
const openAboutKoelModal = () => eventBus.emit('MODAL_SHOW_ABOUT_KOEL')
|
2022-11-20 14:05:53 +00:00
|
|
|
const onProfileLinkClick = () => isMobile.any && (activeTab.value = null)
|
2022-10-13 15:18:47 +00:00
|
|
|
const logout = () => eventBus.emit('LOG_OUT')
|
2022-11-20 14:05:53 +00:00
|
|
|
|
|
|
|
onMounted(() => isMobile.any || (activeTab.value = preferenceStore.activeExtraPanelTab))
|
2022-10-13 15:18:47 +00:00
|
|
|
</script>
|
2022-04-15 17:00:08 +00:00
|
|
|
|
2022-10-13 15:18:47 +00:00
|
|
|
<style lang="scss" scoped>
|
2022-12-15 16:31:52 +00:00
|
|
|
aside {
|
2022-10-13 15:18:47 +00:00
|
|
|
display: flex;
|
|
|
|
flex-direction: row-reverse;
|
|
|
|
color: var(--color-text-secondary);
|
|
|
|
height: var(--header-height);
|
2022-11-27 17:39:50 +00:00
|
|
|
z-index: 2;
|
2022-10-13 15:18:47 +00:00
|
|
|
|
|
|
|
@media screen and (max-width: 768px) {
|
|
|
|
@include themed-background();
|
|
|
|
flex-direction: column;
|
|
|
|
position: fixed;
|
|
|
|
top: 0;
|
|
|
|
width: 100%;
|
|
|
|
|
|
|
|
&.showing-pane {
|
|
|
|
height: 100%;
|
|
|
|
}
|
2022-04-15 14:24:30 +00:00
|
|
|
}
|
2022-10-13 15:18:47 +00:00
|
|
|
}
|
2022-04-15 14:24:30 +00:00
|
|
|
|
2022-10-13 15:18:47 +00:00
|
|
|
.panes {
|
2022-12-15 16:31:52 +00:00
|
|
|
width: var(--extra-drawer-width);
|
2022-10-13 15:18:47 +00:00
|
|
|
padding: 2rem 1.7rem;
|
2022-04-15 14:24:30 +00:00
|
|
|
background: var(--color-bg-secondary);
|
|
|
|
overflow: auto;
|
2022-10-18 14:07:41 +00:00
|
|
|
box-shadow: 0 0 5px 0 rgba(0, 0, 0, 0.1);
|
2022-04-15 14:24:30 +00:00
|
|
|
|
|
|
|
@media (hover: none) {
|
|
|
|
// Enable scroll with momentum on touch devices
|
|
|
|
overflow-y: scroll;
|
|
|
|
-webkit-overflow-scrolling: touch;
|
|
|
|
}
|
|
|
|
|
2022-10-13 15:18:47 +00:00
|
|
|
@media screen and (max-width: 768px) {
|
|
|
|
width: 100%;
|
|
|
|
height: calc(100vh - var(--header-height) - var(--footer-height));
|
2022-04-15 14:24:30 +00:00
|
|
|
}
|
2022-10-13 15:18:47 +00:00
|
|
|
}
|
2022-04-15 14:24:30 +00:00
|
|
|
|
2022-10-13 15:18:47 +00:00
|
|
|
.controls {
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
justify-content: space-between;
|
|
|
|
align-items: center;
|
|
|
|
height: 100%;
|
|
|
|
width: 64px;
|
|
|
|
padding: 1.6rem 0 1.2rem;
|
|
|
|
background-color: rgba(0, 0, 0, .05);
|
|
|
|
border-left: 1px solid rgba(255, 255, 255, .05);
|
|
|
|
|
|
|
|
@media screen and (max-width: 768px) {
|
|
|
|
z-index: 2;
|
|
|
|
height: auto;
|
|
|
|
width: 100%;
|
|
|
|
flex-direction: row;
|
|
|
|
padding: .5rem 1rem;
|
|
|
|
border-bottom: 1px solid rgba(255, 255, 255, .05);
|
2022-10-18 14:07:41 +00:00
|
|
|
box-shadow: 0 0 30px 0 rgba(0, 0, 0, .5);
|
2022-04-15 14:24:30 +00:00
|
|
|
}
|
|
|
|
|
2022-10-13 15:18:47 +00:00
|
|
|
.top, .bottom {
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
justify-content: space-between;
|
|
|
|
align-items: center;
|
|
|
|
gap: 1rem;
|
|
|
|
|
|
|
|
@media screen and (max-width: 768px) {
|
|
|
|
flex-direction: row;
|
|
|
|
gap: .25rem;
|
2022-04-15 14:24:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-10-27 17:06:49 +00:00
|
|
|
:deep(button) {
|
2022-10-26 20:44:44 +00:00
|
|
|
position: relative;
|
2022-10-13 15:18:47 +00:00
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: center;
|
|
|
|
height: 42px;
|
|
|
|
aspect-ratio: 1/1;
|
|
|
|
border-radius: 999rem;
|
|
|
|
background: rgba(0, 0, 0, .3);
|
|
|
|
font-size: 1.2rem;
|
|
|
|
opacity: .7;
|
|
|
|
transition: opacity .2s ease-in-out;
|
|
|
|
color: currentColor;
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
|
|
@media screen and (max-width: 768px) {
|
|
|
|
background: none;
|
|
|
|
}
|
2022-04-15 14:24:30 +00:00
|
|
|
|
2022-10-13 15:18:47 +00:00
|
|
|
&:hover, &.active {
|
|
|
|
opacity: 1;
|
|
|
|
color: var(--color-text-primary);
|
|
|
|
}
|
|
|
|
|
|
|
|
&:active {
|
|
|
|
transform: scale(.9);
|
|
|
|
}
|
|
|
|
|
|
|
|
&.burger {
|
|
|
|
display: none;
|
2022-04-15 14:24:30 +00:00
|
|
|
|
2022-10-13 15:18:47 +00:00
|
|
|
@media screen and (max-width: 768px) {
|
|
|
|
display: block;
|
|
|
|
}
|
2022-04-15 14:24:30 +00:00
|
|
|
}
|
|
|
|
}
|
2022-10-26 20:44:44 +00:00
|
|
|
|
|
|
|
.new-version-notification {
|
|
|
|
position: absolute;
|
|
|
|
width: 10px;
|
|
|
|
height: 10px;
|
|
|
|
background: var(--color-highlight);
|
|
|
|
right: 1px;
|
|
|
|
top: 1px;
|
|
|
|
border-radius: 50%;
|
|
|
|
}
|
2022-04-15 14:24:30 +00:00
|
|
|
}
|
|
|
|
</style>
|