EditSong.vue 41 KB

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