QueueItem.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. <template>
  2. <div class="queue-item">
  3. <div id="thumbnail-and-info">
  4. <img
  5. id="thumbnail"
  6. :src="song.ytThumbnail ? song.ytThumbnail : song.thumbnail"
  7. onerror="this.src='/assets/notes-transparent.png'"
  8. />
  9. <div id="song-info">
  10. <h4
  11. id="song-title"
  12. :style="
  13. song.artists.length < 1 ? { fontSize: '16px' } : null
  14. "
  15. >
  16. {{ song.title }}
  17. </h4>
  18. <h5 id="song-artists" v-if="song.artists">
  19. {{ song.artists.join(", ") }}
  20. </h5>
  21. <p
  22. id="song-request-time"
  23. v-if="
  24. station.type === 'community' &&
  25. station.partyMode === true
  26. "
  27. >
  28. Requested by
  29. <strong>
  30. <user-id-to-username
  31. :user-id="song.requestedBy"
  32. :link="true"
  33. />
  34. {{
  35. formatDistance(
  36. parseISO(song.requestedAt),
  37. new Date(),
  38. {
  39. addSuffix: true
  40. }
  41. )
  42. }}
  43. </strong>
  44. </p>
  45. </div>
  46. </div>
  47. <div id="duration-and-actions">
  48. <p id="song-duration">
  49. {{ utils.formatTime(song.duration) }}
  50. </p>
  51. <i
  52. v-if="
  53. station.type === 'community' &&
  54. ($parent.isOwnerOnly() || $parent.isAdminOnly())
  55. "
  56. class="material-icons"
  57. id="remove-queue-item"
  58. @click="$parent.removeFromQueue(song.songId)"
  59. >delete_forever</i
  60. >
  61. </div>
  62. </div>
  63. </template>
  64. <script>
  65. import { formatDistance, parseISO } from "date-fns";
  66. import UserIdToUsername from "../../../../../components/common/UserIdToUsername.vue";
  67. import utils from "../../../../../../js/utils";
  68. export default {
  69. components: { UserIdToUsername },
  70. props: {
  71. song: {
  72. type: Object,
  73. default: () => {}
  74. },
  75. station: {
  76. type: Object,
  77. default: () => {
  78. return { type: "community", partyMode: false };
  79. }
  80. }
  81. },
  82. data() {
  83. return {
  84. utils
  85. };
  86. },
  87. methods: {
  88. formatDistance,
  89. parseISO
  90. }
  91. };
  92. </script>
  93. <style lang="scss" scoped>
  94. @import "../../../../../styles/global.scss";
  95. .queue-item {
  96. display: flex;
  97. flex-direction: row;
  98. align-items: center;
  99. justify-content: space-between;
  100. padding: 7.5px;
  101. border: 1px solid $light-grey-2;
  102. border-radius: 3px;
  103. #thumbnail-and-info,
  104. #duration-and-actions {
  105. display: flex;
  106. align-items: center;
  107. }
  108. #thumbnail {
  109. width: 60px;
  110. height: 60px;
  111. }
  112. #song-info {
  113. display: flex;
  114. flex-direction: column;
  115. justify-content: center;
  116. margin-left: 25px;
  117. *:not(i) {
  118. margin: 0;
  119. font-family: Karla, Arial, sans-serif;
  120. }
  121. #song-title {
  122. font-size: 20px;
  123. }
  124. #song-artists {
  125. font-size: 14px;
  126. }
  127. #song-request-time {
  128. font-size: 12px;
  129. margin-top: 7px;
  130. }
  131. }
  132. #song-duration {
  133. font-size: 20px;
  134. }
  135. #remove-queue-item {
  136. cursor: pointer;
  137. margin-left: 10px;
  138. }
  139. }
  140. </style>