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

189 lines
5.2 KiB
Vue
Raw Normal View History

2015-12-13 04:42:28 +00:00
<template>
<section id="mainContent">
<div class="translucent" :style="{ backgroundImage: albumCover ? 'url(' + albumCover + ')' : 'none' }"></div>
<home v-show="view === 'home'"></home>
2016-01-15 07:27:25 +00:00
<queue v-show="view === 'queue'"></queue>
<songs v-show="view === 'songs'"></songs>
2016-01-15 07:27:25 +00:00
<albums v-show="view === 'albums'"></albums>
<album v-show="view === 'album'"></album>
<artists v-show="view === 'artists'"></artists>
<artist v-show="view === 'artist'"></artist>
<users v-show="view === 'users'"></users>
<settings v-show="view === 'settings'"></settings>
<playlist v-show="view === 'playlist'"></playlist>
<favorites v-show="view === 'favorites'"></favorites>
<profile v-show="view === 'profile'"></profile>
2015-12-13 04:42:28 +00:00
</section>
</template>
<script>
import albums from './albums.vue';
2016-01-15 07:27:25 +00:00
import album from './album.vue';
2015-12-13 04:42:28 +00:00
import artists from './artists.vue';
2016-01-15 07:27:25 +00:00
import artist from './artist.vue';
2015-12-13 04:42:28 +00:00
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';
2015-12-13 04:42:28 +00:00
import playlist from './playlist.vue';
import favorites from './favorites.vue';
import profile from './profile.vue';
2016-01-15 07:27:25 +00:00
2015-12-13 04:42:28 +00:00
import albumStore from '../../../stores/album';
export default {
components: { albums, album, artists, artist, songs, settings, users, home, queue, playlist, favorites, profile },
2015-12-13 04:42:28 +00:00
data() {
return {
view: 'home', // The default view
2015-12-13 04:42:28 +00:00
albumCover: null,
};
},
events: {
'main-content-view:load': function (view) {
this.view = view;
return true;
2015-12-13 04:42:28 +00:00
},
/**
* When a new song is played, find it cover for the translucent effect.
*
2016-01-07 09:03:38 +00:00
* @param {Object} song
*
2016-01-17 14:26:24 +00:00
* @return {Boolean}
2015-12-13 04:42:28 +00:00
*/
2016-01-07 09:03:38 +00:00
'song:played': function (song) {
2015-12-13 04:42:28 +00:00
this.albumCover = song.album.cover === albumStore.stub.cover ? null : song.album.cover;
return true;
}
},
};
</script>
<style lang="sass">
@import "resources/assets/sass/partials/_vars.scss";
@import "resources/assets/sass/partials/_mixins.scss";
#mainContent {
flex: 1;
position: relative;
2016-01-06 10:57:45 +00:00
> section {
position: absolute;
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
.main-scroll-wrap {
padding: 24px;
overflow: auto;
flex: 1;
2016-02-24 13:29:23 +00:00
overflow-y: hidden;
2016-01-06 10:57:45 +00:00
2016-02-24 13:29:23 +00:00
&:hover, html.touchevents & {
// Enable scroll with momentum on touch devices
overflow-y: scroll;
-webkit-overflow-scrolling: touch;
}
2016-01-06 10:57:45 +00:00
}
}
2015-12-13 04:42:28 +00:00
h1.heading {
font-weight: $fontWeight_UltraThin;
2016-01-14 08:02:59 +00:00
font-size: 36px;
2015-12-13 04:42:28 +00:00
padding: 12px 24px;
border-bottom: 1px solid $color2ndBgr;
2016-01-14 08:02:59 +00:00
min-height: 96px;
2015-12-13 04:42:28 +00:00
position: relative;
align-items: center;
align-content: stretch;
display: flex;
span:first-child {
flex: 1;
}
2016-01-14 08:02:59 +00:00
.meta {
display: block;
font-size: $fontSize;
2016-01-15 07:27:25 +00:00
color: $color2ndText;
2016-01-14 08:02:59 +00:00
margin: 12px 0 0 2px;
}
2015-12-13 04:42:28 +00:00
.buttons {
text-align: right;
z-index: 2;
@include button-group();
2015-12-13 04:42:28 +00:00
}
input[type="search"] {
width: 128px;
transition: width .3s;
&:focus {
width: 192px;
}
}
}
.translucent {
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 100%;
2016-01-11 15:25:58 +00:00
filter: blur(20px);
2015-12-13 04:42:28 +00:00
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
2016-01-06 16:41:59 +00:00
and (max-device-width : 768px) {
2015-12-13 04:42:28 +00:00
h1.heading {
font-size: 18px;
min-height: 0;
line-height: 24px;
text-align: center;
flex-direction: column;
.toggler {
font-size: 14px;
margin-left: 4px;
color: $colorHighlight;
}
2016-01-14 08:02:59 +00:00
.meta {
display: none;
}
2016-01-05 02:54:50 +00:00
.buttons, input[type="search"] {
2015-12-13 04:42:28 +00:00
justify-content: center;
2016-01-05 02:54:50 +00:00
margin-top: 8px;
2015-12-13 04:42:28 +00:00
}
}
2016-01-06 16:41:59 +00:00
> section {
.main-scroll-wrap {
padding: 12px;
}
2015-12-13 04:42:28 +00:00
}
}
}
</style>