SongsList.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  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. </p>
  34. </div>
  35. </div>
  36. <div class="media-right">
  37. {{ $parent.$parent.formatTime(song.duration) }}
  38. </div>
  39. </article>
  40. <div v-if="$parent.type === 'community' && $parent.$parent.loggedIn">
  41. <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>
  42. <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>
  43. <button class='button add-to-queue add-to-queue-disabled' v-if="$parent.station.locked && !isAdminOnly() && !isOwnerOnly()">THIS STATION'S QUEUE IS LOCKED.</button>
  44. </div>
  45. </div>
  46. </div>
  47. </template>
  48. <script>
  49. import io from '../../io';
  50. export default {
  51. data: function () {
  52. return {
  53. dismissedWarning: false
  54. }
  55. },
  56. methods: {
  57. isOwnerOnly: function () {
  58. return this.$parent.$parent.loggedIn && this.$parent.$parent.userId === this.$parent.station.owner;
  59. },
  60. isAdminOnly: function() {
  61. return this.$parent.$parent.loggedIn && this.$parent.$parent.role === 'admin';
  62. }
  63. },
  64. ready: function () {
  65. /*let _this = this;
  66. io.getSocket((socket) => {
  67. _this.socket = socket;
  68. });*/
  69. }
  70. }
  71. </script>
  72. <style type='scss' scoped>
  73. .sidebar {
  74. position: fixed;
  75. z-index: 1;
  76. top: 0;
  77. right: 0;
  78. width: 300px;
  79. height: 100vh;
  80. background-color: #fff;
  81. box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12);
  82. }
  83. .inner-wrapper {
  84. top: 64px;
  85. position: relative;
  86. overflow: auto;
  87. height: 100%;
  88. }
  89. .slide-transition {
  90. transition: transform 0.6s ease-in-out;
  91. transform: translateX(0);
  92. }
  93. .slide-enter, .slide-leave { transform: translateX(100%); }
  94. .title {
  95. background-color: rgb(3, 169, 244);
  96. text-align: center;
  97. padding: 10px;
  98. color: white;
  99. font-weight: 600;
  100. }
  101. .media { padding: 0 25px; }
  102. .media-content .content {
  103. min-height: 64px;
  104. display: flex;
  105. align-items: center;
  106. }
  107. .content p strong { word-break: break-word; }
  108. .content p small { word-break: break-word; }
  109. .add-to-queue {
  110. width: 100%;
  111. margin-top: 25px;
  112. height: 40px;
  113. border-radius: 0;
  114. background: rgb(3, 169, 244);
  115. color: #fff !important;
  116. border: 0;
  117. &:active, &:focus { border: 0; }
  118. }
  119. .add-to-queue.add-to-queue-warning {
  120. background-color: red;
  121. }
  122. .add-to-queue.add-to-queue-disabled {
  123. background-color: gray;
  124. }
  125. .add-to-queue.add-to-queue-disabled:focus {
  126. background-color: gray;
  127. }
  128. .add-to-queue:focus { background: #029ce3; }
  129. .media-right { line-height: 64px; }
  130. </style>