SongsList.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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. <p v-if="$parent.noSong" class="center">There is currently no song playing.</p>
  26. <article class="media" v-for='song in $parent.songsList'>
  27. <div class="media-content">
  28. <div class="content">
  29. <p>
  30. <strong>{{ song.title }}</strong>
  31. <br>
  32. <small>{{ song.artists.join(', ') }}</small>
  33. </p>
  34. </div>
  35. </div>
  36. <div class="media-right">
  37. {{ $parent.$parent.formatTime(song.duration) }}
  38. </div>
  39. </article>
  40. <a class='button add-to-queue' href='#' @click='$parent.modals.addSongToQueue = !$parent.modals.addSongToQueue' v-if="$parent.type === 'community' && $parent.$parent.loggedIn">Add Song to Queue</a>
  41. </div>
  42. </div>
  43. </template>
  44. <script>
  45. import io from '../../io';
  46. export default {
  47. data: function () {
  48. return {
  49. }
  50. },
  51. ready: function () {
  52. /*let _this = this;
  53. io.getSocket((socket) => {
  54. _this.socket = socket;
  55. });*/
  56. }
  57. }
  58. </script>
  59. <style type='scss' scoped>
  60. .sidebar {
  61. position: fixed;
  62. z-index: 1;
  63. top: 0;
  64. right: 0;
  65. width: 300px;
  66. height: 100vh;
  67. background-color: #fff;
  68. box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12);
  69. }
  70. .inner-wrapper {
  71. top: 64px;
  72. position: relative;
  73. overflow: auto;
  74. height: 100%;
  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: 0 25px; }
  89. .media-content .content {
  90. min-height: 64px;
  91. display: flex;
  92. align-items: center;
  93. }
  94. .content p strong { word-break: break-word; }
  95. .content p small { word-break: break-word; }
  96. .add-to-queue {
  97. width: 100%;
  98. margin-top: 25px;
  99. height: 40px;
  100. border-radius: 0;
  101. background: rgb(3, 169, 244);
  102. color: #fff !important;
  103. border: 0;
  104. &:active, &:focus { border: 0; }
  105. }
  106. .add-to-queue:focus { background: #029ce3; }
  107. .media-right { line-height: 64px; }
  108. </style>