Songs.vue 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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 { mapGetters, 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. ...mapGetters({
  55. socket: "websockets/getSocket"
  56. })
  57. },
  58. mounted() {
  59. this.musareSearch.query = this.song.title;
  60. this.searchForMusareSongs(1, false);
  61. }
  62. };
  63. </script>
  64. <style lang="less" scoped>
  65. .musare-songs-tab #song-query-results {
  66. height: calc(100% - 74px);
  67. overflow: auto;
  68. .search-query-item {
  69. .icon-selected {
  70. color: var(--green) !important;
  71. }
  72. .icon-not-selected {
  73. color: var(--grey) !important;
  74. }
  75. }
  76. .search-query-item:not(:last-of-type) {
  77. margin-bottom: 10px;
  78. }
  79. .load-more-button {
  80. width: 100%;
  81. margin-top: 10px;
  82. }
  83. }
  84. </style>