SongsList.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. <template>
  2. <div class='sidebar' transition='slide' v-if='$parent.sidebars.songslist'>
  3. <div class='inner-wrapper'>
  4. <div class='title' v-if='$parent.type === "community"'>Queue</div>
  5. <div class='title' v-else>Playlist</div>
  6. <article class="media" v-if="!$parent.noSong">
  7. <figure class="media-left">
  8. <p class="image is-64x64">
  9. <img :src="$parent.currentSong.thumbnail" onerror="this.src='/assets/notes-transparent.png'">
  10. </p>
  11. </figure>
  12. <div class="media-content">
  13. <div class="content">
  14. <p>
  15. Current Song: <strong>{{ $parent.currentSong.title }}</strong>
  16. <br>
  17. <small>{{ $parent.currentSong.artists }}</small>
  18. </p>
  19. </div>
  20. </div>
  21. <div class="media-right">
  22. {{ $parent.formatTime($parent.currentSong.duration) }}
  23. </div>
  24. </article>
  25. <p v-if="$parent.noSong" class="center">There is currently no song playing.</p>
  26. <article class="media" v-for='song in $parent.songsList'>
  27. <div class="media-content">
  28. <div class="content">
  29. <p>
  30. <strong>{{ song.title }}</strong>
  31. <br>
  32. <small>{{ song.artists.join(', ') }}</small>
  33. <div v-if="this.$parent.$parent.type === 'community'">
  34. <br>
  35. <small>Requested by <b>{{this.$parent.$parent.$parent.getUsernameFromId(song.requestedBy)}} {{this.userIdMap[song.requestedBy]}}</b></small>
  36. </div>
  37. </p>
  38. </div>
  39. </div>
  40. <div class="media-right">
  41. {{ $parent.$parent.formatTime(song.duration) }}
  42. </div>
  43. </article>
  44. <div v-if="$parent.type === 'community' && $parent.$parent.loggedIn">
  45. <button class='button add-to-queue' @click='$parent.modals.addSongToQueue = !$parent.modals.addSongToQueue' v-if="($parent.station.locked && isOwnerOnly()) || !$parent.station.locked || ($parent.station.locked && isAdminOnly() && dismissedWarning)">Add Song to Queue</button>
  46. <button class='button add-to-queue add-to-queue-warning' @click='dismissedWarning = true' v-if="$parent.station.locked && isAdminOnly() && !isOwnerOnly() && !dismissedWarning">THIS STATION'S QUEUE IS LOCKED.</button>
  47. <button class='button add-to-queue add-to-queue-disabled' v-if="$parent.station.locked && !isAdminOnly() && !isOwnerOnly()">THIS STATION'S QUEUE IS LOCKED.</button>
  48. </div>
  49. </div>
  50. </div>
  51. </template>
  52. <script>
  53. import io from '../../io';
  54. export default {
  55. data: function () {
  56. return {
  57. dismissedWarning: false,
  58. userIdMap: this.$parent.$parent.userIdMap
  59. }
  60. },
  61. methods: {
  62. isOwnerOnly: function () {
  63. return this.$parent.$parent.loggedIn && this.$parent.$parent.userId === this.$parent.station.owner;
  64. },
  65. isAdminOnly: function() {
  66. return this.$parent.$parent.loggedIn && this.$parent.$parent.role === 'admin';
  67. }
  68. },
  69. ready: function () {
  70. /*let _this = this;
  71. io.getSocket((socket) => {
  72. _this.socket = socket;
  73. });*/
  74. }
  75. }
  76. </script>
  77. <style type='scss' scoped>
  78. .sidebar {
  79. position: fixed;
  80. z-index: 1;
  81. top: 0;
  82. right: 0;
  83. width: 300px;
  84. height: 100vh;
  85. background-color: #fff;
  86. box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12);
  87. }
  88. .inner-wrapper {
  89. top: 64px;
  90. position: relative;
  91. overflow: auto;
  92. height: 100%;
  93. }
  94. .slide-transition {
  95. transition: transform 0.6s ease-in-out;
  96. transform: translateX(0);
  97. }
  98. .slide-enter, .slide-leave { transform: translateX(100%); }
  99. .title {
  100. background-color: rgb(3, 169, 244);
  101. text-align: center;
  102. padding: 10px;
  103. color: white;
  104. font-weight: 600;
  105. }
  106. .media { padding: 0 25px; }
  107. .media-content .content {
  108. min-height: 64px;
  109. display: flex;
  110. align-items: center;
  111. }
  112. .content p strong { word-break: break-word; }
  113. .content p small { word-break: break-word; }
  114. .add-to-queue {
  115. width: 100%;
  116. margin-top: 25px;
  117. height: 40px;
  118. border-radius: 0;
  119. background: rgb(3, 169, 244);
  120. color: #fff !important;
  121. border: 0;
  122. &:active, &:focus { border: 0; }
  123. }
  124. .add-to-queue.add-to-queue-warning {
  125. background-color: red;
  126. }
  127. .add-to-queue.add-to-queue-disabled {
  128. background-color: gray;
  129. }
  130. .add-to-queue.add-to-queue-disabled:focus {
  131. background-color: gray;
  132. }
  133. .add-to-queue:focus { background: #029ce3; }
  134. .media-right { line-height: 64px; }
  135. </style>