CommunityHeader.vue 8.6 KB

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