Merge pull request #35 from nikandlv/development

Bug fix and playerbar update
master
Nikan Dalvand 2019-07-30 23:33:18 +04:30 committed by GitHub
commit 6640e11511
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 106 additions and 18 deletions

View File

@ -2,7 +2,7 @@
<div id="app" class="root"> <div id="app" class="root">
<DockableSidebar /> <DockableSidebar />
<div class="page-wrapper"> <div class="page-wrapper">
<router-view class="page"></router-view> <router-view class="page" :class="{'fullscreen' : fullscreenStatus}"></router-view>
<PlayerBar class="player-bar" /> <PlayerBar class="player-bar" />
</div> </div>
</div> </div>
@ -11,10 +11,12 @@
<script> <script>
import DockableSidebar from './layouts/DockableSidebar' import DockableSidebar from './layouts/DockableSidebar'
import PlayerBar from './layouts/PlayerBar' import PlayerBar from './layouts/PlayerBar'
import { mapGetters } from 'vuex'
export default { export default {
name: 'jukebox', name: 'jukebox',
components: { DockableSidebar, PlayerBar } components: { DockableSidebar, PlayerBar },
computed: mapGetters(['fullscreenStatus'])
} }
</script> </script>
@ -48,7 +50,18 @@ $lato-font-path: '/node_modules/lato-font/fonts'
flex-grow: 1 flex-grow: 1
overflow-x: hidden overflow-x: hidden
transition: padding-top 300ms transition: padding-top 300ms
img
user-drag: none
user-select: none
-moz-user-select: none
-webkit-user-drag: none
-webkit-user-select: none
-ms-user-select: none
@media(max-width: 800px) @media(max-width: 800px)
.page .page
padding-top: 64px padding-top: 64px
&.fullscreen
padding-top: 0px
</style> </style>

View File

@ -0,0 +1,22 @@
<template>
<div class="dialog-wrapper" :class="{'open' : open}">
<div class="overlay">
</div>
<div class="dialog">
</div>
</div>
</template>
<script>
export default {
name: 'Dialog',
props: ['open']
}
</script>
<style scoped lang="sass">
.dialog
display: block
</style>

View File

@ -1,6 +1,6 @@
<template> <template>
<div> <div>
<section class="handle" :class="{'open': menuStatus === true}"> <section class="handle" :class="{'open': menuStatus, 'fullscreen': fullscreenStatus}">
<div @click="toggleMenuStatus" class="icon"> <div @click="toggleMenuStatus" class="icon">
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 384.97 384.97" style="enable-background:new 0 0 384.97 384.97;" xml:space="preserve"> <svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 384.97 384.97" style="enable-background:new 0 0 384.97 384.97;" xml:space="preserve">
<g> <g>
@ -16,8 +16,8 @@
</div> </div>
<Logo :nopadding="true"/> <Logo :nopadding="true"/>
</section> </section>
<section class="overlay" :class="{'open': menuStatus === true}" @click="toggleMenuStatus" /> <section class="overlay" :class="{'open': menuStatus, 'fullscreen': fullscreenStatus}" @click="toggleMenuStatus" />
<section class="sidebar" :class="{'open': menuStatus === true}"> <section class="sidebar" :class="{'open': menuStatus, 'fullscreen': fullscreenStatus}">
<div class="logo-wrapper"> <div class="logo-wrapper">
<Logo class="logo" /> <Logo class="logo" />
</div> </div>
@ -142,7 +142,7 @@ export default {
methods: { methods: {
...mapActions(['toggleMenuStatus']) ...mapActions(['toggleMenuStatus'])
}, },
computed: mapGetters(['menuStatus']) computed: mapGetters(['menuStatus', 'fullscreenStatus'])
} }
</script> </script>
@ -208,6 +208,13 @@ section.sidebar
min-height: 48px min-height: 48px
.icon .icon
display: none display: none
&.fullscreen
transform: translateX(-100%)
overflow-y: hidden
z-index: 1200
position: absolute
left: 0
top: 0
&.open &.open
transform: translateX(0%) transform: translateX(0%)
padding: 1rem 0rem 0rem 1rem padding: 1rem 0rem 0rem 1rem

View File

@ -1,5 +1,5 @@
<template> <template>
<section class="wtf"> <section>
<ActionBar class="action-bar" /> <ActionBar class="action-bar" />
<div class="upper-row" > <div class="upper-row" >
<MusicRow :items='items' title="Top rated" /> <MusicRow :items='items' title="Top rated" />
@ -272,7 +272,10 @@ section.page
display: flex display: flex
.grow-half .grow-half
flex: 1 0 50% // deviding the space equally between two element flex: 1 0 50%
max-width: 50%
&.recommend
max-width: 30%
.favourite .favourite
background: white background: white

View File

@ -36,4 +36,6 @@ section.music-row
overflow: visible !important overflow: visible !important
.scroll-content .scroll-content
display: flex display: flex
.scrollbar-thumb,.scrollbar-track
display: none !important
</style> </style>

View File

@ -1,5 +1,5 @@
<template> <template>
<section class="player"> <section class="player" :class="{'fullscreen' : fullscreenStatus}">
<img @load="onArtworkLoad" class="artwork" src="/static/demo/yellow.jpeg" /> <img @load="onArtworkLoad" class="artwork" src="/static/demo/yellow.jpeg" />
<div> <div>
<p class="title">Yellow</p> <p class="title">Yellow</p>
@ -28,6 +28,9 @@
<IconButton variant="contained"> <IconButton variant="contained">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M4 18l8.5-6L4 6v12zm9-12v12l8.5-6L13 6z"/><path d="M0 0h24v24H0z" fill="none"/></svg> <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M4 18l8.5-6L4 6v12zm9-12v12l8.5-6L13 6z"/><path d="M0 0h24v24H0z" fill="none"/></svg>
</IconButton> </IconButton>
<IconButton variant="contained" :click="toggleFullscreenStatus">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M7.41 15.41L12 10.83l4.59 4.58L18 14l-6-6-6 6z"/><path d="M0 0h24v24H0z" fill="none"/></svg>
</IconButton>
</div> </div>
</section> </section>
</template> </template>
@ -38,9 +41,20 @@ import minimap from 'wavesurfer.js/dist/plugin/wavesurfer.minimap'
import color from 'dominant-color' import color from 'dominant-color'
import { formatSeconds } from '../utility/DateTime' import { formatSeconds } from '../utility/DateTime'
import IconButton from '../components/IconButton' import IconButton from '../components/IconButton'
import { mapActions, mapGetters } from 'vuex'
export default { export default {
name: 'PlayerBar', name: 'PlayerBar',
components: { IconButton }, components: { IconButton },
data () {
return {
playingStatus: false,
isFavorited: false,
duration: '00:00',
isFullscreen: false
}
},
computed: mapGetters(['fullscreenStatus']),
mounted () { mounted () {
let progress = this.$el.getElementsByClassName('progress')[0] let progress = this.$el.getElementsByClassName('progress')[0]
this.wavesurfer = WaveSurfer.create({ this.wavesurfer = WaveSurfer.create({
@ -111,13 +125,6 @@ export default {
currentWidth = progressWave.style.width currentWidth = progressWave.style.width
}) })
}, },
data () {
return {
playingStatus: false,
isFavorited: false,
duration: '00:00'
}
},
methods: { methods: {
onArtworkLoad () { onArtworkLoad () {
let img = this.$el.getElementsByTagName('img')[0] let img = this.$el.getElementsByTagName('img')[0]
@ -186,7 +193,8 @@ export default {
}, },
toggleFavorite () { toggleFavorite () {
this.isFavorited = !this.isFavorited this.isFavorited = !this.isFavorited
} },
...mapActions(['toggleFullscreenStatus'])
} }
} }
</script> </script>
@ -197,7 +205,13 @@ section.player
align-items: center align-items: center
border-top: 1px solid rgba(0,0,0,0.1) border-top: 1px solid rgba(0,0,0,0.1)
height: 4.5rem height: 4.5rem
background-color: white
min-height: 4.5rem min-height: 4.5rem
transition: height 500ms ease, min-height 500ms ease, width 500ms ease
&.fullscreen
height: 100vh
min-height: 100vh
z-index: 1300
.control-buttons .control-buttons
span span
margin: 0 0.2rem margin: 0 0.2rem
@ -221,7 +235,7 @@ section.player
top: 0 top: 0
bottom: 0 bottom: 0
margin: auto margin: auto
transition: height 500ms ease transition: height 500ms ease ease
height: 0px height: 0px
width: 100% width: 100%
z-index: z-index:

View File

@ -0,0 +1,26 @@
const state = {
fullscreen_mode: false
}
const getters = {
fullscreenStatus: (state) => state.fullscreen_mode
}
const mutations = {
TOGGLE_FULLSCREEN (state) {
state.fullscreen_mode = !state.fullscreen_mode
}
}
const actions = {
toggleFullscreenStatus ({ commit }) {
commit('TOGGLE_FULLSCREEN')
}
}
export default {
actions,
state,
mutations,
getters
}

View File

@ -3,6 +3,7 @@ import Scrollbar from 'smooth-scrollbar'
export default class HorizontalScrollPlugin extends Scrollbar.ScrollbarPlugin { export default class HorizontalScrollPlugin extends Scrollbar.ScrollbarPlugin {
static pluginName = 'horizontalScroll'; static pluginName = 'horizontalScroll';
transformDelta (delta, fromEvent) { transformDelta (delta, fromEvent) {
console.log(fromEvent.type)
if (!/wheel/.test(fromEvent.type)) { if (!/wheel/.test(fromEvent.type)) {
return delta return delta
} }