EditSong.vue 41 KB

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