CommunityHeader.vue 8.9 KB

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