index.vue 3.5 KB

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