EditStation.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056
  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">people</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">queue_music</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">post_add</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">done</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">not_interested</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: mapState({
  302. editing(state) {
  303. return this.$props.store.split("/").reduce((a, v) => a[v], state)
  304. .editing;
  305. },
  306. station(state) {
  307. return this.$props.store.split("/").reduce((a, v) => a[v], state)
  308. .station;
  309. }
  310. }),
  311. mounted() {
  312. io.getSocket(socket => {
  313. this.socket = socket;
  314. return socket;
  315. });
  316. },
  317. data() {
  318. return {
  319. genreInputValue: "",
  320. genreInputFocussed: false,
  321. genreAutosuggestContainerFocussed: false,
  322. keydownGenreInputTimeout: 0,
  323. genreAutosuggestItems: [],
  324. blacklistGenreInputValue: "",
  325. blacklistGenreInputFocussed: false,
  326. blacklistGenreAutosuggestContainerFocussed: false,
  327. blacklistKeydownGenreInputTimeout: 0,
  328. blacklistGenreAutosuggestItems: [],
  329. privacyDropdownActive: false,
  330. modeDropdownActive: false,
  331. queueLockDropdownActive: false,
  332. genres: [
  333. "Blues",
  334. "Country",
  335. "Disco",
  336. "Funk",
  337. "Hip-Hop",
  338. "Jazz",
  339. "Metal",
  340. "Oldies",
  341. "Other",
  342. "Pop",
  343. "Rap",
  344. "Reggae",
  345. "Rock",
  346. "Techno",
  347. "Trance",
  348. "Classical",
  349. "Instrumental",
  350. "House",
  351. "Electronic",
  352. "Christian Rap",
  353. "Lo-Fi",
  354. "Musical",
  355. "Rock 'n' Roll",
  356. "Opera",
  357. "Drum & Bass",
  358. "Club-House",
  359. "Indie",
  360. "Heavy Metal",
  361. "Christian rock",
  362. "Dubstep"
  363. ]
  364. };
  365. },
  366. props: ["store"],
  367. methods: {
  368. update() {
  369. if (this.station.name !== this.editing.name) this.updateName();
  370. if (this.station.displayName !== this.editing.displayName)
  371. this.updateDisplayName();
  372. if (this.station.description !== this.editing.description)
  373. this.updateDescription();
  374. if (this.station.privacy !== this.editing.privacy)
  375. this.updatePrivacy();
  376. if (
  377. this.station.type === "community" &&
  378. this.station.partyMode !== this.editing.partyMode
  379. )
  380. this.updatePartyMode();
  381. if (
  382. this.station.type === "community" &&
  383. this.editing.partyMode &&
  384. this.station.locked !== this.editing.locked
  385. )
  386. this.updateQueueLock();
  387. if (this.$props.store !== "station") {
  388. if (
  389. this.station.genres.toString() !==
  390. this.editing.genres.toString()
  391. )
  392. this.updateGenres();
  393. if (
  394. this.station.blacklistedGenres.toString() !==
  395. this.editing.blacklistedGenres.toString()
  396. )
  397. this.updateBlacklistedGenres();
  398. }
  399. },
  400. updateName() {
  401. const { name } = this.editing;
  402. if (!validation.isLength(name, 2, 16))
  403. return new Toast({
  404. content: "Name must have between 2 and 16 characters.",
  405. timeout: 8000
  406. });
  407. if (!validation.regex.az09_.test(name))
  408. return new Toast({
  409. content:
  410. "Invalid name format. Allowed characters: a-z, 0-9 and _.",
  411. timeout: 8000
  412. });
  413. return this.socket.emit(
  414. "stations.updateName",
  415. this.editing._id,
  416. name,
  417. res => {
  418. if (res.status === "success") {
  419. if (this.station) this.station.name = name;
  420. else {
  421. this.$parent.stations.forEach((station, index) => {
  422. if (station._id === this.editing._id) {
  423. this.$parent.stations[index].name = name;
  424. return name;
  425. }
  426. return false;
  427. });
  428. }
  429. }
  430. new Toast({ content: res.message, timeout: 8000 });
  431. }
  432. );
  433. },
  434. updateDisplayName() {
  435. const { displayName } = this.editing;
  436. if (!validation.isLength(displayName, 2, 32))
  437. return new Toast({
  438. content:
  439. "Display name must have between 2 and 32 characters.",
  440. timeout: 8000
  441. });
  442. if (!validation.regex.ascii.test(displayName))
  443. return new Toast({
  444. content:
  445. "Invalid display name format. Only ASCII characters are allowed.",
  446. timeout: 8000
  447. });
  448. return this.socket.emit(
  449. "stations.updateDisplayName",
  450. this.editing._id,
  451. displayName,
  452. res => {
  453. if (res.status === "success") {
  454. if (this.station)
  455. this.station.displayName = displayName;
  456. else {
  457. this.$parent.stations.forEach((station, index) => {
  458. if (station._id === this.editing._id) {
  459. this.$parent.stations[
  460. index
  461. ].displayName = displayName;
  462. return displayName;
  463. }
  464. return false;
  465. });
  466. }
  467. }
  468. new Toast({ content: res.message, timeout: 8000 });
  469. }
  470. );
  471. },
  472. updateDescription() {
  473. const { description } = this.editing;
  474. if (!validation.isLength(description, 2, 200))
  475. return new Toast({
  476. content:
  477. "Description must have between 2 and 200 characters.",
  478. timeout: 8000
  479. });
  480. let characters = description.split("");
  481. characters = characters.filter(character => {
  482. return character.charCodeAt(0) === 21328;
  483. });
  484. if (characters.length !== 0)
  485. return new Toast({
  486. content: "Invalid description format.",
  487. timeout: 8000
  488. });
  489. return this.socket.emit(
  490. "stations.updateDescription",
  491. this.editing._id,
  492. description,
  493. res => {
  494. if (res.status === "success") {
  495. if (this.station)
  496. this.station.description = description;
  497. else {
  498. this.$parent.stations.forEach((station, index) => {
  499. if (station._id === this.editing._id) {
  500. this.$parent.stations[
  501. index
  502. ].description = description;
  503. return description;
  504. }
  505. return false;
  506. });
  507. }
  508. return new Toast({
  509. content: res.message,
  510. timeout: 4000
  511. });
  512. }
  513. return new Toast({ content: res.message, timeout: 8000 });
  514. }
  515. );
  516. },
  517. updatePrivacyLocal(privacy) {
  518. if (this.editing.privacy === privacy) return;
  519. this.editing.privacy = privacy;
  520. this.privacyDropdownActive = false;
  521. },
  522. updatePrivacy() {
  523. this.socket.emit(
  524. "stations.updatePrivacy",
  525. this.editing._id,
  526. this.editing.privacy,
  527. res => {
  528. if (res.status === "success") {
  529. if (this.station)
  530. this.station.privacy = this.editing.privacy;
  531. else {
  532. this.$parent.stations.forEach((station, index) => {
  533. if (station._id === this.editing._id) {
  534. this.$parent.stations[
  535. index
  536. ].privacy = this.editing.privacy;
  537. return this.editing.privacy;
  538. }
  539. return false;
  540. });
  541. }
  542. return Toast.methods.addToast(res.message, 4000);
  543. }
  544. return Toast.methods.addToast(res.message, 8000);
  545. }
  546. );
  547. },
  548. updateGenres() {
  549. this.socket.emit(
  550. "stations.updateGenres",
  551. this.editing._id,
  552. this.editing.genres,
  553. res => {
  554. if (res.status === "success") {
  555. const genres = JSON.parse(
  556. JSON.stringify(this.editing.genres)
  557. );
  558. if (this.station) this.station.genres = genres;
  559. this.$parent.stations.forEach((station, index) => {
  560. if (station._id === this.editing._id) {
  561. this.$parent.stations[index].genres = genres;
  562. return genres;
  563. }
  564. return false;
  565. });
  566. return new Toast({
  567. content: res.message,
  568. timeout: 4000
  569. });
  570. }
  571. return new Toast({ content: res.message, timeout: 8000 });
  572. }
  573. );
  574. },
  575. updateBlacklistedGenres() {
  576. this.socket.emit(
  577. "stations.updateBlacklistedGenres",
  578. this.editing._id,
  579. this.editing.blacklistedGenres,
  580. res => {
  581. if (res.status === "success") {
  582. const blacklistedGenres = JSON.parse(
  583. JSON.stringify(this.editing.blacklistedGenres)
  584. );
  585. if (this.station)
  586. this.station.blacklistedGenres = blacklistedGenres;
  587. this.$parent.stations.forEach((station, index) => {
  588. if (station._id === this.editing._id) {
  589. this.$parent.stations[
  590. index
  591. ].blacklistedGenres = blacklistedGenres;
  592. return blacklistedGenres;
  593. }
  594. return false;
  595. });
  596. return Toast.methods.addToast(res.message, 4000);
  597. }
  598. return Toast.methods.addToast(res.message, 8000);
  599. }
  600. );
  601. },
  602. updatePartyModeLocal(partyMode) {
  603. if (this.editing.partyMode === partyMode) return;
  604. this.editing.partyMode = partyMode;
  605. this.modeDropdownActive = false;
  606. },
  607. updatePartyMode() {
  608. this.socket.emit(
  609. "stations.updatePartyMode",
  610. this.editing._id,
  611. this.editing.partyMode,
  612. res => {
  613. if (res.status === "success") {
  614. if (this.station)
  615. this.station.partyMode = this.editing.partyMode;
  616. // if (this.station)
  617. // this.station.partyMode = this.editing.partyMode;
  618. // this.$parent.stations.forEach((station, index) => {
  619. // if (station._id === this.editing._id) {
  620. // this.$parent.stations[
  621. // index
  622. // ].partyMode = this.editing.partyMode;
  623. // return this.editing.partyMode;
  624. // }
  625. // return false;
  626. // });
  627. return new Toast({
  628. content: res.message,
  629. timeout: 4000
  630. });
  631. }
  632. return new Toast({ content: res.message, timeout: 8000 });
  633. }
  634. );
  635. },
  636. updateQueueLockLocal(locked) {
  637. if (this.editing.locked === locked) return;
  638. this.editing.locked = locked;
  639. this.queueLockDropdownActive = false;
  640. },
  641. updateQueueLock() {
  642. this.socket.emit("stations.toggleLock", this.editing._id, res => {
  643. console.log(res);
  644. if (res.status === "success") {
  645. if (this.station) this.station.locked = res.data;
  646. return Toast.methods.addToast(
  647. `Toggled queue lock succesfully to ${res.data}`,
  648. 4000
  649. );
  650. }
  651. return Toast.methods.addToast(
  652. "Failed to toggle queue lock.",
  653. 8000
  654. );
  655. });
  656. },
  657. deleteStation() {
  658. this.socket.emit("stations.remove", this.editing._id, res => {
  659. if (res.status === "success")
  660. this.closeModal({
  661. sector: "station",
  662. modal: "editStation"
  663. });
  664. return new Toast({ content: res.message, timeout: 8000 });
  665. });
  666. },
  667. blurGenreInput() {
  668. this.genreInputFocussed = false;
  669. },
  670. focusGenreInput() {
  671. this.genreInputFocussed = true;
  672. },
  673. keydownGenreInput() {
  674. clearTimeout(this.keydownGenreInputTimeout);
  675. this.keydownGenreInputTimeout = setTimeout(() => {
  676. if (this.genreInputValue.length > 1) {
  677. this.genreAutosuggestItems = this.genres.filter(genre => {
  678. return genre
  679. .toLowerCase()
  680. .startsWith(this.genreInputValue.toLowerCase());
  681. });
  682. } else this.genreAutosuggestItems = [];
  683. }, 1000);
  684. },
  685. focusGenreContainer() {
  686. this.genreAutosuggestContainerFocussed = true;
  687. },
  688. blurGenreContainer() {
  689. this.genreAutosuggestContainerFocussed = false;
  690. },
  691. selectGenreAutosuggest(value) {
  692. this.genreInputValue = value;
  693. },
  694. blurBlacklistGenreInput() {
  695. this.blacklistGenreInputFocussed = false;
  696. },
  697. focusBlacklistGenreInput() {
  698. this.blacklistGenreInputFocussed = true;
  699. },
  700. keydownBlacklistGenreInput() {
  701. clearTimeout(this.keydownBlacklistGenreInputTimeout);
  702. this.keydownBlacklistGenreInputTimeout = setTimeout(() => {
  703. console.log(123, this.blacklistGenreInputValue);
  704. if (this.blacklistGenreInputValue.length > 1) {
  705. console.log(333);
  706. this.blacklistGenreAutosuggestItems = this.genres.filter(
  707. genre => {
  708. console.log(444);
  709. return genre
  710. .toLowerCase()
  711. .startsWith(
  712. this.blacklistGenreInputValue.toLowerCase()
  713. );
  714. }
  715. );
  716. } else this.blacklistGenreAutosuggestItems = [];
  717. }, 1000);
  718. },
  719. focusBlacklistGenreContainer() {
  720. this.blacklistGenreAutosuggestContainerFocussed = true;
  721. },
  722. blurBlacklistGenreContainer() {
  723. this.blacklistGenreAutosuggestContainerFocussed = false;
  724. },
  725. selectBlacklistGenreAutosuggest(value) {
  726. this.blacklistGenreInputValue = value;
  727. },
  728. addTag(type) {
  729. if (type === "genres") {
  730. const genre = this.genreInputValue.toLowerCase().trim();
  731. if (this.editing.genres.indexOf(genre) !== -1)
  732. return Toast.methods.addToast("Genre already exists", 3000);
  733. if (genre) {
  734. this.editing.genres.push(genre);
  735. this.genreInputValue = "";
  736. return false;
  737. }
  738. return Toast.methods.addToast("Genre cannot be empty", 3000);
  739. }
  740. if (type === "blacklist-genres") {
  741. const genre = this.blacklistGenreInputValue
  742. .toLowerCase()
  743. .trim();
  744. if (this.editing.blacklistedGenres.indexOf(genre) !== -1)
  745. return Toast.methods.addToast(
  746. "Blacklist genre already exists",
  747. 3000
  748. );
  749. if (genre) {
  750. this.editing.blacklistedGenres.push(genre);
  751. this.blacklistGenreInputValue = "";
  752. return false;
  753. }
  754. return Toast.methods.addToast(
  755. "Blacklis genre cannot be empty",
  756. 3000
  757. );
  758. }
  759. return false;
  760. },
  761. removeTag(type, index) {
  762. if (type === "genres") this.editing.genres.splice(index, 1);
  763. else if (type === "blacklist-genres")
  764. this.editing.blacklistedGenres.splice(index, 1);
  765. },
  766. ...mapActions("modals", ["closeModal"])
  767. },
  768. components: { Modal }
  769. };
  770. </script>
  771. <style lang="scss">
  772. .edit-station-modal {
  773. .modal-card-title {
  774. text-align: center;
  775. margin-left: 24px;
  776. }
  777. .modal-card {
  778. width: 800px;
  779. height: 550px;
  780. .modal-card-body {
  781. padding: 16px;
  782. display: flex;
  783. }
  784. }
  785. }
  786. </style>
  787. <style lang="scss" scoped>
  788. @import "scss/variables/colors.scss";
  789. .section {
  790. border: 1px solid #a3e0ff;
  791. background-color: #f4f4f4;
  792. border-radius: 5px;
  793. padding: 16px;
  794. }
  795. .left-section {
  796. width: 595px;
  797. display: grid;
  798. gap: 16px;
  799. grid-template-rows: min-content min-content auto;
  800. .control {
  801. input {
  802. width: 100%;
  803. }
  804. .add-button {
  805. width: 32px;
  806. &.blue {
  807. background-color: $musareBlue !important;
  808. }
  809. &.red {
  810. background-color: $red !important;
  811. }
  812. i {
  813. font-size: 32px;
  814. }
  815. }
  816. }
  817. .col {
  818. > div {
  819. position: relative;
  820. }
  821. }
  822. .list-item-circle {
  823. width: 16px;
  824. height: 16px;
  825. border-radius: 8px;
  826. cursor: pointer;
  827. margin-right: 8px;
  828. float: left;
  829. -webkit-touch-callout: none;
  830. -webkit-user-select: none;
  831. -khtml-user-select: none;
  832. -moz-user-select: none;
  833. -ms-user-select: none;
  834. user-select: none;
  835. &.blue {
  836. background-color: $musareBlue;
  837. i {
  838. color: $musareBlue;
  839. }
  840. }
  841. &.red {
  842. background-color: $red;
  843. i {
  844. color: $red;
  845. }
  846. }
  847. i {
  848. font-size: 14px;
  849. margin-left: 1px;
  850. }
  851. }
  852. .list-item-circle:hover,
  853. .list-item-circle:focus {
  854. i {
  855. color: white;
  856. }
  857. }
  858. .list-item > p {
  859. line-height: 16px;
  860. word-wrap: break-word;
  861. width: calc(100% - 24px);
  862. left: 24px;
  863. float: left;
  864. margin-bottom: 8px;
  865. }
  866. .list-item:last-child > p {
  867. margin-bottom: 0;
  868. }
  869. .autosuggest-container {
  870. position: absolute;
  871. background: white;
  872. width: calc(100% + 1px);
  873. top: 57px;
  874. z-index: 200;
  875. overflow: auto;
  876. max-height: 100%;
  877. clear: both;
  878. .autosuggest-item {
  879. padding: 8px;
  880. display: block;
  881. border: 1px solid #dbdbdb;
  882. margin-top: -1px;
  883. line-height: 16px;
  884. cursor: pointer;
  885. -webkit-user-select: none;
  886. -ms-user-select: none;
  887. -moz-user-select: none;
  888. user-select: none;
  889. }
  890. .autosuggest-item:hover,
  891. .autosuggest-item:focus {
  892. background-color: #eee;
  893. }
  894. .autosuggest-item:first-child {
  895. border-top: none;
  896. }
  897. .autosuggest-item:last-child {
  898. border-radius: 0 0 3px 3px;
  899. }
  900. }
  901. }
  902. .right-section {
  903. width: 157px;
  904. margin-left: 16px;
  905. display: grid;
  906. gap: 16px;
  907. grid-template-rows: min-content min-content min-content;
  908. .button-wrapper {
  909. display: flex;
  910. flex-direction: column;
  911. }
  912. button {
  913. width: 100%;
  914. height: 36px;
  915. border: 0;
  916. border-radius: 10px;
  917. font-size: 18px;
  918. color: white;
  919. box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.25);
  920. display: block;
  921. text-align: center;
  922. justify-content: center;
  923. display: inline-flex;
  924. -ms-flex-align: center;
  925. align-items: center;
  926. -moz-user-select: none;
  927. user-select: none;
  928. cursor: pointer;
  929. margin-bottom: 16px;
  930. padding: 0;
  931. &.current {
  932. order: -1;
  933. }
  934. &.red {
  935. &.current,
  936. &:hover {
  937. background-color: $red;
  938. }
  939. background-color: rgba($red, 0.7);
  940. transition: all 0.3s ease-in-out;
  941. }
  942. &.green {
  943. &.current,
  944. &:hover {
  945. background-color: $green;
  946. }
  947. background-color: rgba($green, 0.7);
  948. transition: all 0.3s ease-in-out;
  949. }
  950. &.blue {
  951. &.current,
  952. &:hover {
  953. background-color: $musareBlue;
  954. }
  955. background-color: rgba($musareBlue, 0.7);
  956. transition: all 0.3s ease-in-out;
  957. }
  958. &.orange {
  959. &.current,
  960. &:hover {
  961. background-color: $light-orange;
  962. }
  963. background-color: rgba($light-orange, 0.7);
  964. transition: all 0.3s ease-in-out;
  965. }
  966. &.yellow {
  967. &.current,
  968. &:hover {
  969. background-color: $yellow;
  970. }
  971. background-color: rgba($yellow, 0.7);
  972. transition: all 0.3s ease-in-out;
  973. }
  974. i {
  975. font-size: 20px;
  976. margin-right: 4px;
  977. }
  978. }
  979. }
  980. .col {
  981. display: grid;
  982. grid-column-gap: 16px;
  983. }
  984. .col-1 {
  985. grid-template-columns: auto;
  986. }
  987. .col-2 {
  988. grid-template-columns: auto auto;
  989. }
  990. </style>