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