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" onerror="this.src='/assets/notes-transparent.png'">
  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. import io from '../../io';
  38. export default {
  39. data() {
  40. return {
  41. playlist: []
  42. }
  43. },
  44. ready: function () {
  45. let _this = this;
  46. io.getSocket((socket) => {
  47. _this.socket = socket;
  48. _this.socket.emit('stations.getPlaylist', _this.$parent.stationId, res => {
  49. if (res.status == 'success') _this.playlist = res.data;
  50. });
  51. });
  52. }
  53. }
  54. </script>
  55. <style type='scss' scoped>
  56. .sidebar {
  57. position: fixed;
  58. z-index: 1;
  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 { transform: translateX(100%); }
  75. .title {
  76. background-color: rgb(3, 169, 244);
  77. text-align: center;
  78. padding: 10px;
  79. color: white;
  80. font-weight: 600;
  81. }
  82. .add-to-queue {
  83. width: 100%;
  84. margin-top: 25px;
  85. height: 40px;
  86. border-radius: 0;
  87. background: rgb(3, 169, 244);
  88. color: #fff !important;
  89. border: 0;
  90. &:active, &:focus { border: 0; }
  91. }
  92. .media { padding: 0px 25px;}
  93. .media-content .content {
  94. height: 64px;
  95. display: flex;
  96. align-items: center;
  97. }
  98. </style>