Queue.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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. <div class="media-right">
  21. {{ $parent.formatTime($parent.currentSong.duration) }}
  22. </div>
  23. </article>
  24. <article class="media" v-for='song in playlist'>
  25. <div class="media-content">
  26. <div class="content">
  27. <p>
  28. <strong>{{ song.title }}</strong>
  29. <br>
  30. <small>{{ song.artists }}</small>
  31. </p>
  32. </div>
  33. </div>
  34. <div class="media-right">
  35. {{ $parent.$parent.formatTime(song.duration) }}
  36. </div>
  37. </article>
  38. </div>
  39. </div>
  40. </template>
  41. <script>
  42. import io from '../../io';
  43. export default {
  44. data: function () {
  45. return {
  46. playlist: []
  47. }
  48. },
  49. ready: function () {
  50. let _this = this;
  51. io.getSocket((socket) => {
  52. _this.socket = socket;
  53. _this.socket.emit('stations.getPlaylist', _this.$parent.stationId, res => {
  54. if (res.status == 'success') _this.playlist = res.data;
  55. });
  56. });
  57. }
  58. }
  59. </script>
  60. <style type='scss' scoped>
  61. .sidebar {
  62. position: fixed;
  63. z-index: 1;
  64. top: 0;
  65. right: 0;
  66. width: 300px;
  67. height: 100vh;
  68. background-color: #fff;
  69. box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12);
  70. }
  71. .inner-wrapper {
  72. top: 64px;
  73. position: relative;
  74. }
  75. .slide-transition {
  76. transition: transform 0.6s ease-in-out;
  77. transform: translateX(0);
  78. }
  79. .slide-enter, .slide-leave { transform: translateX(100%); }
  80. .title {
  81. background-color: rgb(3, 169, 244);
  82. text-align: center;
  83. padding: 10px;
  84. color: white;
  85. font-weight: 600;
  86. }
  87. .media { padding: 0px 25px;}
  88. .media-content .content {
  89. height: 64px;
  90. display: flex;
  91. align-items: center;
  92. strong { word-break: break-word; }
  93. }
  94. .media-right { line-height: 64px; }
  95. </style>