Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
funkwhale
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Zwordi
funkwhale
Commits
f8de5c2f
Verified
Commit
f8de5c2f
authored
6 years ago
by
Eliot Berriot
Browse files
Options
Downloads
Patches
Plain Diff
Fix #262: added feedback on shuffle button
parent
3634c00e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
changes/changelog.d/262.enhancement
+1
-0
1 addition, 0 deletions
changes/changelog.d/262.enhancement
front/src/components/audio/Player.vue
+22
-2
22 additions, 2 deletions
front/src/components/audio/Player.vue
front/src/store/queue.js
+13
-5
13 additions, 5 deletions
front/src/store/queue.js
with
36 additions
and
7 deletions
changes/changelog.d/262.enhancement
0 → 100644
+
1
−
0
View file @
f8de5c2f
Added feedback on shuffle button (#262)
This diff is collapsed.
Click to expand it.
front/src/components/audio/Player.vue
+
22
−
2
View file @
f8de5c2f
...
...
@@ -113,7 +113,8 @@
:disabled=
"queue.tracks.length === 0"
:title=
"$t('Shuffle your queue')"
class=
"two wide column control"
>
<i
@
click=
"shuffle()"
:class=
"['ui', 'random', 'secondary',
{'disabled': queue.tracks.length === 0}, 'icon']" >
</i>
<div
v-if=
"isShuffling"
class=
"ui inline shuffling inverted small active loader"
></div>
<i
v-else
@
click=
"shuffle()"
:class=
"['ui', 'random', 'secondary',
{'disabled': queue.tracks.length === 0}, 'icon']" >
</i>
</div>
<div
class=
"one wide column"
></div>
<div
...
...
@@ -158,6 +159,7 @@ export default {
data
()
{
let
defaultAmbiantColors
=
[[
46
,
46
,
46
],
[
46
,
46
,
46
],
[
46
,
46
,
46
],
[
46
,
46
,
46
]]
return
{
isShuffling
:
false
,
renderAudio
:
true
,
sliderVolume
:
this
.
volume
,
Track
:
Track
,
...
...
@@ -173,9 +175,24 @@ export default {
...
mapActions
({
togglePlay
:
'
player/togglePlay
'
,
clean
:
'
queue/clean
'
,
shuffle
:
'
queue/shuffle
'
,
updateProgress
:
'
player/updateProgress
'
}),
shuffle
()
{
if
(
this
.
isShuffling
)
{
return
}
let
self
=
this
this
.
isShuffling
=
true
setTimeout
(()
=>
{
self
.
$store
.
dispatch
(
'
queue/shuffle
'
,
()
=>
{
self
.
isShuffling
=
false
self
.
$store
.
commit
(
'
ui/addMessage
'
,
{
content
:
self
.
$t
(
'
Queue shuffled!
'
),
date
:
new
Date
()
})
})
},
100
)
},
next
()
{
let
self
=
this
this
.
$store
.
dispatch
(
'
queue/next
'
).
then
(()
=>
{
...
...
@@ -402,5 +419,8 @@ export default {
.ui.feed.icon
{
margin
:
0
;
}
.shuffling.loader.inline
{
margin
:
0
;
}
</
style
>
This diff is collapsed.
Click to expand it.
front/src/store/queue.js
+
13
−
5
View file @
f8de5c2f
...
...
@@ -72,16 +72,20 @@ export default {
}
},
appendMany
({
state
,
dispatch
},
{
tracks
,
index
})
{
appendMany
({
state
,
dispatch
},
{
tracks
,
index
,
callback
})
{
logger
.
default
.
info
(
'
Appending many tracks to the queue
'
,
tracks
.
map
(
e
=>
{
return
e
.
title
}))
if
(
state
.
tracks
.
length
===
0
)
{
index
=
0
}
else
{
index
=
index
||
state
.
tracks
.
length
}
tracks
.
forEach
((
t
)
=>
{
dispatch
(
'
append
'
,
{
track
:
t
,
index
:
index
,
skipPlay
:
true
})
let
total
=
tracks
.
length
tracks
.
forEach
((
t
,
i
)
=>
{
let
p
=
dispatch
(
'
append
'
,
{
track
:
t
,
index
:
index
,
skipPlay
:
true
})
index
+=
1
if
(
callback
&&
i
+
1
===
total
)
{
p
.
then
(
callback
)
}
})
dispatch
(
'
resume
'
)
},
...
...
@@ -148,13 +152,17 @@ export default {
// so we replay automatically on next track append
commit
(
'
ended
'
,
true
)
},
shuffle
({
dispatch
,
commit
,
state
})
{
shuffle
({
dispatch
,
commit
,
state
}
,
callback
)
{
let
toKeep
=
state
.
tracks
.
slice
(
0
,
state
.
currentIndex
+
1
)
let
toShuffle
=
state
.
tracks
.
slice
(
state
.
currentIndex
+
1
)
let
shuffled
=
toKeep
.
concat
(
_
.
shuffle
(
toShuffle
))
commit
(
'
player/currentTime
'
,
0
,
{
root
:
true
})
commit
(
'
tracks
'
,
[])
dispatch
(
'
appendMany
'
,
{
tracks
:
shuffled
})
let
params
=
{
tracks
:
shuffled
}
if
(
callback
)
{
params
.
callback
=
callback
}
dispatch
(
'
appendMany
'
,
params
)
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment