SongsList.vue 2.3 KB

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