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