OfficialHeader.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334
  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 mobile-only" 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. @import 'theme.scss';
  146. .nav {
  147. background-color: #03a9f4;
  148. line-height: 64px;
  149. .is-brand {
  150. font-size: 2.1rem !important;
  151. line-height: 64px !important;
  152. padding: 0 20px;
  153. }
  154. }
  155. a.nav-item {
  156. color: $white;
  157. font-size: 15px;
  158. &:hover {
  159. color: $white;
  160. }
  161. .admin {
  162. color: #424242;
  163. }
  164. padding: 0 18px;
  165. .icon {
  166. height: 64px;
  167. i {
  168. font-size: 2rem;
  169. line-height: 64px;
  170. height: 64px;
  171. width: 34px;
  172. }
  173. }
  174. }
  175. .grouped {
  176. margin: 0;
  177. display: flex;
  178. text-decoration: none;
  179. }
  180. .skip-votes {
  181. position: relative;
  182. left: 11px;
  183. }
  184. .nav-toggle {
  185. height: 64px;
  186. }
  187. @media screen and (max-width: 998px) {
  188. .nav-menu {
  189. background-color: white;
  190. box-shadow: 0 4px 7px rgba(10, 10, 10, 0.1);
  191. left: 0;
  192. display: none;
  193. right: 0;
  194. top: 100%;
  195. position: absolute;
  196. }
  197. .nav-toggle {
  198. display: block;
  199. }
  200. }
  201. .logo {
  202. font-size: 2.1rem;
  203. line-height: 64px;
  204. padding-left: 20px !important;
  205. padding-right: 20px !important;
  206. }
  207. .nav-center {
  208. display: flex;
  209. align-items: center;
  210. color: $blue;
  211. font-size: 22px;
  212. position: absolute;
  213. margin: auto;
  214. top: 50%;
  215. left: 50%;
  216. transform: translate(-50%, -50%);
  217. }
  218. .nav-right.is-active .nav-item {
  219. background: #03a9f4;
  220. border: 0;
  221. }
  222. .hidden {
  223. display: none;
  224. }
  225. .control-sidebar {
  226. position: fixed;
  227. z-index: 1;
  228. top: 0;
  229. left: 0;
  230. width: 64px;
  231. height: 100vh;
  232. background-color: #03a9f4;
  233. box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12);
  234. @media (max-width: 998px) {
  235. display: none;
  236. }
  237. .inner-wrapper {
  238. @media (min-width: 999px) {
  239. .mobile-only {
  240. display: none;
  241. }
  242. .desktop-only {
  243. display: flex;
  244. }
  245. }
  246. @media (max-width: 998px) {
  247. .mobile-only {
  248. display: flex;
  249. }
  250. .desktop-only {
  251. display: none;
  252. visibility: hidden;
  253. }
  254. }
  255. }
  256. }
  257. .show-controlBar {
  258. display: block;
  259. }
  260. .inner-wrapper {
  261. top: 64px;
  262. position: relative;
  263. }
  264. .control-sidebar .material-icons {
  265. width: 100%;
  266. font-size: 2rem;
  267. }
  268. .control-sidebar .sidebar-item {
  269. font-size: 2rem;
  270. height: 50px;
  271. color: white;
  272. -webkit-box-align: center;
  273. -ms-flex-align: center;
  274. align-items: center;
  275. display: -webkit-box;
  276. display: -ms-flexbox;
  277. display: flex;
  278. -webkit-box-flex: 0;
  279. -ms-flex-positive: 0;
  280. flex-grow: 0;
  281. -ms-flex-negative: 0;
  282. flex-shrink: 0;
  283. -webkit-box-pack: center;
  284. -ms-flex-pack: center;
  285. justify-content: center;
  286. width: 100%;
  287. position: relative;
  288. }
  289. .control-sidebar .sidebar-top-hr {
  290. margin: 0 0 20px 0;
  291. }
  292. .sidebar-item .icon-purpose {
  293. visibility: hidden;
  294. width: 150px;
  295. font-size: 12px;
  296. background-color: rgba(3, 169, 244,0.8);
  297. color: #fff;
  298. text-align: center;
  299. border-radius: 6px;
  300. padding: 5px 0;
  301. position: absolute;
  302. z-index: 1;
  303. left: 105%;
  304. }
  305. .sidebar-item:hover .icon-purpose {
  306. visibility: visible;
  307. }
  308. </style>