Queue.vue 2.0 KB

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