CommunityHeader.vue 8.9 KB

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