OfficialHeader.vue 9.8 KB

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