Songs.vue 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <template>
  2. <div class="musare-songs-tab">
  3. <label class="label"> Search for a song on Musare </label>
  4. <div class="control is-grouped input-with-button">
  5. <p class="control is-expanded">
  6. <input
  7. class="input"
  8. type="text"
  9. placeholder="Enter your song query here..."
  10. v-model="musareSearch.query"
  11. @keyup.enter="searchForMusareSongs(1)"
  12. />
  13. </p>
  14. <p class="control">
  15. <a class="button is-info" @click="searchForMusareSongs(1)"
  16. ><i class="material-icons icon-with-button">search</i
  17. >Search</a
  18. >
  19. </p>
  20. </div>
  21. <div v-if="musareSearch.results.length > 0">
  22. <song-item
  23. v-for="song in musareSearch.results"
  24. :key="song._id"
  25. :song="song"
  26. :disabled-actions="['addToPlaylist', 'edit']"
  27. />
  28. <button
  29. v-if="resultsLeftCount > 0"
  30. class="button is-primary load-more-button"
  31. @click="searchForMusareSongs(musareSearch.page + 1)"
  32. >
  33. Load {{ nextPageResultsCount }} more results
  34. </button>
  35. </div>
  36. </div>
  37. </template>
  38. <script>
  39. import { mapState } from "vuex";
  40. import SearchMusare from "@/mixins/SearchMusare.vue";
  41. import SongItem from "@/components/SongItem.vue";
  42. export default {
  43. components: {
  44. SongItem
  45. },
  46. mixins: [SearchMusare],
  47. data() {
  48. return {};
  49. },
  50. computed: {
  51. ...mapState("modals/editSong", {
  52. song: state => state.song
  53. })
  54. },
  55. mounted() {
  56. this.musareSearch.query = this.song.title;
  57. this.searchForMusareSongs(1);
  58. }
  59. };
  60. </script>
  61. <style lang="scss" scoped>
  62. .musare-songs-tab {
  63. height: calc(100% - 32px);
  64. #song-query-results {
  65. height: calc(100% - 74px);
  66. overflow: auto;
  67. .search-query-item {
  68. /deep/ .thumbnail-and-info {
  69. width: calc(100% - 57px);
  70. }
  71. .icon-selected {
  72. color: var(--green) !important;
  73. }
  74. .icon-not-selected {
  75. color: var(--grey) !important;
  76. }
  77. }
  78. .search-query-item:not(:last-of-type) {
  79. margin-bottom: 10px;
  80. }
  81. .load-more-button {
  82. width: 100%;
  83. margin-top: 10px;
  84. }
  85. }
  86. }
  87. </style>