CurrentlyPlaying.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. <template>
  2. <div id="currently-playing">
  3. <figure class="thumbnail">
  4. <div
  5. v-if="currentSong.ytThumbnail"
  6. id="yt-thumbnail-bg"
  7. :style="{
  8. 'background-image': 'url(' + currentSong.ytThumbnail + ')'
  9. }"
  10. ></div>
  11. <img
  12. v-if="currentSong.ytThumbnail"
  13. :src="currentSong.ytThumbnail"
  14. onerror="this.src='/assets/notes-transparent.png'"
  15. />
  16. <img
  17. v-else
  18. :src="currentSong.thumbnail"
  19. onerror="this.src='/assets/notes-transparent.png'"
  20. />
  21. </figure>
  22. <div id="song-info">
  23. <h6>Currently playing...</h6>
  24. <h4
  25. id="song-title"
  26. :style="!currentSong.artists ? { fontSize: '17px' } : null"
  27. >
  28. {{ currentSong.title }}
  29. </h4>
  30. <h5 id="song-artists" v-if="currentSong.artists">
  31. {{ currentSong.artists }}
  32. </h5>
  33. <p
  34. id="song-request-time"
  35. v-if="
  36. station.type === 'community' && station.partyMode === true
  37. "
  38. >
  39. Requested
  40. <strong>{{
  41. formatDistance(
  42. parseISO(currentSong.requestedAt),
  43. Date.now(),
  44. {
  45. addSuffix: true
  46. }
  47. )
  48. }}</strong>
  49. </p>
  50. <div id="song-actions">
  51. <button
  52. class="button"
  53. id="report-icon"
  54. v-if="loggedIn && !currentSong.simpleSong"
  55. @click="
  56. openModal({
  57. sector: 'station',
  58. modal: 'report'
  59. })
  60. "
  61. >
  62. <i class="material-icons icon-with-button">flag</i>Report
  63. </button>
  64. <a
  65. class="button"
  66. id="youtube-icon"
  67. target="_blank"
  68. :href="
  69. `https://www.youtube.com/watch?v=${currentSong.songId}`
  70. "
  71. >
  72. <div class="icon"></div>
  73. </a>
  74. <button
  75. class="button is-primary"
  76. id="editsong-icon"
  77. v-if="$parent.isAdminOnly() && !currentSong.simpleSong"
  78. @click="$parent.editSong(currentSong)"
  79. >
  80. <i class="material-icons icon-with-button">edit</i>Edit
  81. </button>
  82. </div>
  83. </div>
  84. </div>
  85. </template>
  86. <script>
  87. import { mapState, mapActions } from "vuex";
  88. import { formatDistance, parseISO } from "date-fns";
  89. export default {
  90. computed: {
  91. ...mapState("station", {
  92. currentSong: state => state.currentSong,
  93. station: state => state.station
  94. }),
  95. ...mapState({
  96. loggedIn: state => state.user.auth.loggedIn
  97. })
  98. },
  99. methods: {
  100. ...mapActions("modals", ["openModal"]),
  101. formatDistance,
  102. parseISO
  103. }
  104. };
  105. </script>
  106. <style lang="scss" scoped>
  107. @import "../../../styles/global.scss";
  108. #currently-playing {
  109. display: flex;
  110. flex-direction: row;
  111. align-items: center;
  112. width: 100%;
  113. height: 100%;
  114. padding: 10px;
  115. .thumbnail {
  116. min-width: 120px;
  117. max-height: 120px;
  118. height: 100%;
  119. position: relative;
  120. #yt-thumbnail-bg {
  121. height: 100%;
  122. width: 100%;
  123. position: absolute;
  124. top: 0;
  125. filter: blur(1px);
  126. background: url("/assets/notes-transparent.png") no-repeat center
  127. center;
  128. }
  129. img {
  130. height: auto;
  131. width: 100%;
  132. margin-top: auto;
  133. margin-bottom: auto;
  134. z-index: 1;
  135. position: absolute;
  136. top: 0;
  137. bottom: 0;
  138. left: 0;
  139. right: 0;
  140. }
  141. }
  142. #song-info {
  143. display: flex;
  144. flex-direction: column;
  145. justify-content: center;
  146. margin-left: 20px;
  147. width: 100%;
  148. height: 100%;
  149. *:not(i) {
  150. margin: 0;
  151. font-family: Karla, Arial, sans-serif;
  152. }
  153. h6 {
  154. color: $musare-blue !important;
  155. font-weight: bold;
  156. font-size: 17px;
  157. }
  158. #song-title {
  159. margin-top: 7px;
  160. font-size: 22px;
  161. }
  162. #song-artists {
  163. font-size: 16px;
  164. }
  165. #song-request-time {
  166. font-size: 12px;
  167. margin-top: 7px;
  168. color: $dark-grey;
  169. }
  170. #song-actions {
  171. margin-top: 10px;
  172. .button {
  173. color: #fff;
  174. padding: 0 15px;
  175. border: 0;
  176. }
  177. #report-icon {
  178. background-color: $grey;
  179. }
  180. #youtube-icon {
  181. background-color: #bd2e2e;
  182. &:after {
  183. content: "View on YouTube";
  184. @media (max-width: 1800px) {
  185. content: "Open";
  186. }
  187. }
  188. .icon {
  189. margin-right: 3px;
  190. height: 20px;
  191. width: 20px;
  192. -webkit-mask: url("/assets/social/youtube.svg") no-repeat
  193. center;
  194. mask: url("/assets/social/youtube.svg") no-repeat center;
  195. background-color: #fff;
  196. }
  197. }
  198. }
  199. }
  200. }
  201. </style>