SongsList.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  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" v-if="!$parent.noSong">
  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 $parent.songsList'>
  26. <div class="media-content">
  27. <div class="content">
  28. <p>
  29. <strong>{{ song.title }}</strong>
  30. <br>
  31. <small>{{ song.artists.join(', ') }}</small>
  32. </p>
  33. </div>
  34. </div>
  35. <div class="media-right">
  36. {{ $parent.$parent.formatTime(song.duration) }}
  37. </div>
  38. </article>
  39. <a class='button add-to-queue' href='#' @click='$parent.modals.addSongToQueue = !$parent.modals.addSongToQueue' v-if="$parent.type === 'community'">Add Song to Queue</a>
  40. </div>
  41. </div>
  42. </template>
  43. <script>
  44. import io from '../../io';
  45. export default {
  46. data: function () {
  47. return {
  48. }
  49. },
  50. ready: function () {
  51. /*let _this = this;
  52. io.getSocket((socket) => {
  53. _this.socket = socket;
  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. overflow: auto;
  73. height: 100%;
  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: 0 25px; }
  88. .media-content .content {
  89. min-height: 64px;
  90. display: flex;
  91. align-items: center;
  92. }
  93. .content p strong { word-break: break-word; }
  94. .content p small { word-break: break-word; }
  95. .add-to-queue {
  96. width: 100%;
  97. margin-top: 25px;
  98. height: 40px;
  99. border-radius: 0;
  100. background: rgb(3, 169, 244);
  101. color: #fff !important;
  102. border: 0;
  103. &:active, &:focus { border: 0; }
  104. }
  105. .add-to-queue:focus { background: #029ce3; }
  106. .media-right { line-height: 64px; }
  107. </style>