Merge branch 'play-button' into 'develop'
Play button feedback Closes #100 See merge request funkwhale/funkwhale!76
This commit is contained in:
commit
12ca49d1c8
|
@ -9,6 +9,7 @@ from rest_framework import exceptions
|
||||||
from rest_framework_jwt.settings import api_settings
|
from rest_framework_jwt.settings import api_settings
|
||||||
from rest_framework_jwt.authentication import BaseJSONWebTokenAuthentication
|
from rest_framework_jwt.authentication import BaseJSONWebTokenAuthentication
|
||||||
|
|
||||||
|
from funkwhale_api.users.models import User
|
||||||
|
|
||||||
|
|
||||||
class TokenHeaderAuth(BaseJSONWebTokenAuthentication):
|
class TokenHeaderAuth(BaseJSONWebTokenAuthentication):
|
||||||
|
@ -40,7 +41,7 @@ class TokenAuthMiddleware:
|
||||||
auth = TokenHeaderAuth()
|
auth = TokenHeaderAuth()
|
||||||
try:
|
try:
|
||||||
user, token = auth.authenticate(scope)
|
user, token = auth.authenticate(scope)
|
||||||
except exceptions.AuthenticationFailed:
|
except (User.DoesNotExist, exceptions.AuthenticationFailed):
|
||||||
user = AnonymousUser()
|
user = AnonymousUser()
|
||||||
|
|
||||||
scope['user'] = user
|
scope['user'] = user
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Added some feedback on the play button (#100)
|
|
@ -1,6 +1,9 @@
|
||||||
<template>
|
<template>
|
||||||
<div :class="['ui', {'tiny': discrete}, 'buttons']">
|
<div :class="['ui', {'tiny': discrete}, 'buttons']">
|
||||||
<button title="Add to current queue" @click="add" :class="['ui', {'mini': discrete}, {disabled: playableTracks.length === 0}, 'button']">
|
<button
|
||||||
|
title="Add to current queue"
|
||||||
|
@click="add"
|
||||||
|
:class="['ui', {loading: isLoading}, {'mini': discrete}, {disabled: playableTracks.length === 0}, 'button']">
|
||||||
<i class="ui play icon"></i>
|
<i class="ui play icon"></i>
|
||||||
<template v-if="!discrete"><slot>Play</slot></template>
|
<template v-if="!discrete"><slot>Play</slot></template>
|
||||||
</button>
|
</button>
|
||||||
|
@ -26,6 +29,11 @@ export default {
|
||||||
track: {type: Object, required: false},
|
track: {type: Object, required: false},
|
||||||
discrete: {type: Boolean, default: false}
|
discrete: {type: Boolean, default: false}
|
||||||
},
|
},
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
isLoading: false
|
||||||
|
}
|
||||||
|
},
|
||||||
created () {
|
created () {
|
||||||
if (!this.track & !this.tracks) {
|
if (!this.track & !this.tracks) {
|
||||||
logger.default.error('You have to provide either a track or tracks property')
|
logger.default.error('You have to provide either a track or tracks property')
|
||||||
|
@ -50,10 +58,19 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
triggerLoad () {
|
||||||
|
let self = this
|
||||||
|
this.isLoading = true
|
||||||
|
setTimeout(() => {
|
||||||
|
self.isLoading = false
|
||||||
|
}, 500)
|
||||||
|
},
|
||||||
add () {
|
add () {
|
||||||
|
this.triggerLoad()
|
||||||
this.$store.dispatch('queue/appendMany', {tracks: this.playableTracks})
|
this.$store.dispatch('queue/appendMany', {tracks: this.playableTracks})
|
||||||
},
|
},
|
||||||
addNext (next) {
|
addNext (next) {
|
||||||
|
this.triggerLoad()
|
||||||
this.$store.dispatch('queue/appendMany', {tracks: this.playableTracks, index: this.$store.state.queue.currentIndex + 1})
|
this.$store.dispatch('queue/appendMany', {tracks: this.playableTracks, index: this.$store.state.queue.currentIndex + 1})
|
||||||
if (next) {
|
if (next) {
|
||||||
this.$store.dispatch('queue/next')
|
this.$store.dispatch('queue/next')
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because one or more lines are too long
Before Width: | Height: | Size: 434 KiB After Width: | Height: | Size: 957 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB |
Loading…
Reference in New Issue