OfficialHeader.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349
  1. <template>
  2. <nav class='nav'>
  3. <div class='nav-left'>
  4. <a class='nav-item is-brand' href='#' v-link='{ path: "/" }' @click='this.$dispatch("leaveStation", title)'>
  5. Musare
  6. </a>
  7. </div>
  8. <div class='nav-center stationDisplayName'>
  9. {{ $parent.station.displayName }}
  10. </div>
  11. <span class="nav-toggle" @click="controlBar = !controlBar">
  12. <span></span>
  13. <span></span>
  14. <span></span>
  15. </span>
  16. <div class="nav-right nav-menu" :class="{ 'is-active': isMobile }">
  17. <a class="nav-item is-tab admin" href="#" v-link="{ path: '/admin' }" v-if="$parent.$parent.role === 'admin'">
  18. <strong>Admin</strong>
  19. </a>
  20. <!--a class="nav-item is-tab" href="#">
  21. About
  22. </a-->
  23. <a class="nav-item is-tab" href="#" v-link="{ path: '/team' }">
  24. Team
  25. </a>
  26. <a class="nav-item is-tab" href="#" v-link="{ path: '/about' }">
  27. About
  28. </a>
  29. <a class="nav-item is-tab" href="#" v-link="{ path: '/news' }">
  30. News
  31. </a>
  32. <span class="grouped" v-if="$parent.$parent.loggedIn">
  33. <a class="nav-item is-tab" href="#" v-link="{ path: '/u/' + $parent.$parent.username }">
  34. Profile
  35. </a>
  36. <a class="nav-item is-tab" href="#" v-link="{ path: '/settings' }">
  37. Settings
  38. </a>
  39. <a class="nav-item is-tab" href="#" @click="$parent.$parent.logout()">
  40. Logout
  41. </a>
  42. </span>
  43. <span class="grouped" v-else>
  44. <a class="nav-item" href="#" @click="toggleModal('login')">
  45. Login
  46. </a>
  47. <a class="nav-item" href="#" @click="toggleModal('register')">
  48. Register
  49. </a>
  50. </span>
  51. </div>
  52. </nav>
  53. <div class="control-sidebar" :class="{ 'show-controlBar': controlBar }">
  54. <div class='inner-wrapper'>
  55. <div v-if='isOwner()'>
  56. <a class="sidebar-item" href='#' v-if='isOwner()' @click='$parent.editStation()'>
  57. <span class='icon'>
  58. <i class='material-icons'>settings</i>
  59. </span>
  60. <span class="icon-purpose">Station settings</span>
  61. </a>
  62. <a v-if='isOwner()' class="sidebar-item" href='#' @click='$parent.skipStation()'>
  63. <span class='icon'>
  64. <i class='material-icons'>skip_next</i>
  65. </span>
  66. <span class="icon-purpose">Skip current song</span>
  67. </a>
  68. <a class="sidebar-item" href='#' v-if='isOwner() && !$parent.paused' @click='$parent.pauseStation()'>
  69. <span class='icon'>
  70. <i class='material-icons'>pause</i>
  71. </span>
  72. <span class="icon-purpose">Pause station</span>
  73. </a>
  74. <a class="sidebar-item" href='#' v-if='isOwner() && $parent.paused' @click='$parent.resumeStation()'>
  75. <span class='icon'>
  76. <i class='material-icons'>play_arrow</i>
  77. </span>
  78. <span class="icon-purpose">Resume station</span>
  79. </a>
  80. <hr>
  81. </div>
  82. <div v-if="$parent.$parent.loggedIn">
  83. <a class="sidebar-item" href='#' @click='$parent.modals.addSongToQueue = !$parent.modals.addSongToQueue' v-if='$parent.type === "official" && $parent.$parent.loggedIn'>
  84. <span class='icon'>
  85. <i class='material-icons'>queue</i>
  86. </span>
  87. <span class="icon-purpose">Add song to queue</span>
  88. </a>
  89. <a v-if='!isOwner() && $parent.$parent.loggedIn && !$parent.noSong' class="sidebar-item" href='#' @click='$parent.voteSkipStation()'>
  90. <span class='icon'>
  91. <i class='material-icons'>skip_next</i>
  92. </span>
  93. <span class="skip-votes">{{$parent.currentSong.skipVotes}}</span>
  94. <span class="icon-purpose">Skip current song</span>
  95. </a>
  96. <a v-if='$parent.$parent.loggedIn && !$parent.noSong && !$parent.simpleSong' class="sidebar-item" href='#' @click='$parent.modals.report = !$parent.modals.report'>
  97. <span class='icon'>
  98. <i class='material-icons'>report</i>
  99. </span>
  100. <span class="icon-purpose">Report a song</span>
  101. </a>
  102. <a v-if='$parent.$parent.loggedIn && !$parent.noSong' class="sidebar-item" href='#' @click='$parent.modals.addSongToPlaylist = true'>
  103. <span class='icon'>
  104. <i class='material-icons'>playlist_add</i>
  105. </span>
  106. <span class="icon-purpose">Add current song to playlist</span>
  107. </a>
  108. <hr>
  109. </div>
  110. <a class="sidebar-item" href='#' @click='$parent.toggleSidebar("songslist")'>
  111. <span class='icon'>
  112. <i class='material-icons'>queue_music</i>
  113. </span>
  114. <span class="icon-purpose">Show the station queue</span>
  115. </a>
  116. <a class="sidebar-item" href='#' @click='$parent.toggleSidebar("users")'>
  117. <span class='icon'>
  118. <i class='material-icons'>people</i>
  119. </span>
  120. <span class="icon-purpose">Display users in the station</span>
  121. </a>
  122. </div>
  123. </div>
  124. </template>
  125. <script>
  126. export default {
  127. data() {
  128. return {
  129. title: this.$route.params.id,
  130. isMobile: false,
  131. controlBar: false
  132. }
  133. },
  134. methods: {
  135. isOwner: function () {
  136. return this.$parent.$parent.loggedIn && this.$parent.$parent.role === 'admin';
  137. },
  138. toggleModal: function (type) {
  139. this.$dispatch('toggleModal', type);
  140. }
  141. }
  142. }
  143. </script>
  144. <style lang='scss' scoped>
  145. .nav {
  146. background-color: #03a9f4;
  147. line-height: 64px;
  148. .is-brand {
  149. font-size: 2.1rem !important;
  150. line-height: 64px !important;
  151. padding: 0 20px;
  152. }
  153. }
  154. a.nav-item {
  155. color: hsl(0, 0%, 100%);
  156. font-size: 15px;
  157. &:hover {
  158. color: hsl(0, 0%, 100%);
  159. }
  160. .admin {
  161. color: #424242;
  162. }
  163. padding: 0 12px;
  164. .icon {
  165. height: 64px;
  166. i {
  167. font-size: 2rem;
  168. line-height: 64px;
  169. height: 64px;
  170. width: 34px;
  171. }
  172. }
  173. }
  174. .grouped {
  175. margin: 0;
  176. display: flex;
  177. text-decoration: none;
  178. }
  179. .skip-votes {
  180. position: relative;
  181. left: 11px;
  182. }
  183. .nav-toggle {
  184. height: 64px;
  185. }
  186. @media screen and (max-width: 998px) {
  187. .nav-menu {
  188. background-color: white;
  189. box-shadow: 0 4px 7px rgba(10, 10, 10, 0.1);
  190. left: 0;
  191. display: none;
  192. right: 0;
  193. top: 100%;
  194. position: absolute;
  195. }
  196. .nav-toggle {
  197. display: block;
  198. }
  199. }
  200. .logo {
  201. font-size: 2.1rem;
  202. line-height: 64px;
  203. padding-left: 20px !important;
  204. padding-right: 20px !important;
  205. }
  206. .nav-center {
  207. display: flex;
  208. align-items: center;
  209. color: #03a9f4;
  210. font-size: 22px;
  211. position: absolute;
  212. margin: auto;
  213. top: 50%;
  214. left: 50%;
  215. transform: translate(-50%, -50%);
  216. }
  217. .nav-right.is-active .nav-item {
  218. background: #03a9f4;
  219. border: 0;
  220. }
  221. .hidden {
  222. display: none;
  223. }
  224. .control-sidebar {
  225. position: fixed;
  226. z-index: 1;
  227. top: 0;
  228. left: 0;
  229. width: 64px;
  230. height: 100vh;
  231. background-color: #03a9f4;
  232. box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12);
  233. @media (max-width: 998px) {
  234. display: none;
  235. }
  236. .inner-wrapper {
  237. @media (min-width: 999px) {
  238. .mobile-only {
  239. display: none;
  240. }
  241. .desktop-only {
  242. display: flex;
  243. }
  244. }
  245. @media (max-width: 998px) {
  246. .mobile-only {
  247. display: flex;
  248. }
  249. .desktop-only {
  250. display: none;
  251. visibility: hidden;
  252. }
  253. }
  254. }
  255. }
  256. .show-controlBar {
  257. display: block;
  258. }
  259. .inner-wrapper {
  260. top: 64px;
  261. position: relative;
  262. }
  263. .control-sidebar .material-icons {
  264. width: 100%;
  265. font-size: 2rem;
  266. }
  267. .control-sidebar .sidebar-item {
  268. font-size: 2rem;
  269. height: 50px;
  270. color: white;
  271. -webkit-box-align: center;
  272. -ms-flex-align: center;
  273. align-items: center;
  274. display: -webkit-box;
  275. display: -ms-flexbox;
  276. display: flex;
  277. -webkit-box-flex: 0;
  278. -ms-flex-positive: 0;
  279. flex-grow: 0;
  280. -ms-flex-negative: 0;
  281. flex-shrink: 0;
  282. -webkit-box-pack: center;
  283. -ms-flex-pack: center;
  284. justify-content: center;
  285. width: 100%;
  286. position: relative;
  287. }
  288. .control-sidebar .sidebar-top-hr {
  289. margin: 0 0 20px 0;
  290. }
  291. .sidebar-item .icon-purpose {
  292. visibility: hidden;
  293. width: 160px;
  294. font-size: 12px;
  295. background-color: rgba(3, 169, 244, 0.8);
  296. color: #fff;
  297. text-align: center;
  298. border-radius: 6px;
  299. padding: 5px;
  300. position: absolute;
  301. z-index: 1;
  302. left: 115%;
  303. opacity: 0;
  304. transition: opacity 0.5s;
  305. display: none;
  306. }
  307. .sidebar-item .icon-purpose::after {
  308. content: "";
  309. position: absolute;
  310. top: 50%;
  311. right: 100%;
  312. margin-top: -5px;
  313. border-width: 5px;
  314. border-style: solid;
  315. border-color: transparent rgba(3, 169, 244, 0.8) transparent transparent;
  316. }
  317. .sidebar-item:hover .icon-purpose {
  318. visibility: visible;
  319. opacity: 1;
  320. display: block;
  321. }
  322. </style>