EditSong.vue 41 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820
  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: JSON.parse(
  796. JSON.stringify(this.editing.song.discogs.album.genres)
  797. )
  798. });
  799. if (type === "artists")
  800. this.updateSongField({
  801. field: "artists",
  802. value: JSON.parse(
  803. JSON.stringify(this.editing.song.discogs.album.artists)
  804. )
  805. });
  806. },
  807. searchDiscogsForPage(page) {
  808. const query = this.discogsQuery;
  809. this.socket.emit("apis.searchDiscogs", query, page, res => {
  810. if (res.status === "success") {
  811. if (page === 1)
  812. Toast.methods.addToast(
  813. `Successfully searched. Got ${res.results.length} results.`,
  814. 4000
  815. );
  816. else
  817. Toast.methods.addToast(
  818. `Successfully got ${res.results.length} more results.`,
  819. 4000
  820. );
  821. if (page === 1) {
  822. this.discogs.apiResults = [];
  823. }
  824. this.discogs.pages = res.pages;
  825. this.discogs.apiResults = this.discogs.apiResults.concat(
  826. res.results.map(result => {
  827. const type =
  828. result.type.charAt(0).toUpperCase() +
  829. result.type.slice(1);
  830. return {
  831. expanded: false,
  832. gotMoreInfo: false,
  833. album: {
  834. id: result.id,
  835. title: result.title,
  836. type,
  837. year: result.year,
  838. genres: result.genre,
  839. albumArt: result.cover_image,
  840. resourceUrl: result.resource_url
  841. }
  842. };
  843. })
  844. );
  845. this.discogs.page = page;
  846. this.discogs.disableLoadMore = false;
  847. } else Toast.methods.addToast(res.message, 8000);
  848. });
  849. },
  850. loadNextDiscogsPage() {
  851. this.discogs.disableLoadMore = true;
  852. this.searchDiscogsForPage(this.discogs.page + 1);
  853. },
  854. onDiscogsQueryChange() {
  855. this.discogs.page = 1;
  856. this.discogs.pages = 1;
  857. this.discogs.apiResults = [];
  858. this.discogs.disableLoadMore = false;
  859. },
  860. selectTrack(apiResultIndex, trackIndex) {
  861. const apiResult = JSON.parse(
  862. JSON.stringify(this.discogs.apiResults[apiResultIndex])
  863. );
  864. apiResult.track = apiResult.tracks[trackIndex];
  865. delete apiResult.tracks;
  866. delete apiResult.expanded;
  867. delete apiResult.gotMoreInfo;
  868. this.selectDiscogsInfo(apiResult);
  869. },
  870. blurArtistInput() {
  871. this.artistInputFocussed = false;
  872. },
  873. focusArtistInput() {
  874. this.artistInputFocussed = true;
  875. },
  876. blurArtistContainer() {
  877. this.artistAutosuggestContainerFocussed = false;
  878. },
  879. focusArtistContainer() {
  880. this.artistAutosuggestContainerFocussed = true;
  881. },
  882. keydownArtistInput() {
  883. clearTimeout(this.keydownArtistInputTimeout);
  884. this.keydownArtistInputTimeout = setTimeout(() => {
  885. // Do things here to query the artist
  886. }, 1000);
  887. },
  888. selectArtistAutosuggest(value) {
  889. this.artistInputValue = value;
  890. },
  891. blurGenreInput() {
  892. this.genreInputFocussed = false;
  893. },
  894. focusGenreInput() {
  895. this.genreInputFocussed = true;
  896. },
  897. blurGenreContainer() {
  898. this.genreAutosuggestContainerFocussed = false;
  899. },
  900. focusGenreContainer() {
  901. this.genreAutosuggestContainerFocussed = true;
  902. },
  903. keydownGenreInput() {
  904. clearTimeout(this.keydownGenreInputTimeout);
  905. this.keydownGenreInputTimeout = setTimeout(() => {
  906. if (this.genreInputValue.length > 1) {
  907. this.genreAutosuggestItems = this.genres.filter(genre => {
  908. return genre
  909. .toLowerCase()
  910. .startsWith(this.genreInputValue.toLowerCase());
  911. });
  912. } else this.genreAutosuggestItems = [];
  913. }, 1000);
  914. },
  915. selectGenreAutosuggest(value) {
  916. this.genreInputValue = value;
  917. },
  918. settings(type) {
  919. switch (type) {
  920. default:
  921. break;
  922. case "stop":
  923. this.stopVideo();
  924. this.pauseVideo(true);
  925. break;
  926. case "pause":
  927. this.pauseVideo(true);
  928. break;
  929. case "play":
  930. this.pauseVideo(false);
  931. break;
  932. case "skipToLast10Secs":
  933. if (this.video.paused) this.pauseVideo(false);
  934. this.video.player.seekTo(
  935. this.editing.song.duration -
  936. 10 +
  937. this.editing.song.skipDuration
  938. );
  939. break;
  940. }
  941. },
  942. changeVolume() {
  943. const volume = document.getElementById("volumeSlider").value;
  944. localStorage.setItem("volume", volume);
  945. this.video.player.setVolume(volume);
  946. if (volume > 0) this.video.player.unMute();
  947. },
  948. addTag(type) {
  949. if (type === "genres") {
  950. const genre = document
  951. .getElementById("new-genre")
  952. .value.toLowerCase()
  953. .trim();
  954. if (this.editing.song.genres.indexOf(genre) !== -1)
  955. return Toast.methods.addToast("Genre already exists", 3000);
  956. if (genre) {
  957. this.editing.song.genres.push(genre);
  958. document.getElementById("new-genre").value = "";
  959. return false;
  960. }
  961. return Toast.methods.addToast("Genre cannot be empty", 3000);
  962. }
  963. if (type === "artists") {
  964. const artist = document.getElementById("new-artist").value;
  965. if (this.editing.song.artists.indexOf(artist) !== -1)
  966. return Toast.methods.addToast(
  967. "Artist already exists",
  968. 3000
  969. );
  970. if (document.getElementById("new-artist").value !== "") {
  971. this.editing.song.artists.push(artist);
  972. document.getElementById("new-artist").value = "";
  973. return false;
  974. }
  975. return Toast.methods.addToast("Artist cannot be empty", 3000);
  976. }
  977. return false;
  978. },
  979. removeTag(type, index) {
  980. if (type === "genres") this.editing.song.genres.splice(index, 1);
  981. else if (type === "artists")
  982. this.editing.song.artists.splice(index, 1);
  983. },
  984. drawCanvas() {
  985. const canvasElement = document.getElementById("durationCanvas");
  986. const ctx = canvasElement.getContext("2d");
  987. const videoDuration = Number(this.youtubeVideoDuration);
  988. const skipDuration = Number(this.editing.song.skipDuration);
  989. const duration = Number(this.editing.song.duration);
  990. const afterDuration = videoDuration - (skipDuration + duration);
  991. const width = 530;
  992. const currentTime = this.video.player.getCurrentTime();
  993. const widthSkipDuration = (skipDuration / videoDuration) * width;
  994. const widthDuration = (duration / videoDuration) * width;
  995. const widthAfterDuration = (afterDuration / videoDuration) * width;
  996. const widthCurrentTime = (currentTime / videoDuration) * width;
  997. const skipDurationColor = "#F42003";
  998. const durationColor = "#03A9F4";
  999. const afterDurationColor = "#41E841";
  1000. const currentDurationColor = "#3b25e8";
  1001. ctx.fillStyle = skipDurationColor;
  1002. ctx.fillRect(0, 0, widthSkipDuration, 20);
  1003. ctx.fillStyle = durationColor;
  1004. ctx.fillRect(widthSkipDuration, 0, widthDuration, 20);
  1005. ctx.fillStyle = afterDurationColor;
  1006. ctx.fillRect(
  1007. widthSkipDuration + widthDuration,
  1008. 0,
  1009. widthAfterDuration,
  1010. 20
  1011. );
  1012. ctx.fillStyle = currentDurationColor;
  1013. ctx.fillRect(widthCurrentTime, 0, 1, 20);
  1014. },
  1015. onDragGenreHelper(e) {
  1016. const e1 = e || window.event;
  1017. e1.preventDefault();
  1018. this.genreHelper.pos3 = e1.clientX;
  1019. this.genreHelper.pos4 = e1.clientY;
  1020. document.onmousemove = e => {
  1021. const e2 = e || window.event;
  1022. e2.preventDefault();
  1023. // calculate the new cursor position:
  1024. this.genreHelper.pos1 = this.genreHelper.pos3 - e.clientX;
  1025. this.genreHelper.pos2 = this.genreHelper.pos4 - e.clientY;
  1026. this.genreHelper.pos3 = e.clientX;
  1027. this.genreHelper.pos4 = e.clientY;
  1028. // set the element's new position:
  1029. this.genreHelper.top =
  1030. this.genreHelper.top - this.genreHelper.pos2;
  1031. this.genreHelper.left =
  1032. this.genreHelper.left - this.genreHelper.pos1;
  1033. };
  1034. document.onmouseup = () => {
  1035. document.onmouseup = null;
  1036. document.onmousemove = null;
  1037. this.saveGenreHelper();
  1038. };
  1039. },
  1040. onResizeGenreHelper(e) {
  1041. if (e.target.id !== "genre-helper-container") return;
  1042. document.onmouseup = () => {
  1043. document.onmouseup = null;
  1044. const { height, width } = e.target.style;
  1045. this.genreHelper.height = Number(
  1046. height
  1047. .split("")
  1048. .splice(0, height.length - 2)
  1049. .join("")
  1050. );
  1051. this.genreHelper.width = Number(
  1052. width
  1053. .split("")
  1054. .splice(0, width.length - 2)
  1055. .join("")
  1056. );
  1057. this.saveGenreHelper();
  1058. };
  1059. },
  1060. toggleGenreHelper() {
  1061. this.genreHelper.shown = !this.genreHelper.shown;
  1062. this.saveGenreHelper();
  1063. },
  1064. resetGenreHelper() {
  1065. this.genreHelper.top = 0;
  1066. this.genreHelper.left = 0;
  1067. this.genreHelper.width = 200;
  1068. this.genreHelper.height = 200;
  1069. this.saveGenreHelper();
  1070. },
  1071. saveGenreHelper() {
  1072. localStorage.setItem(
  1073. "genreHelper",
  1074. JSON.stringify({
  1075. height: this.genreHelper.height,
  1076. width: this.genreHelper.width,
  1077. top: this.genreHelper.top,
  1078. left: this.genreHelper.left,
  1079. shown: this.genreHelper.shown
  1080. })
  1081. );
  1082. },
  1083. ...mapActions("admin/songs", [
  1084. "stopVideo",
  1085. "loadVideoById",
  1086. "pauseVideo",
  1087. "getCurrentTime",
  1088. "editSong",
  1089. "updateSongField",
  1090. "selectDiscogsInfo"
  1091. ]),
  1092. ...mapActions("modals", ["closeModal"])
  1093. },
  1094. mounted() {
  1095. // if (this.modals.editSong = false) this.video.player.stopVideo();
  1096. // this.loadVideoById(
  1097. // this.editing.song.songId,
  1098. // this.editing.song.skipDuration
  1099. // );
  1100. if (localStorage.genreHelper) {
  1101. const genreHelper = JSON.parse(localStorage.getItem("genreHelper"));
  1102. this.genreHelper.height = genreHelper.height;
  1103. this.genreHelper.width = genreHelper.width;
  1104. this.genreHelper.top = genreHelper.top;
  1105. this.genreHelper.left = genreHelper.left;
  1106. this.genreHelper.shown = genreHelper.shown;
  1107. }
  1108. this.discogsQuery = this.editing.song.title;
  1109. lofig.get("cookie.secure", res => {
  1110. this.useHTTPS = res;
  1111. });
  1112. io.getSocket(socket => {
  1113. this.socket = socket;
  1114. });
  1115. this.interval = setInterval(() => {
  1116. if (
  1117. this.video.paused === false &&
  1118. this.playerReady &&
  1119. this.video.player.getCurrentTime() -
  1120. this.editing.song.skipDuration >
  1121. this.editing.song.duration
  1122. ) {
  1123. this.video.paused = false;
  1124. this.video.player.stopVideo();
  1125. this.drawCanvas();
  1126. }
  1127. if (this.playerReady) {
  1128. this.youtubeVideoCurrentTime = this.video.player
  1129. .getCurrentTime()
  1130. .toFixed(3);
  1131. }
  1132. if (this.video.paused === false) this.drawCanvas();
  1133. }, 200);
  1134. this.video.player = new window.YT.Player("player", {
  1135. height: 298,
  1136. width: 530,
  1137. videoId: this.editing.song.songId,
  1138. playerVars: {
  1139. controls: 0,
  1140. iv_load_policy: 3,
  1141. rel: 0,
  1142. showinfo: 0,
  1143. autoplay: 1
  1144. },
  1145. startSeconds: this.editing.song.skipDuration,
  1146. events: {
  1147. onReady: () => {
  1148. let volume = parseInt(localStorage.getItem("volume"));
  1149. volume = typeof volume === "number" ? volume : 20;
  1150. console.log(`Seekto: ${this.editing.song.skipDuration}`);
  1151. this.video.player.seekTo(this.editing.song.skipDuration);
  1152. this.video.player.setVolume(volume);
  1153. if (volume > 0) this.video.player.unMute();
  1154. this.youtubeVideoDuration = this.video.player.getDuration();
  1155. this.youtubeVideoNote = "(~)";
  1156. this.playerReady = true;
  1157. this.drawCanvas();
  1158. },
  1159. onStateChange: event => {
  1160. this.drawCanvas();
  1161. if (event.data === 1) {
  1162. if (!this.video.autoPlayed) {
  1163. this.video.autoPlayed = true;
  1164. return this.video.player.stopVideo();
  1165. }
  1166. this.video.paused = false;
  1167. let youtubeDuration = this.video.player.getDuration();
  1168. this.youtubeVideoDuration = youtubeDuration;
  1169. this.youtubeVideoNote = "";
  1170. youtubeDuration -= this.editing.song.skipDuration;
  1171. if (this.editing.song.duration > youtubeDuration + 1) {
  1172. this.video.player.stopVideo();
  1173. this.video.paused = true;
  1174. return Toast.methods.addToast(
  1175. "Video can't play. Specified duration is bigger than the YouTube song duration.",
  1176. 4000
  1177. );
  1178. }
  1179. if (this.editing.song.duration <= 0) {
  1180. this.video.player.stopVideo();
  1181. this.video.paused = true;
  1182. return Toast.methods.addToast(
  1183. "Video can't play. Specified duration has to be more than 0 seconds.",
  1184. 4000
  1185. );
  1186. }
  1187. if (
  1188. this.video.player.getCurrentTime() <
  1189. this.editing.song.skipDuration
  1190. ) {
  1191. return this.video.player.seekTo(
  1192. this.editing.song.skipDuration
  1193. );
  1194. }
  1195. } else if (event.data === 2) {
  1196. this.video.paused = true;
  1197. }
  1198. return false;
  1199. }
  1200. }
  1201. });
  1202. let volume = parseInt(localStorage.getItem("volume"));
  1203. document.getElementById("volumeSlider").value = volume =
  1204. typeof volume === "number" ? volume : 20;
  1205. },
  1206. beforeDestroy() {
  1207. this.playerReady = false;
  1208. clearInterval(this.interval);
  1209. }
  1210. };
  1211. </script>
  1212. <style lang="scss">
  1213. @import "styles/global.scss";
  1214. #genre-helper-container {
  1215. background-color: white;
  1216. position: fixed;
  1217. z-index: 10000000;
  1218. resize: both;
  1219. overflow: auto;
  1220. border: 1px solid #d3d3d3;
  1221. min-height: 50px !important;
  1222. min-width: 50px !important;
  1223. .genre-helper-header {
  1224. cursor: move;
  1225. z-index: 100000001;
  1226. background-color: $musareBlue;
  1227. padding: 10px;
  1228. display: block;
  1229. height: 10px;
  1230. width: 100%;
  1231. }
  1232. .genre-helper-body {
  1233. display: flex;
  1234. flex-wrap: wrap;
  1235. justify-content: space-evenly;
  1236. span {
  1237. padding: 3px 6px;
  1238. }
  1239. }
  1240. }
  1241. .song-modal {
  1242. .modal-card-title {
  1243. text-align: center;
  1244. margin-left: 24px;
  1245. }
  1246. .modal-card {
  1247. width: 1160px;
  1248. height: 100%;
  1249. .modal-card-body {
  1250. padding: 16px;
  1251. }
  1252. }
  1253. }
  1254. </style>
  1255. <style lang="scss" scoped>
  1256. @import "styles/global.scss";
  1257. .modal-card-body > div {
  1258. display: flex;
  1259. height: 100%;
  1260. }
  1261. .left-section {
  1262. display: flex;
  1263. flex-direction: column;
  1264. margin-right: 16px;
  1265. .top-section {
  1266. display: flex;
  1267. .player-section {
  1268. width: 530px;
  1269. display: flex;
  1270. flex-direction: column;
  1271. .player-footer {
  1272. background-color: #f4f4f4;
  1273. border: 1px rgba(163, 224, 255, 0.75) solid;
  1274. border-radius: 0px 0px 5px 5px;
  1275. display: flex;
  1276. justify-content: space-between;
  1277. height: 54px;
  1278. > * {
  1279. width: 33.3%;
  1280. display: flex;
  1281. align-items: center;
  1282. }
  1283. .player-footer-left {
  1284. flex: 1;
  1285. .material-icons {
  1286. font-size: 38px;
  1287. cursor: pointer;
  1288. }
  1289. .player-play-pause {
  1290. color: $musareBlue;
  1291. }
  1292. .player-stop {
  1293. color: $red;
  1294. }
  1295. .player-fast-forward {
  1296. color: $green;
  1297. }
  1298. }
  1299. .player-footer-center {
  1300. justify-content: center;
  1301. align-items: center;
  1302. flex: 2;
  1303. font-size: 21px;
  1304. font-weight: 400;
  1305. img {
  1306. height: 21px;
  1307. margin-right: 12px;
  1308. filter: invert(26%) sepia(54%) saturate(6317%)
  1309. hue-rotate(2deg) brightness(92%) contrast(115%);
  1310. }
  1311. }
  1312. .player-footer-right {
  1313. justify-content: right;
  1314. flex: 1;
  1315. #volumeSlider {
  1316. width: 126px;
  1317. margin-right: 10px;
  1318. background-color: #f4f4f4;
  1319. }
  1320. }
  1321. }
  1322. }
  1323. .thumbnail-preview {
  1324. width: 189px;
  1325. height: 189px;
  1326. margin-left: 16px;
  1327. }
  1328. }
  1329. .edit-section {
  1330. width: 735px;
  1331. background-color: #f4f4f4;
  1332. border: 1px rgba(163, 224, 255, 0.75) solid;
  1333. margin-top: 16px;
  1334. flex: 1;
  1335. overflow: auto;
  1336. border-radius: 5px;
  1337. .album-get-button {
  1338. background-color: $purple;
  1339. color: white;
  1340. width: 32px;
  1341. text-align: center;
  1342. border-width: 0;
  1343. }
  1344. .add-button {
  1345. background-color: $musareBlue !important;
  1346. width: 32px;
  1347. i {
  1348. font-size: 32px;
  1349. }
  1350. }
  1351. > div {
  1352. margin: 16px;
  1353. }
  1354. input {
  1355. width: 100%;
  1356. }
  1357. .title-container {
  1358. width: calc((100% - 32px) / 2);
  1359. }
  1360. .duration-container {
  1361. margin-right: 16px;
  1362. margin-left: 16px;
  1363. width: calc((100% - 32px) / 4);
  1364. }
  1365. .skip-duration-container {
  1366. width: calc((100% - 32px) / 4);
  1367. }
  1368. .album-art-container {
  1369. width: 100%;
  1370. }
  1371. .artists-container {
  1372. width: calc((100% - 32px) / 3);
  1373. position: relative;
  1374. }
  1375. .genres-container {
  1376. width: calc((100% - 32px) / 3);
  1377. margin-left: 16px;
  1378. margin-right: 16px;
  1379. position: relative;
  1380. label {
  1381. display: flex;
  1382. i {
  1383. font-size: 15px;
  1384. align-self: center;
  1385. margin-left: 5px;
  1386. color: $musareBlue;
  1387. cursor: pointer;
  1388. -webkit-user-select: none;
  1389. -moz-user-select: none;
  1390. -ms-user-select: none;
  1391. user-select: none;
  1392. }
  1393. }
  1394. }
  1395. .youtube-id-container {
  1396. width: calc((100% - 32px) / 3);
  1397. }
  1398. .list-item-circle {
  1399. background-color: $musareBlue;
  1400. width: 16px;
  1401. height: 16px;
  1402. border-radius: 8px;
  1403. cursor: pointer;
  1404. margin-right: 8px;
  1405. float: left;
  1406. -webkit-touch-callout: none;
  1407. -webkit-user-select: none;
  1408. -khtml-user-select: none;
  1409. -moz-user-select: none;
  1410. -ms-user-select: none;
  1411. user-select: none;
  1412. i {
  1413. color: $musareBlue;
  1414. font-size: 14px;
  1415. margin-left: 1px;
  1416. }
  1417. }
  1418. .list-item-circle:hover,
  1419. .list-item-circle:focus {
  1420. i {
  1421. color: white;
  1422. }
  1423. }
  1424. .list-item > p {
  1425. line-height: 16px;
  1426. word-wrap: break-word;
  1427. width: calc(100% - 24px);
  1428. left: 24px;
  1429. float: left;
  1430. margin-bottom: 8px;
  1431. }
  1432. .list-item:last-child > p {
  1433. margin-bottom: 0;
  1434. }
  1435. .autosuggest-container {
  1436. position: absolute;
  1437. background: white;
  1438. width: calc(100% + 1px);
  1439. top: 57px;
  1440. z-index: 200;
  1441. overflow: auto;
  1442. max-height: 100%;
  1443. clear: both;
  1444. .autosuggest-item {
  1445. padding: 8px;
  1446. display: block;
  1447. border: 1px solid #dbdbdb;
  1448. margin-top: -1px;
  1449. line-height: 16px;
  1450. cursor: pointer;
  1451. -webkit-user-select: none;
  1452. -ms-user-select: none;
  1453. -moz-user-select: none;
  1454. user-select: none;
  1455. }
  1456. .autosuggest-item:hover,
  1457. .autosuggest-item:focus {
  1458. background-color: #eee;
  1459. }
  1460. .autosuggest-item:first-child {
  1461. border-top: none;
  1462. }
  1463. .autosuggest-item:last-child {
  1464. border-radius: 0 0 3px 3px;
  1465. }
  1466. }
  1467. }
  1468. }
  1469. .right-section {
  1470. display: flex;
  1471. flex-wrap: wrap;
  1472. .api-section {
  1473. width: 376px;
  1474. background-color: #f4f4f4;
  1475. border: 1px rgba(163, 224, 255, 0.75) solid;
  1476. border-radius: 5px;
  1477. padding: 16px;
  1478. overflow: auto;
  1479. height: 100%;
  1480. > label {
  1481. margin-top: 12px;
  1482. }
  1483. .top-container {
  1484. display: flex;
  1485. img {
  1486. height: 85px;
  1487. width: 85px;
  1488. }
  1489. .right-container {
  1490. padding: 8px;
  1491. display: flex;
  1492. flex-direction: column;
  1493. flex: 1;
  1494. .album-title {
  1495. flex: 1;
  1496. font-weight: 600;
  1497. }
  1498. .bottom-row {
  1499. display: flex;
  1500. flex-flow: row;
  1501. line-height: 15px;
  1502. img {
  1503. height: 15px;
  1504. align-self: end;
  1505. flex: 1;
  1506. user-select: none;
  1507. -moz-user-select: none;
  1508. -ms-user-select: none;
  1509. -webkit-user-select: none;
  1510. cursor: pointer;
  1511. }
  1512. p {
  1513. text-align: right;
  1514. }
  1515. .type-year {
  1516. font-size: 13px;
  1517. align-self: end;
  1518. }
  1519. }
  1520. }
  1521. }
  1522. .bottom-container {
  1523. padding: 12px;
  1524. .bottom-container-field {
  1525. line-height: 16px;
  1526. margin-bottom: 8px;
  1527. font-weight: 600;
  1528. span {
  1529. font-weight: 400;
  1530. }
  1531. }
  1532. .bottom-container-field:last-of-type {
  1533. margin-bottom: 0;
  1534. }
  1535. }
  1536. .selected-discogs-info {
  1537. background-color: white;
  1538. border: 1px solid $purple;
  1539. border-radius: 5px;
  1540. margin-bottom: 16px;
  1541. .selected-discogs-info-none {
  1542. font-size: 18px;
  1543. text-align: center;
  1544. }
  1545. .bottom-row > p {
  1546. flex: 1;
  1547. }
  1548. }
  1549. .api-result {
  1550. background-color: white;
  1551. border: 0.5px solid $musareBlue;
  1552. border-radius: 5px;
  1553. margin-bottom: 16px;
  1554. }
  1555. button {
  1556. background-color: $musareBlue !important;
  1557. }
  1558. .tracks {
  1559. margin-top: 12px;
  1560. .track:first-child {
  1561. margin-top: 0;
  1562. border-radius: 3px 3px 0 0;
  1563. }
  1564. .track:last-child {
  1565. border-radius: 0 0 3px 3px;
  1566. }
  1567. .track {
  1568. border: 0.5px solid black;
  1569. margin-top: -1px;
  1570. line-height: 16px;
  1571. display: flex;
  1572. cursor: pointer;
  1573. span {
  1574. font-weight: 600;
  1575. display: inline-block;
  1576. margin-top: 7px;
  1577. margin-bottom: 7px;
  1578. margin-left: 7px;
  1579. }
  1580. p {
  1581. display: inline-block;
  1582. margin: 7px;
  1583. flex: 1;
  1584. }
  1585. }
  1586. .track:hover,
  1587. .track:focus {
  1588. background-color: #f4f4f4;
  1589. }
  1590. }
  1591. .discogs-load-more {
  1592. margin-bottom: 8px;
  1593. }
  1594. }
  1595. }
  1596. .footer-buttons {
  1597. margin-left: auto;
  1598. margin-right: auto;
  1599. }
  1600. input[type="range"] {
  1601. -webkit-appearance: none;
  1602. width: 100%;
  1603. margin: 8.5px 0;
  1604. }
  1605. input[type="range"]:focus {
  1606. outline: none;
  1607. }
  1608. input[type="range"]::-webkit-slider-runnable-track {
  1609. width: 100%;
  1610. height: 3px;
  1611. cursor: pointer;
  1612. box-shadow: none;
  1613. background: #7e7e7e;
  1614. border-radius: none;
  1615. border: none;
  1616. }
  1617. input[type="range"]::-webkit-slider-thumb {
  1618. box-shadow: none;
  1619. border: none;
  1620. height: 20px;
  1621. width: 20px;
  1622. border-radius: 100px;
  1623. background: #03a9f4;
  1624. cursor: pointer;
  1625. -webkit-appearance: none;
  1626. margin-top: -8.5px;
  1627. }
  1628. input[type="range"]:focus::-webkit-slider-runnable-track {
  1629. background: #7e7e7e;
  1630. }
  1631. input[type="range"]::-moz-range-track {
  1632. width: 100%;
  1633. height: 3px;
  1634. cursor: pointer;
  1635. box-shadow: none;
  1636. background: #7e7e7e;
  1637. border-radius: none;
  1638. border: none;
  1639. }
  1640. input[type="range"]::-moz-range-thumb {
  1641. box-shadow: none;
  1642. border: none;
  1643. height: 20px;
  1644. width: 20px;
  1645. border-radius: 100px;
  1646. background: #03a9f4;
  1647. cursor: pointer;
  1648. }
  1649. input[type="range"]::-ms-track {
  1650. width: 100%;
  1651. height: 3px;
  1652. cursor: pointer;
  1653. background: transparent;
  1654. border-color: transparent;
  1655. color: transparent;
  1656. }
  1657. input[type="range"]::-ms-fill-lower {
  1658. background: #717171;
  1659. border: none;
  1660. border-radius: none;
  1661. box-shadow: none;
  1662. }
  1663. input[type="range"]::-ms-fill-upper {
  1664. background: #7e7e7e;
  1665. border: none;
  1666. border-radius: none;
  1667. box-shadow: none;
  1668. }
  1669. input[type="range"]::-ms-thumb {
  1670. box-shadow: none;
  1671. border: none;
  1672. height: 20px;
  1673. width: 20px;
  1674. border-radius: 100px;
  1675. background: #03a9f4;
  1676. cursor: pointer;
  1677. height: 3px;
  1678. }
  1679. input[type="range"]:focus::-ms-fill-lower {
  1680. background: #7e7e7e;
  1681. }
  1682. input[type="range"]:focus::-ms-fill-upper {
  1683. background: #7e7e7e;
  1684. }
  1685. </style>