OfficialHeader.vue 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485
  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}`"
  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 => {
  233. this.frontendDomain = res;
  234. });
  235. lofig.get("siteSettings", res => {
  236. this.siteSettings = res;
  237. });
  238. },
  239. methods: {
  240. isOwner: function() {
  241. return (
  242. this.$parent.$parent.loggedIn &&
  243. this.$parent.$parent.role === "admin"
  244. );
  245. },
  246. settings() {
  247. this.editStation({
  248. _id: this.$parent.station._id,
  249. name: this.$parent.station.name,
  250. type: this.$parent.type,
  251. partyMode: this.$parent.station.partyMode,
  252. description: this.$parent.station.description,
  253. privacy: this.$parent.station.privacy,
  254. displayName: this.$parent.station.displayName
  255. });
  256. this.toggleModal({
  257. sector: "station",
  258. modal: "editStation"
  259. });
  260. },
  261. ...mapActions("modals", ["toggleModal"]),
  262. ...mapActions("station", ["editStation"])
  263. }
  264. };
  265. </script>
  266. <style lang="scss" scoped>
  267. .nav {
  268. background-color: #03a9f4;
  269. line-height: 64px;
  270. border-radius: 0% 0% 33% 33% / 0% 0% 7% 7%;
  271. .is-brand {
  272. font-size: 2.1rem !important;
  273. line-height: 64px !important;
  274. padding: 0 20px;
  275. color: #ffffff;
  276. font-family: Pacifico, cursive;
  277. filter: brightness(0) invert(1);
  278. img {
  279. max-height: 38px;
  280. }
  281. }
  282. }
  283. a.nav-item {
  284. color: #ffffff;
  285. font-size: 17px;
  286. &:hover {
  287. color: #ffffff;
  288. }
  289. padding: 0 12px;
  290. .icon {
  291. height: 64px;
  292. i {
  293. font-size: 2rem;
  294. line-height: 64px;
  295. height: 64px;
  296. width: 34px;
  297. }
  298. }
  299. }
  300. a.nav-item.is-tab:hover {
  301. border-bottom: none;
  302. border-top: solid 1px #ffffff;
  303. }
  304. .admin strong {
  305. color: #9d42b1;
  306. }
  307. .grouped {
  308. margin: 0;
  309. display: flex;
  310. text-decoration: none;
  311. }
  312. .skip-votes {
  313. position: relative;
  314. left: 11px;
  315. }
  316. .nav-toggle {
  317. height: 64px;
  318. }
  319. @media screen and (max-width: 998px) {
  320. .nav-menu {
  321. background-color: white;
  322. box-shadow: 0 4px 7px rgba(10, 10, 10, 0.1);
  323. left: 0;
  324. display: none;
  325. right: 0;
  326. top: 100%;
  327. position: absolute;
  328. }
  329. .nav-toggle {
  330. display: block;
  331. }
  332. }
  333. .logo {
  334. font-size: 2.1rem;
  335. line-height: 64px;
  336. padding-left: 20px !important;
  337. padding-right: 20px !important;
  338. }
  339. .nav-center {
  340. display: flex;
  341. align-items: center;
  342. color: #03a9f4;
  343. font-size: 22px;
  344. position: absolute;
  345. margin: auto;
  346. top: 50%;
  347. left: 50%;
  348. transform: translate(-50%, -50%);
  349. }
  350. .nav-right.is-active .nav-item {
  351. background: #03a9f4;
  352. border: 0;
  353. }
  354. .hidden {
  355. display: none;
  356. }
  357. .control-sidebar {
  358. position: fixed;
  359. z-index: 1;
  360. top: 0;
  361. left: 0;
  362. width: 64px;
  363. height: 100vh;
  364. background-color: #03a9f4;
  365. box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.16),
  366. 0 2px 10px 0 rgba(0, 0, 0, 0.12);
  367. @media (max-width: 998px) {
  368. display: none;
  369. }
  370. .inner-wrapper {
  371. @media (min-width: 999px) {
  372. .mobile-only {
  373. display: none;
  374. }
  375. .desktop-only {
  376. display: flex;
  377. }
  378. }
  379. @media (max-width: 998px) {
  380. .mobile-only {
  381. display: flex;
  382. }
  383. .desktop-only {
  384. display: none;
  385. visibility: hidden;
  386. }
  387. }
  388. }
  389. }
  390. .show-controlBar {
  391. display: block;
  392. }
  393. .inner-wrapper {
  394. top: 64px;
  395. position: relative;
  396. }
  397. .control-sidebar .material-icons {
  398. width: 100%;
  399. font-size: 2rem;
  400. }
  401. .control-sidebar .sidebar-item {
  402. font-size: 2rem;
  403. height: 50px;
  404. color: white;
  405. -webkit-box-align: center;
  406. -ms-flex-align: center;
  407. align-items: center;
  408. display: -webkit-box;
  409. display: -ms-flexbox;
  410. display: flex;
  411. -webkit-box-flex: 0;
  412. -ms-flex-positive: 0;
  413. flex-grow: 0;
  414. -ms-flex-negative: 0;
  415. flex-shrink: 0;
  416. -webkit-box-pack: center;
  417. -ms-flex-pack: center;
  418. justify-content: center;
  419. width: 100%;
  420. position: relative;
  421. }
  422. .control-sidebar .sidebar-top-hr {
  423. margin: 0 0 20px 0;
  424. }
  425. .sidebar-item .icon-purpose {
  426. visibility: hidden;
  427. width: 160px;
  428. font-size: 12px;
  429. background-color: rgba(3, 169, 244, 0.8);
  430. color: #fff;
  431. text-align: center;
  432. border-radius: 6px;
  433. padding: 5px;
  434. position: absolute;
  435. z-index: 1;
  436. left: 115%;
  437. opacity: 0;
  438. transition: opacity 0.5s;
  439. display: none;
  440. }
  441. .sidebar-item .icon-purpose::after {
  442. content: "";
  443. position: absolute;
  444. top: 50%;
  445. right: 100%;
  446. margin-top: -5px;
  447. border-width: 5px;
  448. border-style: solid;
  449. border-color: transparent rgba(3, 169, 244, 0.8) transparent transparent;
  450. }
  451. .sidebar-item:hover .icon-purpose {
  452. visibility: visible;
  453. opacity: 1;
  454. display: block;
  455. }
  456. </style>