CommunityHeader.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339
  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. <hr>
  81. </div>
  82. <div v-if="$parent.$parent.loggedIn && !$parent.noSong">
  83. <a v-if='!isOwner() && $parent.$parent.loggedIn && !$parent.noSong' class="sidebar-item" href='#' @click='$parent.voteSkipStation()'>
  84. <span class='icon'>
  85. <i class='material-icons'>skip_next</i>
  86. </span>
  87. <span class="skip-votes">{{ $parent.currentSong.skipVotes }}</span>
  88. <span class="icon-purpose">Skip current song</span>
  89. </a>
  90. <a v-if='$parent.$parent.loggedIn && !$parent.noSong' class="sidebar-item" href='#' @click='$parent.modals.addSongToPlaylist = true'>
  91. <span class='icon'>
  92. <i class='material-icons'>playlist_add</i>
  93. </span>
  94. <span class="icon-purpose">Add current song to playlist</span>
  95. </a>
  96. <hr>
  97. </div>
  98. <a class="sidebar-item" href='#' @click='$parent.toggleSidebar("songslist")' v-if='$parent.station.partyMode === true'>
  99. <span class='icon'>
  100. <i class='material-icons'>queue_music</i>
  101. </span>
  102. <span class="icon-purpose">Show the station queue</span>
  103. </a>
  104. <a class="sidebar-item" href='#' @click='$parent.toggleSidebar("users")'>
  105. <span class='icon'>
  106. <i class='material-icons'>people</i>
  107. </span>
  108. <span class="icon-purpose">Display users in the station</span>
  109. </a>
  110. <a class="sidebar-item" href='#' @click='$parent.toggleSidebar("playlist")' v-if='$parent.$parent.loggedIn'>
  111. <span class='icon'>
  112. <i class='material-icons'>library_music</i>
  113. </span>
  114. <span class="icon-purpose">Show your playlists</span>
  115. </a>
  116. </div>
  117. </div>
  118. </template>
  119. <script>
  120. export default {
  121. data() {
  122. return {
  123. title: this.$route.params.id,
  124. isMobile: false,
  125. controlBar: true
  126. }
  127. },
  128. methods: {
  129. isOwner: function () {
  130. return this.$parent.$parent.loggedIn && (this.$parent.$parent.role === 'admin' || this.$parent.$parent.userId === this.$parent.station.owner);
  131. },
  132. toggleModal: function (type) {
  133. this.$dispatch('toggleModal', type);
  134. }
  135. }
  136. }
  137. </script>
  138. <style lang='scss' scoped>
  139. .nav {
  140. background-color: #03a9f4;
  141. line-height: 64px;
  142. .is-brand {
  143. font-size: 2.1rem !important;
  144. line-height: 64px !important;
  145. padding: 0 20px;
  146. }
  147. }
  148. a.nav-item {
  149. color: hsl(0, 0%, 100%);
  150. font-size: 15px;
  151. &:hover {
  152. color: hsl(0, 0%, 100%);
  153. }
  154. .admin {
  155. color: #424242;
  156. }
  157. padding: 0 12px;
  158. .icon {
  159. height: 64px;
  160. i {
  161. font-size: 2rem;
  162. line-height: 64px;
  163. height: 64px;
  164. width: 34px;
  165. }
  166. }
  167. }
  168. .grouped {
  169. margin: 0;
  170. display: flex;
  171. text-decoration: none;
  172. }
  173. .skip-votes {
  174. position: relative;
  175. left: 11px;
  176. }
  177. .nav-toggle {
  178. height: 64px;
  179. }
  180. @media screen and (max-width: 998px) {
  181. .nav-menu {
  182. background-color: white;
  183. box-shadow: 0 4px 7px rgba(10, 10, 10, 0.1);
  184. left: 0;
  185. display: none;
  186. right: 0;
  187. top: 100%;
  188. position: absolute;
  189. }
  190. .nav-toggle {
  191. display: block;
  192. }
  193. }
  194. .logo {
  195. font-size: 2.1rem;
  196. line-height: 64px;
  197. padding-left: 20px !important;
  198. padding-right: 20px !important;
  199. }
  200. .nav-center {
  201. display: flex;
  202. align-items: center;
  203. color: #03A9F4;
  204. font-size: 22px;
  205. position: absolute;
  206. margin: auto;
  207. top: 50%;
  208. left: 50%;
  209. transform: translate(-50%, -50%);
  210. }
  211. .nav-right.is-active .nav-item {
  212. background: #03a9f4;
  213. border: 0;
  214. }
  215. .control-sidebar {
  216. position: fixed;
  217. z-index: 1;
  218. top: 0;
  219. left: 0;
  220. width: 64px;
  221. height: 100vh;
  222. background-color: #03a9f4;
  223. box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12);
  224. @media (max-width: 998px) {
  225. display: none;
  226. }
  227. .inner-wrapper {
  228. @media (min-width: 999px) {
  229. .mobile-only {
  230. display: none;
  231. }
  232. .desktop-only {
  233. display: flex;
  234. }
  235. }
  236. @media (max-width: 998px) {
  237. .mobile-only {
  238. display: flex;
  239. }
  240. .desktop-only {
  241. display: none;
  242. visibility: hidden;
  243. }
  244. }
  245. }
  246. }
  247. .show-controlBar {
  248. display: block;
  249. }
  250. .inner-wrapper {
  251. top: 64px;
  252. position: relative;
  253. }
  254. .control-sidebar .material-icons {
  255. width: 100%;
  256. font-size: 2rem;
  257. }
  258. .control-sidebar .sidebar-item {
  259. font-size: 2rem;
  260. height: 50px;
  261. color: white;
  262. -webkit-box-align: center;
  263. -ms-flex-align: center;
  264. align-items: center;
  265. display: -webkit-box;
  266. display: -ms-flexbox;
  267. display: flex;
  268. -webkit-box-flex: 0;
  269. -ms-flex-positive: 0;
  270. flex-grow: 0;
  271. -ms-flex-negative: 0;
  272. flex-shrink: 0;
  273. -webkit-box-pack: center;
  274. -ms-flex-pack: center;
  275. justify-content: center;
  276. width: 100%;
  277. position: relative;
  278. }
  279. .control-sidebar .sidebar-top-hr {
  280. margin: 0 0 20px 0;
  281. }
  282. .sidebar-item .icon-purpose {
  283. visibility: hidden;
  284. width: 160px;
  285. font-size: 12px;
  286. background-color: rgba(3, 169, 244,0.8);
  287. color: #fff;
  288. text-align: center;
  289. border-radius: 6px;
  290. padding: 5px;
  291. position: absolute;
  292. z-index: 1;
  293. left: 115%;
  294. opacity: 0;
  295. transition: opacity 0.5s;
  296. display: none;
  297. }
  298. .sidebar-item .icon-purpose::after {
  299. content: "";
  300. position: absolute;
  301. top: 50%;
  302. right: 100%;
  303. margin-top: -5px;
  304. border-width: 5px;
  305. border-style: solid;
  306. border-color: transparent rgba(3, 169, 244,0.8) transparent transparent;
  307. }
  308. .sidebar-item:hover .icon-purpose {
  309. visibility: visible;
  310. opacity: 1;
  311. display: block;
  312. }
  313. </style>