index.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. <template>
  2. <div id="tabs-container">
  3. <div id="tab-selection">
  4. <button
  5. class="button is-default"
  6. :class="{ selected: tab === 'queue' }"
  7. @click="showTab('queue')"
  8. >
  9. Queue
  10. </button>
  11. <button
  12. class="button is-default"
  13. :class="{ selected: tab === 'users' }"
  14. @click="showTab('users')"
  15. >
  16. Users
  17. </button>
  18. <button
  19. v-if="loggedIn"
  20. class="button is-default"
  21. :class="{ selected: tab === 'playlists' }"
  22. @click="showTab('playlists')"
  23. >
  24. My Playlists
  25. </button>
  26. <button
  27. v-else
  28. class="button is-default"
  29. content="Login to manage playlists"
  30. v-tippy
  31. >
  32. My Playlists
  33. </button>
  34. </div>
  35. <queue class="tab" v-show="tab === 'queue'" />
  36. <users class="tab" v-show="tab === 'users'" />
  37. <playlists class="tab" v-show="tab === 'playlists'" />
  38. </div>
  39. </template>
  40. <script>
  41. import { mapActions, mapState } from "vuex";
  42. import TabQueryHandler from "@/mixins/TabQueryHandler.vue";
  43. import Queue from "@/components/Queue.vue";
  44. import Users from "./Users.vue";
  45. import Playlists from "./Playlists.vue";
  46. export default {
  47. components: { Queue, Users, Playlists },
  48. mixins: [TabQueryHandler],
  49. data() {
  50. return {
  51. tab: "queue"
  52. };
  53. },
  54. computed: mapState({
  55. users: state => state.station.users,
  56. userCount: state => state.station.userCount,
  57. loggedIn: state => state.user.auth.loggedIn
  58. }),
  59. mounted() {
  60. if (
  61. this.$route.query.tab === "queue" ||
  62. this.$route.query.tab === "users" ||
  63. this.$route.query.tab === "playlists"
  64. )
  65. this.tab = this.$route.query.tab;
  66. },
  67. methods: {
  68. ...mapActions("modalVisibility", ["openModal"])
  69. }
  70. };
  71. </script>
  72. <style lang="scss" scoped>
  73. .night-mode {
  74. #tab-selection .button {
  75. background: var(--dark-grey);
  76. color: var(--white);
  77. }
  78. }
  79. #tabs-container .tab {
  80. width: 100%;
  81. height: calc(100% - 36px);
  82. position: absolute;
  83. border: 1px solid var(--light-grey-3);
  84. border-top: 0;
  85. }
  86. #tab-selection {
  87. display: flex;
  88. overflow-x: auto;
  89. .button {
  90. border-radius: 5px 5px 0 0;
  91. border: 0;
  92. text-transform: uppercase;
  93. font-size: 17px;
  94. color: var(--dark-grey-3);
  95. background-color: var(--light-grey-2);
  96. flex-grow: 1;
  97. &:not(:first-of-type) {
  98. margin-left: 5px;
  99. }
  100. }
  101. .selected {
  102. background-color: var(--dark-grey-3) !important;
  103. color: var(--white) !important;
  104. }
  105. }
  106. /deep/ .nothing-here-text {
  107. height: 100%;
  108. }
  109. /deep/ .tab {
  110. .nothing-here-text:not(:only-child) {
  111. height: calc(100% - 40px);
  112. }
  113. }
  114. /deep/ .tab-actionable-button {
  115. width: calc(100% - 20px);
  116. height: 40px;
  117. border-radius: 5px;
  118. margin: 10px;
  119. position: absolute;
  120. bottom: 0;
  121. border: 0;
  122. background-color: var(--primary-color) !important;
  123. color: var(--white) !important;
  124. &:active,
  125. &:focus {
  126. border: 0;
  127. }
  128. &:hover,
  129. &:focus {
  130. background-color: var(--primary-color) !important;
  131. filter: brightness(90%);
  132. }
  133. }
  134. /deep/ .scrollable-list {
  135. width: 100%;
  136. max-height: calc(100% - 40px - 20px);
  137. overflow: auto;
  138. padding: 10px;
  139. .song-item:not(:last-of-type) {
  140. margin-bottom: 10px;
  141. }
  142. }
  143. /deep/ ::-webkit-scrollbar {
  144. width: 10px;
  145. }
  146. /deep/ ::-webkit-scrollbar-track {
  147. background-color: var(--white);
  148. border: 1px solid var(--light-grey-3);
  149. }
  150. /deep/ ::-webkit-scrollbar-thumb {
  151. background-color: var(--dark-grey);
  152. &:hover {
  153. filter: brightness(95%);
  154. }
  155. }
  156. </style>