CommunityHeader.vue 7.7 KB

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