Admin.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. <template>
  2. <div class="app">
  3. <main-header />
  4. <div class="tabs is-centered">
  5. <ul>
  6. <li
  7. :class="{ 'is-active': currentTab == 'queueSongs' }"
  8. @click="showTab('queueSongs')"
  9. >
  10. <router-link class="tab queueSongs" to="/admin/queuesongs">
  11. <i class="material-icons">queue_music</i>
  12. <span>&nbsp;Queue Songs</span>
  13. </router-link>
  14. </li>
  15. <li
  16. :class="{ 'is-active': currentTab == 'songs' }"
  17. @click="showTab('songs')"
  18. >
  19. <router-link class="tab songs" to="/admin/songs">
  20. <i class="material-icons">music_note</i>
  21. <span>&nbsp;Songs</span>
  22. </router-link>
  23. </li>
  24. <li
  25. :class="{ 'is-active': currentTab == 'stations' }"
  26. @click="showTab('stations')"
  27. >
  28. <router-link class="tab stations" to="/admin/stations">
  29. <i class="material-icons">radio</i>
  30. <span>&nbsp;Stations</span>
  31. </router-link>
  32. </li>
  33. <li
  34. :class="{ 'is-active': currentTab == 'reports' }"
  35. @click="showTab('reports')"
  36. >
  37. <router-link class="tab reports" to="/admin/reports">
  38. <i class="material-icons">report_problem</i>
  39. <span>&nbsp;Reports</span>
  40. </router-link>
  41. </li>
  42. <li
  43. :class="{ 'is-active': currentTab == 'news' }"
  44. @click="showTab('news')"
  45. >
  46. <router-link class="tab news" to="/admin/news">
  47. <i class="material-icons">chrome_reader_mode</i>
  48. <span>&nbsp;News</span>
  49. </router-link>
  50. </li>
  51. <li
  52. :class="{ 'is-active': currentTab == 'users' }"
  53. @click="showTab('users')"
  54. >
  55. <router-link class="tab users" to="/admin/users">
  56. <i class="material-icons">people</i>
  57. <span>&nbsp;Users</span>
  58. </router-link>
  59. </li>
  60. <li
  61. :class="{ 'is-active': currentTab == 'statistics' }"
  62. @click="showTab('statistics')"
  63. >
  64. <router-link class="tab statistics" to="/admin/statistics">
  65. <i class="material-icons">show_chart</i>
  66. <span>&nbsp;Statistics</span>
  67. </router-link>
  68. </li>
  69. <li
  70. :class="{ 'is-active': currentTab == 'punishments' }"
  71. @click="showTab('punishments')"
  72. >
  73. <router-link
  74. class="tab punishments"
  75. to="/admin/punishments"
  76. >
  77. <i class="material-icons">gavel</i>
  78. <span>&nbsp;Punishments</span>
  79. </router-link>
  80. </li>
  81. </ul>
  82. </div>
  83. <queue-songs v-if="currentTab == 'queueSongs'" />
  84. <songs v-if="currentTab == 'songs'" />
  85. <stations v-if="currentTab == 'stations'" />
  86. <reports v-if="currentTab == 'reports'" />
  87. <news v-if="currentTab == 'news'" />
  88. <users v-if="currentTab == 'users'" />
  89. <statistics v-if="currentTab == 'statistics'" />
  90. <punishments v-if="currentTab == 'punishments'" />
  91. </div>
  92. </template>
  93. <script>
  94. import MainHeader from "../MainHeader.vue";
  95. export default {
  96. components: {
  97. MainHeader,
  98. QueueSongs: () => import("../Admin/QueueSongs.vue"),
  99. Songs: () => import("../Admin/Songs.vue"),
  100. Stations: () => import("../Admin/Stations.vue"),
  101. Reports: () => import("../Admin/Reports.vue"),
  102. News: () => import("../Admin/News.vue"),
  103. Users: () => import("../Admin/Users.vue"),
  104. Statistics: () => import("../Admin/Statistics.vue"),
  105. Punishments: () => import("../Admin/Punishments.vue")
  106. },
  107. data() {
  108. return {
  109. currentTab: "queueSongs"
  110. };
  111. },
  112. mounted() {
  113. this.changeTab(this.$route.path);
  114. },
  115. watch: {
  116. $route(route) {
  117. this.changeTab(route.path);
  118. }
  119. },
  120. methods: {
  121. changeTab(path) {
  122. switch (path) {
  123. case "/admin/queuesongs":
  124. this.currentTab = "queueSongs";
  125. break;
  126. case "/admin/songs":
  127. this.currentTab = "songs";
  128. break;
  129. case "/admin/stations":
  130. this.currentTab = "stations";
  131. break;
  132. case "/admin/reports":
  133. this.currentTab = "reports";
  134. break;
  135. case "/admin/news":
  136. this.currentTab = "news";
  137. break;
  138. case "/admin/users":
  139. this.currentTab = "users";
  140. break;
  141. case "/admin/statistics":
  142. this.currentTab = "statistics";
  143. break;
  144. case "/admin/punishments":
  145. this.currentTab = "punishments";
  146. break;
  147. default:
  148. this.currentTab = "queueSongs";
  149. }
  150. },
  151. showTab(tab) {
  152. this.currentTab = tab;
  153. }
  154. }
  155. };
  156. </script>
  157. <style lang="scss" scoped>
  158. @import "styles/global.scss";
  159. .tabs {
  160. background-color: $white;
  161. .queueSongs {
  162. color: $teal;
  163. border-color: $teal;
  164. }
  165. .songs {
  166. color: $primary-color;
  167. border-color: $primary-color;
  168. }
  169. .stations {
  170. color: $purple;
  171. border-color: $purple;
  172. }
  173. .reports {
  174. color: $yellow;
  175. border-color: $yellow;
  176. }
  177. .news {
  178. color: $light-pink;
  179. border-color: $light-pink;
  180. }
  181. .users {
  182. color: $dark-pink;
  183. border-color: $dark-pink;
  184. }
  185. .statistics {
  186. color: $light-orange;
  187. border-color: $light-orange;
  188. }
  189. .punishments {
  190. color: $dark-orange;
  191. border-color: $dark-orange;
  192. }
  193. .tab {
  194. transition: all 0.2s ease-in-out;
  195. font-weight: 500;
  196. border-bottom: solid 0px;
  197. }
  198. .tab:hover {
  199. border-width: 3px;
  200. transition: all 0.2s ease-in-out;
  201. font-weight: 600;
  202. }
  203. .is-active .tab {
  204. font-weight: 600;
  205. border-width: 3px;
  206. }
  207. }
  208. </style>