EditStation.vue 23 KB

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