Skip to content
Snippets Groups Projects
Commit f66bcf34 authored by Eliot Berriot's avatar Eliot Berriot
Browse files

Merge branch '131-scroll-queue' into 'develop'

Resolve "Queue doesn't show current song by default"

Closes #131

See merge request funkwhale/funkwhale!103
parents fa449114 d726a959
No related branches found
No related tags found
No related merge requests found
Removed player from queue tab and consistently show current track in queue (#131)
...@@ -16,8 +16,8 @@ ...@@ -16,8 +16,8 @@
<div class="menu-area"> <div class="menu-area">
<div class="ui compact fluid two item inverted menu"> <div class="ui compact fluid two item inverted menu">
<a class="active item" data-tab="library">Browse</a> <a class="active item" @click="selectedTab = 'library'" data-tab="library">Browse</a>
<a class="item" data-tab="queue"> <a class="item" @click="selectedTab = 'queue'" data-tab="queue">
Queue &nbsp; Queue &nbsp;
<template v-if="queue.tracks.length === 0"> <template v-if="queue.tracks.length === 0">
(empty) (empty)
...@@ -46,6 +46,8 @@ ...@@ -46,6 +46,8 @@
v-if="$store.state.auth.authenticated" v-if="$store.state.auth.authenticated"
class="item" :to="{path: '/activity'}"><i class="bell icon"></i> Activity</router-link> class="item" :to="{path: '/activity'}"><i class="bell icon"></i> Activity</router-link>
</div> </div>
<player></player>
</div> </div>
<div v-if="queue.previousQueue " class="ui black icon message"> <div v-if="queue.previousQueue " class="ui black icon message">
<i class="history icon"></i> <i class="history icon"></i>
...@@ -96,7 +98,6 @@ ...@@ -96,7 +98,6 @@
</div> </div>
</div> </div>
</div> </div>
<player></player>
</div> </div>
</template> </template>
...@@ -121,6 +122,7 @@ export default { ...@@ -121,6 +122,7 @@ export default {
}, },
data () { data () {
return { return {
selectedTab: 'library',
backend: backend, backend: backend,
isCollapsed: true isCollapsed: true
} }
...@@ -140,11 +142,36 @@ export default { ...@@ -140,11 +142,36 @@ export default {
}), }),
reorder: function (oldValue, newValue) { reorder: function (oldValue, newValue) {
this.$store.commit('queue/reorder', {oldValue, newValue}) this.$store.commit('queue/reorder', {oldValue, newValue})
},
scrollToCurrent () {
let current = $(this.$el).find('[data-tab="queue"] .active')[0]
if (!current) {
return
}
let container = $(this.$el).find('.tabs')[0]
// Position container at the top line then scroll current into view
container.scrollTop = 0
current.scrollIntoView(true)
// Scroll back nothing if element is at bottom of container else do it
// for half the height of the containers display area
var scrollBack = (container.scrollHeight - container.scrollTop <= container.clientHeight) ? 0 : container.clientHeight / 2
container.scrollTop = container.scrollTop - scrollBack
console.log(container.scrollHeight - container.scrollTop, container.clientHeight)
} }
}, },
watch: { watch: {
url: function () { url: function () {
this.isCollapsed = true this.isCollapsed = true
},
selectedTab: function (newValue) {
if (newValue === 'queue') {
this.scrollToCurrent()
}
},
'$store.state.queue.currentIndex': function () {
if (this.selectedTab !== 'queue') {
this.scrollToCurrent()
}
} }
} }
} }
...@@ -204,19 +231,38 @@ $sidebar-color: #3D3E3F; ...@@ -204,19 +231,38 @@ $sidebar-color: #3D3E3F;
} }
} }
.tabs { .tabs {
flex: 1;
display: flex;
flex-direction: column;
overflow-y: auto; overflow-y: auto;
justify-content: space-between;
@include media(">tablet") { @include media(">tablet") {
height: 0px; height: 0px;
} }
@include media("<desktop") { @include media("<desktop") {
max-height: 400px; max-height: 500px;
} }
} }
.ui.tab.active {
display: flex;
}
.tab[data-tab="queue"] { .tab[data-tab="queue"] {
flex-direction: column;
tr { tr {
cursor: pointer; cursor: pointer;
} }
} }
.tab[data-tab="library"] {
flex-direction: column;
flex: 1 1 auto;
> .menu {
flex: 1;
flex-grow: 1;
}
> .player-wrapper {
width: 100%;
}
}
.sidebar .segment { .sidebar .segment {
margin: 0; margin: 0;
border-radius: 0; border-radius: 0;
...@@ -225,9 +271,6 @@ $sidebar-color: #3D3E3F; ...@@ -225,9 +271,6 @@ $sidebar-color: #3D3E3F;
.ui.inverted.segment.header-wrapper { .ui.inverted.segment.header-wrapper {
padding: 0; padding: 0;
} }
.tabs {
flex: 1;
}
.logo { .logo {
cursor: pointer; cursor: pointer;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment