index.vue 55 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328
  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. <confirm v-if="modals.editSongConfirm" @confirmed="handleConfirmed()" />
  625. </div>
  626. </template>
  627. <script>
  628. import { mapState, mapGetters, mapActions } from "vuex";
  629. import { defineAsyncComponent } from "vue";
  630. import Toast from "toasters";
  631. import aw from "@/aw";
  632. import ws from "@/ws";
  633. import validation from "@/validation";
  634. import keyboardShortcuts from "@/keyboardShortcuts";
  635. import Modal from "../../Modal.vue";
  636. import FloatingBox from "../../FloatingBox.vue";
  637. import SaveButton from "../../SaveButton.vue";
  638. import AutoSuggest from "@/components/AutoSuggest.vue";
  639. import Discogs from "./Tabs/Discogs.vue";
  640. import Reports from "./Tabs/Reports.vue";
  641. import Youtube from "./Tabs/Youtube.vue";
  642. import MusareSongs from "./Tabs/Songs.vue";
  643. export default {
  644. components: {
  645. Modal,
  646. FloatingBox,
  647. SaveButton,
  648. AutoSuggest,
  649. Discogs,
  650. Reports,
  651. Youtube,
  652. MusareSongs,
  653. Confirm: defineAsyncComponent(() =>
  654. import("@/components/modals/Confirm.vue")
  655. )
  656. },
  657. props: {
  658. // songId: { type: String, default: null },
  659. discogsAlbum: { type: Object, default: null },
  660. sector: { type: String, default: "admin" },
  661. bulk: { type: Boolean, default: false },
  662. flagged: { type: Boolean, default: false }
  663. },
  664. emits: [
  665. "error",
  666. "savedSuccess",
  667. "savedError",
  668. "flagSong",
  669. "nextSong",
  670. "close"
  671. ],
  672. data() {
  673. return {
  674. songDataLoaded: false,
  675. songDeleted: false,
  676. youtubeError: false,
  677. youtubeErrorMessage: "",
  678. focusedElementBefore: null,
  679. youtubeVideoDuration: "0.000",
  680. youtubeVideoCurrentTime: 0,
  681. youtubeVideoNote: "",
  682. useHTTPS: false,
  683. muted: false,
  684. volumeSliderValue: 0,
  685. artistInputValue: "",
  686. genreInputValue: "",
  687. tagInputValue: "",
  688. activityWatchVideoDataInterval: null,
  689. activityWatchVideoLastStatus: "",
  690. activityWatchVideoLastStartDuration: "",
  691. confirm: {
  692. message: "",
  693. action: "",
  694. params: null
  695. },
  696. recommendedGenres: [
  697. "Blues",
  698. "Country",
  699. "Disco",
  700. "Funk",
  701. "Hip-Hop",
  702. "Jazz",
  703. "Metal",
  704. "Oldies",
  705. "Other",
  706. "Pop",
  707. "Rap",
  708. "Reggae",
  709. "Rock",
  710. "Techno",
  711. "Trance",
  712. "Classical",
  713. "Instrumental",
  714. "House",
  715. "Electronic",
  716. "Christian Rap",
  717. "Lo-Fi",
  718. "Musical",
  719. "Rock 'n' Roll",
  720. "Opera",
  721. "Drum & Bass",
  722. "Club-House",
  723. "Indie",
  724. "Heavy Metal",
  725. "Christian rock",
  726. "Dubstep"
  727. ],
  728. autosuggest: {
  729. allItems: {
  730. artists: [],
  731. genres: [],
  732. tags: []
  733. }
  734. },
  735. songNotFound: false,
  736. showRateDropdown: false,
  737. thumbnailNotSquare: false,
  738. thumbnailWidth: null,
  739. thumbnailHeight: null
  740. };
  741. },
  742. computed: {
  743. thumbnailIsYouTubeThumbnail() {
  744. return (
  745. this.songDataLoaded &&
  746. this.song.thumbnail &&
  747. this.song.thumbnail.startsWith("https://i.ytimg.com")
  748. );
  749. },
  750. ...mapState("modals/editSong", {
  751. tab: state => state.tab,
  752. video: state => state.video,
  753. song: state => state.song,
  754. songId: state => state.songId,
  755. prefillData: state => state.prefillData,
  756. originalSong: state => state.originalSong,
  757. reports: state => state.reports,
  758. newSong: state => state.newSong
  759. }),
  760. ...mapState("modalVisibility", {
  761. modals: state => state.modals,
  762. currentlyActive: state => state.currentlyActive
  763. }),
  764. ...mapGetters({
  765. socket: "websockets/getSocket"
  766. })
  767. },
  768. watch: {
  769. /* eslint-disable */
  770. "song.duration": function () {
  771. this.drawCanvas();
  772. },
  773. "song.skipDuration": function () {
  774. this.drawCanvas();
  775. },
  776. /* eslint-enable */
  777. songId(songId, oldSongId) {
  778. console.log("NEW SONG ID", songId);
  779. this.unloadSong(oldSongId);
  780. this.loadSong(songId);
  781. }
  782. },
  783. async mounted() {
  784. console.log("MOUNTED");
  785. this.activityWatchVideoDataInterval = setInterval(() => {
  786. this.sendActivityWatchVideoData();
  787. }, 1000);
  788. this.useHTTPS = await lofig.get("cookie.secure");
  789. ws.onConnect(this.init);
  790. let volume = parseFloat(localStorage.getItem("volume"));
  791. volume =
  792. typeof volume === "number" && !Number.isNaN(volume) ? volume : 20;
  793. localStorage.setItem("volume", volume);
  794. this.volumeSliderValue = volume;
  795. if (!this.newSong) {
  796. this.socket.on(
  797. "event:admin.song.removed",
  798. res => {
  799. if (res.data.songId === this.song._id) {
  800. this.songDeleted = true;
  801. }
  802. },
  803. { modal: this.bulk ? "editSongs" : "editSong" }
  804. );
  805. }
  806. keyboardShortcuts.registerShortcut("editSong.pauseResumeVideo", {
  807. keyCode: 101,
  808. preventDefault: true,
  809. handler: () => {
  810. if (this.video.paused) this.play();
  811. else this.settings("pause");
  812. }
  813. });
  814. keyboardShortcuts.registerShortcut("editSong.stopVideo", {
  815. keyCode: 101,
  816. ctrl: true,
  817. preventDefault: true,
  818. handler: () => {
  819. this.settings("stop");
  820. }
  821. });
  822. keyboardShortcuts.registerShortcut("editSong.hardStopVideo", {
  823. keyCode: 101,
  824. ctrl: true,
  825. shift: true,
  826. preventDefault: true,
  827. handler: () => {
  828. this.settings("hardStop");
  829. }
  830. });
  831. keyboardShortcuts.registerShortcut("editSong.skipToLast10Secs", {
  832. keyCode: 102,
  833. preventDefault: true,
  834. handler: () => {
  835. this.settings("skipToLast10Secs");
  836. }
  837. });
  838. keyboardShortcuts.registerShortcut("editSong.lowerVolumeLarge", {
  839. keyCode: 98,
  840. preventDefault: true,
  841. handler: () => {
  842. this.volumeSliderValue = Math.max(
  843. 0,
  844. this.volumeSliderValue - 10
  845. );
  846. this.changeVolume();
  847. }
  848. });
  849. keyboardShortcuts.registerShortcut("editSong.lowerVolumeSmall", {
  850. keyCode: 98,
  851. ctrl: true,
  852. preventDefault: true,
  853. handler: () => {
  854. this.volumeSliderValue = Math.max(
  855. 0,
  856. this.volumeSliderValue - 1
  857. );
  858. this.changeVolume();
  859. }
  860. });
  861. keyboardShortcuts.registerShortcut("editSong.increaseVolumeLarge", {
  862. keyCode: 104,
  863. preventDefault: true,
  864. handler: () => {
  865. this.volumeSliderValue = Math.min(
  866. 100,
  867. this.volumeSliderValue + 10
  868. );
  869. this.changeVolume();
  870. }
  871. });
  872. keyboardShortcuts.registerShortcut("editSong.increaseVolumeSmall", {
  873. keyCode: 104,
  874. ctrl: true,
  875. preventDefault: true,
  876. handler: () => {
  877. this.volumeSliderValue = Math.min(
  878. 100,
  879. this.volumeSliderValue + 1
  880. );
  881. this.changeVolume();
  882. }
  883. });
  884. keyboardShortcuts.registerShortcut("editSong.save", {
  885. keyCode: 83,
  886. ctrl: true,
  887. preventDefault: true,
  888. handler: () => {
  889. this.save(this.song, false, "saveButton");
  890. }
  891. });
  892. keyboardShortcuts.registerShortcut("editSong.saveClose", {
  893. keyCode: 83,
  894. ctrl: true,
  895. alt: true,
  896. preventDefault: true,
  897. handler: () => {
  898. this.save(this.song, true, "saveAndCloseButton");
  899. }
  900. });
  901. keyboardShortcuts.registerShortcut("editSong.focusTitle", {
  902. keyCode: 36,
  903. preventDefault: true,
  904. handler: () => {
  905. this.$refs["title-input"].focus();
  906. }
  907. });
  908. keyboardShortcuts.registerShortcut("editSong.useAllDiscogs", {
  909. keyCode: 68,
  910. alt: true,
  911. ctrl: true,
  912. preventDefault: true,
  913. handler: () => {
  914. this.getAlbumData("title");
  915. this.getAlbumData("albumArt");
  916. this.getAlbumData("artists");
  917. this.getAlbumData("genres");
  918. }
  919. });
  920. keyboardShortcuts.registerShortcut("editSong.closeModal", {
  921. keyCode: 27,
  922. handler: () => {
  923. if (
  924. this.currentlyActive[0] === "editSong" ||
  925. this.currentlyActive[0] === "editSongs"
  926. ) {
  927. this.onCloseModal();
  928. }
  929. }
  930. });
  931. /*
  932. editSong.pauseResume - Num 5 - Pause/resume song
  933. editSong.stopVideo - Ctrl - Num 5 - Stop
  934. editSong.hardStopVideo - Shift - Ctrl - Num 5 - Stop
  935. editSong.skipToLast10Secs - Num 6 - Skip to last 10 seconds
  936. editSong.lowerVolumeLarge - Num 2 - Volume down by 10
  937. editSong.lowerVolumeSmall - Ctrl - Num 2 - Volume down by 1
  938. editSong.increaseVolumeLarge - Num 8 - Volume up by 10
  939. editSong.increaseVolumeSmall - Ctrl - Num 8 - Volume up by 1
  940. editSong.focusTitle - Home - Focus the title input
  941. editSong.focusDicogs - End - Focus the discogs input
  942. editSong.save - Ctrl - S - Saves song
  943. editSong.save - Ctrl - Alt - S - Saves song and closes the modal
  944. editSong.save - Ctrl - Alt - V - Saves song, verifies songs and then closes the modal
  945. editSong.close - F4 - Closes modal without saving
  946. editSong.useAllDiscogs - Ctrl - Alt - D - Sets all fields to the Discogs data
  947. Inside Discogs inputs: Ctrl - D - Sets this field to the Discogs data
  948. */
  949. },
  950. beforeUnmount() {
  951. console.log("UNMOUNT");
  952. if (!this.newSong) this.unloadSong(this.songId);
  953. this.playerReady = false;
  954. clearInterval(this.interval);
  955. clearInterval(this.activityWatchVideoDataInterval);
  956. const shortcutNames = [
  957. "editSong.pauseResume",
  958. "editSong.stopVideo",
  959. "editSong.hardStopVideo",
  960. "editSong.skipToLast10Secs",
  961. "editSong.lowerVolumeLarge",
  962. "editSong.lowerVolumeSmall",
  963. "editSong.increaseVolumeLarge",
  964. "editSong.increaseVolumeSmall",
  965. "editSong.focusTitle",
  966. "editSong.focusDicogs",
  967. "editSong.save",
  968. "editSong.saveClose",
  969. "editSong.useAllDiscogs",
  970. "editSong.closeModal"
  971. ];
  972. shortcutNames.forEach(shortcutName => {
  973. keyboardShortcuts.unregisterShortcut(shortcutName);
  974. });
  975. },
  976. methods: {
  977. onThumbnailLoad() {
  978. if (this.$refs.thumbnailElement) {
  979. const thumbnailHeight =
  980. this.$refs.thumbnailElement.naturalHeight;
  981. const thumbnailWidth = this.$refs.thumbnailElement.naturalWidth;
  982. this.thumbnailNotSquare = thumbnailHeight !== thumbnailWidth;
  983. this.thumbnailHeight = thumbnailHeight;
  984. this.thumbnailWidth = thumbnailWidth;
  985. } else {
  986. this.thumbnailNotSquare = false;
  987. this.thumbnailHeight = null;
  988. this.thumbnailWidth = null;
  989. }
  990. },
  991. init() {
  992. if (this.newSong) {
  993. this.setSong({
  994. youtubeId: "",
  995. title: "",
  996. artists: [],
  997. genres: [],
  998. tags: [],
  999. duration: 0,
  1000. skipDuration: 0,
  1001. thumbnail: "",
  1002. verified: false
  1003. });
  1004. this.songDataLoaded = true;
  1005. this.showTab("youtube");
  1006. } else if (this.songId) this.loadSong(this.songId);
  1007. else if (!this.bulk) {
  1008. new Toast("You can't open EditSong without editing a song");
  1009. return this.closeModal("editSong");
  1010. }
  1011. this.interval = setInterval(() => {
  1012. if (
  1013. this.song.duration !== -1 &&
  1014. this.video.paused === false &&
  1015. this.playerReady &&
  1016. (this.video.player.getCurrentTime() -
  1017. this.song.skipDuration >
  1018. this.song.duration ||
  1019. (this.video.player.getCurrentTime() > 0 &&
  1020. this.video.player.getCurrentTime() >=
  1021. this.video.player.getDuration()))
  1022. ) {
  1023. this.stopVideo();
  1024. this.pauseVideo(true);
  1025. this.drawCanvas();
  1026. }
  1027. if (
  1028. this.playerReady &&
  1029. this.video.player.getVideoData &&
  1030. this.video.player.getVideoData() &&
  1031. this.video.player.getVideoData().video_id ===
  1032. this.song.youtubeId
  1033. ) {
  1034. const currentTime = this.video.player.getCurrentTime();
  1035. if (currentTime !== undefined)
  1036. this.youtubeVideoCurrentTime = currentTime.toFixed(3);
  1037. if (this.youtubeVideoDuration === "0.000") {
  1038. const duration = this.video.player.getDuration();
  1039. if (duration !== undefined) {
  1040. this.youtubeVideoDuration = duration.toFixed(3);
  1041. this.youtubeVideoNote = "(~)";
  1042. this.drawCanvas();
  1043. }
  1044. }
  1045. }
  1046. if (this.video.paused === false) this.drawCanvas();
  1047. }, 200);
  1048. if (window.YT && window.YT.Player) {
  1049. this.video.player = new window.YT.Player("editSongPlayer", {
  1050. height: 298,
  1051. width: 530,
  1052. videoId: null,
  1053. host: "https://www.youtube-nocookie.com",
  1054. playerVars: {
  1055. controls: 0,
  1056. iv_load_policy: 3,
  1057. rel: 0,
  1058. showinfo: 0,
  1059. autoplay: 0
  1060. },
  1061. startSeconds: this.song.skipDuration,
  1062. events: {
  1063. onReady: () => {
  1064. let volume = parseFloat(
  1065. localStorage.getItem("volume")
  1066. );
  1067. volume = typeof volume === "number" ? volume : 20;
  1068. this.video.player.setVolume(volume);
  1069. if (volume > 0) this.video.player.unMute();
  1070. this.playerReady = true;
  1071. if (this.song && this.song._id)
  1072. this.video.player.cueVideoById(
  1073. this.song.youtubeId,
  1074. this.song.skipDuration
  1075. );
  1076. this.setPlaybackRate(null);
  1077. this.drawCanvas();
  1078. },
  1079. onStateChange: event => {
  1080. this.drawCanvas();
  1081. if (event.data === 1) {
  1082. this.video.paused = false;
  1083. let youtubeDuration =
  1084. this.video.player.getDuration();
  1085. const newYoutubeVideoDuration =
  1086. youtubeDuration.toFixed(3);
  1087. const songDurationNumber = Number(
  1088. this.song.duration
  1089. );
  1090. const songDurationNumber2 =
  1091. Number(this.song.duration) + 1;
  1092. const songDurationNumber3 =
  1093. Number(this.song.duration) - 1;
  1094. const fixedSongDuration =
  1095. songDurationNumber.toFixed(3);
  1096. const fixedSongDuration2 =
  1097. songDurationNumber2.toFixed(3);
  1098. const fixedSongDuration3 =
  1099. songDurationNumber3.toFixed(3);
  1100. if (
  1101. this.youtubeVideoDuration !==
  1102. newYoutubeVideoDuration &&
  1103. (fixedSongDuration ===
  1104. this.youtubeVideoDuration ||
  1105. fixedSongDuration2 ===
  1106. this.youtubeVideoDuration ||
  1107. fixedSongDuration3 ===
  1108. this.youtubeVideoDuration)
  1109. )
  1110. this.song.duration =
  1111. newYoutubeVideoDuration;
  1112. this.youtubeVideoDuration =
  1113. newYoutubeVideoDuration;
  1114. this.youtubeVideoNote = "";
  1115. if (this.song.duration === -1)
  1116. this.song.duration = youtubeDuration;
  1117. youtubeDuration -= this.song.skipDuration;
  1118. if (this.song.duration > youtubeDuration + 1) {
  1119. this.stopVideo();
  1120. this.pauseVideo(true);
  1121. return new Toast(
  1122. "Video can't play. Specified duration is bigger than the YouTube song duration."
  1123. );
  1124. }
  1125. if (this.song.duration <= 0) {
  1126. this.stopVideo();
  1127. this.pauseVideo(true);
  1128. return new Toast(
  1129. "Video can't play. Specified duration has to be more than 0 seconds."
  1130. );
  1131. }
  1132. if (
  1133. this.video.player.getCurrentTime() <
  1134. this.song.skipDuration
  1135. ) {
  1136. return this.seekTo(this.song.skipDuration);
  1137. }
  1138. this.setPlaybackRate(null);
  1139. } else if (event.data === 2) {
  1140. this.video.paused = true;
  1141. }
  1142. return false;
  1143. }
  1144. }
  1145. });
  1146. } else {
  1147. this.youtubeError = true;
  1148. this.youtubeErrorMessage = "Player could not be loaded.";
  1149. }
  1150. ["artists", "genres", "tags"].forEach(type => {
  1151. this.socket.dispatch(
  1152. `songs.get${type.charAt(0).toUpperCase()}${type.slice(1)}`,
  1153. res => {
  1154. if (res.status === "success") {
  1155. const { items } = res.data;
  1156. if (type === "genres")
  1157. this.autosuggest.allItems[type] = Array.from(
  1158. new Set([
  1159. ...this.recommendedGenres,
  1160. ...items
  1161. ])
  1162. );
  1163. else this.autosuggest.allItems[type] = items;
  1164. } else {
  1165. new Toast(res.message);
  1166. }
  1167. }
  1168. );
  1169. });
  1170. return null;
  1171. },
  1172. unloadSong(songId) {
  1173. this.songDataLoaded = false;
  1174. this.songDeleted = false;
  1175. this.stopVideo();
  1176. this.pauseVideo(true);
  1177. this.resetSong(songId);
  1178. this.thumbnailNotSquare = false;
  1179. this.thumbnailWidth = null;
  1180. this.thumbnailHeight = null;
  1181. this.youtubeVideoCurrentTime = "0.000";
  1182. this.youtubeVideoDuration = "0.000";
  1183. this.socket.dispatch("apis.leaveRoom", `edit-song.${songId}`);
  1184. if (this.$refs.saveButton) this.$refs.saveButton.status = "default";
  1185. },
  1186. loadSong(songId) {
  1187. console.log(`LOAD SONG ${songId}`);
  1188. this.songNotFound = false;
  1189. this.socket.dispatch(`songs.getSongFromSongId`, songId, res => {
  1190. if (res.status === "success") {
  1191. let { song } = res.data;
  1192. song = Object.assign(song, this.prefillData);
  1193. this.setSong(song);
  1194. this.songDataLoaded = true;
  1195. this.socket.dispatch(
  1196. "apis.joinRoom",
  1197. `edit-song.${this.song._id}`
  1198. );
  1199. if (this.video.player && this.video.player.cueVideoById) {
  1200. this.video.player.cueVideoById(
  1201. this.song.youtubeId,
  1202. this.song.skipDuration
  1203. );
  1204. }
  1205. } else {
  1206. new Toast("Song with that ID not found");
  1207. if (this.bulk) this.songNotFound = true;
  1208. if (!this.bulk) this.closeModal("editSong");
  1209. }
  1210. });
  1211. this.socket.dispatch("reports.getReportsForSong", songId, res => {
  1212. this.updateReports(res.data.reports);
  1213. });
  1214. },
  1215. importAlbum(result) {
  1216. this.selectDiscogsAlbum(result);
  1217. this.openModal("importAlbum");
  1218. this.closeModal("editSong");
  1219. },
  1220. save(songToCopy, closeOrNext, saveButtonRefName, newSong = false) {
  1221. const song = JSON.parse(JSON.stringify(songToCopy));
  1222. if (!newSong) this.$emit("saving", song._id);
  1223. const saveButtonRef = this.$refs[saveButtonRefName];
  1224. if (!this.youtubeError && this.youtubeVideoDuration === "0.000") {
  1225. saveButtonRef.handleFailedSave();
  1226. if (!newSong) this.$emit("savedError", song._id);
  1227. return new Toast("The video appears to not be working.");
  1228. }
  1229. if (!song.title) {
  1230. saveButtonRef.handleFailedSave();
  1231. if (!newSong) this.$emit("savedError", song._id);
  1232. return new Toast("Please fill in all fields");
  1233. }
  1234. if (!song.thumbnail) {
  1235. saveButtonRef.handleFailedSave();
  1236. if (!newSong) this.$emit("savedError", song._id);
  1237. return new Toast("Please fill in all fields");
  1238. }
  1239. // const thumbnailHeight = this.$refs.thumbnailElement.naturalHeight;
  1240. // const thumbnailWidth = this.$refs.thumbnailElement.naturalWidth;
  1241. // if (thumbnailHeight < 80 || thumbnailWidth < 80) {
  1242. // saveButtonRef.handleFailedSave();
  1243. // return new Toast(
  1244. // "Thumbnail width and height must be at least 80px."
  1245. // );
  1246. // }
  1247. // if (thumbnailHeight > 4000 || thumbnailWidth > 4000) {
  1248. // saveButtonRef.handleFailedSave();
  1249. // return new Toast(
  1250. // "Thumbnail width and height must be less than 4000px."
  1251. // );
  1252. // }
  1253. // if (thumbnailHeight - thumbnailWidth > 5) {
  1254. // saveButtonRef.handleFailedSave();
  1255. // return new Toast("Thumbnail cannot be taller than it is wide.");
  1256. // }
  1257. // Youtube Id
  1258. if (
  1259. !newSong &&
  1260. this.youtubeError &&
  1261. this.originalSong.youtubeId !== song.youtubeId
  1262. ) {
  1263. saveButtonRef.handleFailedSave();
  1264. if (!newSong) this.$emit("savedError", song._id);
  1265. return new Toast(
  1266. "You're not allowed to change the YouTube id while the player is not working"
  1267. );
  1268. }
  1269. // Duration
  1270. if (
  1271. Number(song.skipDuration) + Number(song.duration) >
  1272. this.youtubeVideoDuration &&
  1273. ((!newSong && !this.youtubeError) ||
  1274. this.originalSong.duration !== song.duration)
  1275. ) {
  1276. saveButtonRef.handleFailedSave();
  1277. if (!newSong) this.$emit("savedError", song._id);
  1278. return new Toast(
  1279. "Duration can't be higher than the length of the video"
  1280. );
  1281. }
  1282. // Title
  1283. if (!validation.isLength(song.title, 1, 100)) {
  1284. saveButtonRef.handleFailedSave();
  1285. if (!newSong) this.$emit("savedError", song._id);
  1286. return new Toast(
  1287. "Title must have between 1 and 100 characters."
  1288. );
  1289. }
  1290. // Artists
  1291. if (
  1292. (song.verified && song.artists.length < 1) ||
  1293. song.artists.length > 10
  1294. ) {
  1295. saveButtonRef.handleFailedSave();
  1296. if (!newSong) this.$emit("savedError", song._id);
  1297. return new Toast(
  1298. "Invalid artists. You must have at least 1 artist and a maximum of 10 artists."
  1299. );
  1300. }
  1301. let error;
  1302. song.artists.forEach(artist => {
  1303. if (!validation.isLength(artist, 1, 64)) {
  1304. error = "Artist must have between 1 and 64 characters.";
  1305. return error;
  1306. }
  1307. if (artist === "NONE") {
  1308. error =
  1309. 'Invalid artist format. Artists are not allowed to be named "NONE".';
  1310. return error;
  1311. }
  1312. return false;
  1313. });
  1314. if (error) {
  1315. saveButtonRef.handleFailedSave();
  1316. if (!newSong) this.$emit("savedError", song._id);
  1317. return new Toast(error);
  1318. }
  1319. // Genres
  1320. error = undefined;
  1321. song.genres.forEach(genre => {
  1322. if (!validation.isLength(genre, 1, 32)) {
  1323. error = "Genre must have between 1 and 32 characters.";
  1324. return error;
  1325. }
  1326. if (!validation.regex.ascii.test(genre)) {
  1327. error =
  1328. "Invalid genre format. Only ascii characters are allowed.";
  1329. return error;
  1330. }
  1331. return false;
  1332. });
  1333. if (
  1334. (song.verified && song.genres.length < 1) ||
  1335. song.genres.length > 16
  1336. )
  1337. error = "You must have between 1 and 16 genres.";
  1338. if (error) {
  1339. saveButtonRef.handleFailedSave();
  1340. if (!newSong) this.$emit("savedError", song._id);
  1341. return new Toast(error);
  1342. }
  1343. error = undefined;
  1344. song.tags.forEach(tag => {
  1345. if (
  1346. !/^[a-zA-Z0-9_]{1,64}$|^[a-zA-Z0-9_]{1,64}\[[a-zA-Z0-9_]{1,64}\]$/.test(
  1347. tag
  1348. )
  1349. ) {
  1350. error = "Invalid tag format.";
  1351. return error;
  1352. }
  1353. return false;
  1354. });
  1355. if (error) {
  1356. saveButtonRef.handleFailedSave();
  1357. if (!newSong) this.$emit("savedError", song._id);
  1358. return new Toast(error);
  1359. }
  1360. // Thumbnail
  1361. if (!validation.isLength(song.thumbnail, 1, 256)) {
  1362. saveButtonRef.handleFailedSave();
  1363. if (!newSong) this.$emit("savedError", song._id);
  1364. return new Toast(
  1365. "Thumbnail must have between 8 and 256 characters."
  1366. );
  1367. }
  1368. if (this.useHTTPS && song.thumbnail.indexOf("https://") !== 0) {
  1369. saveButtonRef.handleFailedSave();
  1370. if (!newSong) this.$emit("savedError", song._id);
  1371. return new Toast('Thumbnail must start with "https://".');
  1372. }
  1373. if (
  1374. !this.useHTTPS &&
  1375. song.thumbnail.indexOf("http://") !== 0 &&
  1376. song.thumbnail.indexOf("https://") !== 0
  1377. ) {
  1378. saveButtonRef.handleFailedSave();
  1379. if (!newSong) this.$emit("savedError", song._id);
  1380. return new Toast('Thumbnail must start with "http://".');
  1381. }
  1382. saveButtonRef.status = "saving";
  1383. if (newSong)
  1384. return this.socket.dispatch(`songs.create`, song, res => {
  1385. new Toast(res.message);
  1386. if (res.status === "error") {
  1387. saveButtonRef.handleFailedSave();
  1388. return;
  1389. }
  1390. saveButtonRef.handleSuccessfulSave();
  1391. this.closeModal("editSong");
  1392. });
  1393. return this.socket.dispatch(`songs.update`, song._id, song, res => {
  1394. new Toast(res.message);
  1395. if (res.status === "error") {
  1396. saveButtonRef.handleFailedSave();
  1397. this.$emit("savedError", song._id);
  1398. return;
  1399. }
  1400. this.updateOriginalSong(song);
  1401. saveButtonRef.handleSuccessfulSave();
  1402. this.$emit("savedSuccess", song._id);
  1403. if (!closeOrNext) return;
  1404. if (this.bulk) this.$emit("nextSong");
  1405. else this.closeModal("editSong");
  1406. });
  1407. },
  1408. editNextSong() {
  1409. this.$emit("nextSong");
  1410. },
  1411. toggleFlag() {
  1412. this.$emit("toggleFlag");
  1413. },
  1414. getAlbumData(type) {
  1415. if (!this.song.discogs) return;
  1416. if (type === "title")
  1417. this.updateSongField({
  1418. field: "title",
  1419. value: this.song.discogs.track.title
  1420. });
  1421. if (type === "albumArt")
  1422. this.updateSongField({
  1423. field: "thumbnail",
  1424. value: this.song.discogs.album.albumArt
  1425. });
  1426. if (type === "genres")
  1427. this.updateSongField({
  1428. field: "genres",
  1429. value: JSON.parse(
  1430. JSON.stringify(this.song.discogs.album.genres)
  1431. )
  1432. });
  1433. if (type === "artists")
  1434. this.updateSongField({
  1435. field: "artists",
  1436. value: JSON.parse(
  1437. JSON.stringify(this.song.discogs.album.artists)
  1438. )
  1439. });
  1440. },
  1441. fillDuration() {
  1442. this.song.duration =
  1443. this.youtubeVideoDuration - this.song.skipDuration;
  1444. },
  1445. settings(type) {
  1446. switch (type) {
  1447. case "stop":
  1448. this.stopVideo();
  1449. this.pauseVideo(true);
  1450. break;
  1451. case "hardStop":
  1452. this.hardStopVideo();
  1453. this.pauseVideo(true);
  1454. break;
  1455. case "pause":
  1456. this.pauseVideo(true);
  1457. break;
  1458. case "play":
  1459. this.pauseVideo(false);
  1460. break;
  1461. case "skipToLast10Secs":
  1462. this.seekTo(
  1463. this.song.duration - 10 + this.song.skipDuration
  1464. );
  1465. break;
  1466. default:
  1467. break;
  1468. }
  1469. },
  1470. play() {
  1471. if (
  1472. this.video.player.getVideoData().video_id !==
  1473. this.song.youtubeId
  1474. ) {
  1475. this.song.duration = -1;
  1476. this.loadVideoById(this.song.youtubeId, this.song.skipDuration);
  1477. }
  1478. this.settings("play");
  1479. },
  1480. seekTo(position) {
  1481. this.settings("play");
  1482. this.video.player.seekTo(position);
  1483. },
  1484. changeVolume() {
  1485. const volume = this.volumeSliderValue;
  1486. localStorage.setItem("volume", volume);
  1487. this.video.player.setVolume(volume);
  1488. if (volume > 0) {
  1489. this.video.player.unMute();
  1490. this.muted = false;
  1491. }
  1492. },
  1493. toggleMute() {
  1494. const previousVolume = parseFloat(localStorage.getItem("volume"));
  1495. const volume =
  1496. this.video.player.getVolume() <= 0 ? previousVolume : 0;
  1497. this.muted = !this.muted;
  1498. this.volumeSliderValue = volume;
  1499. this.video.player.setVolume(volume);
  1500. if (!this.muted) localStorage.setItem("volume", volume);
  1501. },
  1502. increaseVolume() {
  1503. const previousVolume = parseFloat(localStorage.getItem("volume"));
  1504. let volume = previousVolume + 5;
  1505. this.muted = false;
  1506. if (volume > 100) volume = 100;
  1507. this.volumeSliderValue = volume;
  1508. this.video.player.setVolume(volume);
  1509. localStorage.setItem("volume", volume);
  1510. },
  1511. addTag(type, value) {
  1512. if (type === "genres") {
  1513. const genre = value || this.genreInputValue.trim();
  1514. if (
  1515. this.song.genres
  1516. .map(genre => genre.toLowerCase())
  1517. .indexOf(genre.toLowerCase()) !== -1
  1518. )
  1519. return new Toast("Genre already exists");
  1520. if (genre) {
  1521. this.song.genres.push(genre);
  1522. this.genreInputValue = "";
  1523. return false;
  1524. }
  1525. return new Toast("Genre cannot be empty");
  1526. }
  1527. if (type === "artists") {
  1528. const artist = value || this.artistInputValue;
  1529. if (this.song.artists.indexOf(artist) !== -1)
  1530. return new Toast("Artist already exists");
  1531. if (artist !== "") {
  1532. this.song.artists.push(artist);
  1533. this.artistInputValue = "";
  1534. return false;
  1535. }
  1536. return new Toast("Artist cannot be empty");
  1537. }
  1538. if (type === "tags") {
  1539. const tag = value || this.tagInputValue;
  1540. if (this.song.tags.indexOf(tag) !== -1)
  1541. return new Toast("Tag already exists");
  1542. if (tag !== "") {
  1543. this.song.tags.push(tag);
  1544. this.tagInputValue = "";
  1545. return false;
  1546. }
  1547. return new Toast("Tag cannot be empty");
  1548. }
  1549. return false;
  1550. },
  1551. removeTag(type, value) {
  1552. if (type === "genres")
  1553. this.song.genres.splice(this.song.genres.indexOf(value), 1);
  1554. else if (type === "artists")
  1555. this.song.artists.splice(this.song.artists.indexOf(value), 1);
  1556. else if (type === "tags")
  1557. this.song.tags.splice(this.song.tags.indexOf(value), 1);
  1558. },
  1559. drawCanvas() {
  1560. if (!this.songDataLoaded) return;
  1561. const canvasElement = this.$refs.durationCanvas;
  1562. const ctx = canvasElement.getContext("2d");
  1563. const videoDuration = Number(this.youtubeVideoDuration);
  1564. const skipDuration = Number(this.song.skipDuration);
  1565. const duration = Number(this.song.duration);
  1566. const afterDuration = videoDuration - (skipDuration + duration);
  1567. const width = 530;
  1568. const currentTime =
  1569. this.video.player && this.video.player.getCurrentTime
  1570. ? this.video.player.getCurrentTime()
  1571. : 0;
  1572. const widthSkipDuration = (skipDuration / videoDuration) * width;
  1573. const widthDuration = (duration / videoDuration) * width;
  1574. const widthAfterDuration = (afterDuration / videoDuration) * width;
  1575. const widthCurrentTime = (currentTime / videoDuration) * width;
  1576. const skipDurationColor = "#F42003";
  1577. const durationColor = "#03A9F4";
  1578. const afterDurationColor = "#41E841";
  1579. const currentDurationColor = "#3b25e8";
  1580. ctx.fillStyle = skipDurationColor;
  1581. ctx.fillRect(0, 0, widthSkipDuration, 20);
  1582. ctx.fillStyle = durationColor;
  1583. ctx.fillRect(widthSkipDuration, 0, widthDuration, 20);
  1584. ctx.fillStyle = afterDurationColor;
  1585. ctx.fillRect(
  1586. widthSkipDuration + widthDuration,
  1587. 0,
  1588. widthAfterDuration,
  1589. 20
  1590. );
  1591. ctx.fillStyle = currentDurationColor;
  1592. ctx.fillRect(widthCurrentTime, 0, 1, 20);
  1593. },
  1594. setTrackPosition(event) {
  1595. this.seekTo(
  1596. Number(
  1597. Number(this.video.player.getDuration()) *
  1598. ((event.pageX -
  1599. event.target.getBoundingClientRect().left) /
  1600. 530)
  1601. )
  1602. );
  1603. },
  1604. toggleGenreHelper() {
  1605. this.$refs.genreHelper.toggleBox();
  1606. },
  1607. resetGenreHelper() {
  1608. this.$refs.genreHelper.resetBox();
  1609. },
  1610. sendActivityWatchVideoData() {
  1611. if (!this.video.paused) {
  1612. if (this.activityWatchVideoLastStatus !== "playing") {
  1613. this.activityWatchVideoLastStatus = "playing";
  1614. if (
  1615. this.song.skipDuration > 0 &&
  1616. parseFloat(this.youtubeVideoCurrentTime) === 0
  1617. ) {
  1618. this.activityWatchVideoLastStartDuration = Math.floor(
  1619. this.song.skipDuration +
  1620. parseFloat(this.youtubeVideoCurrentTime)
  1621. );
  1622. } else {
  1623. this.activityWatchVideoLastStartDuration = Math.floor(
  1624. parseFloat(this.youtubeVideoCurrentTime)
  1625. );
  1626. }
  1627. }
  1628. const videoData = {
  1629. title: this.song.title,
  1630. artists: this.song.artists
  1631. ? this.song.artists.join(", ")
  1632. : null,
  1633. youtubeId: this.song.youtubeId,
  1634. muted: this.muted,
  1635. volume: this.volumeSliderValue,
  1636. startedDuration:
  1637. this.activityWatchVideoLastStartDuration <= 0
  1638. ? 0
  1639. : this.activityWatchVideoLastStartDuration,
  1640. source: `editSong#${this.song.youtubeId}`,
  1641. hostname: window.location.hostname
  1642. };
  1643. aw.sendVideoData(videoData);
  1644. } else {
  1645. this.activityWatchVideoLastStatus = "not_playing";
  1646. }
  1647. },
  1648. remove(id) {
  1649. this.socket.dispatch("songs.remove", id, res => {
  1650. new Toast(res.message);
  1651. });
  1652. },
  1653. confirmAction(confirm) {
  1654. this.confirm = confirm;
  1655. this.updateConfirmMessage(confirm.message);
  1656. this.openModal("editSongConfirm");
  1657. },
  1658. handleConfirmed() {
  1659. const { action, params } = this.confirm;
  1660. if (typeof this[action] === "function") {
  1661. if (params) this[action](params);
  1662. else this[action]();
  1663. }
  1664. this.confirm = {
  1665. message: "",
  1666. action: "",
  1667. params: null
  1668. };
  1669. },
  1670. onCloseModal() {
  1671. const songStringified = JSON.stringify({
  1672. ...this.song
  1673. });
  1674. const originalSongStringified = JSON.stringify({
  1675. ...this.originalSong
  1676. });
  1677. const unsavedChanges = songStringified !== originalSongStringified;
  1678. if (unsavedChanges) {
  1679. return this.confirmAction({
  1680. message:
  1681. "You have unsaved changes. Are you sure you want to discard unsaved changes?",
  1682. action: "closeThisModal",
  1683. params: null
  1684. });
  1685. }
  1686. return this.closeThisModal();
  1687. },
  1688. closeThisModal() {
  1689. if (this.bulk) this.$emit("close");
  1690. else this.closeModal("editSong");
  1691. },
  1692. ...mapActions("modals/importAlbum", ["selectDiscogsAlbum"]),
  1693. ...mapActions({
  1694. showTab(dispatch, payload) {
  1695. if (this.$refs[`${payload}-tab`])
  1696. this.$refs[`${payload}-tab`].scrollIntoView({
  1697. block: "nearest"
  1698. });
  1699. return dispatch("modals/editSong/showTab", payload);
  1700. }
  1701. }),
  1702. ...mapActions("modals/editSong", [
  1703. "stopVideo",
  1704. "hardStopVideo",
  1705. "loadVideoById",
  1706. "pauseVideo",
  1707. "getCurrentTime",
  1708. "setSong",
  1709. "resetSong",
  1710. "updateOriginalSong",
  1711. "updateSongField",
  1712. "updateReports",
  1713. "setPlaybackRate"
  1714. ]),
  1715. ...mapActions("modals/confirm", ["updateConfirmMessage"]),
  1716. ...mapActions("modalVisibility", ["closeModal", "openModal"])
  1717. }
  1718. };
  1719. </script>
  1720. <style lang="less" scoped>
  1721. .night-mode {
  1722. .edit-section,
  1723. .player-section,
  1724. #tabs-container {
  1725. background-color: var(--dark-grey-3) !important;
  1726. border: 0 !important;
  1727. .tab {
  1728. border: 0 !important;
  1729. }
  1730. }
  1731. #tabs-container #tab-selection .button {
  1732. background: var(--dark-grey) !important;
  1733. color: var(--white) !important;
  1734. }
  1735. .left-section {
  1736. .edit-section {
  1737. .album-get-button,
  1738. .duration-fill-button,
  1739. .add-button {
  1740. &:focus,
  1741. &:hover {
  1742. border: none !important;
  1743. }
  1744. }
  1745. }
  1746. }
  1747. #durationCanvas {
  1748. background-color: var(--dark-grey-2) !important;
  1749. }
  1750. }
  1751. .modal-card-body {
  1752. display: flex;
  1753. }
  1754. .notice-container {
  1755. display: flex;
  1756. flex: 1;
  1757. justify-content: center;
  1758. h4 {
  1759. margin: auto;
  1760. }
  1761. }
  1762. .left-section {
  1763. flex-basis: unset !important;
  1764. height: 100%;
  1765. display: flex;
  1766. flex-direction: column;
  1767. margin-right: 16px;
  1768. .top-section {
  1769. display: flex;
  1770. .player-section {
  1771. width: 530px;
  1772. display: flex;
  1773. flex-direction: column;
  1774. border: 1px solid var(--light-grey-3);
  1775. border-radius: @border-radius;
  1776. overflow: hidden;
  1777. #durationCanvas {
  1778. background-color: var(--light-grey-2);
  1779. }
  1780. .player-error {
  1781. display: flex;
  1782. height: 318px;
  1783. width: 530px;
  1784. align-items: center;
  1785. * {
  1786. margin: 0;
  1787. flex: 1;
  1788. font-size: 30px;
  1789. text-align: center;
  1790. }
  1791. }
  1792. .player-footer {
  1793. display: flex;
  1794. justify-content: space-between;
  1795. height: 54px;
  1796. padding-left: 10px;
  1797. padding-right: 10px;
  1798. > * {
  1799. width: 33.3%;
  1800. display: flex;
  1801. align-items: center;
  1802. }
  1803. .player-footer-left {
  1804. flex: 1;
  1805. & > .button:not(:first-child) {
  1806. margin-left: 5px;
  1807. }
  1808. :deep(& > .playerRateDropdown) {
  1809. margin-left: 5px;
  1810. margin-bottom: unset !important;
  1811. .control.has-addons {
  1812. margin-bottom: unset !important;
  1813. & > .button {
  1814. font-size: 24px;
  1815. }
  1816. }
  1817. }
  1818. :deep(.tippy-box[data-theme~="dropdown"]) {
  1819. max-width: 100px !important;
  1820. .nav-dropdown-items .nav-item {
  1821. justify-content: center !important;
  1822. border-radius: @border-radius !important;
  1823. &.active {
  1824. background-color: var(--primary-color);
  1825. color: var(--white);
  1826. }
  1827. }
  1828. }
  1829. }
  1830. .player-footer-center {
  1831. justify-content: center;
  1832. align-items: center;
  1833. flex: 2;
  1834. font-size: 18px;
  1835. font-weight: 400;
  1836. width: 200px;
  1837. margin: 0 5px;
  1838. img {
  1839. height: 21px;
  1840. margin-right: 12px;
  1841. filter: invert(26%) sepia(54%) saturate(6317%)
  1842. hue-rotate(2deg) brightness(92%) contrast(115%);
  1843. }
  1844. }
  1845. .player-footer-right {
  1846. justify-content: right;
  1847. flex: 1;
  1848. #volume-control {
  1849. margin: 3px;
  1850. margin-top: 0;
  1851. display: flex;
  1852. align-items: center;
  1853. cursor: pointer;
  1854. .volume-slider {
  1855. width: 100%;
  1856. padding: 0 15px;
  1857. background: transparent;
  1858. min-width: 100px;
  1859. }
  1860. input[type="range"] {
  1861. -webkit-appearance: none;
  1862. margin: 7.3px 0;
  1863. }
  1864. input[type="range"]:focus {
  1865. outline: none;
  1866. }
  1867. input[type="range"]::-webkit-slider-runnable-track {
  1868. width: 100%;
  1869. height: 5.2px;
  1870. cursor: pointer;
  1871. box-shadow: 0;
  1872. background: var(--light-grey-3);
  1873. border-radius: @border-radius;
  1874. border: 0;
  1875. }
  1876. input[type="range"]::-webkit-slider-thumb {
  1877. box-shadow: 0;
  1878. border: 0;
  1879. height: 19px;
  1880. width: 19px;
  1881. border-radius: 100%;
  1882. background: var(--primary-color);
  1883. cursor: pointer;
  1884. -webkit-appearance: none;
  1885. margin-top: -6.5px;
  1886. }
  1887. input[type="range"]::-moz-range-track {
  1888. width: 100%;
  1889. height: 5.2px;
  1890. cursor: pointer;
  1891. box-shadow: 0;
  1892. background: var(--light-grey-3);
  1893. border-radius: @border-radius;
  1894. border: 0;
  1895. }
  1896. input[type="range"]::-moz-range-thumb {
  1897. box-shadow: 0;
  1898. border: 0;
  1899. height: 19px;
  1900. width: 19px;
  1901. border-radius: 100%;
  1902. background: var(--primary-color);
  1903. cursor: pointer;
  1904. -webkit-appearance: none;
  1905. margin-top: -6.5px;
  1906. }
  1907. input[type="range"]::-ms-track {
  1908. width: 100%;
  1909. height: 5.2px;
  1910. cursor: pointer;
  1911. box-shadow: 0;
  1912. background: var(--light-grey-3);
  1913. border-radius: @border-radius;
  1914. }
  1915. input[type="range"]::-ms-fill-lower {
  1916. background: var(--light-grey-3);
  1917. border: 0;
  1918. border-radius: 0;
  1919. box-shadow: 0;
  1920. }
  1921. input[type="range"]::-ms-fill-upper {
  1922. background: var(--light-grey-3);
  1923. border: 0;
  1924. border-radius: 0;
  1925. box-shadow: 0;
  1926. }
  1927. input[type="range"]::-ms-thumb {
  1928. box-shadow: 0;
  1929. border: 0;
  1930. height: 15px;
  1931. width: 15px;
  1932. border-radius: 100%;
  1933. background: var(--primary-color);
  1934. cursor: pointer;
  1935. -webkit-appearance: none;
  1936. margin-top: 1.5px;
  1937. }
  1938. }
  1939. }
  1940. }
  1941. }
  1942. .thumbnail-preview {
  1943. width: 189px;
  1944. height: 189px;
  1945. margin-left: 16px;
  1946. }
  1947. }
  1948. .edit-section {
  1949. width: 735px;
  1950. border: 1px solid var(--light-grey-3);
  1951. flex: 1;
  1952. margin-top: 16px;
  1953. border-radius: @border-radius;
  1954. .album-get-button {
  1955. background-color: var(--purple);
  1956. color: var(--white);
  1957. width: 32px;
  1958. text-align: center;
  1959. border-width: 0;
  1960. }
  1961. .duration-fill-button {
  1962. background-color: var(--dark-red);
  1963. color: var(--white);
  1964. width: 32px;
  1965. text-align: center;
  1966. border-width: 0;
  1967. }
  1968. .add-button {
  1969. background-color: var(--primary-color) !important;
  1970. width: 32px;
  1971. i {
  1972. font-size: 32px;
  1973. }
  1974. }
  1975. .album-get-button,
  1976. .duration-fill-button,
  1977. .add-button {
  1978. &:focus,
  1979. &:hover {
  1980. filter: contrast(0.75);
  1981. border: 1px solid var(--black) !important;
  1982. }
  1983. }
  1984. > div {
  1985. margin: 16px !important;
  1986. }
  1987. input {
  1988. width: 100%;
  1989. }
  1990. .title-container {
  1991. width: calc((100% - 32px) / 2);
  1992. }
  1993. .duration-container {
  1994. margin-right: 16px;
  1995. margin-left: 16px;
  1996. width: calc((100% - 32px) / 4);
  1997. }
  1998. .skip-duration-container {
  1999. width: calc((100% - 32px) / 4);
  2000. }
  2001. .album-art-container {
  2002. margin-right: 16px;
  2003. width: calc((100% - 16px) / 8 * 4);
  2004. }
  2005. .youtube-id-container {
  2006. margin-right: 16px;
  2007. width: calc((100% - 16px) / 8 * 3);
  2008. }
  2009. .verified-container {
  2010. width: calc((100% - 16px) / 8);
  2011. .checkbox-control {
  2012. margin-top: 10px;
  2013. }
  2014. }
  2015. .artists-container {
  2016. width: calc((100% - 32px) / 3);
  2017. position: relative;
  2018. }
  2019. .genres-container {
  2020. width: calc((100% - 32px) / 3);
  2021. margin-left: 16px;
  2022. margin-right: 16px;
  2023. position: relative;
  2024. label {
  2025. display: flex;
  2026. i {
  2027. font-size: 15px;
  2028. align-self: center;
  2029. margin-left: 5px;
  2030. color: var(--primary-color);
  2031. cursor: pointer;
  2032. -webkit-user-select: none;
  2033. -moz-user-select: none;
  2034. -ms-user-select: none;
  2035. user-select: none;
  2036. }
  2037. }
  2038. }
  2039. .tags-container {
  2040. width: calc((100% - 32px) / 3);
  2041. position: relative;
  2042. }
  2043. .list-item-circle {
  2044. background-color: var(--primary-color);
  2045. width: 16px;
  2046. height: 16px;
  2047. border-radius: 8px;
  2048. cursor: pointer;
  2049. margin-right: 8px;
  2050. float: left;
  2051. -webkit-touch-callout: none;
  2052. -webkit-user-select: none;
  2053. -khtml-user-select: none;
  2054. -moz-user-select: none;
  2055. -ms-user-select: none;
  2056. user-select: none;
  2057. i {
  2058. color: var(--primary-color);
  2059. font-size: 14px;
  2060. margin-left: 1px;
  2061. position: relative;
  2062. top: -1px;
  2063. }
  2064. }
  2065. .list-item-circle:hover,
  2066. .list-item-circle:focus {
  2067. i {
  2068. color: var(--white);
  2069. }
  2070. }
  2071. .list-item > p {
  2072. line-height: 16px;
  2073. word-wrap: break-word;
  2074. width: calc(100% - 24px);
  2075. left: 24px;
  2076. float: left;
  2077. margin-bottom: 8px;
  2078. }
  2079. .list-item:last-child > p {
  2080. margin-bottom: 0;
  2081. }
  2082. .thumbnail-warning {
  2083. color: var(--red);
  2084. font-size: 18px;
  2085. margin: auto 0 auto 5px;
  2086. }
  2087. }
  2088. }
  2089. .right-section {
  2090. flex-basis: unset !important;
  2091. flex-grow: 0 !important;
  2092. display: flex;
  2093. height: 100%;
  2094. #tabs-container {
  2095. width: 376px;
  2096. #tab-selection {
  2097. display: flex;
  2098. overflow-x: auto;
  2099. .button {
  2100. border-radius: @border-radius @border-radius 0 0;
  2101. border: 0;
  2102. text-transform: uppercase;
  2103. font-size: 14px;
  2104. color: var(--dark-grey-3);
  2105. background-color: var(--light-grey-2);
  2106. flex-grow: 1;
  2107. height: 32px;
  2108. &:not(:first-of-type) {
  2109. margin-left: 5px;
  2110. }
  2111. }
  2112. .selected {
  2113. background-color: var(--primary-color) !important;
  2114. color: var(--white) !important;
  2115. font-weight: 600;
  2116. }
  2117. }
  2118. .tab {
  2119. border: 1px solid var(--light-grey-3);
  2120. border-radius: 0 0 @border-radius @border-radius;
  2121. padding: 15px;
  2122. height: calc(100% - 32px);
  2123. overflow: auto;
  2124. }
  2125. }
  2126. }
  2127. .modal-card-foot .is-primary {
  2128. width: 200px;
  2129. }
  2130. :deep(.autosuggest-container) {
  2131. top: unset;
  2132. }
  2133. </style>