Skip to content

Commit

Permalink
fix: 🐛 Fixed tracks not being removed correctly from track adder
Browse files Browse the repository at this point in the history
  • Loading branch information
EricLambrecht committed Oct 26, 2019
1 parent 53a857c commit 893c054
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
5 changes: 5 additions & 0 deletions src/components/_base/TextInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<input
:type="type"
:value="value"
:placeholder="placeholder"
v-bind="attrs"
:class="{ hasIcon, big }"
@input="$emit('input', $event.target.value)"
Expand Down Expand Up @@ -33,6 +34,10 @@ export default {
default: 'text',
validator: value => ['text', 'password'].indexOf(value) !== -1,
},
placeholder: {
type: String,
default: '',
},
icon: {
type: String,
default: null,
Expand Down
4 changes: 2 additions & 2 deletions src/components/editor/AddTrackModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
<track-search class="adder" @select="updateTracks" />
<div slot="footer">
<b-button @click="$emit('close')">
Close
Cancel
</b-button>
<b-button :disabled="!uris" primary @click="addTracks">
Add
{{ `Add ${uris.length} track${uris.length > 1 ? 's' : ''}` }}
</b-button>
</div>
</b-modal>
Expand Down
7 changes: 4 additions & 3 deletions src/components/editor/TrackSearch.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
v-model="query"
class="search-input"
icon="search"
placeholder="Search for track"
big
@input="searchTrack"
>
Expand Down Expand Up @@ -47,7 +48,6 @@
import 'vue-awesome/icons/search'
import 'vue-awesome/icons/plus'
import 'vue-awesome/icons/times'
import pull from 'lodash/pull'
import Spotify from '../../utils/Spotify'
import SearchPlaylistItem from './SearchPlaylistItem'
Expand All @@ -70,7 +70,8 @@ export default {
}
},
onAddedTrackClick(track) {
pull(this.tracksToAdd, track)
const i = this.tracksToAdd.findIndex(item => item.uri === track.uri)
this.$delete(this.tracksToAdd, i)
this.emitTrackUris()
},
onResultTrackClick(track) {
Expand All @@ -96,7 +97,7 @@ export default {
padding: 11px 10px 10px;
border-radius: 5px;
box-sizing: border-box;
max-height: 280px;
max-height: 140px;
overflow-y: scroll;
background: var(--spotify-green-light);
flex-shrink: 0;
Expand Down

1 comment on commit 893c054

@EricLambrecht
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#73

Please sign in to comment.