EditSong.vue 41 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816
  1. <template>
  2. <div>
  3. <modal title="Edit Song" class="song-modal">
  4. <div slot="body">
  5. <div class="left-section">
  6. <div class="top-section">
  7. <div class="player-section">
  8. <div id="player"></div>
  9. <canvas
  10. id="durationCanvas"
  11. height="20"
  12. width="530"
  13. ></canvas>
  14. <div class="player-footer">
  15. <div class="player-footer-left">
  16. <i
  17. class="material-icons player-play-pause"
  18. v-on:click="settings('play')"
  19. v-if="video.paused"
  20. >play_arrow</i
  21. >
  22. <i
  23. class="material-icons player-play-pause"
  24. v-on:click="settings('pause')"
  25. v-if="!video.paused"
  26. >pause</i
  27. >
  28. <i
  29. class="material-icons player-stop"
  30. v-on:click="settings('stop')"
  31. >stop</i
  32. >
  33. <i
  34. class="material-icons player-fast-forward"
  35. v-on:click="
  36. settings('skipToLast10Secs')
  37. "
  38. >fast_forward</i
  39. >
  40. </div>
  41. <div class="player-footer-center">
  42. <img src="/assets/social/youtube.svg" />
  43. <span>
  44. <span>
  45. {{ youtubeVideoCurrentTime }}
  46. </span>
  47. /
  48. <span>
  49. {{ youtubeVideoDuration }}
  50. {{ youtubeVideoNote }}
  51. </span>
  52. </span>
  53. </div>
  54. <div class="player-footer-right">
  55. <input
  56. type="range"
  57. id="volumeSlider"
  58. min="0"
  59. max="100"
  60. class="active"
  61. v-on:change="changeVolume()"
  62. v-on:input="changeVolume()"
  63. />
  64. </div>
  65. </div>
  66. </div>
  67. <img
  68. class="thumbnail-preview"
  69. :src="editing.song.thumbnail"
  70. onerror="this.src='/assets/notes-transparent.png'"
  71. />
  72. </div>
  73. <div class="edit-section">
  74. <div class="control is-grouped">
  75. <div class="title-container">
  76. <label class="label">Title</label>
  77. <p class="control has-addons">
  78. <input
  79. class="input"
  80. type="text"
  81. v-model="editing.song.title"
  82. />
  83. <button
  84. class="button album-get-button"
  85. v-on:click="getAlbumData('title')"
  86. >
  87. <i class="material-icons album-get-icon"
  88. >album</i
  89. >
  90. </button>
  91. </p>
  92. </div>
  93. <div class="duration-container">
  94. <label class="label">Duration</label>
  95. <p class="control">
  96. <input
  97. class="input"
  98. type="text"
  99. v-model.number="editing.song.duration"
  100. />
  101. </p>
  102. </div>
  103. <div class="skip-duration-container">
  104. <label class="label">Skip duration</label>
  105. <p class="control">
  106. <input
  107. class="input"
  108. type="text"
  109. v-model.number="
  110. editing.song.skipDuration
  111. "
  112. />
  113. </p>
  114. </div>
  115. </div>
  116. <div class="control is-grouped">
  117. <div class="album-art-container">
  118. <label class="label">Album art</label>
  119. <p class="control has-addons">
  120. <input
  121. class="input"
  122. type="text"
  123. v-model="editing.song.thumbnail"
  124. />
  125. <button
  126. class="button album-get-button"
  127. v-on:click="getAlbumData('albumArt')"
  128. >
  129. <i class="material-icons album-get-icon"
  130. >album</i
  131. >
  132. </button>
  133. </p>
  134. </div>
  135. </div>
  136. <div class="control is-grouped">
  137. <div class="artists-container">
  138. <label class="label">Artists</label>
  139. <p class="control has-addons">
  140. <input
  141. class="input"
  142. type="text"
  143. id="new-artist"
  144. v-model="artistInputValue"
  145. v-on:blur="blurArtistInput()"
  146. v-on:focus="focusArtistInput()"
  147. v-on:keydown="keydownArtistInput()"
  148. />
  149. <button
  150. class="button album-get-button"
  151. v-on:click="getAlbumData('artists')"
  152. >
  153. <i class="material-icons album-get-icon"
  154. >album</i
  155. >
  156. </button>
  157. <button
  158. class="button is-info add-button"
  159. v-on:click="addTag('artists')"
  160. >
  161. <i class="material-icons">add</i>
  162. </button>
  163. </p>
  164. <div
  165. class="autosuggest-container"
  166. v-if="
  167. (artistInputFocussed ||
  168. artistAutosuggestContainerFocussed) &&
  169. artistAutosuggestItems.length > 0
  170. "
  171. @mouseover="focusArtistContainer()"
  172. @mouseleave="blurArtistContainer()"
  173. >
  174. <span
  175. class="autosuggest-item"
  176. tabindex="0"
  177. v-on:click="
  178. selectArtistAutosuggest(item)
  179. "
  180. v-for="(item,
  181. index) in artistAutosuggestItems"
  182. :key="index"
  183. >{{ item }}</span
  184. >
  185. </div>
  186. <div class="list-container">
  187. <div
  188. class="list-item"
  189. v-for="(artist, index) in editing.song
  190. .artists"
  191. :key="index"
  192. >
  193. <div
  194. class="list-item-circle"
  195. v-on:click="
  196. removeTag('artists', index)
  197. "
  198. >
  199. <i class="material-icons">close</i>
  200. </div>
  201. <p>{{ artist }}</p>
  202. </div>
  203. </div>
  204. </div>
  205. <div class="genres-container">
  206. <label class="label">
  207. <span>Genres</span>
  208. <i
  209. class="material-icons"
  210. @click="toggleGenreHelper"
  211. @dblclick="resetGenreHelper"
  212. >info</i
  213. >
  214. </label>
  215. <p class="control has-addons">
  216. <input
  217. class="input"
  218. type="text"
  219. id="new-genre"
  220. v-model="genreInputValue"
  221. v-on:blur="blurGenreInput()"
  222. v-on:focus="focusGenreInput()"
  223. v-on:keydown="keydownGenreInput()"
  224. />
  225. <button
  226. class="button album-get-button"
  227. v-on:click="getAlbumData('genres')"
  228. >
  229. <i class="material-icons album-get-icon"
  230. >album</i
  231. >
  232. </button>
  233. <button
  234. class="button is-info add-button"
  235. v-on:click="addTag('genres')"
  236. >
  237. <i class="material-icons">add</i>
  238. </button>
  239. </p>
  240. <div
  241. class="autosuggest-container"
  242. v-if="
  243. (genreInputFocussed ||
  244. genreAutosuggestContainerFocussed) &&
  245. genreAutosuggestItems.length > 0
  246. "
  247. @mouseover="focusGenreContainer()"
  248. @mouseleave="blurGenreContainer()"
  249. >
  250. <span
  251. class="autosuggest-item"
  252. tabindex="0"
  253. v-on:click="
  254. selectGenreAutosuggest(item)
  255. "
  256. v-for="(item,
  257. index) in genreAutosuggestItems"
  258. :key="index"
  259. >{{ item }}</span
  260. >
  261. </div>
  262. <div class="list-container">
  263. <div
  264. class="list-item"
  265. v-for="(genre, index) in editing.song
  266. .genres"
  267. :key="index"
  268. >
  269. <div
  270. class="list-item-circle"
  271. v-on:click="
  272. removeTag('genres', index)
  273. "
  274. >
  275. <i class="material-icons">close</i>
  276. </div>
  277. <p>{{ genre }}</p>
  278. </div>
  279. </div>
  280. </div>
  281. <div class="youtube-id-container">
  282. <label class="label">YouTube ID</label>
  283. <p class="control">
  284. <input
  285. class="input"
  286. type="text"
  287. v-model="editing.song.songId"
  288. />
  289. </p>
  290. </div>
  291. </div>
  292. </div>
  293. </div>
  294. <div class="right-section">
  295. <div class="api-section">
  296. <div
  297. class="selected-discogs-info"
  298. v-if="!editing.song.discogs"
  299. >
  300. <p class="selected-discogs-info-none">None</p>
  301. </div>
  302. <div
  303. class="selected-discogs-info"
  304. v-if="editing.song.discogs"
  305. >
  306. <div class="top-container">
  307. <img
  308. :src="editing.song.discogs.album.albumArt"
  309. />
  310. <div class="right-container">
  311. <p class="album-title">
  312. {{ editing.song.discogs.album.title }}
  313. </p>
  314. <div class="bottom-row">
  315. <p class="type-year">
  316. <span>{{
  317. editing.song.discogs.album.type
  318. }}</span>
  319. <span>{{
  320. editing.song.discogs.album.year
  321. }}</span>
  322. </p>
  323. </div>
  324. </div>
  325. </div>
  326. <div class="bottom-container">
  327. <p class="bottom-container-field">
  328. Artists:
  329. <span>{{
  330. editing.song.discogs.album.artists.join(
  331. ", "
  332. )
  333. }}</span>
  334. </p>
  335. <p class="bottom-container-field">
  336. Genres:
  337. <span>{{
  338. editing.song.discogs.album.genres.join(
  339. ", "
  340. )
  341. }}</span>
  342. </p>
  343. <p class="bottom-container-field">
  344. Data quality:
  345. <span>{{
  346. editing.song.discogs.dataQuality
  347. }}</span>
  348. </p>
  349. <p class="bottom-container-field">
  350. Track:
  351. <span
  352. >{{
  353. editing.song.discogs.track.position
  354. }}.
  355. {{
  356. editing.song.discogs.track.title
  357. }}</span
  358. >
  359. </p>
  360. </div>
  361. </div>
  362. <p class="control is-expanded">
  363. <label class="label">Search query</label>
  364. <input
  365. class="input"
  366. type="text"
  367. v-model="discogsQuery"
  368. @change="onDiscogsQueryChange"
  369. />
  370. </p>
  371. <button
  372. class="button is-info is-fullwidth"
  373. v-on:click="searchDiscogsForPage(1)"
  374. >
  375. Search
  376. </button>
  377. <label
  378. class="label"
  379. v-if="discogs.apiResults.length > 0"
  380. >API results</label
  381. >
  382. <div
  383. class="api-results-container"
  384. v-if="discogs.apiResults.length > 0"
  385. >
  386. <div
  387. class="api-result"
  388. v-for="(result, index) in discogs.apiResults"
  389. :key="index"
  390. >
  391. <div class="top-container">
  392. <img :src="result.album.albumArt" />
  393. <div class="right-container">
  394. <p class="album-title">
  395. {{ result.album.title }}
  396. </p>
  397. <div class="bottom-row">
  398. <img
  399. src="/assets/arrow_up.svg"
  400. v-if="result.expanded"
  401. v-on:click="
  402. toggleAPIResult(index)
  403. "
  404. />
  405. <img
  406. src="/assets/arrow_down.svg"
  407. v-if="!result.expanded"
  408. v-on:click="
  409. toggleAPIResult(index)
  410. "
  411. />
  412. <p class="type-year">
  413. <span>{{
  414. result.album.type
  415. }}</span>
  416. <span>{{
  417. result.album.year
  418. }}</span>
  419. </p>
  420. </div>
  421. </div>
  422. </div>
  423. <div
  424. class="bottom-container"
  425. v-if="result.expanded"
  426. >
  427. <p class="bottom-container-field">
  428. Artists:
  429. <span>{{
  430. result.album.artists.join(", ")
  431. }}</span>
  432. </p>
  433. <p class="bottom-container-field">
  434. Genres:
  435. <span>{{
  436. result.album.genres.join(", ")
  437. }}</span>
  438. </p>
  439. <p class="bottom-container-field">
  440. Data quality:
  441. <span>{{ result.dataQuality }}</span>
  442. </p>
  443. <div class="tracks">
  444. <div
  445. class="track"
  446. tabindex="0"
  447. v-for="(track,
  448. trackIndex) in result.tracks"
  449. :key="trackIndex"
  450. v-on:click="
  451. selectTrack(index, trackIndex)
  452. "
  453. >
  454. <span>{{ track.position }}.</span>
  455. <p>{{ track.title }}</p>
  456. </div>
  457. </div>
  458. </div>
  459. </div>
  460. </div>
  461. <button
  462. v-if="
  463. discogs.apiResults.length > 0 &&
  464. !discogs.disableLoadMore &&
  465. discogs.page < discogs.pages
  466. "
  467. class="button is-fullwidth is-info discogs-load-more"
  468. @click="loadNextDiscogsPage()"
  469. >
  470. Load more...
  471. </button>
  472. </div>
  473. </div>
  474. </div>
  475. <div slot="footer" class="footer-buttons">
  476. <button
  477. class="button is-success"
  478. v-on:click="save(editing.song, false)"
  479. >
  480. <i class="material-icons save-changes">done</i>
  481. <span>&nbsp;Save</span>
  482. </button>
  483. <button
  484. class="button is-success"
  485. v-on:click="save(editing.song, true)"
  486. >
  487. <i class="material-icons save-changes">done</i>
  488. <span>&nbsp;Save and close</span>
  489. </button>
  490. <button
  491. class="button is-danger"
  492. v-on:click="
  493. closeModal({ sector: 'admin', modal: 'editSong' })
  494. "
  495. >
  496. <span>&nbsp;Close</span>
  497. </button>
  498. </div>
  499. </modal>
  500. <div
  501. id="genre-helper-container"
  502. v-bind:style="{
  503. width: genreHelper.width + 'px',
  504. height: genreHelper.height + 'px',
  505. top: genreHelper.top + 'px',
  506. left: genreHelper.left + 'px'
  507. }"
  508. v-if="genreHelper.shown"
  509. @mousedown="onResizeGenreHelper"
  510. >
  511. <div
  512. class="genre-helper-header"
  513. @mousedown="onDragGenreHelper"
  514. ></div>
  515. <div class="genre-helper-body">
  516. <span>Blues</span><span>Country</span><span>Disco</span
  517. ><span>Funk</span><span>Hip-Hop</span><span>Jazz</span
  518. ><span>Metal</span><span>Oldies</span><span>Other</span
  519. ><span>Pop</span><span>Rap</span><span>Reggae</span
  520. ><span>Rock</span><span>Techno</span><span>Trance</span
  521. ><span>Classical</span><span>Instrumental</span
  522. ><span>House</span><span>Electronic</span
  523. ><span>Christian Rap</span><span>Lo-Fi</span><span>Musical</span
  524. ><span>Rock 'n' Roll</span><span>Opera</span
  525. ><span>Drum & Bass</span><span>Club-House</span
  526. ><span>Indie</span><span>Heavy Metal</span
  527. ><span>Christian rock</span><span>Dubstep</span>
  528. </div>
  529. </div>
  530. </div>
  531. </template>
  532. <script>
  533. import { mapState, mapActions } from "vuex";
  534. import { Toast } from "vue-roaster";
  535. import io from "../../io";
  536. import validation from "../../validation";
  537. import Modal from "./Modal.vue";
  538. export default {
  539. components: { Modal },
  540. data() {
  541. return {
  542. discogsQuery: "",
  543. youtubeVideoDuration: 0.0,
  544. youtubeVideoCurrentTime: 0.0,
  545. youtubeVideoNote: "",
  546. useHTTPS: false,
  547. discogs: {
  548. apiResults: [],
  549. page: 1,
  550. pages: 1,
  551. disableLoadMore: false
  552. },
  553. artistInputValue: "",
  554. genreInputValue: "",
  555. artistInputFocussed: false,
  556. genreInputFocussed: false,
  557. genreAutosuggestContainerFocussed: false,
  558. artistAutosuggestContainerFocussed: false,
  559. keydownArtistInputTimeout: 0,
  560. keydownGenreInputTimeout: 0,
  561. artistAutosuggestItems: [],
  562. genreAutosuggestItems: [],
  563. genreHelper: {
  564. width: 200,
  565. height: 200,
  566. top: 0,
  567. left: 0,
  568. shown: false,
  569. pos1: 0,
  570. pos2: 0,
  571. pos3: 0,
  572. pos4: 0
  573. },
  574. genres: [
  575. "Blues",
  576. "Country",
  577. "Disco",
  578. "Funk",
  579. "Hip-Hop",
  580. "Jazz",
  581. "Metal",
  582. "Oldies",
  583. "Other",
  584. "Pop",
  585. "Rap",
  586. "Reggae",
  587. "Rock",
  588. "Techno",
  589. "Trance",
  590. "Classical",
  591. "Instrumental",
  592. "House",
  593. "Electronic",
  594. "Christian Rap",
  595. "Lo-Fi",
  596. "Musical",
  597. "Rock 'n' Roll",
  598. "Opera",
  599. "Drum & Bass",
  600. "Club-House",
  601. "Indie",
  602. "Heavy Metal",
  603. "Christian rock",
  604. "Dubstep"
  605. ]
  606. };
  607. },
  608. computed: {
  609. ...mapState("admin/songs", {
  610. video: state => state.video,
  611. editing: state => state.editing,
  612. songs: state => state.songs
  613. }),
  614. ...mapState("modals", {
  615. modals: state => state.modals.admin
  616. })
  617. },
  618. watch: {
  619. /* eslint-disable */
  620. "editing.song.duration": function() {
  621. this.drawCanvas();
  622. },
  623. "editing.song.skipDuration": function() {
  624. this.drawCanvas();
  625. }
  626. /* eslint-enable */
  627. },
  628. methods: {
  629. save(songToCopy, close) {
  630. const song = JSON.parse(JSON.stringify(songToCopy));
  631. if (!song.title)
  632. return Toast.methods.addToast(
  633. "Please fill in all fields",
  634. 8000
  635. );
  636. if (!song.thumbnail)
  637. return Toast.methods.addToast(
  638. "Please fill in all fields",
  639. 8000
  640. );
  641. // Duration
  642. if (
  643. Number(song.skipDuration) + Number(song.duration) >
  644. this.youtubeVideoDuration
  645. ) {
  646. return Toast.methods.addToast(
  647. "Duration can't be higher than the length of the video",
  648. 8000
  649. );
  650. }
  651. // Title
  652. if (!validation.isLength(song.title, 1, 100))
  653. return Toast.methods.addToast(
  654. "Title must have between 1 and 100 characters.",
  655. 8000
  656. );
  657. /* if (!validation.regex.ascii.test(song.title))
  658. return Toast.methods.addToast(
  659. "Invalid title format. Only ascii characters are allowed.",
  660. 8000
  661. ); */
  662. // Artists
  663. if (song.artists.length < 1 || song.artists.length > 10)
  664. return Toast.methods.addToast(
  665. "Invalid artists. You must have at least 1 artist and a maximum of 10 artists.",
  666. 8000
  667. );
  668. let error;
  669. song.artists.forEach(artist => {
  670. if (!validation.isLength(artist, 1, 32)) {
  671. error = "Artist must have between 1 and 32 characters.";
  672. return error;
  673. }
  674. if (!validation.regex.ascii.test(artist)) {
  675. error =
  676. "Invalid artist format. Only ascii characters are allowed.";
  677. return error;
  678. }
  679. if (artist === "NONE") {
  680. error =
  681. 'Invalid artist format. Artists are not allowed to be named "NONE".';
  682. return error;
  683. }
  684. return false;
  685. });
  686. if (error) return Toast.methods.addToast(error, 8000);
  687. // Genres
  688. /* error = undefined;
  689. song.genres.forEach(genre => {
  690. if (!validation.isLength(genre, 1, 16)) {
  691. error = "Genre must have between 1 and 16 characters.";
  692. return error;
  693. }
  694. if (!validation.regex.azAZ09_.test(genre)) {
  695. error =
  696. "Invalid genre format. Only ascii characters are allowed.";
  697. return error;
  698. }
  699. return false;
  700. });
  701. if (error) return Toast.methods.addToast(error, 8000); */
  702. // Thumbnail
  703. if (!validation.isLength(song.thumbnail, 8, 256))
  704. return Toast.methods.addToast(
  705. "Thumbnail must have between 8 and 256 characters.",
  706. 8000
  707. );
  708. if (this.useHTTPS && song.thumbnail.indexOf("https://") !== 0) {
  709. return Toast.methods.addToast(
  710. 'Thumbnail must start with "https://".',
  711. 8000
  712. );
  713. }
  714. if (
  715. !this.useHTTPS &&
  716. (song.thumbnail.indexOf("http://") !== 0 &&
  717. song.thumbnail.indexOf("https://") !== 0)
  718. ) {
  719. return Toast.methods.addToast(
  720. 'Thumbnail must start with "http://".',
  721. 8000
  722. );
  723. }
  724. return this.socket.emit(
  725. `${this.editing.type}.update`,
  726. song._id,
  727. song,
  728. res => {
  729. Toast.methods.addToast(res.message, 4000);
  730. if (res.status === "success") {
  731. this.songs.forEach(originalSong => {
  732. const updatedSong = song;
  733. if (originalSong._id === updatedSong._id) {
  734. Object.keys(originalSong).forEach(n => {
  735. updatedSong[n] = originalSong[n];
  736. return originalSong[n];
  737. });
  738. }
  739. });
  740. }
  741. if (close)
  742. this.closeModal({
  743. sector: "admin",
  744. modal: "editSong"
  745. });
  746. }
  747. );
  748. },
  749. toggleAPIResult(index) {
  750. const apiResult = this.discogs.apiResults[index];
  751. if (apiResult.expanded === true) apiResult.expanded = false;
  752. else if (apiResult.gotMoreInfo === true) apiResult.expanded = true;
  753. else {
  754. fetch(apiResult.album.resourceUrl)
  755. .then(response => {
  756. return response.json();
  757. })
  758. .then(data => {
  759. apiResult.album.artists = [];
  760. apiResult.album.artistIds = [];
  761. const artistRegex = new RegExp(" \\([0-9]+\\)$");
  762. apiResult.dataQuality = data.data_quality;
  763. data.artists.forEach(artist => {
  764. apiResult.album.artists.push(
  765. artist.name.replace(artistRegex, "")
  766. );
  767. apiResult.album.artistIds.push(artist.id);
  768. });
  769. apiResult.tracks = data.tracklist.map(track => {
  770. return {
  771. position: track.position,
  772. title: track.title
  773. };
  774. });
  775. apiResult.expanded = true;
  776. apiResult.gotMoreInfo = true;
  777. });
  778. }
  779. },
  780. getAlbumData(type) {
  781. if (!this.editing.song.discogs) return;
  782. if (type === "title")
  783. this.updateSongField({
  784. field: "title",
  785. value: this.editing.song.discogs.track.title
  786. });
  787. if (type === "albumArt")
  788. this.updateSongField({
  789. field: "thumbnail",
  790. value: this.editing.song.discogs.album.albumArt
  791. });
  792. if (type === "genres")
  793. this.updateSongField({
  794. field: "genres",
  795. value: this.editing.song.discogs.album.genres
  796. });
  797. if (type === "artists")
  798. this.updateSongField({
  799. field: "artists",
  800. value: this.editing.song.discogs.album.artists
  801. });
  802. },
  803. searchDiscogsForPage(page) {
  804. const query = this.discogsQuery;
  805. this.socket.emit("apis.searchDiscogs", query, page, res => {
  806. if (res.status === "success") {
  807. if (page === 1)
  808. Toast.methods.addToast(
  809. `Successfully searched. Got ${res.results.length} results.`,
  810. 4000
  811. );
  812. else
  813. Toast.methods.addToast(
  814. `Successfully got ${res.results.length} more results.`,
  815. 4000
  816. );
  817. if (page === 1) {
  818. this.discogs.apiResults = [];
  819. }
  820. this.discogs.pages = res.pages;
  821. this.discogs.apiResults = this.discogs.apiResults.concat(
  822. res.results.map(result => {
  823. const type =
  824. result.type.charAt(0).toUpperCase() +
  825. result.type.slice(1);
  826. return {
  827. expanded: false,
  828. gotMoreInfo: false,
  829. album: {
  830. id: result.id,
  831. title: result.title,
  832. type,
  833. year: result.year,
  834. genres: result.genre,
  835. albumArt: result.cover_image,
  836. resourceUrl: result.resource_url
  837. }
  838. };
  839. })
  840. );
  841. this.discogs.page = page;
  842. this.discogs.disableLoadMore = false;
  843. } else Toast.methods.addToast(res.message, 8000);
  844. });
  845. },
  846. loadNextDiscogsPage() {
  847. this.discogs.disableLoadMore = true;
  848. this.searchDiscogsForPage(this.discogs.page + 1);
  849. },
  850. onDiscogsQueryChange() {
  851. this.discogs.page = 1;
  852. this.discogs.pages = 1;
  853. this.discogs.apiResults = [];
  854. this.discogs.disableLoadMore = false;
  855. },
  856. selectTrack(apiResultIndex, trackIndex) {
  857. const apiResult = JSON.parse(
  858. JSON.stringify(this.discogs.apiResults[apiResultIndex])
  859. );
  860. apiResult.track = apiResult.tracks[trackIndex];
  861. delete apiResult.tracks;
  862. delete apiResult.expanded;
  863. delete apiResult.gotMoreInfo;
  864. this.selectDiscogsInfo(apiResult);
  865. },
  866. blurArtistInput() {
  867. this.artistInputFocussed = false;
  868. },
  869. focusArtistInput() {
  870. this.artistInputFocussed = true;
  871. },
  872. blurArtistContainer() {
  873. this.artistAutosuggestContainerFocussed = false;
  874. },
  875. focusArtistContainer() {
  876. this.artistAutosuggestContainerFocussed = true;
  877. },
  878. keydownArtistInput() {
  879. clearTimeout(this.keydownArtistInputTimeout);
  880. this.keydownArtistInputTimeout = setTimeout(() => {
  881. // Do things here to query the artist
  882. }, 1000);
  883. },
  884. selectArtistAutosuggest(value) {
  885. this.artistInputValue = value;
  886. },
  887. blurGenreInput() {
  888. this.genreInputFocussed = false;
  889. },
  890. focusGenreInput() {
  891. this.genreInputFocussed = true;
  892. },
  893. blurGenreContainer() {
  894. this.genreAutosuggestContainerFocussed = false;
  895. },
  896. focusGenreContainer() {
  897. this.genreAutosuggestContainerFocussed = true;
  898. },
  899. keydownGenreInput() {
  900. clearTimeout(this.keydownGenreInputTimeout);
  901. this.keydownGenreInputTimeout = setTimeout(() => {
  902. if (this.genreInputValue.length > 1) {
  903. this.genreAutosuggestItems = this.genres.filter(genre => {
  904. return genre
  905. .toLowerCase()
  906. .startsWith(this.genreInputValue.toLowerCase());
  907. });
  908. } else this.genreAutosuggestItems = [];
  909. }, 1000);
  910. },
  911. selectGenreAutosuggest(value) {
  912. this.genreInputValue = value;
  913. },
  914. settings(type) {
  915. switch (type) {
  916. default:
  917. break;
  918. case "stop":
  919. this.stopVideo();
  920. this.pauseVideo(true);
  921. break;
  922. case "pause":
  923. this.pauseVideo(true);
  924. break;
  925. case "play":
  926. this.pauseVideo(false);
  927. break;
  928. case "skipToLast10Secs":
  929. if (this.video.paused) this.pauseVideo(false);
  930. this.video.player.seekTo(
  931. this.editing.song.duration -
  932. 10 +
  933. this.editing.song.skipDuration
  934. );
  935. break;
  936. }
  937. },
  938. changeVolume() {
  939. const volume = document.getElementById("volumeSlider").value;
  940. localStorage.setItem("volume", volume);
  941. this.video.player.setVolume(volume);
  942. if (volume > 0) this.video.player.unMute();
  943. },
  944. addTag(type) {
  945. if (type === "genres") {
  946. const genre = document
  947. .getElementById("new-genre")
  948. .value.toLowerCase()
  949. .trim();
  950. if (this.editing.song.genres.indexOf(genre) !== -1)
  951. return Toast.methods.addToast("Genre already exists", 3000);
  952. if (genre) {
  953. this.editing.song.genres.push(genre);
  954. document.getElementById("new-genre").value = "";
  955. return false;
  956. }
  957. return Toast.methods.addToast("Genre cannot be empty", 3000);
  958. }
  959. if (type === "artists") {
  960. const artist = document.getElementById("new-artist").value;
  961. if (this.editing.song.artists.indexOf(artist) !== -1)
  962. return Toast.methods.addToast(
  963. "Artist already exists",
  964. 3000
  965. );
  966. if (document.getElementById("new-artist").value !== "") {
  967. this.editing.song.artists.push(artist);
  968. document.getElementById("new-artist").value = "";
  969. return false;
  970. }
  971. return Toast.methods.addToast("Artist cannot be empty", 3000);
  972. }
  973. return false;
  974. },
  975. removeTag(type, index) {
  976. if (type === "genres") this.editing.song.genres.splice(index, 1);
  977. else if (type === "artists")
  978. this.editing.song.artists.splice(index, 1);
  979. },
  980. drawCanvas() {
  981. const canvasElement = document.getElementById("durationCanvas");
  982. const ctx = canvasElement.getContext("2d");
  983. const videoDuration = Number(this.youtubeVideoDuration);
  984. const skipDuration = Number(this.editing.song.skipDuration);
  985. const duration = Number(this.editing.song.duration);
  986. const afterDuration = videoDuration - (skipDuration + duration);
  987. const width = 530;
  988. const currentTime = this.video.player.getCurrentTime();
  989. const widthSkipDuration = (skipDuration / videoDuration) * width;
  990. const widthDuration = (duration / videoDuration) * width;
  991. const widthAfterDuration = (afterDuration / videoDuration) * width;
  992. const widthCurrentTime = (currentTime / videoDuration) * width;
  993. const skipDurationColor = "#F42003";
  994. const durationColor = "#03A9F4";
  995. const afterDurationColor = "#41E841";
  996. const currentDurationColor = "#3b25e8";
  997. ctx.fillStyle = skipDurationColor;
  998. ctx.fillRect(0, 0, widthSkipDuration, 20);
  999. ctx.fillStyle = durationColor;
  1000. ctx.fillRect(widthSkipDuration, 0, widthDuration, 20);
  1001. ctx.fillStyle = afterDurationColor;
  1002. ctx.fillRect(
  1003. widthSkipDuration + widthDuration,
  1004. 0,
  1005. widthAfterDuration,
  1006. 20
  1007. );
  1008. ctx.fillStyle = currentDurationColor;
  1009. ctx.fillRect(widthCurrentTime, 0, 1, 20);
  1010. },
  1011. onDragGenreHelper(e) {
  1012. const e1 = e || window.event;
  1013. e1.preventDefault();
  1014. this.genreHelper.pos3 = e1.clientX;
  1015. this.genreHelper.pos4 = e1.clientY;
  1016. document.onmousemove = e => {
  1017. const e2 = e || window.event;
  1018. e2.preventDefault();
  1019. // calculate the new cursor position:
  1020. this.genreHelper.pos1 = this.genreHelper.pos3 - e.clientX;
  1021. this.genreHelper.pos2 = this.genreHelper.pos4 - e.clientY;
  1022. this.genreHelper.pos3 = e.clientX;
  1023. this.genreHelper.pos4 = e.clientY;
  1024. // set the element's new position:
  1025. this.genreHelper.top =
  1026. this.genreHelper.top - this.genreHelper.pos2;
  1027. this.genreHelper.left =
  1028. this.genreHelper.left - this.genreHelper.pos1;
  1029. };
  1030. document.onmouseup = () => {
  1031. document.onmouseup = null;
  1032. document.onmousemove = null;
  1033. this.saveGenreHelper();
  1034. };
  1035. },
  1036. onResizeGenreHelper(e) {
  1037. if (e.target.id !== "genre-helper-container") return;
  1038. document.onmouseup = () => {
  1039. document.onmouseup = null;
  1040. const { height, width } = e.target.style;
  1041. this.genreHelper.height = Number(
  1042. height
  1043. .split("")
  1044. .splice(0, height.length - 2)
  1045. .join("")
  1046. );
  1047. this.genreHelper.width = Number(
  1048. width
  1049. .split("")
  1050. .splice(0, width.length - 2)
  1051. .join("")
  1052. );
  1053. this.saveGenreHelper();
  1054. };
  1055. },
  1056. toggleGenreHelper() {
  1057. this.genreHelper.shown = !this.genreHelper.shown;
  1058. this.saveGenreHelper();
  1059. },
  1060. resetGenreHelper() {
  1061. this.genreHelper.top = 0;
  1062. this.genreHelper.left = 0;
  1063. this.genreHelper.width = 200;
  1064. this.genreHelper.height = 200;
  1065. this.saveGenreHelper();
  1066. },
  1067. saveGenreHelper() {
  1068. localStorage.setItem(
  1069. "genreHelper",
  1070. JSON.stringify({
  1071. height: this.genreHelper.height,
  1072. width: this.genreHelper.width,
  1073. top: this.genreHelper.top,
  1074. left: this.genreHelper.left,
  1075. shown: this.genreHelper.shown
  1076. })
  1077. );
  1078. },
  1079. ...mapActions("admin/songs", [
  1080. "stopVideo",
  1081. "loadVideoById",
  1082. "pauseVideo",
  1083. "getCurrentTime",
  1084. "editSong",
  1085. "updateSongField",
  1086. "selectDiscogsInfo"
  1087. ]),
  1088. ...mapActions("modals", ["closeModal"])
  1089. },
  1090. mounted() {
  1091. // if (this.modals.editSong = false) this.video.player.stopVideo();
  1092. // this.loadVideoById(
  1093. // this.editing.song.songId,
  1094. // this.editing.song.skipDuration
  1095. // );
  1096. if (localStorage.genreHelper) {
  1097. const genreHelper = JSON.parse(localStorage.getItem("genreHelper"));
  1098. this.genreHelper.height = genreHelper.height;
  1099. this.genreHelper.width = genreHelper.width;
  1100. this.genreHelper.top = genreHelper.top;
  1101. this.genreHelper.left = genreHelper.left;
  1102. this.genreHelper.shown = genreHelper.shown;
  1103. }
  1104. this.discogsQuery = this.editing.song.title;
  1105. lofig.get("cookie.secure", res => {
  1106. this.useHTTPS = res;
  1107. });
  1108. io.getSocket(socket => {
  1109. this.socket = socket;
  1110. });
  1111. this.interval = setInterval(() => {
  1112. if (
  1113. this.video.paused === false &&
  1114. this.playerReady &&
  1115. this.video.player.getCurrentTime() -
  1116. this.editing.song.skipDuration >
  1117. this.editing.song.duration
  1118. ) {
  1119. this.video.paused = false;
  1120. this.video.player.stopVideo();
  1121. this.drawCanvas();
  1122. }
  1123. if (this.playerReady) {
  1124. this.youtubeVideoCurrentTime = this.video.player
  1125. .getCurrentTime()
  1126. .toFixed(3);
  1127. }
  1128. if (this.video.paused === false) this.drawCanvas();
  1129. }, 200);
  1130. this.video.player = new window.YT.Player("player", {
  1131. height: 298,
  1132. width: 530,
  1133. videoId: this.editing.song.songId,
  1134. playerVars: {
  1135. controls: 0,
  1136. iv_load_policy: 3,
  1137. rel: 0,
  1138. showinfo: 0,
  1139. autoplay: 1
  1140. },
  1141. startSeconds: this.editing.song.skipDuration,
  1142. events: {
  1143. onReady: () => {
  1144. let volume = parseInt(localStorage.getItem("volume"));
  1145. volume = typeof volume === "number" ? volume : 20;
  1146. console.log(`Seekto: ${this.editing.song.skipDuration}`);
  1147. this.video.player.seekTo(this.editing.song.skipDuration);
  1148. this.video.player.setVolume(volume);
  1149. if (volume > 0) this.video.player.unMute();
  1150. this.youtubeVideoDuration = this.video.player.getDuration();
  1151. this.youtubeVideoNote = "(~)";
  1152. this.playerReady = true;
  1153. this.drawCanvas();
  1154. },
  1155. onStateChange: event => {
  1156. this.drawCanvas();
  1157. if (event.data === 1) {
  1158. if (!this.video.autoPlayed) {
  1159. this.video.autoPlayed = true;
  1160. return this.video.player.stopVideo();
  1161. }
  1162. this.video.paused = false;
  1163. let youtubeDuration = this.video.player.getDuration();
  1164. this.youtubeVideoDuration = youtubeDuration;
  1165. this.youtubeVideoNote = "";
  1166. youtubeDuration -= this.editing.song.skipDuration;
  1167. if (this.editing.song.duration > youtubeDuration + 1) {
  1168. this.video.player.stopVideo();
  1169. this.video.paused = true;
  1170. return Toast.methods.addToast(
  1171. "Video can't play. Specified duration is bigger than the YouTube song duration.",
  1172. 4000
  1173. );
  1174. }
  1175. if (this.editing.song.duration <= 0) {
  1176. this.video.player.stopVideo();
  1177. this.video.paused = true;
  1178. return Toast.methods.addToast(
  1179. "Video can't play. Specified duration has to be more than 0 seconds.",
  1180. 4000
  1181. );
  1182. }
  1183. if (
  1184. this.video.player.getCurrentTime() <
  1185. this.editing.song.skipDuration
  1186. ) {
  1187. return this.video.player.seekTo(
  1188. this.editing.song.skipDuration
  1189. );
  1190. }
  1191. } else if (event.data === 2) {
  1192. this.video.paused = true;
  1193. }
  1194. return false;
  1195. }
  1196. }
  1197. });
  1198. let volume = parseInt(localStorage.getItem("volume"));
  1199. document.getElementById("volumeSlider").value = volume =
  1200. typeof volume === "number" ? volume : 20;
  1201. },
  1202. beforeDestroy() {
  1203. this.playerReady = false;
  1204. clearInterval(this.interval);
  1205. }
  1206. };
  1207. </script>
  1208. <style lang="scss">
  1209. @import "styles/global.scss";
  1210. #genre-helper-container {
  1211. background-color: white;
  1212. position: fixed;
  1213. z-index: 10000000;
  1214. resize: both;
  1215. overflow: auto;
  1216. border: 1px solid #d3d3d3;
  1217. min-height: 50px !important;
  1218. min-width: 50px !important;
  1219. .genre-helper-header {
  1220. cursor: move;
  1221. z-index: 100000001;
  1222. background-color: $musareBlue;
  1223. padding: 10px;
  1224. display: block;
  1225. height: 10px;
  1226. width: 100%;
  1227. }
  1228. .genre-helper-body {
  1229. display: flex;
  1230. flex-wrap: wrap;
  1231. justify-content: space-evenly;
  1232. span {
  1233. padding: 3px 6px;
  1234. }
  1235. }
  1236. }
  1237. .song-modal {
  1238. .modal-card-title {
  1239. text-align: center;
  1240. margin-left: 24px;
  1241. }
  1242. .modal-card {
  1243. width: 1160px;
  1244. height: 100%;
  1245. .modal-card-body {
  1246. padding: 16px;
  1247. }
  1248. }
  1249. }
  1250. </style>
  1251. <style lang="scss" scoped>
  1252. @import "styles/global.scss";
  1253. .modal-card-body > div {
  1254. display: flex;
  1255. height: 100%;
  1256. }
  1257. .left-section {
  1258. display: flex;
  1259. flex-direction: column;
  1260. margin-right: 16px;
  1261. .top-section {
  1262. display: flex;
  1263. .player-section {
  1264. width: 530px;
  1265. display: flex;
  1266. flex-direction: column;
  1267. .player-footer {
  1268. background-color: #f4f4f4;
  1269. border: 1px rgba(163, 224, 255, 0.75) solid;
  1270. border-radius: 0px 0px 5px 5px;
  1271. display: flex;
  1272. justify-content: space-between;
  1273. height: 54px;
  1274. > * {
  1275. width: 33.3%;
  1276. display: flex;
  1277. align-items: center;
  1278. }
  1279. .player-footer-left {
  1280. flex: 1;
  1281. .material-icons {
  1282. font-size: 38px;
  1283. cursor: pointer;
  1284. }
  1285. .player-play-pause {
  1286. color: $musareBlue;
  1287. }
  1288. .player-stop {
  1289. color: $red;
  1290. }
  1291. .player-fast-forward {
  1292. color: $green;
  1293. }
  1294. }
  1295. .player-footer-center {
  1296. justify-content: center;
  1297. align-items: center;
  1298. flex: 2;
  1299. font-size: 21px;
  1300. font-weight: 400;
  1301. img {
  1302. height: 21px;
  1303. margin-right: 12px;
  1304. filter: invert(26%) sepia(54%) saturate(6317%)
  1305. hue-rotate(2deg) brightness(92%) contrast(115%);
  1306. }
  1307. }
  1308. .player-footer-right {
  1309. justify-content: right;
  1310. flex: 1;
  1311. #volumeSlider {
  1312. width: 126px;
  1313. margin-right: 10px;
  1314. background-color: #f4f4f4;
  1315. }
  1316. }
  1317. }
  1318. }
  1319. .thumbnail-preview {
  1320. width: 189px;
  1321. height: 189px;
  1322. margin-left: 16px;
  1323. }
  1324. }
  1325. .edit-section {
  1326. width: 735px;
  1327. background-color: #f4f4f4;
  1328. border: 1px rgba(163, 224, 255, 0.75) solid;
  1329. margin-top: 16px;
  1330. flex: 1;
  1331. overflow: auto;
  1332. border-radius: 5px;
  1333. .album-get-button {
  1334. background-color: $purple;
  1335. color: white;
  1336. width: 32px;
  1337. text-align: center;
  1338. border-width: 0;
  1339. }
  1340. .add-button {
  1341. background-color: $musareBlue !important;
  1342. width: 32px;
  1343. i {
  1344. font-size: 32px;
  1345. }
  1346. }
  1347. > div {
  1348. margin: 16px;
  1349. }
  1350. input {
  1351. width: 100%;
  1352. }
  1353. .title-container {
  1354. width: calc((100% - 32px) / 2);
  1355. }
  1356. .duration-container {
  1357. margin-right: 16px;
  1358. margin-left: 16px;
  1359. width: calc((100% - 32px) / 4);
  1360. }
  1361. .skip-duration-container {
  1362. width: calc((100% - 32px) / 4);
  1363. }
  1364. .album-art-container {
  1365. width: 100%;
  1366. }
  1367. .artists-container {
  1368. width: calc((100% - 32px) / 3);
  1369. position: relative;
  1370. }
  1371. .genres-container {
  1372. width: calc((100% - 32px) / 3);
  1373. margin-left: 16px;
  1374. margin-right: 16px;
  1375. position: relative;
  1376. label {
  1377. display: flex;
  1378. i {
  1379. font-size: 15px;
  1380. align-self: center;
  1381. margin-left: 5px;
  1382. color: $musareBlue;
  1383. cursor: pointer;
  1384. -webkit-user-select: none;
  1385. -moz-user-select: none;
  1386. -ms-user-select: none;
  1387. user-select: none;
  1388. }
  1389. }
  1390. }
  1391. .youtube-id-container {
  1392. width: calc((100% - 32px) / 3);
  1393. }
  1394. .list-item-circle {
  1395. background-color: $musareBlue;
  1396. width: 16px;
  1397. height: 16px;
  1398. border-radius: 8px;
  1399. cursor: pointer;
  1400. margin-right: 8px;
  1401. float: left;
  1402. -webkit-touch-callout: none;
  1403. -webkit-user-select: none;
  1404. -khtml-user-select: none;
  1405. -moz-user-select: none;
  1406. -ms-user-select: none;
  1407. user-select: none;
  1408. i {
  1409. color: $musareBlue;
  1410. font-size: 14px;
  1411. margin-left: 1px;
  1412. }
  1413. }
  1414. .list-item-circle:hover,
  1415. .list-item-circle:focus {
  1416. i {
  1417. color: white;
  1418. }
  1419. }
  1420. .list-item > p {
  1421. line-height: 16px;
  1422. word-wrap: break-word;
  1423. width: calc(100% - 24px);
  1424. left: 24px;
  1425. float: left;
  1426. margin-bottom: 8px;
  1427. }
  1428. .list-item:last-child > p {
  1429. margin-bottom: 0;
  1430. }
  1431. .autosuggest-container {
  1432. position: absolute;
  1433. background: white;
  1434. width: calc(100% + 1px);
  1435. top: 57px;
  1436. z-index: 200;
  1437. overflow: auto;
  1438. max-height: 100%;
  1439. clear: both;
  1440. .autosuggest-item {
  1441. padding: 8px;
  1442. display: block;
  1443. border: 1px solid #dbdbdb;
  1444. margin-top: -1px;
  1445. line-height: 16px;
  1446. cursor: pointer;
  1447. -webkit-user-select: none;
  1448. -ms-user-select: none;
  1449. -moz-user-select: none;
  1450. user-select: none;
  1451. }
  1452. .autosuggest-item:hover,
  1453. .autosuggest-item:focus {
  1454. background-color: #eee;
  1455. }
  1456. .autosuggest-item:first-child {
  1457. border-top: none;
  1458. }
  1459. .autosuggest-item:last-child {
  1460. border-radius: 0 0 3px 3px;
  1461. }
  1462. }
  1463. }
  1464. }
  1465. .right-section {
  1466. display: flex;
  1467. flex-wrap: wrap;
  1468. .api-section {
  1469. width: 376px;
  1470. background-color: #f4f4f4;
  1471. border: 1px rgba(163, 224, 255, 0.75) solid;
  1472. border-radius: 5px;
  1473. padding: 16px;
  1474. overflow: auto;
  1475. height: 100%;
  1476. > label {
  1477. margin-top: 12px;
  1478. }
  1479. .top-container {
  1480. display: flex;
  1481. img {
  1482. height: 85px;
  1483. width: 85px;
  1484. }
  1485. .right-container {
  1486. padding: 8px;
  1487. display: flex;
  1488. flex-direction: column;
  1489. flex: 1;
  1490. .album-title {
  1491. flex: 1;
  1492. font-weight: 600;
  1493. }
  1494. .bottom-row {
  1495. display: flex;
  1496. flex-flow: row;
  1497. line-height: 15px;
  1498. img {
  1499. height: 15px;
  1500. align-self: end;
  1501. flex: 1;
  1502. user-select: none;
  1503. -moz-user-select: none;
  1504. -ms-user-select: none;
  1505. -webkit-user-select: none;
  1506. cursor: pointer;
  1507. }
  1508. p {
  1509. text-align: right;
  1510. }
  1511. .type-year {
  1512. font-size: 13px;
  1513. align-self: end;
  1514. }
  1515. }
  1516. }
  1517. }
  1518. .bottom-container {
  1519. padding: 12px;
  1520. .bottom-container-field {
  1521. line-height: 16px;
  1522. margin-bottom: 8px;
  1523. font-weight: 600;
  1524. span {
  1525. font-weight: 400;
  1526. }
  1527. }
  1528. .bottom-container-field:last-of-type {
  1529. margin-bottom: 0;
  1530. }
  1531. }
  1532. .selected-discogs-info {
  1533. background-color: white;
  1534. border: 1px solid $purple;
  1535. border-radius: 5px;
  1536. margin-bottom: 16px;
  1537. .selected-discogs-info-none {
  1538. font-size: 18px;
  1539. text-align: center;
  1540. }
  1541. .bottom-row > p {
  1542. flex: 1;
  1543. }
  1544. }
  1545. .api-result {
  1546. background-color: white;
  1547. border: 0.5px solid $musareBlue;
  1548. border-radius: 5px;
  1549. margin-bottom: 16px;
  1550. }
  1551. button {
  1552. background-color: $musareBlue !important;
  1553. }
  1554. .tracks {
  1555. margin-top: 12px;
  1556. .track:first-child {
  1557. margin-top: 0;
  1558. border-radius: 3px 3px 0 0;
  1559. }
  1560. .track:last-child {
  1561. border-radius: 0 0 3px 3px;
  1562. }
  1563. .track {
  1564. border: 0.5px solid black;
  1565. margin-top: -1px;
  1566. line-height: 16px;
  1567. display: flex;
  1568. cursor: pointer;
  1569. span {
  1570. font-weight: 600;
  1571. display: inline-block;
  1572. margin-top: 7px;
  1573. margin-bottom: 7px;
  1574. margin-left: 7px;
  1575. }
  1576. p {
  1577. display: inline-block;
  1578. margin: 7px;
  1579. flex: 1;
  1580. }
  1581. }
  1582. .track:hover,
  1583. .track:focus {
  1584. background-color: #f4f4f4;
  1585. }
  1586. }
  1587. .discogs-load-more {
  1588. margin-bottom: 8px;
  1589. }
  1590. }
  1591. }
  1592. .footer-buttons {
  1593. margin-left: auto;
  1594. margin-right: auto;
  1595. }
  1596. input[type="range"] {
  1597. -webkit-appearance: none;
  1598. width: 100%;
  1599. margin: 8.5px 0;
  1600. }
  1601. input[type="range"]:focus {
  1602. outline: none;
  1603. }
  1604. input[type="range"]::-webkit-slider-runnable-track {
  1605. width: 100%;
  1606. height: 3px;
  1607. cursor: pointer;
  1608. box-shadow: none;
  1609. background: #7e7e7e;
  1610. border-radius: none;
  1611. border: none;
  1612. }
  1613. input[type="range"]::-webkit-slider-thumb {
  1614. box-shadow: none;
  1615. border: none;
  1616. height: 20px;
  1617. width: 20px;
  1618. border-radius: 100px;
  1619. background: #03a9f4;
  1620. cursor: pointer;
  1621. -webkit-appearance: none;
  1622. margin-top: -8.5px;
  1623. }
  1624. input[type="range"]:focus::-webkit-slider-runnable-track {
  1625. background: #7e7e7e;
  1626. }
  1627. input[type="range"]::-moz-range-track {
  1628. width: 100%;
  1629. height: 3px;
  1630. cursor: pointer;
  1631. box-shadow: none;
  1632. background: #7e7e7e;
  1633. border-radius: none;
  1634. border: none;
  1635. }
  1636. input[type="range"]::-moz-range-thumb {
  1637. box-shadow: none;
  1638. border: none;
  1639. height: 20px;
  1640. width: 20px;
  1641. border-radius: 100px;
  1642. background: #03a9f4;
  1643. cursor: pointer;
  1644. }
  1645. input[type="range"]::-ms-track {
  1646. width: 100%;
  1647. height: 3px;
  1648. cursor: pointer;
  1649. background: transparent;
  1650. border-color: transparent;
  1651. color: transparent;
  1652. }
  1653. input[type="range"]::-ms-fill-lower {
  1654. background: #717171;
  1655. border: none;
  1656. border-radius: none;
  1657. box-shadow: none;
  1658. }
  1659. input[type="range"]::-ms-fill-upper {
  1660. background: #7e7e7e;
  1661. border: none;
  1662. border-radius: none;
  1663. box-shadow: none;
  1664. }
  1665. input[type="range"]::-ms-thumb {
  1666. box-shadow: none;
  1667. border: none;
  1668. height: 20px;
  1669. width: 20px;
  1670. border-radius: 100px;
  1671. background: #03a9f4;
  1672. cursor: pointer;
  1673. height: 3px;
  1674. }
  1675. input[type="range"]:focus::-ms-fill-lower {
  1676. background: #7e7e7e;
  1677. }
  1678. input[type="range"]:focus::-ms-fill-upper {
  1679. background: #7e7e7e;
  1680. }
  1681. </style>