CommunityHeader.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317
  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.resumeStation()'>
  69. <span class='icon'>
  70. <i class='material-icons'>play_arrow</i>
  71. </span>
  72. <span class="icon-purpose">Resume station</span>
  73. </a>
  74. <a class="sidebar-item" href='#' v-if='isOwner() && !$parent.paused' @click='$parent.pauseStation()'>
  75. <span class='icon'>
  76. <i class='material-icons'>pause</i>
  77. </span>
  78. <span class="icon-purpose">Pause station</span>
  79. </a>
  80. <a class="sidebar-item" href="#" v-if='$parent.station.locked && $parent.$parent.role === "admin"' @click='$parent.toggleLock()'>
  81. <span class='icon'>
  82. <i class='material-icons'>lock_open</i>
  83. </span>
  84. <span class="icon-purpose">Unlock station queue</span>
  85. </a>
  86. <a class="sidebar-item" href="#" @click='$parent.toggleLock()' v-if='!$parent.station.locked && $parent.$parent.role === "admin"'>
  87. <span class='icon'>
  88. <i class='material-icons'>lock</i>
  89. </span>
  90. <span class="icon-purpose">Lock Station queue</span>
  91. </a>
  92. <hr>
  93. </div>
  94. <div v-if="$parent.$parent.loggedIn && !$parent.noSong">
  95. <a v-if='!isOwner() && $parent.$parent.loggedIn && !$parent.noSong' class="sidebar-item" href='#' @click='$parent.voteSkipStation()'>
  96. <span class='icon'>
  97. <i class='material-icons'>skip_next</i>
  98. </span>
  99. <span class="skip-votes">{{ $parent.currentSong.skipVotes }}</span>
  100. <span class="icon-purpose">Skip current 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")' v-if='$parent.station.partyMode === true'>
  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. <a class="sidebar-item" href='#' @click='$parent.toggleSidebar("playlist")' v-if='$parent.$parent.loggedIn'>
  123. <span class='icon'>
  124. <i class='material-icons'>library_music</i>
  125. </span>
  126. <span class="icon-purpose">Show your playlists</span>
  127. </a>
  128. </div>
  129. </div>
  130. </template>
  131. <script>
  132. export default {
  133. data() {
  134. return {
  135. title: this.$route.params.id,
  136. isMobile: false,
  137. controlBar: true
  138. }
  139. },
  140. methods: {
  141. isOwner: function () {
  142. return this.$parent.$parent.loggedIn && (this.$parent.$parent.role === 'admin' || this.$parent.$parent.userId === this.$parent.station.owner);
  143. },
  144. toggleModal: function (type) {
  145. this.$dispatch('toggleModal', type);
  146. }
  147. }
  148. }
  149. </script>
  150. <style lang='scss' scoped>
  151. @import 'theme.scss';
  152. .nav {
  153. background-color: #03a9f4;
  154. line-height: 64px;
  155. .is-brand {
  156. font-size: 2.1rem !important;
  157. line-height: 64px !important;
  158. padding: 0 20px;
  159. }
  160. }
  161. a.nav-item {
  162. color: $white;
  163. font-size: 15px;
  164. &:hover {
  165. color: $white;
  166. }
  167. .admin {
  168. color: #424242;
  169. }
  170. padding: 0 18px;
  171. .icon {
  172. height: 64px;
  173. i {
  174. font-size: 2rem;
  175. line-height: 64px;
  176. height: 64px;
  177. width: 34px;
  178. }
  179. }
  180. }
  181. .grouped {
  182. margin: 0;
  183. display: flex;
  184. text-decoration: none;
  185. }
  186. .skip-votes {
  187. position: relative;
  188. left: 11px;
  189. }
  190. .nav-toggle {
  191. height: 64px;
  192. }
  193. @media screen and (max-width: 998px) {
  194. .nav-menu {
  195. background-color: white;
  196. box-shadow: 0 4px 7px rgba(10, 10, 10, 0.1);
  197. left: 0;
  198. display: none;
  199. right: 0;
  200. top: 100%;
  201. position: absolute;
  202. }
  203. .nav-toggle {
  204. display: block;
  205. }
  206. }
  207. .logo {
  208. font-size: 2.1rem;
  209. line-height: 64px;
  210. padding-left: 20px !important;
  211. padding-right: 20px !important;
  212. }
  213. .nav-center {
  214. display: flex;
  215. align-items: center;
  216. color: $blue;
  217. font-size: 22px;
  218. position: absolute;
  219. margin: auto;
  220. top: 50%;
  221. left: 50%;
  222. transform: translate(-50%, -50%);
  223. }
  224. .nav-right.is-active .nav-item {
  225. background: #03a9f4;
  226. border: 0;
  227. }
  228. .control-sidebar {
  229. position: fixed;
  230. z-index: 1;
  231. top: 0;
  232. left: 0;
  233. width: 64px;
  234. height: 100vh;
  235. background-color: #03a9f4;
  236. box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12);
  237. @media (max-width: 998px) {
  238. display: none;
  239. }
  240. }
  241. .show-controlBar {
  242. display: block;
  243. }
  244. .inner-wrapper {
  245. top: 64px;
  246. position: relative;
  247. }
  248. .control-sidebar .material-icons {
  249. width: 100%;
  250. font-size: 2rem;
  251. }
  252. .control-sidebar .sidebar-item {
  253. font-size: 2rem;
  254. height: 50px;
  255. color: white;
  256. -webkit-box-align: center;
  257. -ms-flex-align: center;
  258. align-items: center;
  259. display: -webkit-box;
  260. display: -ms-flexbox;
  261. display: flex;
  262. -webkit-box-flex: 0;
  263. -ms-flex-positive: 0;
  264. flex-grow: 0;
  265. -ms-flex-negative: 0;
  266. flex-shrink: 0;
  267. -webkit-box-pack: center;
  268. -ms-flex-pack: center;
  269. justify-content: center;
  270. width: 100%;
  271. position: relative;
  272. }
  273. .control-sidebar .sidebar-top-hr {
  274. margin: 0 0 20px 0;
  275. }
  276. .sidebar-item .icon-purpose {
  277. visibility: hidden;
  278. width: 150px;
  279. font-size: 12px;
  280. background-color: rgba(3, 169, 244,0.8);
  281. color: #fff;
  282. text-align: center;
  283. border-radius: 6px;
  284. padding: 5px 0;
  285. position: absolute;
  286. z-index: 1;
  287. left: 105%;
  288. }
  289. .sidebar-item:hover .icon-purpose {
  290. visibility: visible;
  291. }
  292. </style>