1
0

index.vue 54 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315
  1. <template>
  2. <div>
  3. <modal
  4. :title="`${newSong ? 'Create' : 'Edit'} Song`"
  5. class="song-modal"
  6. :size="'wide'"
  7. :split="true"
  8. :intercept-close="true"
  9. @close="onCloseModal"
  10. >
  11. <template #toggleMobileSidebar>
  12. <slot name="toggleMobileSidebar" />
  13. </template>
  14. <template #sidebar>
  15. <slot name="sidebar" />
  16. </template>
  17. <template #body>
  18. <div v-if="!songId && !newSong" class="notice-container">
  19. <h4>No song has been selected</h4>
  20. </div>
  21. <div v-if="songDeleted" class="notice-container">
  22. <h4>The song you were editing has been deleted</h4>
  23. </div>
  24. <div
  25. v-if="
  26. songId && !songDataLoaded && !songNotFound && !newSong
  27. "
  28. class="notice-container"
  29. >
  30. <h4>Song hasn't loaded yet</h4>
  31. </div>
  32. <div
  33. v-if="songId && songNotFound && !newSong"
  34. class="notice-container"
  35. >
  36. <h4>Song was not found</h4>
  37. </div>
  38. <div
  39. class="left-section"
  40. v-show="songDataLoaded && !songDeleted"
  41. >
  42. <div class="top-section">
  43. <div class="player-section">
  44. <div id="editSongPlayer" />
  45. <div v-show="youtubeError" class="player-error">
  46. <h2>{{ youtubeErrorMessage }}</h2>
  47. </div>
  48. <canvas
  49. ref="durationCanvas"
  50. id="durationCanvas"
  51. v-show="!youtubeError"
  52. height="20"
  53. width="530"
  54. @click="setTrackPosition($event)"
  55. />
  56. <div class="player-footer">
  57. <div class="player-footer-left">
  58. <button
  59. class="button is-primary"
  60. @click="play()"
  61. @keyup.enter="play()"
  62. v-if="video.paused"
  63. content="Resume Playback"
  64. v-tippy
  65. >
  66. <i class="material-icons">play_arrow</i>
  67. </button>
  68. <button
  69. class="button is-primary"
  70. @click="settings('pause')"
  71. @keyup.enter="settings('pause')"
  72. v-else
  73. content="Pause Playback"
  74. v-tippy
  75. >
  76. <i class="material-icons">pause</i>
  77. </button>
  78. <button
  79. class="button is-danger"
  80. @click.exact="settings('stop')"
  81. @click.shift="settings('hardStop')"
  82. @keyup.enter.exact="settings('stop')"
  83. @keyup.shift.enter="
  84. settings('hardStop')
  85. "
  86. content="Stop Playback"
  87. v-tippy
  88. >
  89. <i class="material-icons">stop</i>
  90. </button>
  91. <tippy
  92. class="playerRateDropdown"
  93. :touch="true"
  94. :interactive="true"
  95. placement="bottom"
  96. theme="dropdown"
  97. ref="dropdown"
  98. trigger="click"
  99. append-to="parent"
  100. @show="
  101. () => {
  102. showRateDropdown = true;
  103. }
  104. "
  105. @hide="
  106. () => {
  107. showRateDropdown = false;
  108. }
  109. "
  110. >
  111. <div
  112. ref="trigger"
  113. class="control has-addons"
  114. content="Set Playback Rate"
  115. v-tippy
  116. >
  117. <button class="button is-primary">
  118. <i class="material-icons"
  119. >fast_forward</i
  120. >
  121. </button>
  122. <button
  123. class="button dropdown-toggle"
  124. >
  125. <i class="material-icons">
  126. {{
  127. showRateDropdown
  128. ? "expand_more"
  129. : "expand_less"
  130. }}
  131. </i>
  132. </button>
  133. </div>
  134. <template #content>
  135. <div class="nav-dropdown-items">
  136. <button
  137. class="nav-item button"
  138. :class="{
  139. active:
  140. video.playbackRate ===
  141. 0.5
  142. }"
  143. title="0.5x"
  144. @click="
  145. setPlaybackRate(0.5)
  146. "
  147. >
  148. <p>0.5x</p>
  149. </button>
  150. <button
  151. class="nav-item button"
  152. :class="{
  153. active:
  154. video.playbackRate ===
  155. 1
  156. }"
  157. title="1x"
  158. @click="setPlaybackRate(1)"
  159. >
  160. <p>1x</p>
  161. </button>
  162. <button
  163. class="nav-item button"
  164. :class="{
  165. active:
  166. video.playbackRate ===
  167. 2
  168. }"
  169. title="2x"
  170. @click="setPlaybackRate(2)"
  171. >
  172. <p>2x</p>
  173. </button>
  174. </div>
  175. </template>
  176. </tippy>
  177. </div>
  178. <div class="player-footer-center">
  179. <span>
  180. <span>
  181. {{ youtubeVideoCurrentTime }}
  182. </span>
  183. /
  184. <span>
  185. {{ youtubeVideoDuration }}
  186. {{ youtubeVideoNote }}
  187. </span>
  188. </span>
  189. </div>
  190. <div class="player-footer-right">
  191. <p id="volume-control">
  192. <i
  193. class="material-icons"
  194. @click="toggleMute()"
  195. :content="`${
  196. muted ? 'Unmute' : 'Mute'
  197. }`"
  198. v-tippy
  199. >{{
  200. muted
  201. ? "volume_mute"
  202. : volumeSliderValue >= 50
  203. ? "volume_up"
  204. : "volume_down"
  205. }}</i
  206. >
  207. <input
  208. v-model="volumeSliderValue"
  209. type="range"
  210. min="0"
  211. max="100"
  212. class="volume-slider active"
  213. @change="changeVolume()"
  214. @input="changeVolume()"
  215. />
  216. </p>
  217. </div>
  218. </div>
  219. </div>
  220. <img
  221. class="thumbnail-preview"
  222. :src="song.thumbnail"
  223. onerror="this.src='/assets/notes-transparent.png'"
  224. ref="thumbnailElement"
  225. @load="onThumbnailLoad"
  226. v-if="songDataLoaded && !songDeleted"
  227. />
  228. </div>
  229. <div
  230. class="edit-section"
  231. v-if="songDataLoaded && !songDeleted"
  232. >
  233. <div class="control is-grouped">
  234. <div class="title-container">
  235. <label class="label">Title</label>
  236. <p class="control has-addons">
  237. <input
  238. class="input"
  239. type="text"
  240. ref="title-input"
  241. v-model="song.title"
  242. placeholder="Enter song title..."
  243. @keyup.shift.enter="
  244. getAlbumData('title')
  245. "
  246. />
  247. <button
  248. class="button album-get-button"
  249. @click="getAlbumData('title')"
  250. >
  251. <i
  252. class="material-icons"
  253. v-tippy
  254. content="Fill from Discogs"
  255. >album</i
  256. >
  257. </button>
  258. </p>
  259. </div>
  260. <div class="duration-container">
  261. <label class="label">Duration</label>
  262. <p class="control has-addons">
  263. <input
  264. class="input"
  265. type="text"
  266. placeholder="Enter song duration..."
  267. v-model.number="song.duration"
  268. @keyup.shift.enter="fillDuration()"
  269. />
  270. <button
  271. class="button duration-fill-button"
  272. @click="fillDuration()"
  273. >
  274. <i
  275. class="material-icons"
  276. v-tippy
  277. content="Sync duration with YouTube"
  278. >sync</i
  279. >
  280. </button>
  281. </p>
  282. </div>
  283. <div class="skip-duration-container">
  284. <label class="label">Skip duration</label>
  285. <p class="control">
  286. <input
  287. class="input"
  288. type="text"
  289. placeholder="Enter skip duration..."
  290. v-model.number="song.skipDuration"
  291. />
  292. </p>
  293. </div>
  294. </div>
  295. <div class="control is-grouped">
  296. <div class="album-art-container">
  297. <label class="label">
  298. Album art
  299. <i
  300. v-if="
  301. thumbnailNotSquare &&
  302. !thumbnailIsYouTubeThumbnail
  303. "
  304. class="material-icons thumbnail-warning"
  305. content="Thumbnail not square, it will be stretched"
  306. v-tippy="{ theme: 'info' }"
  307. >
  308. warning
  309. </i>
  310. </label>
  311. <p class="control has-addons">
  312. <input
  313. class="input"
  314. type="text"
  315. v-model="song.thumbnail"
  316. placeholder="Enter link to album art..."
  317. @keyup.shift.enter="
  318. getAlbumData('albumArt')
  319. "
  320. />
  321. <button
  322. class="button album-get-button"
  323. @click="getAlbumData('albumArt')"
  324. >
  325. <i
  326. class="material-icons"
  327. v-tippy
  328. content="Fill from Discogs"
  329. >album</i
  330. >
  331. </button>
  332. </p>
  333. </div>
  334. <div class="youtube-id-container">
  335. <label class="label">YouTube ID</label>
  336. <p class="control">
  337. <input
  338. class="input"
  339. type="text"
  340. placeholder="Enter YouTube ID..."
  341. v-model="song.youtubeId"
  342. />
  343. </p>
  344. </div>
  345. <div class="verified-container">
  346. <label class="label">Verified</label>
  347. <p class="is-expanded checkbox-control">
  348. <label class="switch">
  349. <input
  350. type="checkbox"
  351. id="verified"
  352. v-model="song.verified"
  353. />
  354. <span class="slider round"></span>
  355. </label>
  356. </p>
  357. </div>
  358. </div>
  359. <div class="control is-grouped">
  360. <div class="artists-container">
  361. <label class="label">Artists</label>
  362. <p class="control has-addons">
  363. <auto-suggest
  364. v-model="artistInputValue"
  365. ref="new-artist"
  366. placeholder="Add artist..."
  367. :all-items="
  368. autosuggest.allItems.artists
  369. "
  370. @submitted="addTag('artists')"
  371. @keyup.shift.enter="
  372. getAlbumData('artists')
  373. "
  374. />
  375. <button
  376. class="button album-get-button"
  377. @click="getAlbumData('artists')"
  378. >
  379. <i
  380. class="material-icons"
  381. v-tippy
  382. content="Fill from Discogs"
  383. >album</i
  384. >
  385. </button>
  386. <button
  387. class="button is-info add-button"
  388. @click="addTag('artists')"
  389. >
  390. <i class="material-icons">add</i>
  391. </button>
  392. </p>
  393. <div class="list-container">
  394. <div
  395. class="list-item"
  396. v-for="artist in song.artists"
  397. :key="artist"
  398. >
  399. <div
  400. class="list-item-circle"
  401. @click="
  402. removeTag('artists', artist)
  403. "
  404. >
  405. <i class="material-icons">close</i>
  406. </div>
  407. <p>{{ artist }}</p>
  408. </div>
  409. </div>
  410. </div>
  411. <div class="genres-container">
  412. <label class="label">
  413. <span>Genres</span>
  414. <i
  415. class="material-icons"
  416. @click="toggleGenreHelper"
  417. @dblclick="resetGenreHelper"
  418. v-tippy
  419. content="View list of genres"
  420. >info</i
  421. >
  422. </label>
  423. <p class="control has-addons">
  424. <auto-suggest
  425. v-model="genreInputValue"
  426. ref="new-genre"
  427. placeholder="Add genre..."
  428. :all-items="autosuggest.allItems.genres"
  429. @submitted="addTag('genres')"
  430. @keyup.shift.enter="
  431. getAlbumData('genres')
  432. "
  433. />
  434. <button
  435. class="button album-get-button"
  436. @click="getAlbumData('genres')"
  437. >
  438. <i
  439. class="material-icons"
  440. v-tippy
  441. content="Fill from Discogs"
  442. >album</i
  443. >
  444. </button>
  445. <button
  446. class="button is-info add-button"
  447. @click="addTag('genres')"
  448. >
  449. <i class="material-icons">add</i>
  450. </button>
  451. </p>
  452. <div class="list-container">
  453. <div
  454. class="list-item"
  455. v-for="genre in song.genres"
  456. :key="genre"
  457. >
  458. <div
  459. class="list-item-circle"
  460. @click="removeTag('genres', genre)"
  461. >
  462. <i class="material-icons">close</i>
  463. </div>
  464. <p>{{ genre }}</p>
  465. </div>
  466. </div>
  467. </div>
  468. <div class="tags-container">
  469. <label class="label">Tags</label>
  470. <p class="control has-addons">
  471. <auto-suggest
  472. v-model="tagInputValue"
  473. ref="new-tag"
  474. placeholder="Add tag..."
  475. :all-items="autosuggest.allItems.tags"
  476. @submitted="addTag('tags')"
  477. />
  478. <button
  479. class="button is-info add-button"
  480. @click="addTag('tags')"
  481. >
  482. <i class="material-icons">add</i>
  483. </button>
  484. </p>
  485. <div class="list-container">
  486. <div
  487. class="list-item"
  488. v-for="tag in song.tags"
  489. :key="tag"
  490. >
  491. <div
  492. class="list-item-circle"
  493. @click="removeTag('tags', tag)"
  494. >
  495. <i class="material-icons">close</i>
  496. </div>
  497. <p>{{ tag }}</p>
  498. </div>
  499. </div>
  500. </div>
  501. </div>
  502. </div>
  503. </div>
  504. <div
  505. class="right-section"
  506. v-if="songDataLoaded && !songDeleted"
  507. >
  508. <div id="tabs-container">
  509. <div id="tab-selection">
  510. <button
  511. class="button is-default"
  512. :class="{ selected: tab === 'discogs' }"
  513. ref="discogs-tab"
  514. @click="showTab('discogs')"
  515. >
  516. Discogs
  517. </button>
  518. <button
  519. v-if="!newSong"
  520. class="button is-default"
  521. :class="{ selected: tab === 'reports' }"
  522. ref="reports-tab"
  523. @click="showTab('reports')"
  524. >
  525. Reports ({{ reports.length }})
  526. </button>
  527. <button
  528. class="button is-default"
  529. :class="{ selected: tab === 'youtube' }"
  530. ref="youtube-tab"
  531. @click="showTab('youtube')"
  532. >
  533. YouTube
  534. </button>
  535. <button
  536. class="button is-default"
  537. :class="{ selected: tab === 'musare-songs' }"
  538. ref="musare-songs-tab"
  539. @click="showTab('musare-songs')"
  540. >
  541. Songs
  542. </button>
  543. </div>
  544. <discogs
  545. class="tab"
  546. v-show="tab === 'discogs'"
  547. :bulk="bulk"
  548. />
  549. <reports
  550. v-if="!newSong"
  551. class="tab"
  552. v-show="tab === 'reports'"
  553. />
  554. <youtube class="tab" v-show="tab === 'youtube'" />
  555. <musare-songs
  556. class="tab"
  557. v-show="tab === 'musare-songs'"
  558. />
  559. </div>
  560. </div>
  561. </template>
  562. <template #footer>
  563. <div v-if="bulk">
  564. <button class="button is-primary" @click="editNextSong()">
  565. Next
  566. </button>
  567. <button
  568. class="button is-primary"
  569. @click="toggleFlag()"
  570. v-if="songId && !songDeleted"
  571. >
  572. {{ flagged ? "Unflag" : "Flag" }}
  573. </button>
  574. </div>
  575. <div v-if="!newSong && !songDeleted">
  576. <save-button
  577. ref="saveButton"
  578. @clicked="save(song, false, 'saveButton')"
  579. />
  580. <save-button
  581. ref="saveAndCloseButton"
  582. :default-message="
  583. bulk ? `Save and next` : `Save and close`
  584. "
  585. @clicked="save(song, true, 'saveAndCloseButton')"
  586. />
  587. <div class="right">
  588. <button
  589. class="button is-danger icon-with-button material-icons"
  590. @click.prevent="
  591. confirmAction({
  592. message:
  593. 'Removing this song will remove it from all playlists and cause a ratings recalculation.',
  594. action: 'remove',
  595. params: song._id
  596. })
  597. "
  598. content="Delete Song"
  599. v-tippy
  600. >
  601. delete_forever
  602. </button>
  603. </div>
  604. </div>
  605. <div v-else-if="newSong">
  606. <save-button
  607. ref="createButton"
  608. default-message="Create Song"
  609. @clicked="save(song, false, 'createButton', true)"
  610. />
  611. </div>
  612. </template>
  613. </modal>
  614. <floating-box id="genreHelper" ref="genreHelper" :column="false">
  615. <template #body>
  616. <span
  617. v-for="item in autosuggest.allItems.genres"
  618. :key="`genre-helper-${item}`"
  619. >
  620. {{ item }}
  621. </span>
  622. </template>
  623. </floating-box>
  624. </div>
  625. </template>
  626. <script>
  627. import { mapState, mapGetters, mapActions } from "vuex";
  628. import Toast from "toasters";
  629. import aw from "@/aw";
  630. import ws from "@/ws";
  631. import validation from "@/validation";
  632. import keyboardShortcuts from "@/keyboardShortcuts";
  633. import FloatingBox from "../../FloatingBox.vue";
  634. import SaveButton from "../../SaveButton.vue";
  635. import AutoSuggest from "@/components/AutoSuggest.vue";
  636. import Discogs from "./Tabs/Discogs.vue";
  637. import Reports from "./Tabs/Reports.vue";
  638. import Youtube from "./Tabs/Youtube.vue";
  639. import MusareSongs from "./Tabs/Songs.vue";
  640. export default {
  641. components: {
  642. FloatingBox,
  643. SaveButton,
  644. AutoSuggest,
  645. Discogs,
  646. Reports,
  647. Youtube,
  648. MusareSongs
  649. },
  650. props: {
  651. // songId: { type: String, default: null },
  652. discogsAlbum: { type: Object, default: null },
  653. sector: { type: String, default: "admin" },
  654. bulk: { type: Boolean, default: false },
  655. flagged: { type: Boolean, default: false }
  656. },
  657. emits: [
  658. "error",
  659. "savedSuccess",
  660. "savedError",
  661. "flagSong",
  662. "nextSong",
  663. "close"
  664. ],
  665. data() {
  666. return {
  667. songDataLoaded: false,
  668. songDeleted: false,
  669. youtubeError: false,
  670. youtubeErrorMessage: "",
  671. focusedElementBefore: null,
  672. youtubeVideoDuration: "0.000",
  673. youtubeVideoCurrentTime: 0,
  674. youtubeVideoNote: "",
  675. useHTTPS: false,
  676. muted: false,
  677. volumeSliderValue: 0,
  678. artistInputValue: "",
  679. genreInputValue: "",
  680. tagInputValue: "",
  681. activityWatchVideoDataInterval: null,
  682. activityWatchVideoLastStatus: "",
  683. activityWatchVideoLastStartDuration: "",
  684. recommendedGenres: [
  685. "Blues",
  686. "Country",
  687. "Disco",
  688. "Funk",
  689. "Hip-Hop",
  690. "Jazz",
  691. "Metal",
  692. "Oldies",
  693. "Other",
  694. "Pop",
  695. "Rap",
  696. "Reggae",
  697. "Rock",
  698. "Techno",
  699. "Trance",
  700. "Classical",
  701. "Instrumental",
  702. "House",
  703. "Electronic",
  704. "Christian Rap",
  705. "Lo-Fi",
  706. "Musical",
  707. "Rock 'n' Roll",
  708. "Opera",
  709. "Drum & Bass",
  710. "Club-House",
  711. "Indie",
  712. "Heavy Metal",
  713. "Christian rock",
  714. "Dubstep"
  715. ],
  716. autosuggest: {
  717. allItems: {
  718. artists: [],
  719. genres: [],
  720. tags: []
  721. }
  722. },
  723. songNotFound: false,
  724. showRateDropdown: false,
  725. thumbnailNotSquare: false,
  726. thumbnailWidth: null,
  727. thumbnailHeight: null
  728. };
  729. },
  730. computed: {
  731. thumbnailIsYouTubeThumbnail() {
  732. return (
  733. this.songDataLoaded &&
  734. this.song.thumbnail &&
  735. this.song.thumbnail.startsWith("https://i.ytimg.com/")
  736. );
  737. },
  738. ...mapState("modals/editSong", {
  739. tab: state => state.tab,
  740. video: state => state.video,
  741. song: state => state.song,
  742. songId: state => state.songId,
  743. prefillData: state => state.prefillData,
  744. originalSong: state => state.originalSong,
  745. reports: state => state.reports,
  746. newSong: state => state.newSong
  747. }),
  748. ...mapState("modalVisibility", {
  749. modals: state => state.modals,
  750. currentlyActive: state => state.currentlyActive
  751. }),
  752. ...mapGetters({
  753. socket: "websockets/getSocket"
  754. })
  755. },
  756. watch: {
  757. /* eslint-disable */
  758. "song.duration": function () {
  759. this.drawCanvas();
  760. },
  761. "song.skipDuration": function () {
  762. this.drawCanvas();
  763. },
  764. /* eslint-enable */
  765. songId(songId, oldSongId) {
  766. console.log("NEW SONG ID", songId);
  767. this.unloadSong(oldSongId);
  768. this.loadSong(songId);
  769. }
  770. },
  771. async mounted() {
  772. console.log("MOUNTED");
  773. this.activityWatchVideoDataInterval = setInterval(() => {
  774. this.sendActivityWatchVideoData();
  775. }, 1000);
  776. this.useHTTPS = await lofig.get("cookie.secure");
  777. ws.onConnect(this.init);
  778. let volume = parseFloat(localStorage.getItem("volume"));
  779. volume =
  780. typeof volume === "number" && !Number.isNaN(volume) ? volume : 20;
  781. localStorage.setItem("volume", volume);
  782. this.volumeSliderValue = volume;
  783. if (!this.newSong) {
  784. this.socket.on(
  785. "event:admin.song.removed",
  786. res => {
  787. if (res.data.songId === this.song._id) {
  788. this.songDeleted = true;
  789. }
  790. },
  791. { modal: this.bulk ? "editSongs" : "editSong" }
  792. );
  793. }
  794. keyboardShortcuts.registerShortcut("editSong.pauseResumeVideo", {
  795. keyCode: 101,
  796. preventDefault: true,
  797. handler: () => {
  798. if (this.video.paused) this.play();
  799. else this.settings("pause");
  800. }
  801. });
  802. keyboardShortcuts.registerShortcut("editSong.stopVideo", {
  803. keyCode: 101,
  804. ctrl: true,
  805. preventDefault: true,
  806. handler: () => {
  807. this.settings("stop");
  808. }
  809. });
  810. keyboardShortcuts.registerShortcut("editSong.hardStopVideo", {
  811. keyCode: 101,
  812. ctrl: true,
  813. shift: true,
  814. preventDefault: true,
  815. handler: () => {
  816. this.settings("hardStop");
  817. }
  818. });
  819. keyboardShortcuts.registerShortcut("editSong.skipToLast10Secs", {
  820. keyCode: 102,
  821. preventDefault: true,
  822. handler: () => {
  823. this.settings("skipToLast10Secs");
  824. }
  825. });
  826. keyboardShortcuts.registerShortcut("editSong.lowerVolumeLarge", {
  827. keyCode: 98,
  828. preventDefault: true,
  829. handler: () => {
  830. this.volumeSliderValue = Math.max(
  831. 0,
  832. this.volumeSliderValue - 10
  833. );
  834. this.changeVolume();
  835. }
  836. });
  837. keyboardShortcuts.registerShortcut("editSong.lowerVolumeSmall", {
  838. keyCode: 98,
  839. ctrl: true,
  840. preventDefault: true,
  841. handler: () => {
  842. this.volumeSliderValue = Math.max(
  843. 0,
  844. this.volumeSliderValue - 1
  845. );
  846. this.changeVolume();
  847. }
  848. });
  849. keyboardShortcuts.registerShortcut("editSong.increaseVolumeLarge", {
  850. keyCode: 104,
  851. preventDefault: true,
  852. handler: () => {
  853. this.volumeSliderValue = Math.min(
  854. 100,
  855. this.volumeSliderValue + 10
  856. );
  857. this.changeVolume();
  858. }
  859. });
  860. keyboardShortcuts.registerShortcut("editSong.increaseVolumeSmall", {
  861. keyCode: 104,
  862. ctrl: true,
  863. preventDefault: true,
  864. handler: () => {
  865. this.volumeSliderValue = Math.min(
  866. 100,
  867. this.volumeSliderValue + 1
  868. );
  869. this.changeVolume();
  870. }
  871. });
  872. keyboardShortcuts.registerShortcut("editSong.save", {
  873. keyCode: 83,
  874. ctrl: true,
  875. preventDefault: true,
  876. handler: () => {
  877. this.save(this.song, false, "saveButton");
  878. }
  879. });
  880. keyboardShortcuts.registerShortcut("editSong.saveClose", {
  881. keyCode: 83,
  882. ctrl: true,
  883. alt: true,
  884. preventDefault: true,
  885. handler: () => {
  886. this.save(this.song, true, "saveAndCloseButton");
  887. }
  888. });
  889. keyboardShortcuts.registerShortcut("editSong.focusTitle", {
  890. keyCode: 36,
  891. preventDefault: true,
  892. handler: () => {
  893. this.$refs["title-input"].focus();
  894. }
  895. });
  896. keyboardShortcuts.registerShortcut("editSong.useAllDiscogs", {
  897. keyCode: 68,
  898. alt: true,
  899. ctrl: true,
  900. preventDefault: true,
  901. handler: () => {
  902. this.getAlbumData("title");
  903. this.getAlbumData("albumArt");
  904. this.getAlbumData("artists");
  905. this.getAlbumData("genres");
  906. }
  907. });
  908. keyboardShortcuts.registerShortcut("editSong.closeModal", {
  909. keyCode: 27,
  910. handler: () => {
  911. if (
  912. this.currentlyActive[0] === "editSong" ||
  913. this.currentlyActive[0] === "editSongs"
  914. ) {
  915. this.onCloseModal();
  916. }
  917. }
  918. });
  919. /*
  920. editSong.pauseResume - Num 5 - Pause/resume song
  921. editSong.stopVideo - Ctrl - Num 5 - Stop
  922. editSong.hardStopVideo - Shift - Ctrl - Num 5 - Stop
  923. editSong.skipToLast10Secs - Num 6 - Skip to last 10 seconds
  924. editSong.lowerVolumeLarge - Num 2 - Volume down by 10
  925. editSong.lowerVolumeSmall - Ctrl - Num 2 - Volume down by 1
  926. editSong.increaseVolumeLarge - Num 8 - Volume up by 10
  927. editSong.increaseVolumeSmall - Ctrl - Num 8 - Volume up by 1
  928. editSong.focusTitle - Home - Focus the title input
  929. editSong.focusDicogs - End - Focus the discogs input
  930. editSong.save - Ctrl - S - Saves song
  931. editSong.save - Ctrl - Alt - S - Saves song and closes the modal
  932. editSong.save - Ctrl - Alt - V - Saves song, verifies songs and then closes the modal
  933. editSong.close - F4 - Closes modal without saving
  934. editSong.useAllDiscogs - Ctrl - Alt - D - Sets all fields to the Discogs data
  935. Inside Discogs inputs: Ctrl - D - Sets this field to the Discogs data
  936. */
  937. },
  938. beforeUnmount() {
  939. console.log("UNMOUNT");
  940. if (!this.newSong) this.unloadSong(this.songId);
  941. this.playerReady = false;
  942. clearInterval(this.interval);
  943. clearInterval(this.activityWatchVideoDataInterval);
  944. const shortcutNames = [
  945. "editSong.pauseResume",
  946. "editSong.stopVideo",
  947. "editSong.hardStopVideo",
  948. "editSong.skipToLast10Secs",
  949. "editSong.lowerVolumeLarge",
  950. "editSong.lowerVolumeSmall",
  951. "editSong.increaseVolumeLarge",
  952. "editSong.increaseVolumeSmall",
  953. "editSong.focusTitle",
  954. "editSong.focusDicogs",
  955. "editSong.save",
  956. "editSong.saveClose",
  957. "editSong.useAllDiscogs",
  958. "editSong.closeModal"
  959. ];
  960. shortcutNames.forEach(shortcutName => {
  961. keyboardShortcuts.unregisterShortcut(shortcutName);
  962. });
  963. },
  964. methods: {
  965. onThumbnailLoad() {
  966. if (this.$refs.thumbnailElement) {
  967. const thumbnailHeight =
  968. this.$refs.thumbnailElement.naturalHeight;
  969. const thumbnailWidth = this.$refs.thumbnailElement.naturalWidth;
  970. this.thumbnailNotSquare = thumbnailHeight !== thumbnailWidth;
  971. this.thumbnailHeight = thumbnailHeight;
  972. this.thumbnailWidth = thumbnailWidth;
  973. } else {
  974. this.thumbnailNotSquare = false;
  975. this.thumbnailHeight = null;
  976. this.thumbnailWidth = null;
  977. }
  978. },
  979. init() {
  980. if (this.newSong) {
  981. this.setSong({
  982. youtubeId: "",
  983. title: "",
  984. artists: [],
  985. genres: [],
  986. tags: [],
  987. duration: 0,
  988. skipDuration: 0,
  989. thumbnail: "",
  990. verified: false
  991. });
  992. this.songDataLoaded = true;
  993. this.showTab("youtube");
  994. } else if (this.songId) this.loadSong(this.songId);
  995. else if (!this.bulk) {
  996. new Toast("You can't open EditSong without editing a song");
  997. return this.closeModal("editSong");
  998. }
  999. this.interval = setInterval(() => {
  1000. if (
  1001. this.song.duration !== -1 &&
  1002. this.video.paused === false &&
  1003. this.playerReady &&
  1004. (this.video.player.getCurrentTime() -
  1005. this.song.skipDuration >
  1006. this.song.duration ||
  1007. (this.video.player.getCurrentTime() > 0 &&
  1008. this.video.player.getCurrentTime() >=
  1009. this.video.player.getDuration()))
  1010. ) {
  1011. this.stopVideo();
  1012. this.pauseVideo(true);
  1013. this.drawCanvas();
  1014. }
  1015. if (
  1016. this.playerReady &&
  1017. this.video.player.getVideoData &&
  1018. this.video.player.getVideoData() &&
  1019. this.video.player.getVideoData().video_id ===
  1020. this.song.youtubeId
  1021. ) {
  1022. const currentTime = this.video.player.getCurrentTime();
  1023. if (currentTime !== undefined)
  1024. this.youtubeVideoCurrentTime = currentTime.toFixed(3);
  1025. if (this.youtubeVideoDuration === "0.000") {
  1026. const duration = this.video.player.getDuration();
  1027. if (duration !== undefined) {
  1028. this.youtubeVideoDuration = duration.toFixed(3);
  1029. this.youtubeVideoNote = "(~)";
  1030. this.drawCanvas();
  1031. }
  1032. }
  1033. }
  1034. if (this.video.paused === false) this.drawCanvas();
  1035. }, 200);
  1036. if (window.YT && window.YT.Player) {
  1037. this.video.player = new window.YT.Player("editSongPlayer", {
  1038. height: 298,
  1039. width: 530,
  1040. videoId: null,
  1041. host: "https://www.youtube-nocookie.com",
  1042. playerVars: {
  1043. controls: 0,
  1044. iv_load_policy: 3,
  1045. rel: 0,
  1046. showinfo: 0,
  1047. autoplay: 0
  1048. },
  1049. startSeconds: this.song.skipDuration,
  1050. events: {
  1051. onReady: () => {
  1052. let volume = parseFloat(
  1053. localStorage.getItem("volume")
  1054. );
  1055. volume = typeof volume === "number" ? volume : 20;
  1056. this.video.player.setVolume(volume);
  1057. if (volume > 0) this.video.player.unMute();
  1058. this.playerReady = true;
  1059. if (this.song && this.song._id)
  1060. this.video.player.cueVideoById(
  1061. this.song.youtubeId,
  1062. this.song.skipDuration
  1063. );
  1064. this.setPlaybackRate(null);
  1065. this.drawCanvas();
  1066. },
  1067. onStateChange: event => {
  1068. this.drawCanvas();
  1069. if (event.data === 1) {
  1070. this.video.paused = false;
  1071. let youtubeDuration =
  1072. this.video.player.getDuration();
  1073. const newYoutubeVideoDuration =
  1074. youtubeDuration.toFixed(3);
  1075. const songDurationNumber = Number(
  1076. this.song.duration
  1077. );
  1078. const songDurationNumber2 =
  1079. Number(this.song.duration) + 1;
  1080. const songDurationNumber3 =
  1081. Number(this.song.duration) - 1;
  1082. const fixedSongDuration =
  1083. songDurationNumber.toFixed(3);
  1084. const fixedSongDuration2 =
  1085. songDurationNumber2.toFixed(3);
  1086. const fixedSongDuration3 =
  1087. songDurationNumber3.toFixed(3);
  1088. if (
  1089. this.youtubeVideoDuration !==
  1090. newYoutubeVideoDuration &&
  1091. (fixedSongDuration ===
  1092. this.youtubeVideoDuration ||
  1093. fixedSongDuration2 ===
  1094. this.youtubeVideoDuration ||
  1095. fixedSongDuration3 ===
  1096. this.youtubeVideoDuration)
  1097. )
  1098. this.song.duration =
  1099. newYoutubeVideoDuration;
  1100. this.youtubeVideoDuration =
  1101. newYoutubeVideoDuration;
  1102. this.youtubeVideoNote = "";
  1103. if (this.song.duration === -1)
  1104. this.song.duration = youtubeDuration;
  1105. youtubeDuration -= this.song.skipDuration;
  1106. if (this.song.duration > youtubeDuration + 1) {
  1107. this.stopVideo();
  1108. this.pauseVideo(true);
  1109. return new Toast(
  1110. "Video can't play. Specified duration is bigger than the YouTube song duration."
  1111. );
  1112. }
  1113. if (this.song.duration <= 0) {
  1114. this.stopVideo();
  1115. this.pauseVideo(true);
  1116. return new Toast(
  1117. "Video can't play. Specified duration has to be more than 0 seconds."
  1118. );
  1119. }
  1120. if (
  1121. this.video.player.getCurrentTime() <
  1122. this.song.skipDuration
  1123. ) {
  1124. return this.seekTo(this.song.skipDuration);
  1125. }
  1126. this.setPlaybackRate(null);
  1127. } else if (event.data === 2) {
  1128. this.video.paused = true;
  1129. }
  1130. return false;
  1131. }
  1132. }
  1133. });
  1134. } else {
  1135. this.youtubeError = true;
  1136. this.youtubeErrorMessage = "Player could not be loaded.";
  1137. }
  1138. ["artists", "genres", "tags"].forEach(type => {
  1139. this.socket.dispatch(
  1140. `songs.get${type.charAt(0).toUpperCase()}${type.slice(1)}`,
  1141. res => {
  1142. if (res.status === "success") {
  1143. const { items } = res.data;
  1144. if (type === "genres")
  1145. this.autosuggest.allItems[type] = Array.from(
  1146. new Set([
  1147. ...this.recommendedGenres,
  1148. ...items
  1149. ])
  1150. );
  1151. else this.autosuggest.allItems[type] = items;
  1152. } else {
  1153. new Toast(res.message);
  1154. }
  1155. }
  1156. );
  1157. });
  1158. return null;
  1159. },
  1160. unloadSong(songId) {
  1161. this.songDataLoaded = false;
  1162. this.songDeleted = false;
  1163. this.stopVideo();
  1164. this.pauseVideo(true);
  1165. this.resetSong(songId);
  1166. this.thumbnailNotSquare = false;
  1167. this.thumbnailWidth = null;
  1168. this.thumbnailHeight = null;
  1169. this.youtubeVideoCurrentTime = "0.000";
  1170. this.youtubeVideoDuration = "0.000";
  1171. this.socket.dispatch("apis.leaveRoom", `edit-song.${songId}`);
  1172. if (this.$refs.saveButton) this.$refs.saveButton.status = "default";
  1173. },
  1174. loadSong(songId) {
  1175. console.log(`LOAD SONG ${songId}`);
  1176. this.songNotFound = false;
  1177. this.socket.dispatch(`songs.getSongFromSongId`, songId, res => {
  1178. if (res.status === "success") {
  1179. let { song } = res.data;
  1180. song = Object.assign(song, this.prefillData);
  1181. this.setSong(song);
  1182. this.songDataLoaded = true;
  1183. this.socket.dispatch(
  1184. "apis.joinRoom",
  1185. `edit-song.${this.song._id}`
  1186. );
  1187. if (this.video.player && this.video.player.cueVideoById) {
  1188. this.video.player.cueVideoById(
  1189. this.song.youtubeId,
  1190. this.song.skipDuration
  1191. );
  1192. }
  1193. } else {
  1194. new Toast("Song with that ID not found");
  1195. if (this.bulk) this.songNotFound = true;
  1196. if (!this.bulk) this.closeModal("editSong");
  1197. }
  1198. });
  1199. this.socket.dispatch("reports.getReportsForSong", songId, res => {
  1200. this.updateReports(res.data.reports);
  1201. });
  1202. },
  1203. importAlbum(result) {
  1204. this.selectDiscogsAlbum(result);
  1205. this.openModal("importAlbum");
  1206. this.closeModal("editSong");
  1207. },
  1208. save(songToCopy, closeOrNext, saveButtonRefName, newSong = false) {
  1209. const song = JSON.parse(JSON.stringify(songToCopy));
  1210. if (!newSong) this.$emit("saving", song._id);
  1211. const saveButtonRef = this.$refs[saveButtonRefName];
  1212. if (!this.youtubeError && this.youtubeVideoDuration === "0.000") {
  1213. saveButtonRef.handleFailedSave();
  1214. if (!newSong) this.$emit("savedError", song._id);
  1215. return new Toast("The video appears to not be working.");
  1216. }
  1217. if (!song.title) {
  1218. saveButtonRef.handleFailedSave();
  1219. if (!newSong) this.$emit("savedError", song._id);
  1220. return new Toast("Please fill in all fields");
  1221. }
  1222. if (!song.thumbnail) {
  1223. saveButtonRef.handleFailedSave();
  1224. if (!newSong) this.$emit("savedError", song._id);
  1225. return new Toast("Please fill in all fields");
  1226. }
  1227. // const thumbnailHeight = this.$refs.thumbnailElement.naturalHeight;
  1228. // const thumbnailWidth = this.$refs.thumbnailElement.naturalWidth;
  1229. // if (thumbnailHeight < 80 || thumbnailWidth < 80) {
  1230. // saveButtonRef.handleFailedSave();
  1231. // return new Toast(
  1232. // "Thumbnail width and height must be at least 80px."
  1233. // );
  1234. // }
  1235. // if (thumbnailHeight > 4000 || thumbnailWidth > 4000) {
  1236. // saveButtonRef.handleFailedSave();
  1237. // return new Toast(
  1238. // "Thumbnail width and height must be less than 4000px."
  1239. // );
  1240. // }
  1241. // if (thumbnailHeight - thumbnailWidth > 5) {
  1242. // saveButtonRef.handleFailedSave();
  1243. // return new Toast("Thumbnail cannot be taller than it is wide.");
  1244. // }
  1245. // Youtube Id
  1246. if (
  1247. !newSong &&
  1248. this.youtubeError &&
  1249. this.originalSong.youtubeId !== song.youtubeId
  1250. ) {
  1251. saveButtonRef.handleFailedSave();
  1252. if (!newSong) this.$emit("savedError", song._id);
  1253. return new Toast(
  1254. "You're not allowed to change the YouTube id while the player is not working"
  1255. );
  1256. }
  1257. // Duration
  1258. if (
  1259. Number(song.skipDuration) + Number(song.duration) >
  1260. this.youtubeVideoDuration &&
  1261. ((!newSong && !this.youtubeError) ||
  1262. this.originalSong.duration !== song.duration)
  1263. ) {
  1264. saveButtonRef.handleFailedSave();
  1265. if (!newSong) this.$emit("savedError", song._id);
  1266. return new Toast(
  1267. "Duration can't be higher than the length of the video"
  1268. );
  1269. }
  1270. // Title
  1271. if (!validation.isLength(song.title, 1, 100)) {
  1272. saveButtonRef.handleFailedSave();
  1273. if (!newSong) this.$emit("savedError", song._id);
  1274. return new Toast(
  1275. "Title must have between 1 and 100 characters."
  1276. );
  1277. }
  1278. // Artists
  1279. if (
  1280. (song.verified && song.artists.length < 1) ||
  1281. song.artists.length > 10
  1282. ) {
  1283. saveButtonRef.handleFailedSave();
  1284. if (!newSong) this.$emit("savedError", song._id);
  1285. return new Toast(
  1286. "Invalid artists. You must have at least 1 artist and a maximum of 10 artists."
  1287. );
  1288. }
  1289. let error;
  1290. song.artists.forEach(artist => {
  1291. if (!validation.isLength(artist, 1, 64)) {
  1292. error = "Artist must have between 1 and 64 characters.";
  1293. return error;
  1294. }
  1295. if (artist === "NONE") {
  1296. error =
  1297. 'Invalid artist format. Artists are not allowed to be named "NONE".';
  1298. return error;
  1299. }
  1300. return false;
  1301. });
  1302. if (error) {
  1303. saveButtonRef.handleFailedSave();
  1304. if (!newSong) this.$emit("savedError", song._id);
  1305. return new Toast(error);
  1306. }
  1307. // Genres
  1308. error = undefined;
  1309. song.genres.forEach(genre => {
  1310. if (!validation.isLength(genre, 1, 32)) {
  1311. error = "Genre must have between 1 and 32 characters.";
  1312. return error;
  1313. }
  1314. if (!validation.regex.ascii.test(genre)) {
  1315. error =
  1316. "Invalid genre format. Only ascii characters are allowed.";
  1317. return error;
  1318. }
  1319. return false;
  1320. });
  1321. if (
  1322. (song.verified && song.genres.length < 1) ||
  1323. song.genres.length > 16
  1324. )
  1325. error = "You must have between 1 and 16 genres.";
  1326. if (error) {
  1327. saveButtonRef.handleFailedSave();
  1328. if (!newSong) this.$emit("savedError", song._id);
  1329. return new Toast(error);
  1330. }
  1331. error = undefined;
  1332. song.tags.forEach(tag => {
  1333. if (
  1334. !/^[a-zA-Z0-9_]{1,64}$|^[a-zA-Z0-9_]{1,64}\[[a-zA-Z0-9_]{1,64}\]$/.test(
  1335. tag
  1336. )
  1337. ) {
  1338. error = "Invalid tag format.";
  1339. return error;
  1340. }
  1341. return false;
  1342. });
  1343. if (error) {
  1344. saveButtonRef.handleFailedSave();
  1345. if (!newSong) this.$emit("savedError", song._id);
  1346. return new Toast(error);
  1347. }
  1348. // Thumbnail
  1349. if (!validation.isLength(song.thumbnail, 1, 256)) {
  1350. saveButtonRef.handleFailedSave();
  1351. if (!newSong) this.$emit("savedError", song._id);
  1352. return new Toast(
  1353. "Thumbnail must have between 8 and 256 characters."
  1354. );
  1355. }
  1356. if (this.useHTTPS && song.thumbnail.indexOf("https://") !== 0) {
  1357. saveButtonRef.handleFailedSave();
  1358. if (!newSong) this.$emit("savedError", song._id);
  1359. return new Toast('Thumbnail must start with "https://".');
  1360. }
  1361. if (
  1362. !this.useHTTPS &&
  1363. song.thumbnail.indexOf("http://") !== 0 &&
  1364. song.thumbnail.indexOf("https://") !== 0
  1365. ) {
  1366. saveButtonRef.handleFailedSave();
  1367. if (!newSong) this.$emit("savedError", song._id);
  1368. return new Toast('Thumbnail must start with "http://".');
  1369. }
  1370. saveButtonRef.status = "saving";
  1371. if (newSong)
  1372. return this.socket.dispatch(`songs.create`, song, res => {
  1373. new Toast(res.message);
  1374. if (res.status === "error") {
  1375. saveButtonRef.handleFailedSave();
  1376. return;
  1377. }
  1378. saveButtonRef.handleSuccessfulSave();
  1379. this.closeModal("editSong");
  1380. });
  1381. return this.socket.dispatch(`songs.update`, song._id, song, res => {
  1382. new Toast(res.message);
  1383. if (res.status === "error") {
  1384. saveButtonRef.handleFailedSave();
  1385. this.$emit("savedError", song._id);
  1386. return;
  1387. }
  1388. this.updateOriginalSong(song);
  1389. saveButtonRef.handleSuccessfulSave();
  1390. this.$emit("savedSuccess", song._id);
  1391. if (!closeOrNext) return;
  1392. if (this.bulk) this.$emit("nextSong");
  1393. else this.closeModal("editSong");
  1394. });
  1395. },
  1396. editNextSong() {
  1397. this.$emit("nextSong");
  1398. },
  1399. toggleFlag() {
  1400. this.$emit("toggleFlag");
  1401. },
  1402. getAlbumData(type) {
  1403. if (!this.song.discogs) return;
  1404. if (type === "title")
  1405. this.updateSongField({
  1406. field: "title",
  1407. value: this.song.discogs.track.title
  1408. });
  1409. if (type === "albumArt")
  1410. this.updateSongField({
  1411. field: "thumbnail",
  1412. value: this.song.discogs.album.albumArt
  1413. });
  1414. if (type === "genres")
  1415. this.updateSongField({
  1416. field: "genres",
  1417. value: JSON.parse(
  1418. JSON.stringify(this.song.discogs.album.genres)
  1419. )
  1420. });
  1421. if (type === "artists")
  1422. this.updateSongField({
  1423. field: "artists",
  1424. value: JSON.parse(
  1425. JSON.stringify(this.song.discogs.album.artists)
  1426. )
  1427. });
  1428. },
  1429. fillDuration() {
  1430. this.song.duration =
  1431. this.youtubeVideoDuration - this.song.skipDuration;
  1432. },
  1433. settings(type) {
  1434. switch (type) {
  1435. case "stop":
  1436. this.stopVideo();
  1437. this.pauseVideo(true);
  1438. break;
  1439. case "hardStop":
  1440. this.hardStopVideo();
  1441. this.pauseVideo(true);
  1442. break;
  1443. case "pause":
  1444. this.pauseVideo(true);
  1445. break;
  1446. case "play":
  1447. this.pauseVideo(false);
  1448. break;
  1449. case "skipToLast10Secs":
  1450. this.seekTo(
  1451. this.song.duration - 10 + this.song.skipDuration
  1452. );
  1453. break;
  1454. default:
  1455. break;
  1456. }
  1457. },
  1458. play() {
  1459. if (
  1460. this.video.player.getVideoData().video_id !==
  1461. this.song.youtubeId
  1462. ) {
  1463. this.song.duration = -1;
  1464. this.loadVideoById(this.song.youtubeId, this.song.skipDuration);
  1465. }
  1466. this.settings("play");
  1467. },
  1468. seekTo(position) {
  1469. this.settings("play");
  1470. this.video.player.seekTo(position);
  1471. },
  1472. changeVolume() {
  1473. const volume = this.volumeSliderValue;
  1474. localStorage.setItem("volume", volume);
  1475. this.video.player.setVolume(volume);
  1476. if (volume > 0) {
  1477. this.video.player.unMute();
  1478. this.muted = false;
  1479. }
  1480. },
  1481. toggleMute() {
  1482. const previousVolume = parseFloat(localStorage.getItem("volume"));
  1483. const volume =
  1484. this.video.player.getVolume() <= 0 ? previousVolume : 0;
  1485. this.muted = !this.muted;
  1486. this.volumeSliderValue = volume;
  1487. this.video.player.setVolume(volume);
  1488. if (!this.muted) localStorage.setItem("volume", volume);
  1489. },
  1490. increaseVolume() {
  1491. const previousVolume = parseFloat(localStorage.getItem("volume"));
  1492. let volume = previousVolume + 5;
  1493. this.muted = false;
  1494. if (volume > 100) volume = 100;
  1495. this.volumeSliderValue = volume;
  1496. this.video.player.setVolume(volume);
  1497. localStorage.setItem("volume", volume);
  1498. },
  1499. addTag(type, value) {
  1500. if (type === "genres") {
  1501. const genre = value || this.genreInputValue.trim();
  1502. if (
  1503. this.song.genres
  1504. .map(genre => genre.toLowerCase())
  1505. .indexOf(genre.toLowerCase()) !== -1
  1506. )
  1507. return new Toast("Genre already exists");
  1508. if (genre) {
  1509. this.song.genres.push(genre);
  1510. this.genreInputValue = "";
  1511. return false;
  1512. }
  1513. return new Toast("Genre cannot be empty");
  1514. }
  1515. if (type === "artists") {
  1516. const artist = value || this.artistInputValue;
  1517. if (this.song.artists.indexOf(artist) !== -1)
  1518. return new Toast("Artist already exists");
  1519. if (artist !== "") {
  1520. this.song.artists.push(artist);
  1521. this.artistInputValue = "";
  1522. return false;
  1523. }
  1524. return new Toast("Artist cannot be empty");
  1525. }
  1526. if (type === "tags") {
  1527. const tag = value || this.tagInputValue;
  1528. if (this.song.tags.indexOf(tag) !== -1)
  1529. return new Toast("Tag already exists");
  1530. if (tag !== "") {
  1531. this.song.tags.push(tag);
  1532. this.tagInputValue = "";
  1533. return false;
  1534. }
  1535. return new Toast("Tag cannot be empty");
  1536. }
  1537. return false;
  1538. },
  1539. removeTag(type, value) {
  1540. if (type === "genres")
  1541. this.song.genres.splice(this.song.genres.indexOf(value), 1);
  1542. else if (type === "artists")
  1543. this.song.artists.splice(this.song.artists.indexOf(value), 1);
  1544. else if (type === "tags")
  1545. this.song.tags.splice(this.song.tags.indexOf(value), 1);
  1546. },
  1547. drawCanvas() {
  1548. if (!this.songDataLoaded) return;
  1549. const canvasElement = this.$refs.durationCanvas;
  1550. const ctx = canvasElement.getContext("2d");
  1551. const videoDuration = Number(this.youtubeVideoDuration);
  1552. const skipDuration = Number(this.song.skipDuration);
  1553. const duration = Number(this.song.duration);
  1554. const afterDuration = videoDuration - (skipDuration + duration);
  1555. const width = 530;
  1556. const currentTime =
  1557. this.video.player && this.video.player.getCurrentTime
  1558. ? this.video.player.getCurrentTime()
  1559. : 0;
  1560. const widthSkipDuration = (skipDuration / videoDuration) * width;
  1561. const widthDuration = (duration / videoDuration) * width;
  1562. const widthAfterDuration = (afterDuration / videoDuration) * width;
  1563. const widthCurrentTime = (currentTime / videoDuration) * width;
  1564. const skipDurationColor = "#F42003";
  1565. const durationColor = "#03A9F4";
  1566. const afterDurationColor = "#41E841";
  1567. const currentDurationColor = "#3b25e8";
  1568. ctx.fillStyle = skipDurationColor;
  1569. ctx.fillRect(0, 0, widthSkipDuration, 20);
  1570. ctx.fillStyle = durationColor;
  1571. ctx.fillRect(widthSkipDuration, 0, widthDuration, 20);
  1572. ctx.fillStyle = afterDurationColor;
  1573. ctx.fillRect(
  1574. widthSkipDuration + widthDuration,
  1575. 0,
  1576. widthAfterDuration,
  1577. 20
  1578. );
  1579. ctx.fillStyle = currentDurationColor;
  1580. ctx.fillRect(widthCurrentTime, 0, 1, 20);
  1581. },
  1582. setTrackPosition(event) {
  1583. this.seekTo(
  1584. Number(
  1585. Number(this.video.player.getDuration()) *
  1586. ((event.pageX -
  1587. event.target.getBoundingClientRect().left) /
  1588. 530)
  1589. )
  1590. );
  1591. },
  1592. toggleGenreHelper() {
  1593. this.$refs.genreHelper.toggleBox();
  1594. },
  1595. resetGenreHelper() {
  1596. this.$refs.genreHelper.resetBox();
  1597. },
  1598. sendActivityWatchVideoData() {
  1599. if (!this.video.paused) {
  1600. if (this.activityWatchVideoLastStatus !== "playing") {
  1601. this.activityWatchVideoLastStatus = "playing";
  1602. if (
  1603. this.song.skipDuration > 0 &&
  1604. parseFloat(this.youtubeVideoCurrentTime) === 0
  1605. ) {
  1606. this.activityWatchVideoLastStartDuration = Math.floor(
  1607. this.song.skipDuration +
  1608. parseFloat(this.youtubeVideoCurrentTime)
  1609. );
  1610. } else {
  1611. this.activityWatchVideoLastStartDuration = Math.floor(
  1612. parseFloat(this.youtubeVideoCurrentTime)
  1613. );
  1614. }
  1615. }
  1616. const videoData = {
  1617. title: this.song.title,
  1618. artists: this.song.artists
  1619. ? this.song.artists.join(", ")
  1620. : null,
  1621. youtubeId: this.song.youtubeId,
  1622. muted: this.muted,
  1623. volume: this.volumeSliderValue,
  1624. startedDuration:
  1625. this.activityWatchVideoLastStartDuration <= 0
  1626. ? 0
  1627. : this.activityWatchVideoLastStartDuration,
  1628. source: `editSong#${this.song.youtubeId}`,
  1629. hostname: window.location.hostname
  1630. };
  1631. aw.sendVideoData(videoData);
  1632. } else {
  1633. this.activityWatchVideoLastStatus = "not_playing";
  1634. }
  1635. },
  1636. remove(id) {
  1637. this.socket.dispatch("songs.remove", id, res => {
  1638. new Toast(res.message);
  1639. });
  1640. },
  1641. confirmAction({ message, action, params }) {
  1642. this.openModal({
  1643. modal: "confirm",
  1644. data: {
  1645. message,
  1646. action,
  1647. params,
  1648. onCompleted: this.handleConfirmed
  1649. }
  1650. });
  1651. },
  1652. handleConfirmed({ action, params }) {
  1653. if (typeof this[action] === "function") {
  1654. if (params) this[action](params);
  1655. else this[action]();
  1656. }
  1657. },
  1658. onCloseModal() {
  1659. const songStringified = JSON.stringify({
  1660. ...this.song
  1661. });
  1662. const originalSongStringified = JSON.stringify({
  1663. ...this.originalSong
  1664. });
  1665. const unsavedChanges = songStringified !== originalSongStringified;
  1666. if (unsavedChanges) {
  1667. return this.confirmAction({
  1668. message:
  1669. "You have unsaved changes. Are you sure you want to discard unsaved changes?",
  1670. action: "closeThisModal",
  1671. params: null
  1672. });
  1673. }
  1674. return this.closeThisModal();
  1675. },
  1676. closeThisModal() {
  1677. if (this.bulk) this.$emit("close");
  1678. else this.closeModal("editSong");
  1679. },
  1680. ...mapActions("modals/importAlbum", ["selectDiscogsAlbum"]),
  1681. ...mapActions({
  1682. showTab(dispatch, payload) {
  1683. if (this.$refs[`${payload}-tab`])
  1684. this.$refs[`${payload}-tab`].scrollIntoView({
  1685. block: "nearest"
  1686. });
  1687. return dispatch("modals/editSong/showTab", payload);
  1688. }
  1689. }),
  1690. ...mapActions("modals/editSong", [
  1691. "stopVideo",
  1692. "hardStopVideo",
  1693. "loadVideoById",
  1694. "pauseVideo",
  1695. "getCurrentTime",
  1696. "setSong",
  1697. "resetSong",
  1698. "updateOriginalSong",
  1699. "updateSongField",
  1700. "updateReports",
  1701. "setPlaybackRate"
  1702. ]),
  1703. ...mapActions("modalVisibility", ["closeModal", "openModal"])
  1704. }
  1705. };
  1706. </script>
  1707. <style lang="less" scoped>
  1708. .night-mode {
  1709. .edit-section,
  1710. .player-section,
  1711. #tabs-container {
  1712. background-color: var(--dark-grey-3) !important;
  1713. border: 0 !important;
  1714. .tab {
  1715. border: 0 !important;
  1716. }
  1717. }
  1718. #tabs-container #tab-selection .button {
  1719. background: var(--dark-grey) !important;
  1720. color: var(--white) !important;
  1721. }
  1722. .left-section {
  1723. .edit-section {
  1724. .album-get-button,
  1725. .duration-fill-button,
  1726. .add-button {
  1727. &:focus,
  1728. &:hover {
  1729. border: none !important;
  1730. }
  1731. }
  1732. }
  1733. }
  1734. #durationCanvas {
  1735. background-color: var(--dark-grey-2) !important;
  1736. }
  1737. }
  1738. .modal-card-body {
  1739. display: flex;
  1740. }
  1741. .notice-container {
  1742. display: flex;
  1743. flex: 1;
  1744. justify-content: center;
  1745. h4 {
  1746. margin: auto;
  1747. }
  1748. }
  1749. .left-section {
  1750. flex-basis: unset !important;
  1751. height: 100%;
  1752. display: flex;
  1753. flex-direction: column;
  1754. margin-right: 16px;
  1755. .top-section {
  1756. display: flex;
  1757. .player-section {
  1758. width: 530px;
  1759. display: flex;
  1760. flex-direction: column;
  1761. border: 1px solid var(--light-grey-3);
  1762. border-radius: @border-radius;
  1763. overflow: hidden;
  1764. #durationCanvas {
  1765. background-color: var(--light-grey-2);
  1766. }
  1767. .player-error {
  1768. display: flex;
  1769. height: 318px;
  1770. width: 530px;
  1771. align-items: center;
  1772. * {
  1773. margin: 0;
  1774. flex: 1;
  1775. font-size: 30px;
  1776. text-align: center;
  1777. }
  1778. }
  1779. .player-footer {
  1780. display: flex;
  1781. justify-content: space-between;
  1782. height: 54px;
  1783. padding-left: 10px;
  1784. padding-right: 10px;
  1785. > * {
  1786. width: 33.3%;
  1787. display: flex;
  1788. align-items: center;
  1789. }
  1790. .player-footer-left {
  1791. flex: 1;
  1792. & > .button:not(:first-child) {
  1793. margin-left: 5px;
  1794. }
  1795. :deep(& > .playerRateDropdown) {
  1796. margin-left: 5px;
  1797. margin-bottom: unset !important;
  1798. .control.has-addons {
  1799. margin-bottom: unset !important;
  1800. & > .button {
  1801. font-size: 24px;
  1802. }
  1803. }
  1804. }
  1805. :deep(.tippy-box[data-theme~="dropdown"]) {
  1806. max-width: 100px !important;
  1807. .nav-dropdown-items .nav-item {
  1808. justify-content: center !important;
  1809. border-radius: @border-radius !important;
  1810. &.active {
  1811. background-color: var(--primary-color);
  1812. color: var(--white);
  1813. }
  1814. }
  1815. }
  1816. }
  1817. .player-footer-center {
  1818. justify-content: center;
  1819. align-items: center;
  1820. flex: 2;
  1821. font-size: 18px;
  1822. font-weight: 400;
  1823. width: 200px;
  1824. margin: 0 5px;
  1825. img {
  1826. height: 21px;
  1827. margin-right: 12px;
  1828. filter: invert(26%) sepia(54%) saturate(6317%)
  1829. hue-rotate(2deg) brightness(92%) contrast(115%);
  1830. }
  1831. }
  1832. .player-footer-right {
  1833. justify-content: right;
  1834. flex: 1;
  1835. #volume-control {
  1836. margin: 3px;
  1837. margin-top: 0;
  1838. display: flex;
  1839. align-items: center;
  1840. cursor: pointer;
  1841. .volume-slider {
  1842. width: 100%;
  1843. padding: 0 15px;
  1844. background: transparent;
  1845. min-width: 100px;
  1846. }
  1847. input[type="range"] {
  1848. -webkit-appearance: none;
  1849. margin: 7.3px 0;
  1850. }
  1851. input[type="range"]:focus {
  1852. outline: none;
  1853. }
  1854. input[type="range"]::-webkit-slider-runnable-track {
  1855. width: 100%;
  1856. height: 5.2px;
  1857. cursor: pointer;
  1858. box-shadow: 0;
  1859. background: var(--light-grey-3);
  1860. border-radius: @border-radius;
  1861. border: 0;
  1862. }
  1863. input[type="range"]::-webkit-slider-thumb {
  1864. box-shadow: 0;
  1865. border: 0;
  1866. height: 19px;
  1867. width: 19px;
  1868. border-radius: 100%;
  1869. background: var(--primary-color);
  1870. cursor: pointer;
  1871. -webkit-appearance: none;
  1872. margin-top: -6.5px;
  1873. }
  1874. input[type="range"]::-moz-range-track {
  1875. width: 100%;
  1876. height: 5.2px;
  1877. cursor: pointer;
  1878. box-shadow: 0;
  1879. background: var(--light-grey-3);
  1880. border-radius: @border-radius;
  1881. border: 0;
  1882. }
  1883. input[type="range"]::-moz-range-thumb {
  1884. box-shadow: 0;
  1885. border: 0;
  1886. height: 19px;
  1887. width: 19px;
  1888. border-radius: 100%;
  1889. background: var(--primary-color);
  1890. cursor: pointer;
  1891. -webkit-appearance: none;
  1892. margin-top: -6.5px;
  1893. }
  1894. input[type="range"]::-ms-track {
  1895. width: 100%;
  1896. height: 5.2px;
  1897. cursor: pointer;
  1898. box-shadow: 0;
  1899. background: var(--light-grey-3);
  1900. border-radius: @border-radius;
  1901. }
  1902. input[type="range"]::-ms-fill-lower {
  1903. background: var(--light-grey-3);
  1904. border: 0;
  1905. border-radius: 0;
  1906. box-shadow: 0;
  1907. }
  1908. input[type="range"]::-ms-fill-upper {
  1909. background: var(--light-grey-3);
  1910. border: 0;
  1911. border-radius: 0;
  1912. box-shadow: 0;
  1913. }
  1914. input[type="range"]::-ms-thumb {
  1915. box-shadow: 0;
  1916. border: 0;
  1917. height: 15px;
  1918. width: 15px;
  1919. border-radius: 100%;
  1920. background: var(--primary-color);
  1921. cursor: pointer;
  1922. -webkit-appearance: none;
  1923. margin-top: 1.5px;
  1924. }
  1925. }
  1926. }
  1927. }
  1928. }
  1929. .thumbnail-preview {
  1930. width: 189px;
  1931. height: 189px;
  1932. margin-left: 16px;
  1933. }
  1934. }
  1935. .edit-section {
  1936. width: 735px;
  1937. border: 1px solid var(--light-grey-3);
  1938. flex: 1;
  1939. margin-top: 16px;
  1940. border-radius: @border-radius;
  1941. .album-get-button {
  1942. background-color: var(--purple);
  1943. color: var(--white);
  1944. width: 32px;
  1945. text-align: center;
  1946. border-width: 0;
  1947. }
  1948. .duration-fill-button {
  1949. background-color: var(--dark-red);
  1950. color: var(--white);
  1951. width: 32px;
  1952. text-align: center;
  1953. border-width: 0;
  1954. }
  1955. .add-button {
  1956. background-color: var(--primary-color) !important;
  1957. width: 32px;
  1958. i {
  1959. font-size: 32px;
  1960. }
  1961. }
  1962. .album-get-button,
  1963. .duration-fill-button,
  1964. .add-button {
  1965. &:focus,
  1966. &:hover {
  1967. filter: contrast(0.75);
  1968. border: 1px solid var(--black) !important;
  1969. }
  1970. }
  1971. > div {
  1972. margin: 16px !important;
  1973. }
  1974. input {
  1975. width: 100%;
  1976. }
  1977. .title-container {
  1978. width: calc((100% - 32px) / 2);
  1979. }
  1980. .duration-container {
  1981. margin-right: 16px;
  1982. margin-left: 16px;
  1983. width: calc((100% - 32px) / 4);
  1984. }
  1985. .skip-duration-container {
  1986. width: calc((100% - 32px) / 4);
  1987. }
  1988. .album-art-container {
  1989. margin-right: 16px;
  1990. width: calc((100% - 16px) / 8 * 4);
  1991. }
  1992. .youtube-id-container {
  1993. margin-right: 16px;
  1994. width: calc((100% - 16px) / 8 * 3);
  1995. }
  1996. .verified-container {
  1997. width: calc((100% - 16px) / 8);
  1998. .checkbox-control {
  1999. margin-top: 10px;
  2000. }
  2001. }
  2002. .artists-container {
  2003. width: calc((100% - 32px) / 3);
  2004. position: relative;
  2005. }
  2006. .genres-container {
  2007. width: calc((100% - 32px) / 3);
  2008. margin-left: 16px;
  2009. margin-right: 16px;
  2010. position: relative;
  2011. label {
  2012. display: flex;
  2013. i {
  2014. font-size: 15px;
  2015. align-self: center;
  2016. margin-left: 5px;
  2017. color: var(--primary-color);
  2018. cursor: pointer;
  2019. -webkit-user-select: none;
  2020. -moz-user-select: none;
  2021. -ms-user-select: none;
  2022. user-select: none;
  2023. }
  2024. }
  2025. }
  2026. .tags-container {
  2027. width: calc((100% - 32px) / 3);
  2028. position: relative;
  2029. }
  2030. .list-item-circle {
  2031. background-color: var(--primary-color);
  2032. width: 16px;
  2033. height: 16px;
  2034. border-radius: 8px;
  2035. cursor: pointer;
  2036. margin-right: 8px;
  2037. float: left;
  2038. -webkit-touch-callout: none;
  2039. -webkit-user-select: none;
  2040. -khtml-user-select: none;
  2041. -moz-user-select: none;
  2042. -ms-user-select: none;
  2043. user-select: none;
  2044. i {
  2045. color: var(--primary-color);
  2046. font-size: 14px;
  2047. margin-left: 1px;
  2048. position: relative;
  2049. top: -1px;
  2050. }
  2051. }
  2052. .list-item-circle:hover,
  2053. .list-item-circle:focus {
  2054. i {
  2055. color: var(--white);
  2056. }
  2057. }
  2058. .list-item > p {
  2059. line-height: 16px;
  2060. word-wrap: break-word;
  2061. width: calc(100% - 24px);
  2062. left: 24px;
  2063. float: left;
  2064. margin-bottom: 8px;
  2065. }
  2066. .list-item:last-child > p {
  2067. margin-bottom: 0;
  2068. }
  2069. .thumbnail-warning {
  2070. color: var(--red);
  2071. font-size: 18px;
  2072. margin: auto 0 auto 5px;
  2073. }
  2074. }
  2075. }
  2076. .right-section {
  2077. flex-basis: unset !important;
  2078. flex-grow: 0 !important;
  2079. display: flex;
  2080. height: 100%;
  2081. #tabs-container {
  2082. width: 376px;
  2083. #tab-selection {
  2084. display: flex;
  2085. overflow-x: auto;
  2086. .button {
  2087. border-radius: @border-radius @border-radius 0 0;
  2088. border: 0;
  2089. text-transform: uppercase;
  2090. font-size: 14px;
  2091. color: var(--dark-grey-3);
  2092. background-color: var(--light-grey-2);
  2093. flex-grow: 1;
  2094. height: 32px;
  2095. &:not(:first-of-type) {
  2096. margin-left: 5px;
  2097. }
  2098. }
  2099. .selected {
  2100. background-color: var(--primary-color) !important;
  2101. color: var(--white) !important;
  2102. font-weight: 600;
  2103. }
  2104. }
  2105. .tab {
  2106. border: 1px solid var(--light-grey-3);
  2107. border-radius: 0 0 @border-radius @border-radius;
  2108. padding: 15px;
  2109. height: calc(100% - 32px);
  2110. overflow: auto;
  2111. }
  2112. }
  2113. }
  2114. .modal-card-foot .is-primary {
  2115. width: 200px;
  2116. }
  2117. :deep(.autosuggest-container) {
  2118. top: unset;
  2119. }
  2120. </style>