EditSong.vue 41 KB

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