PlaylistSongItem.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. <template>
  2. <div class="universal-item playlist-song-item">
  3. <div id="thumbnail-and-info">
  4. <song-thumbnail :song="song" />
  5. <div id="song-info">
  6. <h4 class="item-title" :title="song.title">
  7. {{ song.title }}
  8. <i
  9. v-if="song.status === 'verified'"
  10. class="material-icons verified-song"
  11. content="Verified Song"
  12. v-tippy
  13. >
  14. check_circle
  15. </i>
  16. </h4>
  17. <h5
  18. class="item-description"
  19. v-if="song.artists"
  20. :style="
  21. song.artists.length < 1 ? { fontSize: '16px' } : null
  22. "
  23. :title="song.artists.join(', ')"
  24. >
  25. {{ song.artists.join(", ") }}
  26. </h5>
  27. </div>
  28. </div>
  29. <div class="universal-item-actions">
  30. <tippy
  31. v-if="loggedIn"
  32. interactive="true"
  33. placement="left"
  34. theme="songActions"
  35. trigger="click"
  36. >
  37. <template #trigger>
  38. <i
  39. class="material-icons action-dropdown-icon"
  40. content="Song Options"
  41. v-tippy
  42. >more_horiz</i
  43. >
  44. </template>
  45. <a
  46. target="_blank"
  47. :href="`https://www.youtube.com/watch?v=${song.songId}`"
  48. content="View on Youtube"
  49. v-tippy
  50. >
  51. <div class="youtube-icon"></div>
  52. </a>
  53. <i
  54. class="material-icons report-icon"
  55. @click="reportSongInPlaylist(song)"
  56. content="Report Song"
  57. v-tippy
  58. >
  59. flag
  60. </i>
  61. <add-to-playlist-dropdown :song="song">
  62. <i
  63. slot="button"
  64. class="material-icons add-to-playlist-icon"
  65. content="Add Song to Playlist"
  66. v-tippy
  67. >queue</i
  68. >
  69. </add-to-playlist-dropdown>
  70. <i
  71. v-if="userRole === 'admin'"
  72. class="material-icons edit-icon"
  73. @click="editSongInPlaylist(song)"
  74. content="Edit Song"
  75. v-tippy
  76. >
  77. edit
  78. </i>
  79. <slot name="remove" />
  80. <slot name="actions" />
  81. </tippy>
  82. <a
  83. v-else
  84. target="_blank"
  85. :href="`https://www.youtube.com/watch?v=${song.songId}`"
  86. content="View on Youtube"
  87. v-tippy
  88. >
  89. <div class="youtube-icon"></div>
  90. </a>
  91. </div>
  92. </div>
  93. </template>
  94. <script>
  95. import { mapState, mapActions } from "vuex";
  96. import AddToPlaylistDropdown from "../../../ui/AddToPlaylistDropdown.vue";
  97. import SongThumbnail from "../../../ui/SongThumbnail.vue";
  98. export default {
  99. components: { AddToPlaylistDropdown, SongThumbnail },
  100. props: {
  101. song: {
  102. type: Object,
  103. default: () => {}
  104. }
  105. },
  106. computed: mapState({
  107. loggedIn: state => state.user.auth.loggedIn,
  108. userRole: state => state.user.auth.role
  109. }),
  110. methods: {
  111. editSongInPlaylist(song) {
  112. this.editSong(song);
  113. this.openModal({ sector: "admin", modal: "editSong" });
  114. },
  115. reportSongInPlaylist(song) {
  116. this.reportSong(song);
  117. this.openModal({ sector: "station", modal: "report" });
  118. },
  119. ...mapActions("modals/editSong", ["editSong"]),
  120. ...mapActions("modals/report", ["reportSong"]),
  121. ...mapActions("modalVisibility", ["openModal"])
  122. }
  123. };
  124. </script>
  125. <style lang="scss" scoped>
  126. .night-mode {
  127. .playlist-song-item {
  128. background-color: var(--dark-grey-3) !important;
  129. border: 0 !important;
  130. }
  131. }
  132. /deep/ #nav-dropdown {
  133. margin-top: 36px;
  134. width: 0;
  135. height: 0;
  136. .nav-dropdown-items {
  137. width: 250px;
  138. max-width: 100vw;
  139. position: relative;
  140. right: 250px;
  141. }
  142. }
  143. .playlist-song-item {
  144. width: 100%;
  145. min-height: 50px;
  146. #thumbnail-and-info,
  147. .universal-item-actions div {
  148. display: flex;
  149. align-items: center;
  150. }
  151. .universal-item-actions {
  152. margin-left: 5px;
  153. i {
  154. margin-left: 5px;
  155. }
  156. }
  157. .thumbnail {
  158. min-width: 55px;
  159. width: 55px;
  160. height: 55px;
  161. }
  162. #thumbnail-and-info {
  163. width: calc(100% - 50px);
  164. }
  165. #song-info {
  166. display: flex;
  167. flex-direction: column;
  168. justify-content: center;
  169. margin-left: 20px;
  170. width: calc(100% - 50px);
  171. .item-title {
  172. font-size: 16px;
  173. }
  174. *:not(i) {
  175. margin: 0;
  176. font-family: Karla, Arial, sans-serif;
  177. }
  178. }
  179. }
  180. </style>