index.vue 55 KB

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