Playlist.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <template>
  2. <div class='sidebar' transition='slide' v-if='$parent.sidebars.playlist'>
  3. <div class='inner-wrapper'>
  4. <div class='title'>Playlists</div>
  5. <aside class='menu' v-if='playlists.length > 0'>
  6. <ul class='menu-list'>
  7. <li v-for='playlist in playlists'>
  8. <a href='#'>{{ playlist.displayName }}</a>
  9. <!--Will play playlist in community station Kris-->
  10. <div class='icons-group'>
  11. <a href='#' @click=''>
  12. <i class='material-icons'>play_arrow</i>
  13. </a>
  14. <a href='#' @click='editPlaylist(playlist._id)'>
  15. <i class='material-icons'>edit</i>
  16. </a>
  17. </div>
  18. </li>
  19. </ul>
  20. </aside>
  21. <div class='none-found' v-else>No Playlists found</div>
  22. <a class='button create-playlist' @click='$parent.toggleModal("createPlaylist")'>Create Playlist</a>
  23. </div>
  24. </div>
  25. </template>
  26. <script>
  27. export default {
  28. data() {
  29. return {
  30. playlists: []
  31. }
  32. },
  33. methods: {
  34. editPlaylist: function (id) {
  35. this.$parent.editPlaylist(id);
  36. }
  37. },
  38. ready: function () {
  39. // TODO: Update when playlist is removed/created
  40. let _this = this;
  41. let socketInterval = setInterval(() => {
  42. if (!!_this.$parent.$parent.socket) {
  43. _this.socket = _this.$parent.$parent.socket;
  44. _this.socket.emit('playlists.indexForUser', _this.$parent.$parent.username, res => {
  45. if (res.status == 'success') _this.playlists = res.data;
  46. });
  47. clearInterval(socketInterval);
  48. }
  49. }, 100);
  50. }
  51. }
  52. </script>
  53. <style type='scss' scoped>
  54. .sidebar {
  55. position: fixed;
  56. top: 0;
  57. right: 0;
  58. width: 300px;
  59. height: 100vh;
  60. background-color: #fff;
  61. box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12);
  62. }
  63. .inner-wrapper {
  64. top: 50px;
  65. position: relative;
  66. }
  67. .slide-transition {
  68. transition: transform 0.6s ease-in-out;
  69. transform: translateX(0);
  70. }
  71. .slide-enter, .slide-leave { transform: translateX(100%); }
  72. .title {
  73. background-color: rgb(3, 169, 244);
  74. text-align: center;
  75. padding: 10px;
  76. color: white;
  77. font-weight: 600;
  78. }
  79. .create-playlist {
  80. width: 100%;
  81. margin-top: 20px;
  82. height: 40px;
  83. border-radius: 0;
  84. background: rgb(3, 169, 244);
  85. color: #fff !important;
  86. border: 0;
  87. &:active, &:focus { border: 0; }
  88. }
  89. .menu { padding: 0 20px; }
  90. .menu-list li a:hover { color: #000 !important; }
  91. .menu-list li {
  92. display: flex;
  93. justify-content: space-between;
  94. }
  95. .icons-group { display: flex; }
  96. .none-found { text-align: center; }
  97. </style>