2022-04-15 14:24:30 +00:00
|
|
|
<template>
|
2022-04-25 16:13:18 +00:00
|
|
|
<section id="extra" :class="{ showing }" class="text-secondary" data-testid="extra-panel">
|
2022-04-15 14:24:30 +00:00
|
|
|
<div class="tabs">
|
|
|
|
<div class="clear" role="tablist">
|
|
|
|
<button
|
2022-04-25 16:13:18 +00:00
|
|
|
id="extraTabLyrics"
|
2022-04-15 14:24:30 +00:00
|
|
|
:aria-selected="currentTab === 'Lyrics'"
|
|
|
|
aria-controls="extraPanelLyrics"
|
2022-05-06 10:28:02 +00:00
|
|
|
data-testid="extra-tab-lyrics"
|
2022-04-15 14:24:30 +00:00
|
|
|
role="tab"
|
2022-04-25 16:13:18 +00:00
|
|
|
@click.prevent="currentTab = 'Lyrics'"
|
2022-04-15 14:24:30 +00:00
|
|
|
>
|
|
|
|
Lyrics
|
|
|
|
</button>
|
|
|
|
<button
|
2022-04-25 16:13:18 +00:00
|
|
|
id="extraTabArtist"
|
2022-04-15 14:24:30 +00:00
|
|
|
:aria-selected="currentTab === 'Artist'"
|
|
|
|
aria-controls="extraPanelArtist"
|
2022-05-06 10:28:02 +00:00
|
|
|
data-testid="extra-tab-artist"
|
2022-04-15 14:24:30 +00:00
|
|
|
role="tab"
|
2022-04-25 16:13:18 +00:00
|
|
|
@click.prevent="currentTab = 'Artist'"
|
2022-04-15 14:24:30 +00:00
|
|
|
>
|
|
|
|
Artist
|
|
|
|
</button>
|
|
|
|
<button
|
2022-04-25 16:13:18 +00:00
|
|
|
id="extraTabAlbum"
|
2022-04-15 14:24:30 +00:00
|
|
|
:aria-selected="currentTab === 'Album'"
|
|
|
|
aria-controls="extraPanelAlbum"
|
2022-05-06 10:28:02 +00:00
|
|
|
data-testid="extra-tab-album"
|
2022-04-15 14:24:30 +00:00
|
|
|
role="tab"
|
2022-04-25 16:13:18 +00:00
|
|
|
@click.prevent="currentTab = 'Album'"
|
2022-04-15 14:24:30 +00:00
|
|
|
>
|
|
|
|
Album
|
|
|
|
</button>
|
|
|
|
<button
|
2022-04-25 16:13:18 +00:00
|
|
|
v-if="useYouTube"
|
|
|
|
id="extraTabYouTube"
|
2022-04-15 14:24:30 +00:00
|
|
|
:aria-selected="currentTab === 'YouTube'"
|
|
|
|
aria-controls="extraPanelYouTube"
|
2022-05-06 10:28:02 +00:00
|
|
|
data-testid="extra-tab-youtube"
|
2022-04-15 14:24:30 +00:00
|
|
|
role="tab"
|
|
|
|
title="YouTube"
|
2022-04-25 16:13:18 +00:00
|
|
|
@click.prevent="currentTab = 'YouTube'"
|
2022-04-15 14:24:30 +00:00
|
|
|
>
|
|
|
|
<i class="fa fa-youtube-play"></i>
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="panes">
|
|
|
|
<div
|
2022-04-25 16:13:18 +00:00
|
|
|
v-show="currentTab === 'Lyrics'"
|
2022-04-15 14:24:30 +00:00
|
|
|
id="extraPanelLyrics"
|
2022-04-25 16:13:18 +00:00
|
|
|
aria-labelledby="extraTabLyrics"
|
2022-04-15 14:24:30 +00:00
|
|
|
role="tabpanel"
|
|
|
|
tabindex="0"
|
|
|
|
>
|
2022-05-06 08:44:10 +00:00
|
|
|
<LyricsPane :song="song"/>
|
2022-04-15 14:24:30 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div
|
2022-04-25 16:13:18 +00:00
|
|
|
v-show="currentTab === 'Artist'"
|
2022-04-15 14:24:30 +00:00
|
|
|
id="extraPanelArtist"
|
2022-04-25 16:13:18 +00:00
|
|
|
aria-labelledby="extraTabArtist"
|
2022-04-15 14:24:30 +00:00
|
|
|
role="tabpanel"
|
|
|
|
tabindex="0"
|
|
|
|
>
|
2022-05-06 08:44:10 +00:00
|
|
|
<ArtistInfo v-if="artist" :artist="artist" mode="aside"/>
|
2022-04-15 14:24:30 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div
|
2022-04-25 16:13:18 +00:00
|
|
|
v-show="currentTab === 'Album'"
|
2022-04-15 14:24:30 +00:00
|
|
|
id="extraPanelAlbum"
|
2022-04-25 16:13:18 +00:00
|
|
|
aria-labelledby="extraTabAlbum"
|
2022-04-15 14:24:30 +00:00
|
|
|
role="tabpanel"
|
|
|
|
tabindex="0"
|
|
|
|
>
|
2022-05-06 08:44:10 +00:00
|
|
|
<AlbumInfo v-if="album" :album="album" mode="aside"/>
|
2022-04-15 14:24:30 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div
|
2022-04-25 16:13:18 +00:00
|
|
|
v-show="currentTab === 'YouTube'"
|
2022-04-15 14:24:30 +00:00
|
|
|
id="extraPanelYouTube"
|
2022-04-25 16:13:18 +00:00
|
|
|
aria-labelledby="extraTabYouTube"
|
2022-04-15 14:24:30 +00:00
|
|
|
role="tabpanel"
|
|
|
|
tabindex="0"
|
|
|
|
>
|
2022-04-25 16:13:18 +00:00
|
|
|
<YouTubeVideoList v-if="useYouTube && song" :song="song"/>
|
2022-04-15 14:24:30 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</section>
|
|
|
|
</template>
|
|
|
|
|
2022-04-15 17:00:08 +00:00
|
|
|
<script lang="ts" setup>
|
2022-04-15 14:24:30 +00:00
|
|
|
import isMobile from 'ismobilejs'
|
2022-06-10 10:47:46 +00:00
|
|
|
import { defineAsyncComponent, ref, toRef, watch } from 'vue'
|
2022-04-15 17:00:08 +00:00
|
|
|
import { $, eventBus } from '@/utils'
|
2022-06-10 10:47:46 +00:00
|
|
|
import { albumStore, artistStore, preferenceStore as preferences } from '@/stores'
|
2022-04-30 14:05:02 +00:00
|
|
|
import { useThirdPartyServices } from '@/composables'
|
2022-04-15 14:24:30 +00:00
|
|
|
|
|
|
|
type Tab = 'Lyrics' | 'Artist' | 'Album' | 'YouTube'
|
|
|
|
const defaultTab: Tab = 'Lyrics'
|
|
|
|
|
2022-04-21 09:38:24 +00:00
|
|
|
const LyricsPane = defineAsyncComponent(() => import('@/components/ui/LyricsPane.vue'))
|
2022-04-21 21:51:17 +00:00
|
|
|
const ArtistInfo = defineAsyncComponent(() => import('@/components/artist/ArtistInfo.vue'))
|
2022-04-21 10:43:10 +00:00
|
|
|
const AlbumInfo = defineAsyncComponent(() => import('@/components/album/AlbumInfo.vue'))
|
2022-04-23 22:31:40 +00:00
|
|
|
const YouTubeVideoList = defineAsyncComponent(() => import('@/components/ui/YouTubeVideoList.vue'))
|
2022-04-15 17:00:08 +00:00
|
|
|
|
|
|
|
const song = ref<Song | null>(null)
|
2022-04-25 16:13:18 +00:00
|
|
|
const showing = toRef(preferences.state, 'showExtraPanel')
|
2022-04-29 13:32:12 +00:00
|
|
|
const currentTab = ref<Tab>(defaultTab)
|
2022-04-15 17:00:08 +00:00
|
|
|
|
2022-04-30 14:05:02 +00:00
|
|
|
const { useYouTube } = useThirdPartyServices()
|
|
|
|
|
2022-06-10 10:47:46 +00:00
|
|
|
const artist = ref<Artist>()
|
|
|
|
const album = ref<Album>()
|
2022-04-15 17:00:08 +00:00
|
|
|
|
2022-04-25 16:13:18 +00:00
|
|
|
watch(showing, (showingExtraPanel) => {
|
2022-04-15 17:00:08 +00:00
|
|
|
if (showingExtraPanel && !isMobile.any) {
|
|
|
|
$.addClass(document.documentElement, 'with-extra-panel')
|
|
|
|
} else {
|
|
|
|
$.removeClass(document.documentElement, 'with-extra-panel')
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
2022-04-25 16:13:18 +00:00
|
|
|
const fetchSongInfo = async (_song: Song) => {
|
2022-04-15 17:00:08 +00:00
|
|
|
try {
|
|
|
|
song.value = _song
|
2022-06-10 10:47:46 +00:00
|
|
|
artist.value = await artistStore.resolve(_song.artist_id)
|
|
|
|
album.value = await albumStore.resolve(_song.album_id)
|
|
|
|
} catch (err) {
|
2022-04-15 17:00:08 +00:00
|
|
|
throw err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
eventBus.on({
|
2022-04-29 13:32:12 +00:00
|
|
|
'SONG_STARTED': async (song: Song) => await fetchSongInfo(song),
|
2022-04-15 17:00:08 +00:00
|
|
|
'LOAD_MAIN_CONTENT': (): void => {
|
|
|
|
// On ready, add 'with-extra-panel' class.
|
|
|
|
isMobile.any || $.addClass(document.documentElement, 'with-extra-panel')
|
|
|
|
|
|
|
|
// Hide the extra panel if on mobile
|
2022-04-25 16:13:18 +00:00
|
|
|
isMobile.phone && (showing.value = false)
|
2022-04-15 14:24:30 +00:00
|
|
|
}
|
|
|
|
})
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
#extra {
|
|
|
|
flex: 0 0 var(--extra-panel-width);
|
|
|
|
padding-top: 2.3rem;
|
|
|
|
background: var(--color-bg-secondary);
|
|
|
|
display: none;
|
|
|
|
overflow: auto;
|
|
|
|
-ms-overflow-style: -ms-autohiding-scrollbar;
|
|
|
|
|
|
|
|
@media (hover: none) {
|
|
|
|
// Enable scroll with momentum on touch devices
|
|
|
|
overflow-y: scroll;
|
|
|
|
-webkit-overflow-scrolling: touch;
|
|
|
|
}
|
|
|
|
|
|
|
|
&.showing {
|
|
|
|
display: block;
|
|
|
|
}
|
|
|
|
|
|
|
|
h1 {
|
|
|
|
font-weight: var(--font-weight-thin);
|
|
|
|
font-size: 2.2rem;
|
|
|
|
margin-bottom: 1.25rem;
|
|
|
|
line-height: 2.8rem;
|
|
|
|
}
|
|
|
|
|
2022-04-15 17:00:08 +00:00
|
|
|
@media only screen and (max-width: 1024px) {
|
2022-04-15 14:24:30 +00:00
|
|
|
position: fixed;
|
|
|
|
height: calc(100vh - var(--header-height));
|
|
|
|
width: var(--extra-panel-width);
|
|
|
|
z-index: 5;
|
|
|
|
top: var(--header-height);
|
|
|
|
right: -100%;
|
|
|
|
transition: right .3s ease-in;
|
|
|
|
|
|
|
|
&.showing {
|
|
|
|
right: 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-04-15 17:00:08 +00:00
|
|
|
@media only screen and (max-width: 667px) {
|
2022-04-15 14:24:30 +00:00
|
|
|
@include themed-background();
|
|
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
|
|
[role=tabpanel] {
|
|
|
|
padding-bottom: calc(var(--footer-height-mobile) + 1rem)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|