OfficialHeader.vue 9.3 KB

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