CurrentlyPlaying.vue 3.8 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. </div>
  75. </div>
  76. </div>
  77. </template>
  78. <script>
  79. import { mapState, mapActions } from "vuex";
  80. import { formatDistance, parseISO } from "date-fns";
  81. export default {
  82. computed: {
  83. ...mapState("station", {
  84. currentSong: state => state.currentSong,
  85. station: state => state.station
  86. }),
  87. ...mapState({
  88. loggedIn: state => state.user.auth.loggedIn
  89. })
  90. },
  91. methods: {
  92. ...mapActions("modals", ["openModal"]),
  93. formatDistance,
  94. parseISO
  95. }
  96. };
  97. </script>
  98. <style lang="scss" scoped>
  99. @import "../../../styles/global.scss";
  100. #currently-playing {
  101. display: flex;
  102. flex-direction: row;
  103. align-items: center;
  104. width: 100%;
  105. height: 100%;
  106. padding: 10px;
  107. .thumbnail {
  108. min-width: 120px;
  109. max-height: 120px;
  110. height: 100%;
  111. position: relative;
  112. #yt-thumbnail-bg {
  113. height: 100%;
  114. width: 100%;
  115. position: absolute;
  116. top: 0;
  117. filter: blur(1px);
  118. background: url("/assets/notes-transparent.png") no-repeat center
  119. center;
  120. }
  121. img {
  122. height: auto;
  123. width: 100%;
  124. margin-top: auto;
  125. margin-bottom: auto;
  126. z-index: 1;
  127. position: absolute;
  128. top: 0;
  129. bottom: 0;
  130. left: 0;
  131. right: 0;
  132. }
  133. }
  134. @media (max-width: 1500px) {
  135. #song-actions {
  136. .button {
  137. padding: 0 10px !important;
  138. }
  139. }
  140. }
  141. #song-info {
  142. display: flex;
  143. flex-direction: column;
  144. justify-content: center;
  145. margin-left: 20px;
  146. width: 100%;
  147. height: 100%;
  148. *:not(i) {
  149. margin: 0;
  150. font-family: Karla, Arial, sans-serif;
  151. }
  152. h6 {
  153. color: $musare-blue !important;
  154. font-weight: bold;
  155. font-size: 17px;
  156. }
  157. #song-title {
  158. margin-top: 7px;
  159. font-size: 22px;
  160. }
  161. #song-artists {
  162. font-size: 16px;
  163. }
  164. #song-request-time {
  165. font-size: 12px;
  166. margin-top: 7px;
  167. color: $dark-grey;
  168. }
  169. #song-actions {
  170. margin-top: 10px;
  171. .button {
  172. color: #fff;
  173. padding: 0 15px;
  174. border: 0;
  175. }
  176. #report-icon {
  177. background-color: $grey;
  178. }
  179. #youtube-icon {
  180. background-color: #bd2e2e;
  181. &:after {
  182. content: "View on YouTube";
  183. @media (max-width: 1800px) {
  184. content: "Open";
  185. }
  186. }
  187. .icon {
  188. margin-right: 3px;
  189. height: 20px;
  190. width: 20px;
  191. -webkit-mask: url("/assets/social/youtube.svg") no-repeat
  192. center;
  193. mask: url("/assets/social/youtube.svg") no-repeat center;
  194. background-color: #fff;
  195. }
  196. }
  197. }
  198. }
  199. }
  200. </style>