EditSong.vue 41 KB

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