-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: ✨ Added "Sort" feature. It allows sorting by track name, artist…
… name, duration and popularity. This feature also introduces some refactoring to the whole modal/rearrangement system
- Loading branch information
1 parent
ad7164b
commit 74358c1
Showing
11 changed files
with
186 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,7 +28,7 @@ export default { | |
}, | ||
closeChangelog() { | ||
this.showChangelog = false; | ||
} | ||
}, | ||
}, | ||
}; | ||
</script> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
<template> | ||
<div class="container"> | ||
<b-button | ||
tertiary | ||
class="toggle" | ||
@click="openModal" | ||
> | ||
<v-icon | ||
slot="icon" | ||
name="sort" | ||
label="sort" | ||
/> | ||
Sort | ||
</b-button> | ||
<b-modal headline="Sort settings" :show="showModal"> | ||
<b-radio-button-group | ||
name="order" | ||
label="Order" | ||
class="button-group" | ||
:options="orderOptions" | ||
:value="order" | ||
@change="onOrderChange" | ||
/> | ||
<b-radio-button-group | ||
name="sortBy" | ||
label="Sort by" | ||
class="button-group" | ||
:options="sortByOptions" | ||
:value="sortBy" | ||
@change="onSortByChange" | ||
/> | ||
<div slot="footer"> | ||
<b-button tertiary @click="closeModal"> | ||
Close | ||
</b-button> | ||
<b-button primary @click="sort"> | ||
Sort | ||
</b-button> | ||
</div> | ||
</b-modal> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import 'vue-awesome/icons/sort'; | ||
import { mapActions } from 'vuex'; | ||
import SortByTrackProperty from '../../playlist-modifications/SortByTrackProperty'; | ||
export default { | ||
name: 'SortConfigurationModal', | ||
data() { | ||
return { | ||
showModal: false, | ||
order: 'ASC', | ||
orderOptions: { | ||
ASC: 'ASC', | ||
DESC: 'DESC', | ||
}, | ||
sortBy: 'artists.0.name', | ||
sortByOptions: { | ||
'artists.0.name': 'Artist name', | ||
name: 'Track name', | ||
popularity: 'Popularity', | ||
duration_ms: 'Duration', | ||
}, | ||
}; | ||
}, | ||
methods: { | ||
openModal() { | ||
this.showModal = true; | ||
}, | ||
closeModal() { | ||
this.showModal = false; | ||
}, | ||
onSortByChange(value) { | ||
this.sortBy = value; | ||
}, | ||
onOrderChange(value) { | ||
this.order = value; | ||
}, | ||
async sort() { | ||
this.showModal = false; | ||
await this.askForConfirmation({ | ||
headline: 'Sort', | ||
question: 'Are you sure you want to sort your playlist?', | ||
positive: 'Sort', | ||
negative: 'Cancel', | ||
}); | ||
await this.rearrangePlaylistWith({ | ||
rearranger: SortByTrackProperty, | ||
options: { | ||
sortBy: this.sortBy, | ||
order: this.order, | ||
}, | ||
}); | ||
}, | ||
...mapActions('app', [ | ||
'askForConfirmation', | ||
]), | ||
...mapActions('editor', [ | ||
'rearrangePlaylistWith', | ||
]), | ||
}, | ||
}; | ||
</script> | ||
|
||
<style lang="scss" scoped> | ||
.container { | ||
display: inline-block; | ||
} | ||
.button-group { | ||
margin-bottom: 10px; | ||
} | ||
.toggle { | ||
margin: 0; | ||
} | ||
.fa-icon { | ||
color: var(--spotify-green); | ||
font-size: 18px; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.