Queue.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <template>
  2. <div class='sidebar' transition='slide' v-if='$parent.sidebars.queue'>
  3. <div class='inner-wrapper'>
  4. <div class='title'>Queue</div>
  5. <article class="media">
  6. <figure class="media-left">
  7. <p class="image is-64x64">
  8. <img :src="$parent.currentSong.thumbnail">
  9. </p>
  10. </figure>
  11. <div class="media-content">
  12. <div class="content">
  13. <p>
  14. Current Song: <strong>{{ $parent.currentSong.title }}</strong>
  15. <br>
  16. <small>{{ $parent.currentSong.artists }}</small>
  17. </p>
  18. </div>
  19. </div>
  20. </article>
  21. <article class="media" v-for='song in $parent.queue'>
  22. <div class="media-content">
  23. <div class="content">
  24. <p>
  25. <strong>{{ song.title }}</strong>
  26. <br>
  27. <small>{{ song.artists }}</small>
  28. </p>
  29. </div>
  30. </div>
  31. </article>
  32. <a class='button add-to-queue' @click='$parent.toggleModal("addSongToQueue")'>Add Song to Queue</a>
  33. </div>
  34. </div>
  35. </template>
  36. <script>
  37. export default {
  38. data() {
  39. return {
  40. playlist: []
  41. }
  42. },
  43. ready: function () {
  44. let _this = this;
  45. let socketInterval = setInterval(() => {
  46. if (!!_this.$parent.$parent.socket) {
  47. _this.socket = _this.$parent.$parent.socket;
  48. _this.socket.emit('stations.getPlaylist', _this.$parent.stationId, res => {
  49. if (res.status == 'success') _this.playlist = res.data;
  50. });
  51. clearInterval(socketInterval);
  52. }
  53. }, 100);
  54. }
  55. }
  56. </script>
  57. <style type='scss' scoped>
  58. .sidebar {
  59. position: fixed;
  60. top: 0;
  61. right: 0;
  62. width: 300px;
  63. height: 100vh;
  64. background-color: #fff;
  65. box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12);
  66. }
  67. .inner-wrapper {
  68. top: 50px;
  69. position: relative;
  70. }
  71. .slide-transition {
  72. transition: transform 0.6s ease-in-out;
  73. transform: translateX(0);
  74. }
  75. .slide-enter, .slide-leave { transform: translateX(100%); }
  76. .title {
  77. background-color: rgb(3, 169, 244);
  78. text-align: center;
  79. padding: 10px;
  80. color: white;
  81. font-weight: 600;
  82. }
  83. .add-to-queue {
  84. width: 100%;
  85. margin-top: 25px;
  86. height: 40px;
  87. border-radius: 0;
  88. background: rgb(3, 169, 244);
  89. color: #fff !important;
  90. border: 0;
  91. &:active, &:focus { border: 0; }
  92. }
  93. .media { padding: 0px 25px;}
  94. .media-content .content {
  95. height: 64px;
  96. display: flex;
  97. align-items: center;
  98. }
  99. </style>