Blacklist.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. <template>
  2. <div class="station-blacklist">
  3. <p class="text-centered">
  4. Blacklist a playlist to prevent all of its songs playing in this
  5. station, or blacklist a song to prevent it playing.
  6. </p>
  7. <div class="tabs-container">
  8. <div class="tab-selection">
  9. <button
  10. class="button is-default"
  11. :class="{ selected: tab === 'playlists' }"
  12. @click="showTab('playlists')"
  13. >
  14. Playlists
  15. </button>
  16. <button
  17. class="button is-default"
  18. :class="{ selected: tab === 'songs' }"
  19. @click="showTab('songs')"
  20. >
  21. Songs
  22. </button>
  23. </div>
  24. <div class="tab" v-show="tab === 'playlists'">
  25. <div v-if="excludedPlaylists.length > 0">
  26. <playlist-item
  27. :playlist="playlist"
  28. v-for="(playlist, index) in excludedPlaylists"
  29. :key="'key-' + index"
  30. >
  31. <div class="icons-group" slot="actions">
  32. <i
  33. @click="deselectPlaylist(playlist._id)"
  34. class="material-icons stop-icon"
  35. content="Stop blacklisting songs from this playlist
  36. "
  37. v-tippy
  38. >stop</i
  39. >
  40. <i
  41. v-if="playlist.createdBy === userId"
  42. @click="showPlaylist(playlist._id)"
  43. class="material-icons edit-icon"
  44. content="Edit Playlist"
  45. v-tippy
  46. >edit</i
  47. >
  48. <i
  49. v-else
  50. @click="showPlaylist(playlist._id)"
  51. class="material-icons edit-icon"
  52. content="View Playlist"
  53. v-tippy
  54. >visibility</i
  55. >
  56. </div>
  57. </playlist-item>
  58. </div>
  59. <p v-else class="nothing-here-text scrollable-list">
  60. No playlists currently blacklisted.
  61. </p>
  62. </div>
  63. <div class="tab" v-show="tab === 'songs'">
  64. Blacklisting songs has yet to be added.
  65. </div>
  66. </div>
  67. </div>
  68. </template>
  69. <script>
  70. import { mapActions, mapState, mapGetters } from "vuex";
  71. import Toast from "toasters";
  72. import PlaylistItem from "@/components/PlaylistItem.vue";
  73. export default {
  74. components: {
  75. PlaylistItem
  76. },
  77. data() {
  78. return {
  79. tab: "playlists"
  80. };
  81. },
  82. computed: {
  83. ...mapState({
  84. userId: state => state.user.auth.userId
  85. }),
  86. ...mapState("modals/manageStation", {
  87. station: state => state.station,
  88. originalStation: state => state.originalStation,
  89. excludedPlaylists: state => state.excludedPlaylists
  90. }),
  91. ...mapGetters({
  92. socket: "websockets/getSocket"
  93. })
  94. },
  95. methods: {
  96. showTab(tab) {
  97. this.tab = tab;
  98. },
  99. showPlaylist(playlistId) {
  100. this.editPlaylist(playlistId);
  101. this.openModal({ sector: "station", modal: "editPlaylist" });
  102. },
  103. deselectPlaylist(id) {
  104. this.socket.dispatch(
  105. "stations.removeExcludedPlaylist",
  106. this.station._id,
  107. id,
  108. res => {
  109. new Toast(res.message);
  110. }
  111. );
  112. },
  113. ...mapActions("modalVisibility", ["openModal"]),
  114. ...mapActions("user/playlists", ["editPlaylist"])
  115. }
  116. };
  117. </script>
  118. <style lang="scss" scoped>
  119. .station-blacklist {
  120. .tabs-container {
  121. margin-top: 10px;
  122. .tab-selection {
  123. display: flex;
  124. .button {
  125. border-radius: 0;
  126. border: 0;
  127. text-transform: uppercase;
  128. font-size: 14px;
  129. color: var(--dark-grey-3);
  130. background-color: var(--light-grey-2);
  131. flex-grow: 1;
  132. height: 32px;
  133. &:not(:first-of-type) {
  134. margin-left: 5px;
  135. }
  136. }
  137. .selected {
  138. background-color: var(--dark-grey-3) !important;
  139. color: var(--white) !important;
  140. }
  141. }
  142. .tab {
  143. padding: 15px 0;
  144. border-radius: 0;
  145. .playlist-item:not(:last-of-type) {
  146. margin-bottom: 10px;
  147. }
  148. }
  149. }
  150. }
  151. </style>