2022-04-15 14:24:30 +00:00
|
|
|
<template>
|
2022-10-13 15:18:47 +00:00
|
|
|
<div id="extraPanel" :class="{ 'showing-pane': selectedTab }">
|
|
|
|
<div class="controls">
|
|
|
|
<div class="top">
|
|
|
|
<SidebarMenuToggleButton class="burger"/>
|
|
|
|
<ExtraPanelTabHeader v-if="song" v-model="selectedTab"/>
|
|
|
|
</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"
|
|
|
|
>
|
2022-10-13 15:18:47 +00:00
|
|
|
<icon :icon="faInfoCircle"/>
|
2022-10-26 20:44:44 +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">
|
2022-10-13 15:18:47 +00:00
|
|
|
<icon :icon="faArrowRightFromBracket"/>
|
2022-04-15 14:24:30 +00:00
|
|
|
</button>
|
|
|
|
|
2022-10-13 15:18:47 +00:00
|
|
|
<ProfileAvatar @click="onProfileLinkClick"/>
|
2022-04-15 14:24:30 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2022-10-13 15:18:47 +00:00
|
|
|
<div class="panes" v-if="song" v-show="selectedTab">
|
|
|
|
<div
|
|
|
|
v-show="selectedTab === 'Lyrics'"
|
|
|
|
id="extraPanelLyrics"
|
|
|
|
aria-labelledby="extraTabLyrics"
|
|
|
|
role="tabpanel"
|
|
|
|
tabindex="0"
|
|
|
|
>
|
|
|
|
<LyricsPane :song="song"/>
|
|
|
|
</div>
|
2022-04-15 14:24:30 +00:00
|
|
|
|
2022-10-13 15:18:47 +00:00
|
|
|
<div
|
|
|
|
v-show="selectedTab === 'Artist'"
|
|
|
|
id="extraPanelArtist"
|
|
|
|
aria-labelledby="extraTabArtist"
|
|
|
|
role="tabpanel"
|
|
|
|
tabindex="0"
|
|
|
|
>
|
|
|
|
<ArtistInfo v-if="artist" :artist="artist" mode="aside"/>
|
|
|
|
<span v-else>Loading…</span>
|
|
|
|
</div>
|
2022-07-07 18:05:46 +00:00
|
|
|
|
2022-10-13 15:18:47 +00:00
|
|
|
<div
|
|
|
|
v-show="selectedTab === 'Album'"
|
|
|
|
id="extraPanelAlbum"
|
|
|
|
aria-labelledby="extraTabAlbum"
|
|
|
|
role="tabpanel"
|
|
|
|
tabindex="0"
|
|
|
|
>
|
|
|
|
<AlbumInfo v-if="album" :album="album" mode="aside"/>
|
|
|
|
<span v-else>Loading…</span>
|
|
|
|
</div>
|
2022-04-15 14:24:30 +00:00
|
|
|
|
2022-10-13 15:18:47 +00:00
|
|
|
<div
|
|
|
|
v-show="selectedTab === 'YouTube'"
|
|
|
|
id="extraPanelYouTube"
|
|
|
|
aria-labelledby="extraTabYouTube"
|
|
|
|
role="tabpanel"
|
|
|
|
tabindex="0"
|
|
|
|
>
|
|
|
|
<YouTubeVideoList v-if="useYouTube && song" :song="song"/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</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'
|
|
|
|
import { defineAsyncComponent, ref, watch } from 'vue'
|
|
|
|
import { albumStore, artistStore } 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'))
|
|
|
|
const ExtraPanelTabHeader = defineAsyncComponent(() => import('@/components/ui/ExtraPanelTabHeader.vue'))
|
|
|
|
|
|
|
|
const { currentUser } = useAuthorization()
|
2022-04-30 14:05:02 +00:00
|
|
|
const { useYouTube } = useThirdPartyServices()
|
|
|
|
|
2022-10-13 15:18:47 +00:00
|
|
|
const song = requireInjection(CurrentSongKey, ref(null))
|
|
|
|
const selectedTab = ref<ExtraPanelTab | undefined>(undefined)
|
2022-04-15 17:00:08 +00:00
|
|
|
|
2022-10-13 15:18:47 +00:00
|
|
|
const artist = ref<Artist | null>(null)
|
|
|
|
const album = ref<Album | null>(null)
|
|
|
|
|
|
|
|
watch(song, song => song && fetchSongInfo(song))
|
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
|
|
|
|
artist.value = null
|
|
|
|
album.value = null
|
|
|
|
|
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-26 20:44:44 +00:00
|
|
|
const { shouldNotifyNewVersion } = useNewVersionNotification()
|
|
|
|
|
2022-10-13 15:18:47 +00:00
|
|
|
const openAboutKoelModal = () => eventBus.emit('MODAL_SHOW_ABOUT_KOEL')
|
|
|
|
const onProfileLinkClick = () => isMobile.any && (selectedTab.value = undefined)
|
|
|
|
const logout = () => eventBus.emit('LOG_OUT')
|
|
|
|
</script>
|
2022-04-15 17:00:08 +00:00
|
|
|
|
2022-10-13 15:18:47 +00:00
|
|
|
<style lang="scss" scoped>
|
|
|
|
#extraPanel {
|
|
|
|
display: flex;
|
|
|
|
flex-direction: row-reverse;
|
|
|
|
color: var(--color-text-secondary);
|
|
|
|
height: var(--header-height);
|
|
|
|
z-index: 1;
|
|
|
|
|
|
|
|
@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 {
|
|
|
|
width: var(--extra-panel-width);
|
|
|
|
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>
|