EditStation.vue 23 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069
  1. <template>
  2. <modal title="Edit Station" class="edit-station-modal">
  3. <template v-slot:body>
  4. <div class="section left-section">
  5. <div class="col col-2">
  6. <div>
  7. <label class="label">Name</label>
  8. <p class="control">
  9. <input
  10. class="input"
  11. type="text"
  12. v-model="editing.name"
  13. />
  14. </p>
  15. </div>
  16. <div>
  17. <label class="label">Display name</label>
  18. <p class="control">
  19. <input
  20. class="input"
  21. type="text"
  22. v-model="editing.displayName"
  23. />
  24. </p>
  25. </div>
  26. </div>
  27. <div class="col col-1">
  28. <div>
  29. <label class="label">Description</label>
  30. <p class="control">
  31. <input
  32. class="input"
  33. type="text"
  34. v-model="editing.description"
  35. />
  36. </p>
  37. </div>
  38. </div>
  39. <div class="col col-2" v-if="editing.genres">
  40. <div>
  41. <label class="label">Genre(s)</label>
  42. <p class="control has-addons">
  43. <input
  44. class="input"
  45. type="text"
  46. id="new-genre"
  47. v-model="genreInputValue"
  48. v-on:blur="blurGenreInput()"
  49. v-on:focus="focusGenreInput()"
  50. v-on:keydown="keydownGenreInput()"
  51. v-on:keyup.enter="addTag('genres')"
  52. />
  53. <button
  54. class="button is-info add-button blue"
  55. v-on:click="addTag('genres')"
  56. >
  57. <i class="material-icons">add</i>
  58. </button>
  59. </p>
  60. <div
  61. class="autosuggest-container"
  62. v-if="
  63. (genreInputFocussed ||
  64. genreAutosuggestContainerFocussed) &&
  65. genreAutosuggestItems.length > 0
  66. "
  67. @mouseover="focusGenreContainer()"
  68. @mouseleave="blurGenreContainer()"
  69. >
  70. <span
  71. class="autosuggest-item"
  72. tabindex="0"
  73. v-on:click="selectGenreAutosuggest(item)"
  74. v-for="(item, index) in genreAutosuggestItems"
  75. :key="index"
  76. >{{ item }}</span
  77. >
  78. </div>
  79. <div class="list-container">
  80. <div
  81. class="list-item"
  82. v-for="(genre, index) in editing.genres"
  83. :key="index"
  84. >
  85. <div
  86. class="list-item-circle blue"
  87. v-on:click="removeTag('genres', index)"
  88. >
  89. <i class="material-icons">close</i>
  90. </div>
  91. <p>{{ genre }}</p>
  92. </div>
  93. </div>
  94. </div>
  95. <div>
  96. <label class="label">Blacklist genre(s)</label>
  97. <p class="control has-addons">
  98. <input
  99. class="input"
  100. type="text"
  101. v-model="blacklistGenreInputValue"
  102. v-on:blur="blurBlacklistGenreInput()"
  103. v-on:focus="focusBlacklistGenreInput()"
  104. v-on:keydown="keydownBlacklistGenreInput()"
  105. v-on:keyup.enter="addTag('blacklist-genres')"
  106. />
  107. <button
  108. class="button is-info add-button red"
  109. v-on:click="addTag('blacklist-genres')"
  110. >
  111. <i class="material-icons">add</i>
  112. </button>
  113. </p>
  114. <div
  115. class="autosuggest-container"
  116. v-if="
  117. (blacklistGenreInputFocussed ||
  118. blacklistGenreAutosuggestContainerFocussed) &&
  119. blacklistGenreAutosuggestItems.length > 0
  120. "
  121. @mouseover="focusBlacklistGenreContainer()"
  122. @mouseleave="blurBlacklistGenreContainer()"
  123. >
  124. <span
  125. class="autosuggest-item"
  126. tabindex="0"
  127. v-on:click="
  128. selectBlacklistGenreAutosuggest(item)
  129. "
  130. v-for="(item,
  131. index) in blacklistGenreAutosuggestItems"
  132. :key="index"
  133. >{{ item }}</span
  134. >
  135. </div>
  136. <div class="list-container">
  137. <div
  138. class="list-item"
  139. v-for="(genre,
  140. index) in editing.blacklistedGenres"
  141. :key="index"
  142. >
  143. <div
  144. class="list-item-circle red"
  145. v-on:click="
  146. removeTag('blacklist-genres', index)
  147. "
  148. >
  149. <i class="material-icons">close</i>
  150. </div>
  151. <p>{{ genre }}</p>
  152. </div>
  153. </div>
  154. </div>
  155. </div>
  156. </div>
  157. <div class="section right-section">
  158. <div>
  159. <label class="label">Privacy</label>
  160. <div
  161. @mouseenter="privacyDropdownActive = true"
  162. @mouseleave="privacyDropdownActive = false"
  163. class="button-wrapper"
  164. >
  165. <button
  166. v-bind:class="{
  167. green: true,
  168. current: editing.privacy === 'public'
  169. }"
  170. v-if="
  171. privacyDropdownActive ||
  172. editing.privacy === 'public'
  173. "
  174. @click="updatePrivacyLocal('public')"
  175. >
  176. <i class="material-icons">public</i>
  177. Public
  178. </button>
  179. <button
  180. v-bind:class="{
  181. orange: true,
  182. current: editing.privacy === 'unlisted'
  183. }"
  184. v-if="
  185. privacyDropdownActive ||
  186. editing.privacy === 'unlisted'
  187. "
  188. @click="updatePrivacyLocal('unlisted')"
  189. >
  190. <i class="material-icons">link</i>
  191. Unlisted
  192. </button>
  193. <button
  194. v-bind:class="{
  195. red: true,
  196. current: editing.privacy === 'private'
  197. }"
  198. v-if="
  199. privacyDropdownActive ||
  200. editing.privacy === 'private'
  201. "
  202. @click="updatePrivacyLocal('private')"
  203. >
  204. <i class="material-icons">lock</i>
  205. Private
  206. </button>
  207. </div>
  208. </div>
  209. <div v-if="editing.type === 'community'">
  210. <label class="label">Mode</label>
  211. <div
  212. @mouseenter="modeDropdownActive = true"
  213. @mouseleave="modeDropdownActive = false"
  214. class="button-wrapper"
  215. >
  216. <button
  217. v-bind:class="{
  218. blue: true,
  219. current: editing.partyMode === false
  220. }"
  221. v-if="modeDropdownActive || !editing.partyMode"
  222. @click="updatePartyModeLocal(false)"
  223. >
  224. <i class="material-icons">playlist_play</i>
  225. Playlist
  226. </button>
  227. <button
  228. v-bind:class="{
  229. yellow: true,
  230. current: editing.partyMode === true
  231. }"
  232. v-if="
  233. modeDropdownActive || editing.partyMode === true
  234. "
  235. @click="updatePartyModeLocal(true)"
  236. >
  237. <i class="material-icons">emoji_people</i>
  238. Party
  239. </button>
  240. </div>
  241. </div>
  242. <div
  243. v-if="
  244. editing.type === 'community' &&
  245. editing.partyMode === true
  246. "
  247. >
  248. <label class="label">Queue lock</label>
  249. <div
  250. @mouseenter="queueLockDropdownActive = true"
  251. @mouseleave="queueLockDropdownActive = false"
  252. class="button-wrapper"
  253. >
  254. <button
  255. v-bind:class="{
  256. green: true,
  257. current: editing.locked
  258. }"
  259. v-if="queueLockDropdownActive || editing.locked"
  260. @click="updateQueueLockLocal(true)"
  261. >
  262. <i class="material-icons">lock</i>
  263. On
  264. </button>
  265. <button
  266. v-bind:class="{
  267. red: true,
  268. current: !editing.locked
  269. }"
  270. v-if="queueLockDropdownActive || !editing.locked"
  271. @click="updateQueueLockLocal(false)"
  272. >
  273. <i class="material-icons">lock_open</i>
  274. Off
  275. </button>
  276. </div>
  277. </div>
  278. </div>
  279. </template>
  280. <template v-slot:footer>
  281. <button class="button is-success" v-on:click="update()">
  282. Update Settings
  283. </button>
  284. <button
  285. v-if="station.type === 'community'"
  286. class="button is-danger"
  287. @click="deleteStation()"
  288. >
  289. Delete station
  290. </button>
  291. </template>
  292. </modal>
  293. </template>
  294. <script>
  295. import { mapState, mapActions } from "vuex";
  296. import Toast from "toasters";
  297. import Modal from "./Modal.vue";
  298. import io from "../../io";
  299. import validation from "../../validation";
  300. export default {
  301. computed: {
  302. ...mapState("admin/station", {
  303. stations: state => state.stations
  304. }),
  305. ...mapState({
  306. editing(state) {
  307. return this.$props.store
  308. .split("/")
  309. .reduce((a, v) => a[v], state).editing;
  310. },
  311. station(state) {
  312. return this.$props.store
  313. .split("/")
  314. .reduce((a, v) => a[v], state).station;
  315. }
  316. })
  317. },
  318. mounted() {
  319. io.getSocket(socket => {
  320. this.socket = socket;
  321. return socket;
  322. });
  323. },
  324. data() {
  325. return {
  326. genreInputValue: "",
  327. genreInputFocussed: false,
  328. genreAutosuggestContainerFocussed: false,
  329. keydownGenreInputTimeout: 0,
  330. genreAutosuggestItems: [],
  331. blacklistGenreInputValue: "",
  332. blacklistGenreInputFocussed: false,
  333. blacklistGenreAutosuggestContainerFocussed: false,
  334. blacklistKeydownGenreInputTimeout: 0,
  335. blacklistGenreAutosuggestItems: [],
  336. privacyDropdownActive: false,
  337. modeDropdownActive: false,
  338. queueLockDropdownActive: false,
  339. genres: [
  340. "Blues",
  341. "Country",
  342. "Disco",
  343. "Funk",
  344. "Hip-Hop",
  345. "Jazz",
  346. "Metal",
  347. "Oldies",
  348. "Other",
  349. "Pop",
  350. "Rap",
  351. "Reggae",
  352. "Rock",
  353. "Techno",
  354. "Trance",
  355. "Classical",
  356. "Instrumental",
  357. "House",
  358. "Electronic",
  359. "Christian Rap",
  360. "Lo-Fi",
  361. "Musical",
  362. "Rock 'n' Roll",
  363. "Opera",
  364. "Drum & Bass",
  365. "Club-House",
  366. "Indie",
  367. "Heavy Metal",
  368. "Christian rock",
  369. "Dubstep"
  370. ]
  371. };
  372. },
  373. props: ["store"],
  374. methods: {
  375. update() {
  376. if (this.station.name !== this.editing.name) this.updateName();
  377. if (this.station.displayName !== this.editing.displayName)
  378. this.updateDisplayName();
  379. if (this.station.description !== this.editing.description)
  380. this.updateDescription();
  381. if (this.station.privacy !== this.editing.privacy)
  382. this.updatePrivacy();
  383. if (
  384. this.station.type === "community" &&
  385. this.station.partyMode !== this.editing.partyMode
  386. )
  387. this.updatePartyMode();
  388. if (
  389. this.station.type === "community" &&
  390. this.editing.partyMode &&
  391. this.station.locked !== this.editing.locked
  392. )
  393. this.updateQueueLock();
  394. if (this.$props.store !== "station") {
  395. if (
  396. this.station.genres.toString() !==
  397. this.editing.genres.toString()
  398. )
  399. this.updateGenres();
  400. if (
  401. this.station.blacklistedGenres.toString() !==
  402. this.editing.blacklistedGenres.toString()
  403. )
  404. this.updateBlacklistedGenres();
  405. }
  406. },
  407. updateName() {
  408. const { name } = this.editing;
  409. if (!validation.isLength(name, 2, 16))
  410. return new Toast({
  411. content: "Name must have between 2 and 16 characters.",
  412. timeout: 8000
  413. });
  414. if (!validation.regex.az09_.test(name))
  415. return new Toast({
  416. content:
  417. "Invalid name format. Allowed characters: a-z, 0-9 and _.",
  418. timeout: 8000
  419. });
  420. return this.socket.emit(
  421. "stations.updateName",
  422. this.editing._id,
  423. name,
  424. res => {
  425. if (res.status === "success") {
  426. if (this.station) this.station.name = name;
  427. else {
  428. this.stations.forEach((station, index) => {
  429. if (station._id === this.editing._id) {
  430. this.stations[index].name = name;
  431. return name;
  432. }
  433. return false;
  434. });
  435. }
  436. }
  437. new Toast({ content: res.message, timeout: 8000 });
  438. }
  439. );
  440. },
  441. updateDisplayName() {
  442. const { displayName } = this.editing;
  443. if (!validation.isLength(displayName, 2, 32))
  444. return new Toast({
  445. content:
  446. "Display name must have between 2 and 32 characters.",
  447. timeout: 8000
  448. });
  449. if (!validation.regex.ascii.test(displayName))
  450. return new Toast({
  451. content:
  452. "Invalid display name format. Only ASCII characters are allowed.",
  453. timeout: 8000
  454. });
  455. return this.socket.emit(
  456. "stations.updateDisplayName",
  457. this.editing._id,
  458. displayName,
  459. res => {
  460. if (res.status === "success") {
  461. if (this.station)
  462. this.station.displayName = displayName;
  463. else {
  464. this.stations.forEach((station, index) => {
  465. if (station._id === this.editing._id) {
  466. this.stations[
  467. index
  468. ].displayName = displayName;
  469. return displayName;
  470. }
  471. return false;
  472. });
  473. }
  474. }
  475. new Toast({ content: res.message, timeout: 8000 });
  476. }
  477. );
  478. },
  479. updateDescription() {
  480. const { description } = this.editing;
  481. if (!validation.isLength(description, 2, 200))
  482. return new Toast({
  483. content:
  484. "Description must have between 2 and 200 characters.",
  485. timeout: 8000
  486. });
  487. let characters = description.split("");
  488. characters = characters.filter(character => {
  489. return character.charCodeAt(0) === 21328;
  490. });
  491. if (characters.length !== 0)
  492. return new Toast({
  493. content: "Invalid description format.",
  494. timeout: 8000
  495. });
  496. return this.socket.emit(
  497. "stations.updateDescription",
  498. this.editing._id,
  499. description,
  500. res => {
  501. if (res.status === "success") {
  502. if (this.station)
  503. this.station.description = description;
  504. else {
  505. this.stations.forEach((station, index) => {
  506. if (station._id === this.editing._id) {
  507. this.stations[
  508. index
  509. ].description = description;
  510. return description;
  511. }
  512. return false;
  513. });
  514. }
  515. return new Toast({
  516. content: res.message,
  517. timeout: 4000
  518. });
  519. }
  520. return new Toast({ content: res.message, timeout: 8000 });
  521. }
  522. );
  523. },
  524. updatePrivacyLocal(privacy) {
  525. if (this.editing.privacy === privacy) return;
  526. this.editing.privacy = privacy;
  527. this.privacyDropdownActive = false;
  528. },
  529. updatePrivacy() {
  530. this.socket.emit(
  531. "stations.updatePrivacy",
  532. this.editing._id,
  533. this.editing.privacy,
  534. res => {
  535. if (res.status === "success") {
  536. if (this.station)
  537. this.station.privacy = this.editing.privacy;
  538. else {
  539. this.stations.forEach((station, index) => {
  540. if (station._id === this.editing._id) {
  541. this.stations[
  542. index
  543. ].privacy = this.editing.privacy;
  544. return this.editing.privacy;
  545. }
  546. return false;
  547. });
  548. }
  549. return new Toast({
  550. content: res.message,
  551. timeout: 4000
  552. });
  553. }
  554. return new Toast({ content: res.message, timeout: 8000 });
  555. }
  556. );
  557. },
  558. updateGenres() {
  559. this.socket.emit(
  560. "stations.updateGenres",
  561. this.editing._id,
  562. this.editing.genres,
  563. res => {
  564. if (res.status === "success") {
  565. const genres = JSON.parse(
  566. JSON.stringify(this.editing.genres)
  567. );
  568. if (this.station) this.station.genres = genres;
  569. this.stations.forEach((station, index) => {
  570. if (station._id === this.editing._id) {
  571. this.stations[index].genres = genres;
  572. return genres;
  573. }
  574. return false;
  575. });
  576. return new Toast({
  577. content: res.message,
  578. timeout: 4000
  579. });
  580. }
  581. return new Toast({ content: res.message, timeout: 8000 });
  582. }
  583. );
  584. },
  585. updateBlacklistedGenres() {
  586. this.socket.emit(
  587. "stations.updateBlacklistedGenres",
  588. this.editing._id,
  589. this.editing.blacklistedGenres,
  590. res => {
  591. if (res.status === "success") {
  592. const blacklistedGenres = JSON.parse(
  593. JSON.stringify(this.editing.blacklistedGenres)
  594. );
  595. if (this.station)
  596. this.station.blacklistedGenres = blacklistedGenres;
  597. this.stations.forEach((station, index) => {
  598. if (station._id === this.editing._id) {
  599. this.stations[
  600. index
  601. ].blacklistedGenres = blacklistedGenres;
  602. return blacklistedGenres;
  603. }
  604. return false;
  605. });
  606. return new Toast({
  607. content: res.message,
  608. timeout: 4000
  609. });
  610. }
  611. return new Toast({ content: res.message, timeout: 8000 });
  612. }
  613. );
  614. },
  615. updatePartyModeLocal(partyMode) {
  616. if (this.editing.partyMode === partyMode) return;
  617. this.editing.partyMode = partyMode;
  618. this.modeDropdownActive = false;
  619. },
  620. updatePartyMode() {
  621. this.socket.emit(
  622. "stations.updatePartyMode",
  623. this.editing._id,
  624. this.editing.partyMode,
  625. res => {
  626. if (res.status === "success") {
  627. if (this.station)
  628. this.station.partyMode = this.editing.partyMode;
  629. // if (this.station)
  630. // this.station.partyMode = this.editing.partyMode;
  631. // this.stations.forEach((station, index) => {
  632. // if (station._id === this.editing._id) {
  633. // this.stations[
  634. // index
  635. // ].partyMode = this.editing.partyMode;
  636. // return this.editing.partyMode;
  637. // }
  638. // return false;
  639. // });
  640. return new Toast({
  641. content: res.message,
  642. timeout: 4000
  643. });
  644. }
  645. return new Toast({ content: res.message, timeout: 8000 });
  646. }
  647. );
  648. },
  649. updateQueueLockLocal(locked) {
  650. if (this.editing.locked === locked) return;
  651. this.editing.locked = locked;
  652. this.queueLockDropdownActive = false;
  653. },
  654. updateQueueLock() {
  655. this.socket.emit("stations.toggleLock", this.editing._id, res => {
  656. console.log(res);
  657. if (res.status === "success") {
  658. if (this.station) this.station.locked = res.data;
  659. return new Toast({
  660. content: `Toggled queue lock succesfully to ${res.data}`,
  661. timeout: 4000
  662. });
  663. }
  664. return new Toast({
  665. content: "Failed to toggle queue lock.",
  666. timeout: 8000
  667. });
  668. });
  669. },
  670. deleteStation() {
  671. this.socket.emit("stations.remove", this.editing._id, res => {
  672. if (res.status === "success")
  673. this.closeModal({
  674. sector: "station",
  675. modal: "editStation"
  676. });
  677. return new Toast({ content: res.message, timeout: 8000 });
  678. });
  679. },
  680. blurGenreInput() {
  681. this.genreInputFocussed = false;
  682. },
  683. focusGenreInput() {
  684. this.genreInputFocussed = true;
  685. },
  686. keydownGenreInput() {
  687. clearTimeout(this.keydownGenreInputTimeout);
  688. this.keydownGenreInputTimeout = setTimeout(() => {
  689. if (this.genreInputValue.length > 1) {
  690. this.genreAutosuggestItems = this.genres.filter(genre => {
  691. return genre
  692. .toLowerCase()
  693. .startsWith(this.genreInputValue.toLowerCase());
  694. });
  695. } else this.genreAutosuggestItems = [];
  696. }, 1000);
  697. },
  698. focusGenreContainer() {
  699. this.genreAutosuggestContainerFocussed = true;
  700. },
  701. blurGenreContainer() {
  702. this.genreAutosuggestContainerFocussed = false;
  703. },
  704. selectGenreAutosuggest(value) {
  705. this.genreInputValue = value;
  706. },
  707. blurBlacklistGenreInput() {
  708. this.blacklistGenreInputFocussed = false;
  709. },
  710. focusBlacklistGenreInput() {
  711. this.blacklistGenreInputFocussed = true;
  712. },
  713. keydownBlacklistGenreInput() {
  714. clearTimeout(this.keydownBlacklistGenreInputTimeout);
  715. this.keydownBlacklistGenreInputTimeout = setTimeout(() => {
  716. if (this.blacklistGenreInputValue.length > 1) {
  717. this.blacklistGenreAutosuggestItems = this.genres.filter(
  718. genre => {
  719. return genre
  720. .toLowerCase()
  721. .startsWith(
  722. this.blacklistGenreInputValue.toLowerCase()
  723. );
  724. }
  725. );
  726. } else this.blacklistGenreAutosuggestItems = [];
  727. }, 1000);
  728. },
  729. focusBlacklistGenreContainer() {
  730. this.blacklistGenreAutosuggestContainerFocussed = true;
  731. },
  732. blurBlacklistGenreContainer() {
  733. this.blacklistGenreAutosuggestContainerFocussed = false;
  734. },
  735. selectBlacklistGenreAutosuggest(value) {
  736. this.blacklistGenreInputValue = value;
  737. },
  738. addTag(type) {
  739. if (type === "genres") {
  740. const genre = this.genreInputValue.toLowerCase().trim();
  741. if (this.editing.genres.indexOf(genre) !== -1)
  742. return new Toast({
  743. content: "Genre already exists",
  744. timeout: 3000
  745. });
  746. if (genre) {
  747. this.editing.genres.push(genre);
  748. this.genreInputValue = "";
  749. return false;
  750. }
  751. return new Toast({
  752. content: "Genre cannot be empty",
  753. timeout: 3000
  754. });
  755. }
  756. if (type === "blacklist-genres") {
  757. const genre = this.blacklistGenreInputValue
  758. .toLowerCase()
  759. .trim();
  760. if (this.editing.blacklistedGenres.indexOf(genre) !== -1)
  761. return new Toast({
  762. content: "Blacklist genre already exists",
  763. timeout: 3000
  764. });
  765. if (genre) {
  766. this.editing.blacklistedGenres.push(genre);
  767. this.blacklistGenreInputValue = "";
  768. return false;
  769. }
  770. return new Toast({
  771. content: "Blacklist genre cannot be empty",
  772. timeout: 3000
  773. });
  774. }
  775. return false;
  776. },
  777. removeTag(type, index) {
  778. if (type === "genres") this.editing.genres.splice(index, 1);
  779. else if (type === "blacklist-genres")
  780. this.editing.blacklistedGenres.splice(index, 1);
  781. },
  782. ...mapActions("modals", ["closeModal"])
  783. },
  784. components: { Modal }
  785. };
  786. </script>
  787. <style lang="scss">
  788. @import "styles/global.scss";
  789. .night-mode {
  790. .modal-card,
  791. .modal-card-head,
  792. .modal-card-body,
  793. .modal-card-foot {
  794. background-color: $night-mode-secondary;
  795. }
  796. .section {
  797. background-color: #111 !important;
  798. border: 0 !important;
  799. }
  800. .label,
  801. p,
  802. strong {
  803. color: #ddd;
  804. }
  805. }
  806. .edit-station-modal {
  807. .modal-card-title {
  808. text-align: center;
  809. margin-left: 24px;
  810. }
  811. .modal-card {
  812. width: 800px;
  813. height: 550px;
  814. .modal-card-body {
  815. padding: 16px;
  816. display: flex;
  817. }
  818. }
  819. }
  820. </style>
  821. <style lang="scss" scoped>
  822. @import "styles/global.scss";
  823. .section {
  824. border: 1px solid #a3e0ff;
  825. background-color: #f4f4f4;
  826. border-radius: 5px;
  827. padding: 16px;
  828. }
  829. .left-section {
  830. width: 595px;
  831. display: grid;
  832. gap: 16px;
  833. grid-template-rows: min-content min-content auto;
  834. .control {
  835. input {
  836. width: 100%;
  837. }
  838. .add-button {
  839. width: 32px;
  840. &.blue {
  841. background-color: $musareBlue !important;
  842. }
  843. &.red {
  844. background-color: $red !important;
  845. }
  846. i {
  847. font-size: 32px;
  848. }
  849. }
  850. }
  851. .col {
  852. > div {
  853. position: relative;
  854. }
  855. }
  856. .list-item-circle {
  857. width: 16px;
  858. height: 16px;
  859. border-radius: 8px;
  860. cursor: pointer;
  861. margin-right: 8px;
  862. float: left;
  863. -webkit-touch-callout: none;
  864. -webkit-user-select: none;
  865. -khtml-user-select: none;
  866. -moz-user-select: none;
  867. -ms-user-select: none;
  868. user-select: none;
  869. &.blue {
  870. background-color: $musareBlue;
  871. i {
  872. color: $musareBlue;
  873. }
  874. }
  875. &.red {
  876. background-color: $red;
  877. i {
  878. color: $red;
  879. }
  880. }
  881. i {
  882. font-size: 14px;
  883. margin-left: 1px;
  884. }
  885. }
  886. .list-item-circle:hover,
  887. .list-item-circle:focus {
  888. i {
  889. color: white;
  890. }
  891. }
  892. .list-item > p {
  893. line-height: 16px;
  894. word-wrap: break-word;
  895. width: calc(100% - 24px);
  896. left: 24px;
  897. float: left;
  898. margin-bottom: 8px;
  899. }
  900. .list-item:last-child > p {
  901. margin-bottom: 0;
  902. }
  903. .autosuggest-container {
  904. position: absolute;
  905. background: white;
  906. width: calc(100% + 1px);
  907. top: 57px;
  908. z-index: 200;
  909. overflow: auto;
  910. max-height: 100%;
  911. clear: both;
  912. .autosuggest-item {
  913. padding: 8px;
  914. display: block;
  915. border: 1px solid #dbdbdb;
  916. margin-top: -1px;
  917. line-height: 16px;
  918. cursor: pointer;
  919. -webkit-user-select: none;
  920. -ms-user-select: none;
  921. -moz-user-select: none;
  922. user-select: none;
  923. }
  924. .autosuggest-item:hover,
  925. .autosuggest-item:focus {
  926. background-color: #eee;
  927. }
  928. .autosuggest-item:first-child {
  929. border-top: none;
  930. }
  931. .autosuggest-item:last-child {
  932. border-radius: 0 0 3px 3px;
  933. }
  934. }
  935. }
  936. .right-section {
  937. width: 157px;
  938. margin-left: 16px;
  939. display: grid;
  940. gap: 16px;
  941. grid-template-rows: min-content min-content min-content;
  942. .button-wrapper {
  943. display: flex;
  944. flex-direction: column;
  945. }
  946. button {
  947. width: 100%;
  948. height: 36px;
  949. border: 0;
  950. border-radius: 10px;
  951. font-size: 18px;
  952. color: white;
  953. box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.25);
  954. display: block;
  955. text-align: center;
  956. justify-content: center;
  957. display: inline-flex;
  958. -ms-flex-align: center;
  959. align-items: center;
  960. -moz-user-select: none;
  961. user-select: none;
  962. cursor: pointer;
  963. margin-bottom: 16px;
  964. padding: 0;
  965. &.current {
  966. order: -1;
  967. }
  968. &.red {
  969. background-color: $red;
  970. }
  971. &.green {
  972. background-color: $green;
  973. }
  974. &.blue {
  975. background-color: $musareBlue;
  976. }
  977. &.orange {
  978. background-color: $light-orange;
  979. }
  980. &.yellow {
  981. background-color: $yellow;
  982. }
  983. i {
  984. font-size: 20px;
  985. margin-right: 4px;
  986. }
  987. }
  988. }
  989. .col {
  990. display: grid;
  991. grid-column-gap: 16px;
  992. }
  993. .col-1 {
  994. grid-template-columns: auto;
  995. }
  996. .col-2 {
  997. grid-template-columns: auto auto;
  998. }
  999. </style>