index.vue 3.1 KB

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