2022-04-15 14:24:30 +00:00
|
|
|
<template>
|
|
|
|
<section id="mainContent">
|
|
|
|
<!--
|
|
|
|
Most of the views are render-expensive and have their own UI states (viewport/scroll position), e.g. the song
|
|
|
|
lists), so we use v-show.
|
2022-04-15 17:00:08 +00:00
|
|
|
For those that don't need to maintain their own UI state, we use v-if and enjoy some code-splitting juice.
|
2022-04-15 14:24:30 +00:00
|
|
|
-->
|
2022-04-15 17:00:08 +00:00
|
|
|
<Visualizer v-if="showingVisualizer"/>
|
2022-06-10 10:47:46 +00:00
|
|
|
<AlbumArtOverlay v-if="showAlbumArtOverlay && currentSong" :album="currentSong?.album_id"/>
|
2022-04-15 14:24:30 +00:00
|
|
|
|
2022-09-12 11:11:56 +00:00
|
|
|
<HomeScreen v-show="screen === 'Home'"/>
|
|
|
|
<QueueScreen v-show="screen === 'Queue'"/>
|
|
|
|
<AllSongsScreen v-show="screen === 'Songs'"/>
|
|
|
|
<AlbumListScreen v-show="screen === 'Albums'"/>
|
|
|
|
<ArtistListScreen v-show="screen === 'Artists'"/>
|
|
|
|
<PlaylistScreen v-show="screen === 'Playlist'"/>
|
|
|
|
<FavoritesScreen v-show="screen === 'Favorites'"/>
|
|
|
|
<RecentlyPlayedScreen v-show="screen === 'RecentlyPlayed'"/>
|
|
|
|
<UploadScreen v-show="screen === 'Upload'"/>
|
|
|
|
<SearchExcerptsScreen v-show="screen === 'Search.Excerpt'"/>
|
2022-04-15 14:24:30 +00:00
|
|
|
|
2022-09-12 11:11:56 +00:00
|
|
|
<SearchSongResultsScreen v-if="screen === 'Search.Songs'" :q="screenProps"/>
|
|
|
|
<AlbumScreen v-if="screen === 'Album'" :album="screenProps"/>
|
|
|
|
<ArtistScreen v-if="screen === 'Artist'" :artist="screenProps"/>
|
|
|
|
<SettingsScreen v-if="screen === 'Settings'"/>
|
|
|
|
<ProfileScreen v-if="screen === 'Profile'"/>
|
|
|
|
<UserListScreen v-if="screen === 'Users'"/>
|
|
|
|
<YoutubeScreen v-if="useYouTube" v-show="screen === 'YouTube'"/>
|
2022-04-15 14:24:30 +00:00
|
|
|
</section>
|
|
|
|
</template>
|
|
|
|
|
2022-04-15 17:00:08 +00:00
|
|
|
<script lang="ts" setup>
|
2022-09-21 08:40:06 +00:00
|
|
|
import { defineAsyncComponent, onMounted, ref, toRef } from 'vue'
|
2022-04-15 14:24:30 +00:00
|
|
|
import { eventBus } from '@/utils'
|
2022-05-06 15:52:37 +00:00
|
|
|
import { preferenceStore } from '@/stores'
|
|
|
|
import { useThirdPartyServices } from '@/composables'
|
2022-07-10 14:33:33 +00:00
|
|
|
|
2022-04-23 22:01:40 +00:00
|
|
|
import HomeScreen from '@/components/screens/HomeScreen.vue'
|
2022-04-21 16:28:12 +00:00
|
|
|
import QueueScreen from '@/components/screens/QueueScreen.vue'
|
2022-04-21 21:51:17 +00:00
|
|
|
import AlbumListScreen from '@/components/screens/AlbumListScreen.vue'
|
|
|
|
import ArtistListScreen from '@/components/screens/ArtistListScreen.vue'
|
2022-04-21 16:06:45 +00:00
|
|
|
import AllSongsScreen from '@/components/screens/AllSongsScreen.vue'
|
2022-04-21 18:12:11 +00:00
|
|
|
import PlaylistScreen from '@/components/screens/PlaylistScreen.vue'
|
|
|
|
import FavoritesScreen from '@/components/screens/FavoritesScreen.vue'
|
2022-07-10 14:33:33 +00:00
|
|
|
import RecentlyPlayedScreen from '@/components/screens/RecentlyPlayedScreen.vue'
|
|
|
|
import UploadScreen from '@/components/screens/UploadScreen.vue'
|
|
|
|
import SearchExcerptsScreen from '@/components/screens/search/SearchExcerptsScreen.vue'
|
2022-09-21 08:40:06 +00:00
|
|
|
import router from '@/router'
|
2022-04-15 14:24:30 +00:00
|
|
|
|
2022-04-23 22:04:16 +00:00
|
|
|
const UserListScreen = defineAsyncComponent(() => import('@/components/screens/UserListScreen.vue'))
|
2022-04-23 22:47:21 +00:00
|
|
|
const AlbumArtOverlay = defineAsyncComponent(() => import('@/components/ui/AlbumArtOverlay.vue'))
|
2022-04-21 18:12:11 +00:00
|
|
|
const AlbumScreen = defineAsyncComponent(() => import('@/components/screens/AlbumScreen.vue'))
|
|
|
|
const ArtistScreen = defineAsyncComponent(() => import('@/components/screens/ArtistScreen.vue'))
|
2022-04-21 22:20:21 +00:00
|
|
|
const SettingsScreen = defineAsyncComponent(() => import('@/components/screens/SettingsScreen.vue'))
|
2022-04-21 22:51:48 +00:00
|
|
|
const ProfileScreen = defineAsyncComponent(() => import('@/components/screens/ProfileScreen.vue'))
|
2022-04-23 22:10:46 +00:00
|
|
|
const YoutubeScreen = defineAsyncComponent(() => import('@/components/screens/YouTubeScreen.vue'))
|
2022-04-23 21:24:02 +00:00
|
|
|
const SearchSongResultsScreen = defineAsyncComponent(() => import('@/components/screens/search/SearchSongResultsScreen.vue'))
|
2022-04-20 15:57:53 +00:00
|
|
|
const Visualizer = defineAsyncComponent(() => import('@/components/ui/Visualizer.vue'))
|
2022-04-15 14:24:30 +00:00
|
|
|
|
2022-04-30 14:05:02 +00:00
|
|
|
const { useYouTube } = useThirdPartyServices()
|
|
|
|
|
2022-04-25 13:07:38 +00:00
|
|
|
const showAlbumArtOverlay = toRef(preferenceStore.state, 'showAlbumArtOverlay')
|
2022-04-15 17:00:08 +00:00
|
|
|
const showingVisualizer = ref(false)
|
|
|
|
const screenProps = ref<any>(null)
|
2022-09-12 11:11:56 +00:00
|
|
|
const screen = ref<ScreenName>('Home')
|
2022-04-15 17:00:08 +00:00
|
|
|
const currentSong = ref<Song | null>(null)
|
2022-04-15 14:24:30 +00:00
|
|
|
|
2022-04-15 17:00:08 +00:00
|
|
|
eventBus.on({
|
2022-09-12 11:11:56 +00:00
|
|
|
ACTIVATE_SCREEN (screenName: ScreenName, data: any) {
|
2022-04-15 17:00:08 +00:00
|
|
|
screenProps.value = data
|
2022-09-12 11:11:56 +00:00
|
|
|
screen.value = screenName
|
2022-04-15 17:00:08 +00:00
|
|
|
},
|
2022-04-15 14:24:30 +00:00
|
|
|
|
2022-09-12 11:11:56 +00:00
|
|
|
TOGGLE_VISUALIZER: () => (showingVisualizer.value = !showingVisualizer.value),
|
|
|
|
SONG_STARTED: (song: Song) => (currentSong.value = song)
|
2022-04-15 14:24:30 +00:00
|
|
|
})
|
2022-09-21 08:40:06 +00:00
|
|
|
|
|
|
|
onMounted(() => router.resolveRoute())
|
2022-04-15 14:24:30 +00:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
#mainContent {
|
|
|
|
flex: 1;
|
|
|
|
position: relative;
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
|
|
> section {
|
|
|
|
position: absolute;
|
|
|
|
width: 100%;
|
|
|
|
height: 100%;
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
backface-visibility: hidden;
|
|
|
|
|
|
|
|
.main-scroll-wrap {
|
2022-07-29 12:12:55 +00:00
|
|
|
&:not(.song-list-wrap) {
|
|
|
|
padding: 24px 24px 48px;
|
|
|
|
}
|
|
|
|
|
2022-07-05 18:01:33 +00:00
|
|
|
overflow: scroll;
|
|
|
|
|
|
|
|
@supports (scrollbar-gutter: stable) {
|
|
|
|
overflow: auto;
|
|
|
|
scrollbar-gutter: stable;
|
2022-07-29 12:12:55 +00:00
|
|
|
|
|
|
|
@media (hover: none) {
|
|
|
|
scrollbar-gutter: auto;
|
|
|
|
}
|
2022-07-05 18:01:33 +00:00
|
|
|
}
|
|
|
|
|
2022-04-15 14:24:30 +00:00
|
|
|
flex: 1;
|
|
|
|
-ms-overflow-style: -ms-autohiding-scrollbar;
|
|
|
|
place-content: start;
|
|
|
|
|
|
|
|
@media (hover: none) {
|
|
|
|
// Enable scroll with momentum on touch devices
|
|
|
|
overflow-y: scroll;
|
|
|
|
-webkit-overflow-scrolling: touch;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@media only screen and (max-width: 375px) {
|
|
|
|
> section {
|
|
|
|
// Leave some space for the "Back to top" button
|
|
|
|
.main-scroll-wrap {
|
|
|
|
padding-bottom: 64px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|