Queue.vue 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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 playlist'>
  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. </div>
  33. </div>
  34. </template>
  35. <script>
  36. export default {
  37. data() {
  38. return {
  39. playlist: []
  40. }
  41. },
  42. ready: function () {
  43. let _this = this;
  44. let socketInterval = setInterval(() => {
  45. if (!!_this.$parent.$parent.socket) {
  46. _this.socket = _this.$parent.$parent.socket;
  47. _this.socket.emit('stations.getPlaylist', _this.$parent.stationId, res => {
  48. if (res.status == 'success') _this.playlist = res.data;
  49. });
  50. clearInterval(socketInterval);
  51. }
  52. }, 100);
  53. }
  54. }
  55. </script>
  56. <style type='scss' scoped>
  57. .sidebar {
  58. position: fixed;
  59. top: 0;
  60. right: 0;
  61. width: 300px;
  62. height: 100vh;
  63. background-color: #fff;
  64. box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12);
  65. }
  66. .inner-wrapper {
  67. top: 50px;
  68. position: relative;
  69. }
  70. .slide-transition {
  71. transition: transform 0.6s ease-in-out;
  72. transform: translateX(0);
  73. }
  74. .slide-enter, .slide-leave {
  75. transform: translateX(100%);
  76. }
  77. .title {
  78. background-color: rgb(3, 169, 244);
  79. text-align: center;
  80. padding: 10px;
  81. color: white;
  82. font-weight: 600;
  83. }
  84. .media {
  85. padding: 0px 25px;
  86. }
  87. .media-content .content {
  88. height: 64px;
  89. display: flex;
  90. align-items: center;
  91. }
  92. </style>