koel/resources/assets/js/components/main-wrapper/main-content/index.vue

199 lines
4.4 KiB
Vue
Raw Normal View History

2015-12-13 04:42:28 +00:00
<template>
2016-06-25 16:05:24 +00:00
<section id="mainContent">
<div class="translucent" :style="{ backgroundImage: albumCover ? 'url('+albumCover+')' : 'none' }"></div>
2016-10-31 04:28:12 +00:00
<home v-show="view === 'home'"/>
<queue v-show="view === 'queue'"/>
<songs v-show="view === 'songs'"/>
<albums v-show="view === 'albums'"/>
<album v-show="view === 'album'"/>
<artists v-show="view === 'artists'"/>
<artist v-show="view === 'artist'"/>
<users v-show="view === 'users'"/>
<settings v-show="view === 'settings'"/>
<playlist v-show="view === 'playlist'"/>
<favorites v-show="view === 'favorites'"/>
<profile v-show="view === 'profile'"/>
<youtube-player v-if="sharedState.useYouTube" v-show="view === 'youtubePlayer'"/>
2016-06-25 16:05:24 +00:00
</section>
2015-12-13 04:42:28 +00:00
</template>
<script>
2016-11-26 03:25:35 +00:00
import { event } from '../../../utils'
import { albumStore, sharedStore } from '../../../stores'
2016-06-25 16:05:24 +00:00
2016-11-26 03:25:35 +00:00
import albums from './albums.vue'
import album from './album.vue'
import artists from './artists.vue'
import artist from './artist.vue'
import songs from './songs.vue'
import settings from './settings.vue'
import users from './users.vue'
import queue from './queue.vue'
import home from './home.vue'
import playlist from './playlist.vue'
import favorites from './favorites.vue'
import profile from './profile.vue'
import youtubePlayer from './youtube-player.vue'
2016-06-25 16:05:24 +00:00
export default {
2016-07-30 15:32:17 +00:00
components: { albums, album, artists, artist, songs, settings,
users, home, queue, playlist, favorites, profile, youtubePlayer },
2016-06-25 16:05:24 +00:00
2016-11-26 03:25:35 +00:00
data () {
2016-06-25 16:05:24 +00:00
return {
view: 'home', // The default view
albumCover: null,
2016-11-26 03:25:35 +00:00
sharedState: sharedStore.state
}
2016-06-25 16:05:24 +00:00
},
2016-11-26 03:25:35 +00:00
created () {
2016-06-25 16:05:24 +00:00
event.on({
2016-11-26 03:25:35 +00:00
'main-content-view:load': view => {
this.view = view
},
2016-06-25 16:05:24 +00:00
/**
* When a new song is played, find its cover for the translucent effect.
*
* @param {Object} song
*
* @return {Boolean}
*/
'song:played': song => {
2016-11-26 03:25:35 +00:00
this.albumCover = song.album.cover === albumStore.stub.cover ? null : song.album.cover
}
})
}
}
2015-12-13 04:42:28 +00:00
</script>
<style lang="sass">
2016-06-25 16:05:24 +00:00
@import "../../../../sass/partials/_vars.scss";
@import "../../../../sass/partials/_mixins.scss";
#mainContent {
flex: 1;
position: relative;
overflow: hidden;
2016-06-25 16:05:24 +00:00
> section {
position: absolute;
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
backface-visibility: hidden;
.main-scroll-wrap {
padding: 24px 24px 48px;
overflow: auto;
flex: 1;
-ms-overflow-style: -ms-autohiding-scrollbar;
html.touchevents & {
// Enable scroll with momentum on touch devices
overflow-y: scroll;
-webkit-overflow-scrolling: touch;
}
}
}
h1.heading {
font-weight: $fontWeight_UltraThin;
font-size: 2.76rem;
padding: 1rem 1.8rem;
border-bottom: 1px solid $color2ndBgr;
min-height: 96px;
position: relative;
align-items: center;
align-content: stretch;
display: flex;
2016-08-26 08:19:42 +00:00
line-height: normal;
2017-01-06 02:05:29 +00:00
background: rgba(0, 0, 0, .1);
2016-06-25 16:05:24 +00:00
span:first-child {
flex: 1;
}
2016-01-06 10:57:45 +00:00
2016-06-25 16:05:24 +00:00
.meta {
display: block;
2016-11-26 03:46:06 +00:00
font-size: .9rem;
2016-06-25 16:05:24 +00:00
color: $color2ndText;
2016-11-26 03:46:06 +00:00
margin: 6px 0 0 2px;
2015-12-13 04:42:28 +00:00
2016-06-25 16:05:24 +00:00
a {
color: #fff;
2015-12-13 04:42:28 +00:00
2016-06-25 16:05:24 +00:00
&:hover {
color: $colorHighlight;
2015-12-13 04:42:28 +00:00
}
2016-06-25 16:05:24 +00:00
}
}
2016-06-25 16:05:24 +00:00
.buttons {
text-align: right;
z-index: 2;
@include button-group();
}
}
.translucent {
position: absolute;
top: -20px;
left: -20px;
right: -20px;
bottom: -20px;
2016-06-25 16:05:24 +00:00
filter: blur(20px);
opacity: .07;
z-index: 0;
overflow: hidden;
background-size: cover;
background-position: center;
transform: translateZ(0);
backface-visibility: hidden;
perspective: 1000;
pointer-events: none;
}
@media only screen and (max-width: 768px) {
h1.heading {
font-size: 1.38rem;
min-height: 0;
line-height: 1.85rem;
text-align: center;
flex-direction: column;
.meta {
display: none;
}
.buttons {
justify-content: center;
margin-top: 8px;
}
span:first-child {
flex: 0 0 28px;
}
}
> section {
.main-scroll-wrap {
padding: 12px;
}
}
}
@media only screen and (max-width: 375px) {
> section {
// Leave some space for the "Back to top" button
.main-scroll-wrap {
padding-bottom: 64px;
}
2015-12-13 04:42:28 +00:00
}
2016-06-25 16:05:24 +00:00
}
}
2015-12-13 04:42:28 +00:00
</style>