OfficialHeader.vue 9.2 KB

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