index.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305
  1. <template>
  2. <div class="app">
  3. <main-header />
  4. <div class="tabs is-centered">
  5. <ul>
  6. <li
  7. :class="{ 'is-active': currentTab == 'hiddensongs' }"
  8. ref="hiddensongs-tab"
  9. @click="showTab('hiddensongs')"
  10. >
  11. <router-link
  12. class="tab hiddensongs"
  13. to="/admin/hiddensongs"
  14. >
  15. <i class="material-icons">music_note</i>
  16. <span>&nbsp;Hidden Songs</span>
  17. </router-link>
  18. </li>
  19. <li
  20. :class="{ 'is-active': currentTab == 'unverifiedsongs' }"
  21. ref="unverifiedsongs-tab"
  22. @click="showTab('unverifiedsongs')"
  23. >
  24. <router-link
  25. class="tab unverifiedsongs"
  26. to="/admin/unverifiedsongs"
  27. >
  28. <i class="material-icons">unpublished</i>
  29. <span>&nbsp;Unverified Songs</span>
  30. </router-link>
  31. </li>
  32. <li
  33. :class="{ 'is-active': currentTab == 'verifiedsongs' }"
  34. ref="verifiedsongs-tab"
  35. @click="showTab('verifiedsongs')"
  36. >
  37. <router-link
  38. class="tab verifiedsongs"
  39. to="/admin/verifiedsongs"
  40. >
  41. <i class="material-icons">check_circle</i>
  42. <span>&nbsp;Verified Songs</span>
  43. </router-link>
  44. </li>
  45. <li
  46. :class="{ 'is-active': currentTab == 'stations' }"
  47. ref="stations-tab"
  48. @click="showTab('stations')"
  49. >
  50. <router-link class="tab stations" to="/admin/stations">
  51. <i class="material-icons">radio</i>
  52. <span>&nbsp;Stations</span>
  53. </router-link>
  54. </li>
  55. <li
  56. :class="{ 'is-active': currentTab == 'playlists' }"
  57. ref="playlists-tab"
  58. @click="showTab('playlists')"
  59. >
  60. <router-link class="tab playlists" to="/admin/playlists">
  61. <i class="material-icons">library_music</i>
  62. <span>&nbsp;Playlists</span>
  63. </router-link>
  64. </li>
  65. <li
  66. :class="{ 'is-active': currentTab == 'reports' }"
  67. ref="reports-tab"
  68. @click="showTab('reports')"
  69. >
  70. <router-link class="tab reports" to="/admin/reports">
  71. <i class="material-icons">flag</i>
  72. <span>&nbsp;Reports</span>
  73. </router-link>
  74. </li>
  75. <li
  76. :class="{ 'is-active': currentTab == 'news' }"
  77. ref="news-tab"
  78. @click="showTab('news')"
  79. >
  80. <router-link class="tab news" to="/admin/news">
  81. <i class="material-icons">chrome_reader_mode</i>
  82. <span>&nbsp;News</span>
  83. </router-link>
  84. </li>
  85. <li
  86. :class="{ 'is-active': currentTab == 'users' }"
  87. ref="users-tab"
  88. @click="showTab('users')"
  89. >
  90. <router-link class="tab users" to="/admin/users">
  91. <i class="material-icons">people</i>
  92. <span>&nbsp;Users</span>
  93. </router-link>
  94. </li>
  95. <li
  96. :class="{ 'is-active': currentTab == 'statistics' }"
  97. ref="statistics-tab"
  98. @click="showTab('statistics')"
  99. >
  100. <router-link class="tab statistics" to="/admin/statistics">
  101. <i class="material-icons">show_chart</i>
  102. <span>&nbsp;Statistics</span>
  103. </router-link>
  104. </li>
  105. <li
  106. :class="{ 'is-active': currentTab == 'punishments' }"
  107. ref="punishments-tab"
  108. @click="showTab('punishments')"
  109. >
  110. <router-link
  111. class="tab punishments"
  112. to="/admin/punishments"
  113. >
  114. <i class="material-icons">gavel</i>
  115. <span>&nbsp;Punishments</span>
  116. </router-link>
  117. </li>
  118. </ul>
  119. </div>
  120. <unverified-songs v-if="currentTab == 'unverifiedsongs'" />
  121. <verified-songs v-if="currentTab == 'verifiedsongs'" />
  122. <hidden-songs v-if="currentTab == 'hiddensongs'" />
  123. <stations v-if="currentTab == 'stations'" />
  124. <playlists v-if="currentTab == 'playlists'" />
  125. <reports v-if="currentTab == 'reports'" />
  126. <news v-if="currentTab == 'news'" />
  127. <users v-if="currentTab == 'users'" />
  128. <statistics v-if="currentTab == 'statistics'" />
  129. <punishments v-if="currentTab == 'punishments'" />
  130. </div>
  131. </template>
  132. <script>
  133. import { mapGetters } from "vuex";
  134. import { defineAsyncComponent } from "vue";
  135. import MainHeader from "@/components/layout/MainHeader.vue";
  136. export default {
  137. components: {
  138. MainHeader,
  139. UnverifiedSongs: defineAsyncComponent(() =>
  140. import("./tabs/UnverifiedSongs.vue")
  141. ),
  142. VerifiedSongs: defineAsyncComponent(() =>
  143. import("./tabs/VerifiedSongs.vue")
  144. ),
  145. HiddenSongs: defineAsyncComponent(() =>
  146. import("./tabs/HiddenSongs.vue")
  147. ),
  148. Stations: defineAsyncComponent(() => import("./tabs/Stations.vue")),
  149. Playlists: defineAsyncComponent(() => import("./tabs/Playlists.vue")),
  150. Reports: defineAsyncComponent(() => import("./tabs/Reports.vue")),
  151. News: defineAsyncComponent(() => import("./tabs/News.vue")),
  152. Users: defineAsyncComponent(() => import("./tabs/Users.vue")),
  153. Statistics: defineAsyncComponent(() => import("./tabs/Statistics.vue")),
  154. Punishments: defineAsyncComponent(() =>
  155. import("./tabs/Punishments.vue")
  156. )
  157. },
  158. data() {
  159. return {
  160. currentTab: ""
  161. };
  162. },
  163. computed: mapGetters({
  164. socket: "websockets/getSocket"
  165. }),
  166. watch: {
  167. $route(route) {
  168. this.changeTab(route.path);
  169. }
  170. },
  171. mounted() {
  172. this.changeTab(this.$route.path);
  173. },
  174. beforeUnmount() {
  175. this.socket.dispatch("apis.leaveRooms");
  176. },
  177. methods: {
  178. changeTab(path) {
  179. switch (path) {
  180. case "/admin/unverifiedsongs":
  181. this.showTab("unverifiedsongs");
  182. break;
  183. case "/admin/verifiedsongs":
  184. this.showTab("verifiedsongs");
  185. break;
  186. case "/admin/hiddensongs":
  187. this.showTab("hiddensongs");
  188. break;
  189. case "/admin/stations":
  190. this.showTab("stations");
  191. break;
  192. case "/admin/playlists":
  193. this.showTab("playlists");
  194. break;
  195. case "/admin/reports":
  196. this.showTab("reports");
  197. break;
  198. case "/admin/news":
  199. this.showTab("news");
  200. break;
  201. case "/admin/users":
  202. this.showTab("users");
  203. break;
  204. case "/admin/statistics":
  205. this.showTab("statistics");
  206. break;
  207. case "/admin/punishments":
  208. this.showTab("punishments");
  209. break;
  210. default:
  211. this.showTab("verifiedsongs");
  212. }
  213. },
  214. showTab(tab) {
  215. if (this.$refs[`${tab}-tab`])
  216. this.$refs[`${tab}-tab`].scrollIntoView({
  217. inline: "center",
  218. block: "nearest"
  219. });
  220. this.currentTab = tab;
  221. }
  222. }
  223. };
  224. </script>
  225. <style lang="scss" scoped>
  226. .night-mode {
  227. .tabs {
  228. background-color: var(--dark-grey-2);
  229. border: 0;
  230. ul {
  231. border-bottom: 0;
  232. }
  233. }
  234. }
  235. .main-container {
  236. height: auto;
  237. }
  238. .tabs {
  239. padding-top: 10px;
  240. margin-top: -10px;
  241. background-color: var(--white);
  242. .unverifiedsongs {
  243. color: var(--teal);
  244. border-color: var(--teal);
  245. }
  246. .verifiedsongs {
  247. color: var(--primary-color);
  248. border-color: var(--primary-color);
  249. }
  250. .hiddensongs {
  251. color: var(--grey);
  252. border-color: var(--grey);
  253. }
  254. .stations {
  255. color: var(--purple);
  256. border-color: var(--purple);
  257. }
  258. .playlists {
  259. color: var(--light-purple);
  260. border-color: var(--light-purple);
  261. }
  262. .reports {
  263. color: var(--yellow);
  264. border-color: var(--yellow);
  265. }
  266. .news {
  267. color: var(--light-pink);
  268. border-color: var(--light-pink);
  269. }
  270. .users {
  271. color: var(--dark-pink);
  272. border-color: var(--dark-pink);
  273. }
  274. .statistics {
  275. color: var(--orange);
  276. border-color: var(--orange);
  277. }
  278. .punishments {
  279. color: var(--dark-orange);
  280. border-color: var(--dark-orange);
  281. }
  282. .tab {
  283. transition: all 0.2s ease-in-out;
  284. font-weight: 500;
  285. border-bottom: solid 0px;
  286. }
  287. .tab:hover {
  288. border-width: 3px;
  289. transition: all 0.2s ease-in-out;
  290. font-weight: 600;
  291. }
  292. .is-active .tab {
  293. font-weight: 600;
  294. border-width: 3px;
  295. }
  296. }
  297. </style>