OfficialQueue.vue 2.2 KB

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