CommunityHeader.vue 8.6 KB

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