Queue.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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.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. top: 0;
  59. right: 0;
  60. width: 300px;
  61. height: 100vh;
  62. background-color: #fff;
  63. box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12);
  64. }
  65. .inner-wrapper {
  66. top: 50px;
  67. position: relative;
  68. }
  69. .slide-transition {
  70. transition: transform 0.6s ease-in-out;
  71. transform: translateX(0);
  72. }
  73. .slide-enter, .slide-leave { transform: translateX(100%); }
  74. .title {
  75. background-color: rgb(3, 169, 244);
  76. text-align: center;
  77. padding: 10px;
  78. color: white;
  79. font-weight: 600;
  80. }
  81. .add-to-queue {
  82. width: 100%;
  83. margin-top: 25px;
  84. height: 40px;
  85. border-radius: 0;
  86. background: rgb(3, 169, 244);
  87. color: #fff !important;
  88. border: 0;
  89. &:active, &:focus { border: 0; }
  90. }
  91. .media { padding: 0px 25px;}
  92. .media-content .content {
  93. height: 64px;
  94. display: flex;
  95. align-items: center;
  96. }
  97. </style>