CurrentlyPlaying.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. <template>
  2. <div class="currently-playing">
  3. <song-thumbnail :song="song" />
  4. <div class="song-info">
  5. <div class="song-details">
  6. <h6 v-if="type === 'current'">Currently Playing...</h6>
  7. <h6 v-if="type === 'next'">Next Up...</h6>
  8. <h4
  9. class="song-title"
  10. :style="!song.artists ? { fontSize: '17px' } : null"
  11. :title="song.title"
  12. >
  13. {{ song.title }}
  14. <i
  15. v-if="song.status === 'verified'"
  16. class="material-icons verified-song"
  17. content="Verified Song"
  18. v-tippy
  19. >
  20. check_circle
  21. </i>
  22. </h4>
  23. <h5
  24. class="song-artists"
  25. v-if="song.artists"
  26. :title="song.artists.join(', ')"
  27. >
  28. {{ song.artists.join(", ") }}
  29. </h5>
  30. <p
  31. class="song-request-time"
  32. v-if="
  33. station.type === 'community' &&
  34. station.partyMode === true
  35. "
  36. >
  37. Requested by
  38. <strong>
  39. <user-id-to-username
  40. :user-id="song.requestedBy"
  41. :link="true"
  42. />
  43. {{
  44. formatDistance(
  45. parseISO(song.requestedAt),
  46. new Date(),
  47. {
  48. includeSeconds: true
  49. }
  50. )
  51. }}
  52. ago
  53. </strong>
  54. </p>
  55. </div>
  56. </div>
  57. <tippy
  58. class="song-actions"
  59. interactive="true"
  60. placement="right"
  61. theme="songActions"
  62. trigger="click"
  63. >
  64. <template #trigger>
  65. <i
  66. class="material-icons action-dropdown-icon"
  67. content="Song Options"
  68. v-tippy
  69. >more_horiz</i
  70. >
  71. </template>
  72. <a
  73. target="_blank"
  74. :href="`https://www.youtube.com/watch?v=${song.songId}`"
  75. content="View on Youtube"
  76. v-tippy
  77. >
  78. <div class="youtube-icon"></div>
  79. </a>
  80. <i
  81. v-if="$parent.loggedIn"
  82. class="material-icons report-icon"
  83. @click="report(song)"
  84. content="Report Song"
  85. v-tippy
  86. >
  87. flag
  88. </i>
  89. <add-to-playlist-dropdown v-if="$parent.loggedIn" :song="song">
  90. <i
  91. slot="button"
  92. class="material-icons add-to-playlist-icon"
  93. content="Add Song to Playlist"
  94. v-tippy
  95. >queue</i
  96. >
  97. </add-to-playlist-dropdown>
  98. <i
  99. v-if="$parent.isAdminOnly()"
  100. class="material-icons edit-icon"
  101. @click="edit(song)"
  102. content="Edit Song"
  103. v-tippy
  104. >
  105. edit
  106. </i>
  107. </tippy>
  108. </div>
  109. </template>
  110. <script>
  111. import { mapState, mapActions } from "vuex";
  112. import { formatDistance, parseISO } from "date-fns";
  113. import AddToPlaylistDropdown from "../../../components/ui/AddToPlaylistDropdown.vue";
  114. import UserIdToUsername from "../../../components/common/UserIdToUsername.vue";
  115. import SongThumbnail from "../../../components/ui/SongThumbnail.vue";
  116. export default {
  117. components: { AddToPlaylistDropdown, UserIdToUsername, SongThumbnail },
  118. props: {
  119. song: {
  120. type: Object,
  121. default: () => {}
  122. },
  123. type: {
  124. type: String,
  125. default: "current"
  126. }
  127. },
  128. computed: {
  129. ...mapState("station", {
  130. station: state => state.station
  131. }),
  132. ...mapState({
  133. loggedIn: state => state.user.auth.loggedIn
  134. })
  135. },
  136. methods: {
  137. edit(song) {
  138. this.editSong(song);
  139. this.openModal({ sector: "admin", modal: "editSong" });
  140. },
  141. report(song) {
  142. this.reportSong(song);
  143. this.openModal({ sector: "station", modal: "report" });
  144. },
  145. ...mapActions("modals/editSong", ["editSong"]),
  146. ...mapActions("modals/report", ["reportSong"]),
  147. ...mapActions("modalVisibility", ["openModal"]),
  148. formatDistance,
  149. parseISO
  150. }
  151. };
  152. </script>
  153. <style lang="scss" scoped>
  154. .currently-playing {
  155. display: flex;
  156. flex-direction: row;
  157. align-items: center;
  158. width: 100%;
  159. height: 100%;
  160. padding: 10px;
  161. min-height: 130px;
  162. .song-info {
  163. display: flex;
  164. flex-direction: column;
  165. flex-wrap: wrap;
  166. margin-left: 20px;
  167. width: calc(100% - 130px - 34px);
  168. height: 100%;
  169. *:not(i) {
  170. margin: 0;
  171. font-family: Karla, Arial, sans-serif;
  172. }
  173. .song-details {
  174. display: flex;
  175. justify-content: center;
  176. flex-direction: column;
  177. flex-grow: 1;
  178. width: 100%;
  179. h6 {
  180. color: var(--primary-color) !important;
  181. font-weight: bold;
  182. font-size: 17px;
  183. }
  184. .song-title {
  185. margin-top: 7px;
  186. font-size: 22px;
  187. overflow: hidden;
  188. text-overflow: ellipsis;
  189. white-space: nowrap;
  190. }
  191. .song-artists {
  192. font-size: 16px;
  193. margin-bottom: 5px;
  194. overflow: hidden;
  195. text-overflow: ellipsis;
  196. white-space: nowrap;
  197. }
  198. .song-request-time {
  199. font-size: 12px;
  200. margin-top: 7px;
  201. color: var(--dark-grey);
  202. }
  203. }
  204. }
  205. .song-actions {
  206. display: flex;
  207. cursor: pointer;
  208. color: var(--primary-color);
  209. &:hover,
  210. &:focus {
  211. filter: brightness(90%);
  212. }
  213. }
  214. }
  215. </style>