index.vue 71 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107
  1. <script setup lang="ts">
  2. import { storeToRefs } from "pinia";
  3. import {
  4. defineAsyncComponent,
  5. ref,
  6. computed,
  7. watch,
  8. onMounted,
  9. onBeforeUnmount
  10. } from "vue";
  11. import Toast from "toasters";
  12. import aw from "@/aw";
  13. import ws from "@/ws";
  14. import validation from "@/validation";
  15. import keyboardShortcuts from "@/keyboardShortcuts";
  16. import { Song } from "@/types/song.js";
  17. import { useWebsocketsStore } from "@/stores/websockets";
  18. import { useModalsStore } from "@/stores/modals";
  19. import { useEditSongStore } from "@/stores/editSong";
  20. import { useStationStore } from "@/stores/station";
  21. import { useUserAuthStore } from "@/stores/userAuth";
  22. import Modal from "@/components/Modal.vue";
  23. const FloatingBox = defineAsyncComponent(
  24. () => import("@/components/FloatingBox.vue")
  25. );
  26. const SaveButton = defineAsyncComponent(
  27. () => import("@/components/SaveButton.vue")
  28. );
  29. const AutoSuggest = defineAsyncComponent(
  30. () => import("@/components/AutoSuggest.vue")
  31. );
  32. const SongItem = defineAsyncComponent(
  33. () => import("@/components/SongItem.vue")
  34. );
  35. const Discogs = defineAsyncComponent(() => import("./Tabs/Discogs.vue"));
  36. const ReportsTab = defineAsyncComponent(() => import("./Tabs/Reports.vue"));
  37. const Youtube = defineAsyncComponent(() => import("./Tabs/Youtube.vue"));
  38. const MusareSongs = defineAsyncComponent(() => import("./Tabs/Songs.vue"));
  39. const SongThumbnail = defineAsyncComponent(
  40. () => import("@/components/SongThumbnail.vue")
  41. );
  42. const props = defineProps({
  43. modalUuid: { type: String, default: "" },
  44. modalModulePath: {
  45. type: String,
  46. default: "modals/editSong/MODAL_UUID"
  47. },
  48. discogsAlbum: { type: Object, default: null }
  49. });
  50. const editSongStore = useEditSongStore(props);
  51. const stationStore = useStationStore();
  52. const { socket } = useWebsocketsStore();
  53. const userAuthStore = useUserAuthStore();
  54. const modalsStore = useModalsStore();
  55. const { modals, activeModals } = storeToRefs(modalsStore);
  56. const { openModal } = modalsStore;
  57. const { hasPermission } = userAuthStore;
  58. const {
  59. tab,
  60. video,
  61. song,
  62. youtubeId,
  63. prefillData,
  64. originalSong,
  65. reports,
  66. newSong,
  67. bulk,
  68. youtubeIds,
  69. songPrefillData
  70. } = storeToRefs(editSongStore);
  71. const songDataLoaded = ref(false);
  72. const songDeleted = ref(false);
  73. const youtubeError = ref(false);
  74. const youtubeErrorMessage = ref("");
  75. const youtubeVideoDuration = ref("0.000");
  76. const youtubeVideoCurrentTime = ref(<number | string>0);
  77. const youtubeVideoNote = ref("");
  78. const useHTTPS = ref(false);
  79. const muted = ref(false);
  80. const volumeSliderValue = ref(0);
  81. const artistInputValue = ref("");
  82. const genreInputValue = ref("");
  83. const tagInputValue = ref("");
  84. const activityWatchVideoDataInterval = ref(null);
  85. const activityWatchVideoLastStatus = ref("");
  86. const activityWatchVideoLastStartDuration = ref(0);
  87. const recommendedGenres = ref([
  88. "Blues",
  89. "Country",
  90. "Disco",
  91. "Funk",
  92. "Hip-Hop",
  93. "Jazz",
  94. "Metal",
  95. "Oldies",
  96. "Other",
  97. "Pop",
  98. "Rap",
  99. "Reggae",
  100. "Rock",
  101. "Techno",
  102. "Trance",
  103. "Classical",
  104. "Instrumental",
  105. "House",
  106. "Electronic",
  107. "Christian Rap",
  108. "Lo-Fi",
  109. "Musical",
  110. "Rock 'n' Roll",
  111. "Opera",
  112. "Drum & Bass",
  113. "Club-House",
  114. "Indie",
  115. "Heavy Metal",
  116. "Christian rock",
  117. "Dubstep"
  118. ]);
  119. const autosuggest = ref({
  120. allItems: {
  121. artists: [],
  122. genres: [],
  123. tags: []
  124. }
  125. });
  126. const songNotFound = ref(false);
  127. const showRateDropdown = ref(false);
  128. const thumbnailElement = ref();
  129. const thumbnailNotSquare = ref(false);
  130. const thumbnailWidth = ref(null);
  131. const thumbnailHeight = ref(null);
  132. const thumbnailLoadError = ref(false);
  133. const tabs = ref([]);
  134. const inputs = ref([]);
  135. const playerReady = ref(true);
  136. const interval = ref();
  137. const saveButtonRefs = ref(<any>[]);
  138. const canvasElement = ref();
  139. const genreHelper = ref();
  140. // EditSongs
  141. const items = ref([]);
  142. const currentSong = ref(<Song>{});
  143. const flagFilter = ref(false);
  144. const sidebarMobileActive = ref(false);
  145. const songItems = ref([]);
  146. // EditSongs end
  147. const isYoutubeThumbnail = computed(
  148. () =>
  149. songDataLoaded.value &&
  150. song.value.youtubeId &&
  151. song.value.thumbnail &&
  152. (song.value.thumbnail.lastIndexOf("i.ytimg.com") !== -1 ||
  153. song.value.thumbnail.lastIndexOf("img.youtube.com") !== -1)
  154. );
  155. // EditSongs
  156. const editingItemIndex = computed(() =>
  157. items.value.findIndex(
  158. item => item.song.youtubeId === currentSong.value.youtubeId
  159. )
  160. );
  161. const filteredItems = computed({
  162. get: () =>
  163. items.value.filter(item => (flagFilter.value ? item.flagged : true)),
  164. set: (newItem: any) => {
  165. const index = items.value.findIndex(
  166. item => item.song.youtubeId === newItem.youtubeId
  167. );
  168. items.value[index] = newItem;
  169. }
  170. });
  171. const filteredEditingItemIndex = computed(() =>
  172. filteredItems.value.findIndex(
  173. item => item.song.youtubeId === currentSong.value.youtubeId
  174. )
  175. );
  176. const currentSongFlagged = computed(
  177. () =>
  178. items.value.find(
  179. item => item.song.youtubeId === currentSong.value.youtubeId
  180. )?.flagged
  181. );
  182. // EditSongs end
  183. const {
  184. editSong,
  185. stopVideo,
  186. hardStopVideo,
  187. loadVideoById,
  188. pauseVideo,
  189. setSong,
  190. resetSong,
  191. updateOriginalSong,
  192. updateSongField,
  193. updateReports,
  194. setPlaybackRate
  195. } = editSongStore;
  196. const { updateMediaModalPlayingAudio } = stationStore;
  197. const showTab = payload => {
  198. if (tabs.value[`${payload}-tab`])
  199. tabs.value[`${payload}-tab`].scrollIntoView({ block: "nearest" });
  200. editSongStore.showTab(payload);
  201. };
  202. // EditSongs
  203. const toggleDone = (index, overwrite = null) => {
  204. const { status } = filteredItems.value[index];
  205. if (status === "done" && overwrite !== "done")
  206. filteredItems.value[index].status = "todo";
  207. else {
  208. filteredItems.value[index].status = "done";
  209. filteredItems.value[index].flagged = false;
  210. }
  211. };
  212. const toggleFlagFilter = () => {
  213. flagFilter.value = !flagFilter.value;
  214. };
  215. const toggleMobileSidebar = () => {
  216. sidebarMobileActive.value = !sidebarMobileActive.value;
  217. };
  218. const pickSong = song => {
  219. editSong({
  220. youtubeId: song.youtubeId,
  221. prefill: songPrefillData.value[song.youtubeId]
  222. });
  223. currentSong.value = song;
  224. if (songItems.value[`edit-songs-item-${song.youtubeId}`])
  225. songItems.value[`edit-songs-item-${song.youtubeId}`].scrollIntoView();
  226. };
  227. const editNextSong = () => {
  228. const currentlyEditingSongIndex = filteredEditingItemIndex.value;
  229. let newEditingSongIndex = -1;
  230. const index =
  231. currentlyEditingSongIndex + 1 === filteredItems.value.length
  232. ? 0
  233. : currentlyEditingSongIndex + 1;
  234. for (let i = index; i < filteredItems.value.length; i += 1) {
  235. if (!flagFilter.value || filteredItems.value[i].flagged) {
  236. newEditingSongIndex = i;
  237. break;
  238. }
  239. }
  240. if (newEditingSongIndex > -1) {
  241. const nextSong = filteredItems.value[newEditingSongIndex].song;
  242. if (nextSong.removed) editNextSong();
  243. else pickSong(nextSong);
  244. }
  245. };
  246. const toggleFlag = (songIndex = null) => {
  247. if (songIndex && songIndex > -1) {
  248. filteredItems.value[songIndex].flagged =
  249. !filteredItems.value[songIndex].flagged;
  250. new Toast(
  251. `Successfully ${
  252. filteredItems.value[songIndex].flagged ? "flagged" : "unflagged"
  253. } song.`
  254. );
  255. } else if (!songIndex && editingItemIndex.value > -1) {
  256. items.value[editingItemIndex.value].flagged =
  257. !items.value[editingItemIndex.value].flagged;
  258. new Toast(
  259. `Successfully ${
  260. items.value[editingItemIndex.value].flagged
  261. ? "flagged"
  262. : "unflagged"
  263. } song.`
  264. );
  265. }
  266. };
  267. const onSavedSuccess = youtubeId => {
  268. const itemIndex = items.value.findIndex(
  269. item => item.song.youtubeId === youtubeId
  270. );
  271. if (itemIndex > -1) {
  272. items.value[itemIndex].status = "done";
  273. items.value[itemIndex].flagged = false;
  274. }
  275. };
  276. const onSavedError = youtubeId => {
  277. const itemIndex = items.value.findIndex(
  278. item => item.song.youtubeId === youtubeId
  279. );
  280. if (itemIndex > -1) items.value[itemIndex].status = "error";
  281. };
  282. const onSaving = youtubeId => {
  283. const itemIndex = items.value.findIndex(
  284. item => item.song.youtubeId === youtubeId
  285. );
  286. if (itemIndex > -1) items.value[itemIndex].status = "saving";
  287. };
  288. // EditSongs end
  289. const onThumbnailLoad = () => {
  290. if (thumbnailElement.value) {
  291. const height = thumbnailElement.value.naturalHeight;
  292. const width = thumbnailElement.value.naturalWidth;
  293. thumbnailNotSquare.value = height !== width;
  294. thumbnailHeight.value = height;
  295. thumbnailWidth.value = width;
  296. } else {
  297. thumbnailNotSquare.value = false;
  298. thumbnailHeight.value = null;
  299. thumbnailWidth.value = null;
  300. }
  301. };
  302. const onThumbnailLoadError = error => {
  303. thumbnailLoadError.value = error !== 0;
  304. };
  305. const unloadSong = (_youtubeId, songId?) => {
  306. songDataLoaded.value = false;
  307. songDeleted.value = false;
  308. stopVideo();
  309. pauseVideo(true);
  310. resetSong(_youtubeId);
  311. thumbnailNotSquare.value = false;
  312. thumbnailWidth.value = null;
  313. thumbnailHeight.value = null;
  314. youtubeVideoCurrentTime.value = "0.000";
  315. youtubeVideoDuration.value = "0.000";
  316. youtubeVideoNote.value = "";
  317. if (songId) socket.dispatch("apis.leaveRoom", `edit-song.${songId}`);
  318. if (saveButtonRefs.value.saveButton)
  319. saveButtonRefs.value.saveButton.status = "default";
  320. };
  321. const loadSong = _youtubeId => {
  322. console.log(`LOAD SONG ${_youtubeId}`);
  323. songNotFound.value = false;
  324. socket.dispatch(`songs.getSongsFromYoutubeIds`, [_youtubeId], res => {
  325. const { songs } = res.data;
  326. if (res.status === "success" && songs.length > 0) {
  327. let _song = songs[0];
  328. _song = Object.assign(_song, prefillData.value);
  329. setSong(_song);
  330. songDataLoaded.value = true;
  331. if (_song._id) {
  332. socket.dispatch("apis.joinRoom", `edit-song.${_song._id}`);
  333. if (!newSong.value)
  334. socket.dispatch(
  335. "reports.getReportsForSong",
  336. _song._id,
  337. res => {
  338. console.log(222, res);
  339. updateReports(res.data.reports);
  340. }
  341. );
  342. }
  343. if (video.value.player && video.value.player.cueVideoById) {
  344. video.value.player.cueVideoById(_youtubeId, _song.skipDuration);
  345. }
  346. } else {
  347. new Toast("Song with that ID not found");
  348. if (bulk.value) songNotFound.value = true;
  349. if (!bulk.value) modalsStore.closeCurrentModal();
  350. }
  351. });
  352. };
  353. const drawCanvas = () => {
  354. if (!songDataLoaded.value || !canvasElement.value) return;
  355. const ctx = canvasElement.value.getContext("2d");
  356. const videoDuration = Number(youtubeVideoDuration.value);
  357. const skipDuration = Number(song.value.skipDuration);
  358. const duration = Number(song.value.duration);
  359. const afterDuration = videoDuration - (skipDuration + duration);
  360. const width = 530;
  361. const currentTime =
  362. video.value.player && video.value.player.getCurrentTime
  363. ? video.value.player.getCurrentTime()
  364. : 0;
  365. const widthSkipDuration = (skipDuration / videoDuration) * width;
  366. const widthDuration = (duration / videoDuration) * width;
  367. const widthAfterDuration = (afterDuration / videoDuration) * width;
  368. const widthCurrentTime = (currentTime / videoDuration) * width;
  369. const skipDurationColor = "#F42003";
  370. const durationColor = "#03A9F4";
  371. const afterDurationColor = "#41E841";
  372. const currentDurationColor = "#3b25e8";
  373. ctx.fillStyle = skipDurationColor;
  374. ctx.fillRect(0, 0, widthSkipDuration, 20);
  375. ctx.fillStyle = durationColor;
  376. ctx.fillRect(widthSkipDuration, 0, widthDuration, 20);
  377. ctx.fillStyle = afterDurationColor;
  378. ctx.fillRect(widthSkipDuration + widthDuration, 0, widthAfterDuration, 20);
  379. ctx.fillStyle = currentDurationColor;
  380. ctx.fillRect(widthCurrentTime, 0, 1, 20);
  381. };
  382. const seekTo = position => {
  383. pauseVideo(false);
  384. video.value.player.seekTo(position);
  385. };
  386. const init = () => {
  387. if (newSong.value && !youtubeId.value && !bulk.value) {
  388. setSong({
  389. youtubeId: "",
  390. title: "",
  391. artists: [],
  392. genres: [],
  393. tags: [],
  394. duration: 0,
  395. skipDuration: 0,
  396. thumbnail: "",
  397. verified: false
  398. });
  399. songDataLoaded.value = true;
  400. showTab("youtube");
  401. } else if (youtubeId.value) loadSong(youtubeId.value);
  402. else if (!bulk.value) {
  403. new Toast("You can't open EditSong without editing a song");
  404. return modalsStore.closeCurrentModal();
  405. }
  406. interval.value = setInterval(() => {
  407. if (
  408. song.value.duration !== -1 &&
  409. video.value.paused === false &&
  410. playerReady.value &&
  411. (video.value.player.getCurrentTime() - song.value.skipDuration >
  412. song.value.duration ||
  413. (video.value.player.getCurrentTime() > 0 &&
  414. video.value.player.getCurrentTime() >=
  415. video.value.player.getDuration()))
  416. ) {
  417. stopVideo();
  418. pauseVideo(true);
  419. drawCanvas();
  420. }
  421. if (
  422. playerReady.value &&
  423. video.value.player.getVideoData &&
  424. video.value.player.getVideoData() &&
  425. video.value.player.getVideoData().video_id === song.value.youtubeId
  426. ) {
  427. const currentTime = video.value.player.getCurrentTime();
  428. if (currentTime !== undefined)
  429. youtubeVideoCurrentTime.value = currentTime.toFixed(3);
  430. if (youtubeVideoDuration.value.indexOf(".000") !== -1) {
  431. const duration = video.value.player.getDuration();
  432. if (duration !== undefined) {
  433. if (
  434. `${youtubeVideoDuration.value}` ===
  435. `${Number(song.value.duration).toFixed(3)}`
  436. )
  437. song.value.duration = duration.toFixed(3);
  438. youtubeVideoDuration.value = duration.toFixed(3);
  439. if (youtubeVideoDuration.value.indexOf(".000") !== -1)
  440. youtubeVideoNote.value = "(~)";
  441. else youtubeVideoNote.value = "";
  442. drawCanvas();
  443. }
  444. }
  445. }
  446. if (video.value.paused === false) drawCanvas();
  447. }, 200);
  448. if (window.YT && window.YT.Player) {
  449. video.value.player = new window.YT.Player(
  450. `editSongPlayer-${props.modalUuid}`,
  451. {
  452. height: 298,
  453. width: 530,
  454. videoId: null,
  455. host: "https://www.youtube-nocookie.com",
  456. playerVars: {
  457. controls: 0,
  458. iv_load_policy: 3,
  459. rel: 0,
  460. showinfo: 0,
  461. autoplay: 0
  462. },
  463. startSeconds: song.value.skipDuration,
  464. events: {
  465. onReady: () => {
  466. let volume = parseFloat(localStorage.getItem("volume"));
  467. volume = typeof volume === "number" ? volume : 20;
  468. video.value.player.setVolume(volume);
  469. if (volume > 0) video.value.player.unMute();
  470. playerReady.value = true;
  471. if (song.value && song.value.youtubeId)
  472. video.value.player.cueVideoById(
  473. song.value.youtubeId,
  474. song.value.skipDuration
  475. );
  476. setPlaybackRate(null);
  477. drawCanvas();
  478. },
  479. onStateChange: event => {
  480. drawCanvas();
  481. if (event.data === 1) {
  482. video.value.paused = false;
  483. updateMediaModalPlayingAudio(true);
  484. let youtubeDuration =
  485. video.value.player.getDuration();
  486. const newYoutubeVideoDuration =
  487. youtubeDuration.toFixed(3);
  488. if (
  489. youtubeVideoDuration.value.indexOf(".000") !==
  490. -1 &&
  491. `${youtubeVideoDuration.value}` !==
  492. `${newYoutubeVideoDuration}`
  493. ) {
  494. const songDurationNumber = Number(
  495. song.value.duration
  496. );
  497. const songDurationNumber2 =
  498. Number(song.value.duration) + 1;
  499. const songDurationNumber3 =
  500. Number(song.value.duration) - 1;
  501. const fixedSongDuration =
  502. songDurationNumber.toFixed(3);
  503. const fixedSongDuration2 =
  504. songDurationNumber2.toFixed(3);
  505. const fixedSongDuration3 =
  506. songDurationNumber3.toFixed(3);
  507. if (
  508. `${youtubeVideoDuration.value}` ===
  509. `${Number(song.value.duration).toFixed(
  510. 3
  511. )}` &&
  512. (fixedSongDuration ===
  513. youtubeVideoDuration.value ||
  514. fixedSongDuration2 ===
  515. youtubeVideoDuration.value ||
  516. fixedSongDuration3 ===
  517. youtubeVideoDuration.value)
  518. )
  519. song.value.duration =
  520. newYoutubeVideoDuration;
  521. youtubeVideoDuration.value =
  522. newYoutubeVideoDuration;
  523. if (
  524. youtubeVideoDuration.value.indexOf(
  525. ".000"
  526. ) !== -1
  527. )
  528. youtubeVideoNote.value = "(~)";
  529. else youtubeVideoNote.value = "";
  530. }
  531. if (song.value.duration === -1)
  532. song.value.duration = Number.parseInt(
  533. youtubeVideoDuration.value
  534. );
  535. youtubeDuration -= song.value.skipDuration;
  536. if (song.value.duration > youtubeDuration + 1) {
  537. stopVideo();
  538. pauseVideo(true);
  539. return new Toast(
  540. "Video can't play. Specified duration is bigger than the YouTube song duration."
  541. );
  542. }
  543. if (song.value.duration <= 0) {
  544. stopVideo();
  545. pauseVideo(true);
  546. return new Toast(
  547. "Video can't play. Specified duration has to be more than 0 seconds."
  548. );
  549. }
  550. if (
  551. video.value.player.getCurrentTime() <
  552. song.value.skipDuration
  553. ) {
  554. return seekTo(song.value.skipDuration);
  555. }
  556. setPlaybackRate(null);
  557. } else if (event.data === 2) {
  558. video.value.paused = true;
  559. updateMediaModalPlayingAudio(false);
  560. }
  561. return false;
  562. }
  563. }
  564. }
  565. );
  566. } else {
  567. youtubeError.value = true;
  568. youtubeErrorMessage.value = "Player could not be loaded.";
  569. }
  570. ["artists", "genres", "tags"].forEach(type => {
  571. socket.dispatch(
  572. `songs.get${type.charAt(0).toUpperCase()}${type.slice(1)}`,
  573. res => {
  574. if (res.status === "success") {
  575. const { items } = res.data;
  576. if (type === "genres")
  577. autosuggest.value.allItems[type] = Array.from(
  578. new Set([...recommendedGenres.value, ...items])
  579. );
  580. else autosuggest.value.allItems[type] = items;
  581. } else {
  582. new Toast(res.message);
  583. }
  584. }
  585. );
  586. });
  587. return null;
  588. };
  589. const save = (songToCopy, closeOrNext, saveButtonRefName, _newSong = false) => {
  590. const _song = JSON.parse(JSON.stringify(songToCopy));
  591. if (!newSong.value || bulk.value) onSaving(_song.youtubeId);
  592. const saveButtonRef = saveButtonRefs.value[saveButtonRefName];
  593. if (!youtubeError.value && youtubeVideoDuration.value === "0.000") {
  594. saveButtonRef.handleFailedSave();
  595. if (!_newSong) onSavedError(_song.youtubeId);
  596. return new Toast("The video appears to not be working.");
  597. }
  598. if (!_song.title) {
  599. saveButtonRef.handleFailedSave();
  600. if (!_newSong || bulk.value) onSavedError(_song.youtubeId);
  601. return new Toast("Please fill in all fields");
  602. }
  603. if (!_song.thumbnail) {
  604. saveButtonRef.handleFailedSave();
  605. if (!_newSong || bulk.value) onSavedError(_song.youtubeId);
  606. return new Toast("Please fill in all fields");
  607. }
  608. // const thumbnailHeight = thumbnailElement.value.naturalHeight;
  609. // const thumbnailWidth = thumbnailElement.value.naturalWidth;
  610. // if (thumbnailHeight < 80 || thumbnailWidth < 80) {
  611. // saveButtonRef.handleFailedSave();
  612. // return new Toast(
  613. // "Thumbnail width and height must be at least 80px."
  614. // );
  615. // }
  616. // if (thumbnailHeight > 4000 || thumbnailWidth > 4000) {
  617. // saveButtonRef.handleFailedSave();
  618. // return new Toast(
  619. // "Thumbnail width and height must be less than 4000px."
  620. // );
  621. // }
  622. // if (thumbnailHeight - thumbnailWidth > 5) {
  623. // saveButtonRef.handleFailedSave();
  624. // return new Toast("Thumbnail cannot be taller than it is wide.");
  625. // }
  626. // Youtube Id
  627. if (
  628. !_newSong &&
  629. youtubeError.value &&
  630. originalSong.value.youtubeId !== _song.youtubeId
  631. ) {
  632. saveButtonRef.handleFailedSave();
  633. if (!_newSong || bulk.value) onSavedError(_song.youtubeId);
  634. return new Toast(
  635. "You're not allowed to change the YouTube id while the player is not working"
  636. );
  637. }
  638. // Duration
  639. if (
  640. Number(_song.skipDuration) + Number(_song.duration) >
  641. Number.parseInt(youtubeVideoDuration.value) &&
  642. (((!_newSong || bulk.value) && !youtubeError.value) ||
  643. originalSong.value.duration !== _song.duration)
  644. ) {
  645. saveButtonRef.handleFailedSave();
  646. if (!_newSong || bulk.value) onSavedError(_song.youtubeId);
  647. return new Toast(
  648. "Duration can't be higher than the length of the video"
  649. );
  650. }
  651. // Title
  652. if (!validation.isLength(_song.title, 1, 100)) {
  653. saveButtonRef.handleFailedSave();
  654. if (!_newSong || bulk.value) onSavedError(_song.youtubeId);
  655. return new Toast("Title must have between 1 and 100 characters.");
  656. }
  657. // Artists
  658. if (
  659. (_song.verified && _song.artists.length < 1) ||
  660. _song.artists.length > 10
  661. ) {
  662. saveButtonRef.handleFailedSave();
  663. if (!_newSong || bulk.value) onSavedError(_song.youtubeId);
  664. return new Toast(
  665. "Invalid artists. You must have at least 1 artist and a maximum of 10 artists."
  666. );
  667. }
  668. let error;
  669. _song.artists.forEach(artist => {
  670. if (!validation.isLength(artist, 1, 64)) {
  671. error = "Artist must have between 1 and 64 characters.";
  672. return error;
  673. }
  674. if (artist === "NONE") {
  675. error =
  676. 'Invalid artist format. Artists are not allowed to be named "NONE".';
  677. return error;
  678. }
  679. return false;
  680. });
  681. if (error) {
  682. saveButtonRef.handleFailedSave();
  683. if (!_newSong || bulk.value) onSavedError(_song.youtubeId);
  684. return new Toast(error);
  685. }
  686. // Genres
  687. error = undefined;
  688. if (_song.verified && _song.genres.length < 1)
  689. _song.genres.forEach(genre => {
  690. if (!validation.isLength(genre, 1, 32)) {
  691. error = "Genre must have between 1 and 32 characters.";
  692. return error;
  693. }
  694. if (!validation.regex.ascii.test(genre)) {
  695. error =
  696. "Invalid genre format. Only ascii characters are allowed.";
  697. return error;
  698. }
  699. return false;
  700. });
  701. if ((_song.verified && _song.genres.length < 1) || _song.genres.length > 16)
  702. error = "You must have between 1 and 16 genres.";
  703. if (error) {
  704. saveButtonRef.handleFailedSave();
  705. if (!_newSong || bulk.value) onSavedError(_song.youtubeId);
  706. return new Toast(error);
  707. }
  708. error = undefined;
  709. _song.tags.forEach(tag => {
  710. if (
  711. !/^[a-zA-Z0-9_]{1,64}$|^[a-zA-Z0-9_]{1,64}\[[a-zA-Z0-9_]{1,64}\]$/.test(
  712. tag
  713. )
  714. ) {
  715. error = "Invalid tag format.";
  716. return error;
  717. }
  718. return false;
  719. });
  720. if (error) {
  721. saveButtonRef.handleFailedSave();
  722. if (!_newSong || bulk.value) onSavedError(_song.youtubeId);
  723. return new Toast(error);
  724. }
  725. // Thumbnail
  726. if (!validation.isLength(_song.thumbnail, 1, 256)) {
  727. saveButtonRef.handleFailedSave();
  728. if (!_newSong || bulk.value) onSavedError(_song.youtubeId);
  729. return new Toast("Thumbnail must have between 8 and 256 characters.");
  730. }
  731. if (useHTTPS.value && _song.thumbnail.indexOf("https://") !== 0) {
  732. saveButtonRef.handleFailedSave();
  733. if (!_newSong || bulk.value) onSavedError(_song.youtubeId);
  734. return new Toast('Thumbnail must start with "https://".');
  735. }
  736. if (
  737. !useHTTPS.value &&
  738. _song.thumbnail.indexOf("http://") !== 0 &&
  739. _song.thumbnail.indexOf("https://") !== 0
  740. ) {
  741. saveButtonRef.handleFailedSave();
  742. if (!_newSong || bulk.value) onSavedError(_song.youtubeId);
  743. return new Toast('Thumbnail must start with "http://".');
  744. }
  745. saveButtonRef.status = "saving";
  746. if (_newSong)
  747. return socket.dispatch(`songs.create`, _song, res => {
  748. new Toast(res.message);
  749. if (res.status === "error") {
  750. saveButtonRef.handleFailedSave();
  751. onSavedError(_song.youtubeId);
  752. return;
  753. }
  754. saveButtonRef.handleSuccessfulSave();
  755. onSavedSuccess(_song.youtubeId);
  756. if (!closeOrNext) {
  757. loadSong(_song.youtubeId);
  758. return;
  759. }
  760. if (bulk.value) editNextSong();
  761. else modalsStore.closeCurrentModal();
  762. });
  763. return socket.dispatch(`songs.update`, _song._id, _song, res => {
  764. new Toast(res.message);
  765. if (res.status === "error") {
  766. saveButtonRef.handleFailedSave();
  767. onSavedError(_song.youtubeId);
  768. return;
  769. }
  770. updateOriginalSong(_song);
  771. saveButtonRef.handleSuccessfulSave();
  772. onSavedSuccess(_song.youtubeId);
  773. if (!closeOrNext) return;
  774. if (bulk.value) editNextSong();
  775. else modalsStore.closeCurrentModal();
  776. });
  777. };
  778. const getAlbumData = type => {
  779. if (!song.value.discogs) return;
  780. if (type === "title")
  781. updateSongField({
  782. field: "title",
  783. value: song.value.discogs.track.title
  784. });
  785. if (type === "albumArt")
  786. updateSongField({
  787. field: "thumbnail",
  788. value: song.value.discogs.album.albumArt
  789. });
  790. if (type === "genres")
  791. updateSongField({
  792. field: "genres",
  793. value: JSON.parse(JSON.stringify(song.value.discogs.album.genres))
  794. });
  795. if (type === "artists")
  796. updateSongField({
  797. field: "artists",
  798. value: JSON.parse(JSON.stringify(song.value.discogs.album.artists))
  799. });
  800. };
  801. const getYouTubeData = type => {
  802. if (type === "title") {
  803. try {
  804. const { title } = video.value.player.getVideoData();
  805. if (title)
  806. updateSongField({
  807. field: "title",
  808. value: title
  809. });
  810. else throw new Error("No title found");
  811. } catch (e) {
  812. new Toast(
  813. "Unable to fetch YouTube video title. Try starting the video."
  814. );
  815. }
  816. }
  817. if (type === "thumbnail")
  818. updateSongField({
  819. field: "thumbnail",
  820. value: `https://img.youtube.com/vi/${song.value.youtubeId}/mqdefault.jpg`
  821. });
  822. if (type === "author") {
  823. try {
  824. const { author } = video.value.player.getVideoData();
  825. if (author) artistInputValue.value = author;
  826. else throw new Error("No video author found");
  827. } catch (e) {
  828. new Toast(
  829. "Unable to fetch YouTube video author. Try starting the video."
  830. );
  831. }
  832. }
  833. };
  834. const fillDuration = () => {
  835. song.value.duration =
  836. Number.parseInt(youtubeVideoDuration.value) - song.value.skipDuration;
  837. };
  838. const settings = type => {
  839. switch (type) {
  840. case "stop":
  841. stopVideo();
  842. pauseVideo(true);
  843. break;
  844. case "hardStop":
  845. hardStopVideo();
  846. pauseVideo(true);
  847. break;
  848. case "pause":
  849. pauseVideo(true);
  850. break;
  851. case "play":
  852. pauseVideo(false);
  853. break;
  854. case "skipToLast10Secs":
  855. seekTo(song.value.duration - 10 + song.value.skipDuration);
  856. break;
  857. default:
  858. break;
  859. }
  860. };
  861. const play = () => {
  862. if (video.value.player.getVideoData().video_id !== song.value.youtubeId) {
  863. song.value.duration = -1;
  864. loadVideoById(song.value.youtubeId, song.value.skipDuration);
  865. }
  866. settings("play");
  867. };
  868. const changeVolume = () => {
  869. const volume = volumeSliderValue.value;
  870. localStorage.setItem("volume", `${volume}`);
  871. video.value.player.setVolume(volume);
  872. if (volume > 0) {
  873. video.value.player.unMute();
  874. muted.value = false;
  875. }
  876. };
  877. const toggleMute = () => {
  878. const previousVolume = parseFloat(localStorage.getItem("volume"));
  879. const volume = video.value.player.getVolume() <= 0 ? previousVolume : 0;
  880. muted.value = !muted.value;
  881. volumeSliderValue.value = volume;
  882. video.value.player.setVolume(volume);
  883. if (!muted.value) localStorage.setItem("volume", `${volume}`);
  884. };
  885. const addTag = (type, value?) => {
  886. if (type === "genres") {
  887. const genre = value || genreInputValue.value.trim();
  888. if (
  889. song.value.genres
  890. .map(genre => genre.toLowerCase())
  891. .indexOf(genre.toLowerCase()) !== -1
  892. )
  893. return new Toast("Genre already exists");
  894. if (genre) {
  895. song.value.genres.push(genre);
  896. genreInputValue.value = "";
  897. return false;
  898. }
  899. return new Toast("Genre cannot be empty");
  900. }
  901. if (type === "artists") {
  902. const artist = value || artistInputValue.value;
  903. if (song.value.artists.indexOf(artist) !== -1)
  904. return new Toast("Artist already exists");
  905. if (artist !== "") {
  906. song.value.artists.push(artist);
  907. artistInputValue.value = "";
  908. return false;
  909. }
  910. return new Toast("Artist cannot be empty");
  911. }
  912. if (type === "tags") {
  913. const tag = value || tagInputValue.value;
  914. if (song.value.tags.indexOf(tag) !== -1)
  915. return new Toast("Tag already exists");
  916. if (tag !== "") {
  917. song.value.tags.push(tag);
  918. tagInputValue.value = "";
  919. return false;
  920. }
  921. return new Toast("Tag cannot be empty");
  922. }
  923. return false;
  924. };
  925. const removeTag = (type, value) => {
  926. if (type === "genres")
  927. song.value.genres.splice(song.value.genres.indexOf(value), 1);
  928. else if (type === "artists")
  929. song.value.artists.splice(song.value.artists.indexOf(value), 1);
  930. else if (type === "tags")
  931. song.value.tags.splice(song.value.tags.indexOf(value), 1);
  932. };
  933. const setTrackPosition = event => {
  934. seekTo(
  935. Number(
  936. Number(video.value.player.getDuration()) *
  937. ((event.pageX - event.target.getBoundingClientRect().left) /
  938. 530)
  939. )
  940. );
  941. };
  942. const toggleGenreHelper = () => {
  943. genreHelper.value.toggleBox();
  944. };
  945. const resetGenreHelper = () => {
  946. genreHelper.value.resetBox();
  947. };
  948. const sendActivityWatchVideoData = () => {
  949. if (!video.value.paused) {
  950. if (activityWatchVideoLastStatus.value !== "playing") {
  951. activityWatchVideoLastStatus.value = "playing";
  952. if (
  953. song.value.skipDuration > 0 &&
  954. Number(youtubeVideoCurrentTime.value) === 0
  955. ) {
  956. activityWatchVideoLastStartDuration.value = Math.floor(
  957. song.value.skipDuration +
  958. Number(youtubeVideoCurrentTime.value)
  959. );
  960. } else {
  961. activityWatchVideoLastStartDuration.value = Math.floor(
  962. Number(youtubeVideoCurrentTime.value)
  963. );
  964. }
  965. }
  966. const videoData = {
  967. title: song.value.title,
  968. artists: song.value.artists ? song.value.artists.join(", ") : null,
  969. youtubeId: song.value.youtubeId,
  970. muted: muted.value,
  971. volume: volumeSliderValue.value,
  972. startedDuration:
  973. activityWatchVideoLastStartDuration.value <= 0
  974. ? 0
  975. : activityWatchVideoLastStartDuration.value,
  976. source: `editSong#${song.value.youtubeId}`,
  977. hostname: window.location.hostname
  978. };
  979. aw.sendVideoData(videoData);
  980. } else {
  981. activityWatchVideoLastStatus.value = "not_playing";
  982. }
  983. };
  984. const remove = id => {
  985. socket.dispatch("songs.remove", id, res => {
  986. new Toast(res.message);
  987. });
  988. };
  989. const handleConfirmed = ({ action, params }) => {
  990. if (typeof action === "function") {
  991. if (params) action(params);
  992. else action();
  993. }
  994. };
  995. const confirmAction = ({ message, action, params }) => {
  996. openModal({
  997. modal: "confirm",
  998. data: {
  999. message,
  1000. action,
  1001. params,
  1002. onCompleted: handleConfirmed
  1003. }
  1004. });
  1005. };
  1006. const onCloseModal = () => {
  1007. const songStringified = JSON.stringify({
  1008. ...song.value,
  1009. ...{
  1010. duration: Number(song.value.duration).toFixed(3)
  1011. }
  1012. });
  1013. const originalSongStringified = JSON.stringify({
  1014. ...originalSong.value,
  1015. ...{
  1016. duration: Number(originalSong.value.duration).toFixed(3)
  1017. }
  1018. });
  1019. const unsavedChanges = songStringified !== originalSongStringified;
  1020. const confirmReasons = [];
  1021. if (unsavedChanges) {
  1022. confirmReasons.push(
  1023. "You have unsaved changes. Are you sure you want to discard unsaved changes?"
  1024. );
  1025. }
  1026. if (bulk.value) {
  1027. const doneItems = items.value.filter(
  1028. item => item.status === "done"
  1029. ).length;
  1030. const flaggedItems = items.value.filter(item => item.flagged).length;
  1031. const notDoneItems = items.value.length - doneItems;
  1032. if (doneItems > 0 && notDoneItems > 0)
  1033. confirmReasons.push(
  1034. "You have songs which are not done yet. Are you sure you want to stop editing songs?"
  1035. );
  1036. else if (flaggedItems > 0)
  1037. confirmReasons.push(
  1038. "You have songs which are flagged. Are you sure you want to stop editing songs?"
  1039. );
  1040. }
  1041. if (confirmReasons.length > 0) {
  1042. return confirmAction({
  1043. message: confirmReasons,
  1044. action: modalsStore.closeCurrentModal,
  1045. params: null
  1046. });
  1047. }
  1048. return modalsStore.closeCurrentModal();
  1049. };
  1050. watch(
  1051. () => song.value.duration,
  1052. () => drawCanvas()
  1053. );
  1054. watch(
  1055. () => song.value.skipDuration,
  1056. () => drawCanvas()
  1057. );
  1058. watch(youtubeId, (_youtubeId, _oldYoutubeId) => {
  1059. console.log("NEW YOUTUBE ID", _youtubeId);
  1060. if (_oldYoutubeId) unloadSong(_oldYoutubeId);
  1061. if (_youtubeId) loadSong(_youtubeId);
  1062. });
  1063. onMounted(async () => {
  1064. activityWatchVideoDataInterval.value = setInterval(() => {
  1065. sendActivityWatchVideoData();
  1066. }, 1000);
  1067. useHTTPS.value = await lofig.get("cookie.secure");
  1068. ws.onConnect(init);
  1069. let volume = parseFloat(localStorage.getItem("volume"));
  1070. volume = typeof volume === "number" && !Number.isNaN(volume) ? volume : 20;
  1071. localStorage.setItem("volume", `${volume}`);
  1072. volumeSliderValue.value = volume;
  1073. socket.on(
  1074. "event:admin.song.removed",
  1075. res => {
  1076. if (res.data.songId === song.value._id) {
  1077. songDeleted.value = true;
  1078. }
  1079. },
  1080. { modalUuid: props.modalUuid }
  1081. );
  1082. if (bulk.value) {
  1083. socket.dispatch("apis.joinRoom", "edit-songs");
  1084. socket.dispatch(
  1085. "songs.getSongsFromYoutubeIds",
  1086. youtubeIds.value,
  1087. res => {
  1088. if (res.data.songs.length === 0) {
  1089. modalsStore.closeCurrentModal();
  1090. new Toast("You can't edit 0 songs.");
  1091. } else {
  1092. items.value = res.data.songs.map(song => ({
  1093. status: "todo",
  1094. flagged: false,
  1095. song
  1096. }));
  1097. editNextSong();
  1098. }
  1099. }
  1100. );
  1101. socket.on(
  1102. `event:admin.song.created`,
  1103. res => {
  1104. const index = items.value
  1105. .map(item => item.song.youtubeId)
  1106. .indexOf(res.data.song.youtubeId);
  1107. if (index >= 0)
  1108. items.value[index].song = {
  1109. ...items.value[index].song,
  1110. ...res.data.song,
  1111. created: true
  1112. };
  1113. },
  1114. { modalUuid: props.modalUuid }
  1115. );
  1116. socket.on(
  1117. `event:admin.song.updated`,
  1118. res => {
  1119. const index = items.value
  1120. .map(item => item.song.youtubeId)
  1121. .indexOf(res.data.song.youtubeId);
  1122. if (index >= 0)
  1123. items.value[index].song = {
  1124. ...items.value[index].song,
  1125. ...res.data.song,
  1126. updated: true
  1127. };
  1128. },
  1129. { modalUuid: props.modalUuid }
  1130. );
  1131. socket.on(
  1132. `event:admin.song.removed`,
  1133. res => {
  1134. const index = items.value
  1135. .map(item => item.song._id)
  1136. .indexOf(res.data.songId);
  1137. if (index >= 0) items.value[index].song.removed = true;
  1138. },
  1139. { modalUuid: props.modalUuid }
  1140. );
  1141. socket.on(
  1142. `event:admin.youtubeVideo.removed`,
  1143. res => {
  1144. const index = items.value
  1145. .map(item => item.song.youtubeVideoId)
  1146. .indexOf(res.videoId);
  1147. if (index >= 0) items.value[index].song.removed = true;
  1148. },
  1149. { modalUuid: props.modalUuid }
  1150. );
  1151. }
  1152. keyboardShortcuts.registerShortcut("editSong.pauseResumeVideo", {
  1153. keyCode: 101,
  1154. preventDefault: true,
  1155. handler: () => {
  1156. if (video.value.paused) play();
  1157. else settings("pause");
  1158. }
  1159. });
  1160. keyboardShortcuts.registerShortcut("editSong.stopVideo", {
  1161. keyCode: 101,
  1162. ctrl: true,
  1163. preventDefault: true,
  1164. handler: () => {
  1165. settings("stop");
  1166. }
  1167. });
  1168. keyboardShortcuts.registerShortcut("editSong.hardStopVideo", {
  1169. keyCode: 101,
  1170. ctrl: true,
  1171. shift: true,
  1172. preventDefault: true,
  1173. handler: () => {
  1174. settings("hardStop");
  1175. }
  1176. });
  1177. keyboardShortcuts.registerShortcut("editSong.skipToLast10Secs", {
  1178. keyCode: 102,
  1179. preventDefault: true,
  1180. handler: () => {
  1181. settings("skipToLast10Secs");
  1182. }
  1183. });
  1184. keyboardShortcuts.registerShortcut("editSong.lowerVolumeLarge", {
  1185. keyCode: 98,
  1186. preventDefault: true,
  1187. handler: () => {
  1188. volumeSliderValue.value = Math.max(0, volumeSliderValue.value - 10);
  1189. changeVolume();
  1190. }
  1191. });
  1192. keyboardShortcuts.registerShortcut("editSong.lowerVolumeSmall", {
  1193. keyCode: 98,
  1194. ctrl: true,
  1195. preventDefault: true,
  1196. handler: () => {
  1197. volumeSliderValue.value = Math.max(0, volumeSliderValue.value - 1);
  1198. changeVolume();
  1199. }
  1200. });
  1201. keyboardShortcuts.registerShortcut("editSong.increaseVolumeLarge", {
  1202. keyCode: 104,
  1203. preventDefault: true,
  1204. handler: () => {
  1205. volumeSliderValue.value = Math.min(
  1206. 100,
  1207. volumeSliderValue.value + 10
  1208. );
  1209. changeVolume();
  1210. }
  1211. });
  1212. keyboardShortcuts.registerShortcut("editSong.increaseVolumeSmall", {
  1213. keyCode: 104,
  1214. ctrl: true,
  1215. preventDefault: true,
  1216. handler: () => {
  1217. volumeSliderValue.value = Math.min(
  1218. 100,
  1219. volumeSliderValue.value + 1
  1220. );
  1221. changeVolume();
  1222. }
  1223. });
  1224. keyboardShortcuts.registerShortcut("editSong.save", {
  1225. keyCode: 83,
  1226. ctrl: true,
  1227. preventDefault: true,
  1228. handler: () => {
  1229. save(song.value, false, "saveButton");
  1230. }
  1231. });
  1232. keyboardShortcuts.registerShortcut("editSong.saveClose", {
  1233. keyCode: 83,
  1234. ctrl: true,
  1235. alt: true,
  1236. preventDefault: true,
  1237. handler: () => {
  1238. save(song.value, true, "saveAndCloseButton");
  1239. }
  1240. });
  1241. keyboardShortcuts.registerShortcut("editSong.focusTitle", {
  1242. keyCode: 36,
  1243. preventDefault: true,
  1244. handler: () => {
  1245. inputs.value["title-input"].focus();
  1246. }
  1247. });
  1248. keyboardShortcuts.registerShortcut("editSong.useAllDiscogs", {
  1249. keyCode: 68,
  1250. alt: true,
  1251. ctrl: true,
  1252. preventDefault: true,
  1253. handler: () => {
  1254. getAlbumData("title");
  1255. getAlbumData("albumArt");
  1256. getAlbumData("artists");
  1257. getAlbumData("genres");
  1258. }
  1259. });
  1260. keyboardShortcuts.registerShortcut("editSong.closeModal", {
  1261. keyCode: 27,
  1262. handler: () => {
  1263. if (
  1264. modals.value[
  1265. activeModals.value[activeModals.value.length - 1]
  1266. ] === "editSong"
  1267. ) {
  1268. onCloseModal();
  1269. }
  1270. }
  1271. });
  1272. /*
  1273. editSong.pauseResume - Num 5 - Pause/resume song
  1274. editSong.stopVideo - Ctrl - Num 5 - Stop
  1275. editSong.hardStopVideo - Shift - Ctrl - Num 5 - Stop
  1276. editSong.skipToLast10Secs - Num 6 - Skip to last 10 seconds
  1277. editSong.lowerVolumeLarge - Num 2 - Volume down by 10
  1278. editSong.lowerVolumeSmall - Ctrl - Num 2 - Volume down by 1
  1279. editSong.increaseVolumeLarge - Num 8 - Volume up by 10
  1280. editSong.increaseVolumeSmall - Ctrl - Num 8 - Volume up by 1
  1281. editSong.focusTitle - Home - Focus the title input
  1282. editSong.focusDicogs - End - Focus the discogs input
  1283. editSong.save - Ctrl - S - Saves song
  1284. editSong.save - Ctrl - Alt - S - Saves song and closes the modal
  1285. editSong.save - Ctrl - Alt - V - Saves song, verifies songs and then closes the modal
  1286. editSong.close - F4 - Closes modal without saving
  1287. editSong.useAllDiscogs - Ctrl - Alt - D - Sets all fields to the Discogs data
  1288. Inside Discogs inputs: Ctrl - D - Sets this field to the Discogs data
  1289. */
  1290. });
  1291. onBeforeUnmount(() => {
  1292. if (bulk.value) {
  1293. socket.dispatch("apis.leaveRoom", "edit-songs");
  1294. }
  1295. unloadSong(youtubeId.value, song.value._id);
  1296. updateMediaModalPlayingAudio(false);
  1297. playerReady.value = false;
  1298. clearInterval(interval.value);
  1299. clearInterval(activityWatchVideoDataInterval.value);
  1300. const shortcutNames = [
  1301. "editSong.pauseResume",
  1302. "editSong.stopVideo",
  1303. "editSong.hardStopVideo",
  1304. "editSong.skipToLast10Secs",
  1305. "editSong.lowerVolumeLarge",
  1306. "editSong.lowerVolumeSmall",
  1307. "editSong.increaseVolumeLarge",
  1308. "editSong.increaseVolumeSmall",
  1309. "editSong.focusTitle",
  1310. "editSong.focusDicogs",
  1311. "editSong.save",
  1312. "editSong.saveClose",
  1313. "editSong.useAllDiscogs",
  1314. "editSong.closeModal"
  1315. ];
  1316. shortcutNames.forEach(shortcutName => {
  1317. keyboardShortcuts.unregisterShortcut(shortcutName);
  1318. });
  1319. // Delete the Pinia store that was created for this modal, after all other cleanup tasks are performed
  1320. editSongStore.$dispose();
  1321. });
  1322. </script>
  1323. <template>
  1324. <div>
  1325. <modal
  1326. :title="`${newSong ? 'Create' : 'Edit'} Song`"
  1327. class="song-modal"
  1328. :size="'wide'"
  1329. :split="true"
  1330. :intercept-close="true"
  1331. @close="onCloseModal"
  1332. >
  1333. <template #toggleMobileSidebar v-if="bulk">
  1334. <i
  1335. class="material-icons toggle-sidebar-icon"
  1336. :content="`${
  1337. sidebarMobileActive ? 'Close' : 'Open'
  1338. } Edit Queue`"
  1339. v-tippy
  1340. @click="toggleMobileSidebar()"
  1341. >expand_circle_down</i
  1342. >
  1343. </template>
  1344. <template #sidebar v-if="bulk">
  1345. <div class="sidebar" :class="{ active: sidebarMobileActive }">
  1346. <header class="sidebar-head">
  1347. <h2 class="sidebar-title is-marginless">Edit Queue</h2>
  1348. <i
  1349. class="material-icons toggle-sidebar-icon"
  1350. :content="`${
  1351. sidebarMobileActive ? 'Close' : 'Open'
  1352. } Edit Queue`"
  1353. v-tippy
  1354. @click="toggleMobileSidebar()"
  1355. >expand_circle_down</i
  1356. >
  1357. </header>
  1358. <section class="sidebar-body">
  1359. <div
  1360. v-show="filteredItems.length > 0"
  1361. class="edit-songs-items"
  1362. >
  1363. <div
  1364. class="item"
  1365. v-for="(data, index) in filteredItems"
  1366. :key="`edit-songs-item-${index}`"
  1367. :ref="
  1368. el =>
  1369. (songItems[
  1370. `edit-songs-item-${data.song.youtubeId}`
  1371. ] = el)
  1372. "
  1373. >
  1374. <song-item
  1375. :song="data.song"
  1376. :thumbnail="false"
  1377. :duration="false"
  1378. :disabled-actions="
  1379. data.song.removed
  1380. ? ['all']
  1381. : ['report', 'edit']
  1382. "
  1383. :class="{
  1384. updated: data.song.updated,
  1385. removed: data.song.removed
  1386. }"
  1387. >
  1388. <template #leftIcon>
  1389. <i
  1390. v-if="
  1391. currentSong.youtubeId ===
  1392. data.song.youtubeId &&
  1393. !data.song.removed
  1394. "
  1395. class="material-icons item-icon editing-icon"
  1396. content="Currently editing song"
  1397. v-tippy="{ theme: 'info' }"
  1398. @click="toggleDone(index)"
  1399. >edit</i
  1400. >
  1401. <i
  1402. v-else-if="data.song.removed"
  1403. class="material-icons item-icon removed-icon"
  1404. content="Song removed"
  1405. v-tippy="{ theme: 'info' }"
  1406. >delete_forever</i
  1407. >
  1408. <i
  1409. v-else-if="data.status === 'error'"
  1410. class="material-icons item-icon error-icon"
  1411. content="Error saving song"
  1412. v-tippy="{ theme: 'info' }"
  1413. @click="toggleDone(index)"
  1414. >error</i
  1415. >
  1416. <i
  1417. v-else-if="data.status === 'saving'"
  1418. class="material-icons item-icon saving-icon"
  1419. content="Currently saving song"
  1420. v-tippy="{ theme: 'info' }"
  1421. >pending</i
  1422. >
  1423. <i
  1424. v-else-if="data.flagged"
  1425. class="material-icons item-icon flag-icon"
  1426. content="Song flagged"
  1427. v-tippy="{ theme: 'info' }"
  1428. @click="toggleDone(index)"
  1429. >flag_circle</i
  1430. >
  1431. <i
  1432. v-else-if="data.status === 'done'"
  1433. class="material-icons item-icon done-icon"
  1434. content="Song marked complete"
  1435. v-tippy="{ theme: 'info' }"
  1436. @click="toggleDone(index)"
  1437. >check_circle</i
  1438. >
  1439. <i
  1440. v-else-if="data.status === 'todo'"
  1441. class="material-icons item-icon todo-icon"
  1442. content="Song marked todo"
  1443. v-tippy="{ theme: 'info' }"
  1444. @click="toggleDone(index)"
  1445. >cancel</i
  1446. >
  1447. </template>
  1448. <template
  1449. v-if="!data.song.removed"
  1450. #actions
  1451. >
  1452. <i
  1453. class="material-icons edit-icon"
  1454. content="Edit Song"
  1455. v-tippy
  1456. @click="pickSong(data.song)"
  1457. >
  1458. edit
  1459. </i>
  1460. </template>
  1461. <template #tippyActions>
  1462. <i
  1463. class="material-icons flag-icon"
  1464. :class="{
  1465. flagged: data.flagged
  1466. }"
  1467. content="Toggle Flag"
  1468. v-tippy
  1469. @click="toggleFlag(index)"
  1470. >
  1471. flag_circle
  1472. </i>
  1473. </template>
  1474. </song-item>
  1475. </div>
  1476. </div>
  1477. <p v-if="filteredItems.length === 0" class="no-items">
  1478. {{
  1479. flagFilter
  1480. ? "No flagged songs queued"
  1481. : "No songs queued"
  1482. }}
  1483. </p>
  1484. </section>
  1485. <footer class="sidebar-foot">
  1486. <button
  1487. @click="toggleFlagFilter()"
  1488. class="button is-primary"
  1489. >
  1490. {{
  1491. flagFilter
  1492. ? "Show All Songs"
  1493. : "Show Only Flagged Songs"
  1494. }}
  1495. </button>
  1496. </footer>
  1497. </div>
  1498. <div
  1499. v-if="sidebarMobileActive"
  1500. class="sidebar-overlay"
  1501. @click="toggleMobileSidebar()"
  1502. ></div>
  1503. </template>
  1504. <template #body>
  1505. <div v-if="!youtubeId && !newSong" class="notice-container">
  1506. <h4>No song has been selected</h4>
  1507. </div>
  1508. <div v-if="songDeleted" class="notice-container">
  1509. <h4>The song you were editing has been deleted</h4>
  1510. </div>
  1511. <div
  1512. v-if="
  1513. youtubeId &&
  1514. !songDataLoaded &&
  1515. !songNotFound &&
  1516. !newSong
  1517. "
  1518. class="notice-container"
  1519. >
  1520. <h4>Song hasn't loaded yet</h4>
  1521. </div>
  1522. <div
  1523. v-if="youtubeId && songNotFound && !newSong"
  1524. class="notice-container"
  1525. >
  1526. <h4>Song was not found</h4>
  1527. </div>
  1528. <div
  1529. class="left-section"
  1530. v-show="songDataLoaded && !songDeleted"
  1531. >
  1532. <div class="top-section">
  1533. <div class="player-section">
  1534. <div :id="`editSongPlayer-${modalUuid}`" />
  1535. <div v-show="youtubeError" class="player-error">
  1536. <h2>{{ youtubeErrorMessage }}</h2>
  1537. </div>
  1538. <canvas
  1539. ref="canvasElement"
  1540. class="duration-canvas"
  1541. v-show="!youtubeError"
  1542. height="20"
  1543. width="530"
  1544. @click="setTrackPosition($event)"
  1545. />
  1546. <div class="player-footer">
  1547. <div class="player-footer-left">
  1548. <button
  1549. class="button is-primary"
  1550. @click="play()"
  1551. @keyup.enter="play()"
  1552. v-if="video.paused"
  1553. content="Resume Playback"
  1554. v-tippy
  1555. >
  1556. <i class="material-icons">play_arrow</i>
  1557. </button>
  1558. <button
  1559. class="button is-primary"
  1560. @click="settings('pause')"
  1561. @keyup.enter="settings('pause')"
  1562. v-else
  1563. content="Pause Playback"
  1564. v-tippy
  1565. >
  1566. <i class="material-icons">pause</i>
  1567. </button>
  1568. <button
  1569. class="button is-danger"
  1570. @click.exact="settings('stop')"
  1571. @click.shift="settings('hardStop')"
  1572. @keyup.enter.exact="settings('stop')"
  1573. @keyup.shift.enter="
  1574. settings('hardStop')
  1575. "
  1576. content="Stop Playback"
  1577. v-tippy
  1578. >
  1579. <i class="material-icons">stop</i>
  1580. </button>
  1581. <tippy
  1582. class="playerRateDropdown"
  1583. :touch="true"
  1584. :interactive="true"
  1585. placement="bottom"
  1586. theme="dropdown"
  1587. ref="dropdown"
  1588. trigger="click"
  1589. append-to="parent"
  1590. @show="
  1591. () => {
  1592. showRateDropdown = true;
  1593. }
  1594. "
  1595. @hide="
  1596. () => {
  1597. showRateDropdown = false;
  1598. }
  1599. "
  1600. >
  1601. <div
  1602. ref="trigger"
  1603. class="control has-addons"
  1604. content="Set Playback Rate"
  1605. v-tippy
  1606. >
  1607. <button class="button is-primary">
  1608. <i class="material-icons"
  1609. >fast_forward</i
  1610. >
  1611. </button>
  1612. <button
  1613. class="button dropdown-toggle"
  1614. >
  1615. <i class="material-icons">
  1616. {{
  1617. showRateDropdown
  1618. ? "expand_more"
  1619. : "expand_less"
  1620. }}
  1621. </i>
  1622. </button>
  1623. </div>
  1624. <template #content>
  1625. <div class="nav-dropdown-items">
  1626. <button
  1627. class="nav-item button"
  1628. :class="{
  1629. active:
  1630. video.playbackRate ===
  1631. 0.5
  1632. }"
  1633. title="0.5x"
  1634. @click="
  1635. setPlaybackRate(0.5)
  1636. "
  1637. >
  1638. <p>0.5x</p>
  1639. </button>
  1640. <button
  1641. class="nav-item button"
  1642. :class="{
  1643. active:
  1644. video.playbackRate ===
  1645. 1
  1646. }"
  1647. title="1x"
  1648. @click="setPlaybackRate(1)"
  1649. >
  1650. <p>1x</p>
  1651. </button>
  1652. <button
  1653. class="nav-item button"
  1654. :class="{
  1655. active:
  1656. video.playbackRate ===
  1657. 2
  1658. }"
  1659. title="2x"
  1660. @click="setPlaybackRate(2)"
  1661. >
  1662. <p>2x</p>
  1663. </button>
  1664. </div>
  1665. </template>
  1666. </tippy>
  1667. </div>
  1668. <div class="player-footer-center">
  1669. <span>
  1670. <span>
  1671. {{ youtubeVideoCurrentTime }}
  1672. </span>
  1673. /
  1674. <span>
  1675. {{ youtubeVideoDuration }}
  1676. {{ youtubeVideoNote }}
  1677. </span>
  1678. </span>
  1679. </div>
  1680. <div class="player-footer-right">
  1681. <p id="volume-control">
  1682. <i
  1683. class="material-icons"
  1684. @click="toggleMute()"
  1685. :content="`${
  1686. muted ? 'Unmute' : 'Mute'
  1687. }`"
  1688. v-tippy
  1689. >{{
  1690. muted
  1691. ? "volume_mute"
  1692. : volumeSliderValue >= 50
  1693. ? "volume_up"
  1694. : "volume_down"
  1695. }}</i
  1696. >
  1697. <input
  1698. v-model="volumeSliderValue"
  1699. type="range"
  1700. min="0"
  1701. max="100"
  1702. class="volume-slider active"
  1703. @change="changeVolume()"
  1704. @input="changeVolume()"
  1705. />
  1706. </p>
  1707. </div>
  1708. </div>
  1709. </div>
  1710. <song-thumbnail
  1711. v-if="songDataLoaded && !songDeleted"
  1712. :song="song"
  1713. :fallback="false"
  1714. class="thumbnail-preview"
  1715. @load-error="onThumbnailLoadError"
  1716. />
  1717. <img
  1718. v-if="
  1719. !isYoutubeThumbnail &&
  1720. songDataLoaded &&
  1721. !songDeleted
  1722. "
  1723. class="thumbnail-dummy"
  1724. :src="song.thumbnail"
  1725. ref="thumbnailElement"
  1726. @load="onThumbnailLoad"
  1727. />
  1728. </div>
  1729. <div
  1730. class="edit-section"
  1731. v-if="songDataLoaded && !songDeleted"
  1732. >
  1733. <div class="control is-grouped">
  1734. <div class="title-container">
  1735. <label class="label">Title</label>
  1736. <p class="control has-addons">
  1737. <input
  1738. class="input"
  1739. type="text"
  1740. :ref="
  1741. el => (inputs['title-input'] = el)
  1742. "
  1743. v-model="song.title"
  1744. placeholder="Enter song title..."
  1745. @keyup.shift.enter="
  1746. getAlbumData('title')
  1747. "
  1748. />
  1749. <button
  1750. class="button youtube-get-button"
  1751. @click="getYouTubeData('title')"
  1752. >
  1753. <div
  1754. class="youtube-icon"
  1755. v-tippy
  1756. content="Fill from YouTube"
  1757. ></div>
  1758. </button>
  1759. <button
  1760. class="button album-get-button"
  1761. @click="getAlbumData('title')"
  1762. >
  1763. <i
  1764. class="material-icons"
  1765. v-tippy
  1766. content="Fill from Discogs"
  1767. >album</i
  1768. >
  1769. </button>
  1770. </p>
  1771. </div>
  1772. <div class="duration-container">
  1773. <label class="label">Duration</label>
  1774. <p class="control has-addons">
  1775. <input
  1776. class="input"
  1777. type="text"
  1778. placeholder="Enter song duration..."
  1779. v-model.number="song.duration"
  1780. @keyup.shift.enter="fillDuration()"
  1781. />
  1782. <button
  1783. class="button duration-fill-button"
  1784. @click="fillDuration()"
  1785. >
  1786. <i
  1787. class="material-icons"
  1788. v-tippy
  1789. content="Sync duration with YouTube"
  1790. >sync</i
  1791. >
  1792. </button>
  1793. </p>
  1794. </div>
  1795. <div class="skip-duration-container">
  1796. <label class="label">Skip duration</label>
  1797. <p class="control">
  1798. <input
  1799. class="input"
  1800. type="text"
  1801. placeholder="Enter skip duration..."
  1802. v-model.number="song.skipDuration"
  1803. />
  1804. </p>
  1805. </div>
  1806. </div>
  1807. <div class="control is-grouped">
  1808. <div class="album-art-container">
  1809. <label class="label">
  1810. Thumbnail
  1811. <i
  1812. v-if="
  1813. thumbnailNotSquare &&
  1814. !isYoutubeThumbnail
  1815. "
  1816. class="material-icons thumbnail-warning"
  1817. content="Thumbnail not square, it will be stretched"
  1818. v-tippy="{ theme: 'info' }"
  1819. >
  1820. warning
  1821. </i>
  1822. <i
  1823. v-if="
  1824. thumbnailLoadError &&
  1825. !isYoutubeThumbnail
  1826. "
  1827. class="material-icons thumbnail-warning"
  1828. content="Error loading thumbnail"
  1829. v-tippy="{ theme: 'info' }"
  1830. >
  1831. warning
  1832. </i>
  1833. </label>
  1834. <p class="control has-addons">
  1835. <input
  1836. class="input"
  1837. type="text"
  1838. v-model="song.thumbnail"
  1839. placeholder="Enter link to thumbnail..."
  1840. @keyup.shift.enter="
  1841. getAlbumData('albumArt')
  1842. "
  1843. />
  1844. <button
  1845. class="button youtube-get-button"
  1846. @click="getYouTubeData('thumbnail')"
  1847. >
  1848. <div
  1849. class="youtube-icon"
  1850. v-tippy
  1851. content="Fill from YouTube"
  1852. ></div>
  1853. </button>
  1854. <button
  1855. class="button album-get-button"
  1856. @click="getAlbumData('albumArt')"
  1857. >
  1858. <i
  1859. class="material-icons"
  1860. v-tippy
  1861. content="Fill from Discogs"
  1862. >album</i
  1863. >
  1864. </button>
  1865. </p>
  1866. </div>
  1867. <div class="youtube-id-container">
  1868. <label class="label">YouTube ID</label>
  1869. <p class="control">
  1870. <input
  1871. class="input"
  1872. type="text"
  1873. placeholder="Enter YouTube ID..."
  1874. v-model="song.youtubeId"
  1875. />
  1876. </p>
  1877. </div>
  1878. <div class="verified-container">
  1879. <label class="label">Verified</label>
  1880. <p class="is-expanded checkbox-control">
  1881. <label class="switch">
  1882. <input
  1883. type="checkbox"
  1884. id="verified"
  1885. v-model="song.verified"
  1886. />
  1887. <span class="slider round"></span>
  1888. </label>
  1889. </p>
  1890. </div>
  1891. </div>
  1892. <div class="control is-grouped">
  1893. <div class="artists-container">
  1894. <label class="label">Artists</label>
  1895. <p class="control has-addons">
  1896. <auto-suggest
  1897. v-model="artistInputValue"
  1898. ref="new-artist"
  1899. placeholder="Add artist..."
  1900. :all-items="
  1901. autosuggest.allItems.artists
  1902. "
  1903. @submitted="addTag('artists')"
  1904. @keyup.shift.enter="
  1905. getAlbumData('artists')
  1906. "
  1907. />
  1908. <button
  1909. class="button youtube-get-button"
  1910. @click="getYouTubeData('author')"
  1911. >
  1912. <div
  1913. class="youtube-icon"
  1914. v-tippy
  1915. content="Fill from YouTube"
  1916. ></div>
  1917. </button>
  1918. <button
  1919. class="button album-get-button"
  1920. @click="getAlbumData('artists')"
  1921. >
  1922. <i
  1923. class="material-icons"
  1924. v-tippy
  1925. content="Fill from Discogs"
  1926. >album</i
  1927. >
  1928. </button>
  1929. <button
  1930. class="button is-info add-button"
  1931. @click="addTag('artists')"
  1932. >
  1933. <i class="material-icons">add</i>
  1934. </button>
  1935. </p>
  1936. <div class="list-container">
  1937. <div
  1938. class="list-item"
  1939. v-for="artist in song.artists"
  1940. :key="artist"
  1941. >
  1942. <div
  1943. class="list-item-circle"
  1944. @click="
  1945. removeTag('artists', artist)
  1946. "
  1947. >
  1948. <i class="material-icons">close</i>
  1949. </div>
  1950. <p>{{ artist }}</p>
  1951. </div>
  1952. </div>
  1953. </div>
  1954. <div class="genres-container">
  1955. <label class="label">
  1956. <span>Genres</span>
  1957. <i
  1958. class="material-icons"
  1959. @click="toggleGenreHelper"
  1960. @dblclick="resetGenreHelper"
  1961. v-tippy
  1962. content="View list of genres"
  1963. >info</i
  1964. >
  1965. </label>
  1966. <p class="control has-addons">
  1967. <auto-suggest
  1968. v-model="genreInputValue"
  1969. ref="new-genre"
  1970. placeholder="Add genre..."
  1971. :all-items="autosuggest.allItems.genres"
  1972. @submitted="addTag('genres')"
  1973. @keyup.shift.enter="
  1974. getAlbumData('genres')
  1975. "
  1976. />
  1977. <button
  1978. class="button album-get-button"
  1979. @click="getAlbumData('genres')"
  1980. >
  1981. <i
  1982. class="material-icons"
  1983. v-tippy
  1984. content="Fill from Discogs"
  1985. >album</i
  1986. >
  1987. </button>
  1988. <button
  1989. class="button is-info add-button"
  1990. @click="addTag('genres')"
  1991. >
  1992. <i class="material-icons">add</i>
  1993. </button>
  1994. </p>
  1995. <div class="list-container">
  1996. <div
  1997. class="list-item"
  1998. v-for="genre in song.genres"
  1999. :key="genre"
  2000. >
  2001. <div
  2002. class="list-item-circle"
  2003. @click="removeTag('genres', genre)"
  2004. >
  2005. <i class="material-icons">close</i>
  2006. </div>
  2007. <p>{{ genre }}</p>
  2008. </div>
  2009. </div>
  2010. </div>
  2011. <div class="tags-container">
  2012. <label class="label">Tags</label>
  2013. <p class="control has-addons">
  2014. <auto-suggest
  2015. v-model="tagInputValue"
  2016. ref="new-tag"
  2017. placeholder="Add tag..."
  2018. :all-items="autosuggest.allItems.tags"
  2019. @submitted="addTag('tags')"
  2020. />
  2021. <button
  2022. class="button is-info add-button"
  2023. @click="addTag('tags')"
  2024. >
  2025. <i class="material-icons">add</i>
  2026. </button>
  2027. </p>
  2028. <div class="list-container">
  2029. <div
  2030. class="list-item"
  2031. v-for="tag in song.tags"
  2032. :key="tag"
  2033. >
  2034. <div
  2035. class="list-item-circle"
  2036. @click="removeTag('tags', tag)"
  2037. >
  2038. <i class="material-icons">close</i>
  2039. </div>
  2040. <p>{{ tag }}</p>
  2041. </div>
  2042. </div>
  2043. </div>
  2044. </div>
  2045. </div>
  2046. </div>
  2047. <div
  2048. class="right-section"
  2049. v-if="songDataLoaded && !songDeleted"
  2050. >
  2051. <div id="tabs-container">
  2052. <div id="tab-selection">
  2053. <button
  2054. class="button is-default"
  2055. :class="{ selected: tab === 'discogs' }"
  2056. :ref="el => (tabs['discogs-tab'] = el)"
  2057. @click="showTab('discogs')"
  2058. >
  2059. Discogs
  2060. </button>
  2061. <button
  2062. v-if="!newSong"
  2063. class="button is-default"
  2064. :class="{ selected: tab === 'reports' }"
  2065. :ref="el => (tabs['reports-tab'] = el)"
  2066. @click="showTab('reports')"
  2067. >
  2068. Reports ({{ reports.length }})
  2069. </button>
  2070. <button
  2071. class="button is-default"
  2072. :class="{ selected: tab === 'youtube' }"
  2073. :ref="el => (tabs['youtube-tab'] = el)"
  2074. @click="showTab('youtube')"
  2075. >
  2076. YouTube
  2077. </button>
  2078. <button
  2079. class="button is-default"
  2080. :class="{ selected: tab === 'musare-songs' }"
  2081. :ref="el => (tabs['musare-songs-tab'] = el)"
  2082. @click="showTab('musare-songs')"
  2083. >
  2084. Songs
  2085. </button>
  2086. </div>
  2087. <discogs
  2088. class="tab"
  2089. v-show="tab === 'discogs'"
  2090. :bulk="bulk"
  2091. :modal-uuid="modalUuid"
  2092. :modal-module-path="modalModulePath"
  2093. />
  2094. <reports-tab
  2095. v-if="!newSong"
  2096. class="tab"
  2097. v-show="tab === 'reports'"
  2098. :modal-uuid="modalUuid"
  2099. :modal-module-path="modalModulePath"
  2100. />
  2101. <youtube
  2102. class="tab"
  2103. v-show="tab === 'youtube'"
  2104. :modal-uuid="modalUuid"
  2105. :modal-module-path="modalModulePath"
  2106. />
  2107. <musare-songs
  2108. class="tab"
  2109. v-show="tab === 'musare-songs'"
  2110. :modal-uuid="modalUuid"
  2111. :modal-module-path="modalModulePath"
  2112. />
  2113. </div>
  2114. </div>
  2115. </template>
  2116. <template #footer>
  2117. <div v-if="bulk">
  2118. <button class="button is-primary" @click="editNextSong()">
  2119. Next
  2120. </button>
  2121. <button
  2122. class="button is-primary"
  2123. @click="toggleFlag()"
  2124. v-if="youtubeId && !songDeleted"
  2125. >
  2126. {{ currentSongFlagged ? "Unflag" : "Flag" }}
  2127. </button>
  2128. </div>
  2129. <div v-if="!newSong && !songDeleted">
  2130. <save-button
  2131. :ref="el => (saveButtonRefs['saveButton'] = el)"
  2132. @clicked="save(song, false, 'saveButton')"
  2133. />
  2134. <save-button
  2135. :ref="el => (saveButtonRefs['saveAndCloseButton'] = el)"
  2136. :default-message="
  2137. bulk ? `Save and next` : `Save and close`
  2138. "
  2139. @clicked="save(song, true, 'saveAndCloseButton')"
  2140. />
  2141. <div class="right">
  2142. <button
  2143. v-if="hasPermission('songs.remove')"
  2144. class="button is-danger icon-with-button material-icons"
  2145. @click.prevent="
  2146. confirmAction({
  2147. message:
  2148. 'Removing this song will remove it from all playlists and cause a ratings recalculation.',
  2149. action: remove,
  2150. params: song._id
  2151. })
  2152. "
  2153. content="Delete Song"
  2154. v-tippy
  2155. >
  2156. delete_forever
  2157. </button>
  2158. </div>
  2159. </div>
  2160. <div v-else-if="newSong">
  2161. <save-button
  2162. :ref="el => (saveButtonRefs['createButton'] = el)"
  2163. default-message="Create Song"
  2164. @clicked="save(song, false, 'createButton', true)"
  2165. />
  2166. <save-button
  2167. :ref="
  2168. el => (saveButtonRefs['createAndCloseButton'] = el)
  2169. "
  2170. :default-message="
  2171. bulk ? `Create and next` : `Create and close`
  2172. "
  2173. @clicked="
  2174. save(song, true, 'createAndCloseButton', true)
  2175. "
  2176. />
  2177. </div>
  2178. </template>
  2179. </modal>
  2180. <floating-box
  2181. id="genreHelper"
  2182. ref="genreHelper"
  2183. :column="false"
  2184. title="Song Genres List"
  2185. >
  2186. <template #body>
  2187. <span
  2188. v-for="item in autosuggest.allItems.genres"
  2189. :key="`genre-helper-${item}`"
  2190. >
  2191. {{ item }}
  2192. </span>
  2193. </template>
  2194. </floating-box>
  2195. </div>
  2196. </template>
  2197. <style lang="less" scoped>
  2198. .night-mode {
  2199. .edit-section,
  2200. .player-section,
  2201. #tabs-container {
  2202. background-color: var(--dark-grey-3) !important;
  2203. border: 0 !important;
  2204. .tab {
  2205. border: 0 !important;
  2206. }
  2207. }
  2208. #tabs-container #tab-selection .button {
  2209. background: var(--dark-grey) !important;
  2210. color: var(--white) !important;
  2211. }
  2212. .left-section {
  2213. .edit-section {
  2214. .album-get-button,
  2215. .duration-fill-button,
  2216. .youtube-get-button,
  2217. .add-button {
  2218. &:focus,
  2219. &:hover {
  2220. border: none !important;
  2221. }
  2222. }
  2223. }
  2224. }
  2225. .duration-canvas {
  2226. background-color: var(--dark-grey-2) !important;
  2227. }
  2228. .sidebar {
  2229. .sidebar-head,
  2230. .sidebar-foot {
  2231. background-color: var(--dark-grey-3);
  2232. border: none;
  2233. }
  2234. .sidebar-body {
  2235. background-color: var(--dark-grey-4) !important;
  2236. }
  2237. .sidebar-head .toggle-sidebar-icon.material-icons,
  2238. .sidebar-title {
  2239. color: var(--white);
  2240. }
  2241. p,
  2242. label,
  2243. td,
  2244. th {
  2245. color: var(--light-grey-2) !important;
  2246. }
  2247. h1,
  2248. h2,
  2249. h3,
  2250. h4,
  2251. h5,
  2252. h6 {
  2253. color: var(--white) !important;
  2254. }
  2255. }
  2256. }
  2257. .modal-card-body {
  2258. display: flex;
  2259. }
  2260. .notice-container {
  2261. display: flex;
  2262. flex: 1;
  2263. justify-content: center;
  2264. h4 {
  2265. margin: auto;
  2266. }
  2267. }
  2268. .left-section {
  2269. height: 100%;
  2270. display: flex;
  2271. flex-direction: column;
  2272. margin-right: 16px;
  2273. .top-section {
  2274. display: flex;
  2275. .player-section {
  2276. width: 530px;
  2277. display: flex;
  2278. flex-direction: column;
  2279. border: 1px solid var(--light-grey-3);
  2280. border-radius: @border-radius;
  2281. overflow: hidden;
  2282. .duration-canvas {
  2283. background-color: var(--light-grey-2);
  2284. }
  2285. .player-error {
  2286. display: flex;
  2287. height: 318px;
  2288. width: 530px;
  2289. align-items: center;
  2290. * {
  2291. margin: 0;
  2292. flex: 1;
  2293. font-size: 30px;
  2294. text-align: center;
  2295. }
  2296. }
  2297. .player-footer {
  2298. display: flex;
  2299. justify-content: space-between;
  2300. height: 54px;
  2301. padding-left: 10px;
  2302. padding-right: 10px;
  2303. > * {
  2304. width: 33.3%;
  2305. display: flex;
  2306. align-items: center;
  2307. }
  2308. .player-footer-left {
  2309. flex: 1;
  2310. & > .button:not(:first-child) {
  2311. margin-left: 5px;
  2312. }
  2313. :deep(& > .playerRateDropdown) {
  2314. margin-left: 5px;
  2315. margin-bottom: unset !important;
  2316. .control.has-addons {
  2317. margin-bottom: unset !important;
  2318. & > .button {
  2319. font-size: 24px;
  2320. }
  2321. }
  2322. }
  2323. :deep(.tippy-box[data-theme~="dropdown"]) {
  2324. max-width: 100px !important;
  2325. .nav-dropdown-items .nav-item {
  2326. justify-content: center !important;
  2327. border-radius: @border-radius !important;
  2328. &.active {
  2329. background-color: var(--primary-color);
  2330. color: var(--white);
  2331. }
  2332. }
  2333. }
  2334. }
  2335. .player-footer-center {
  2336. justify-content: center;
  2337. align-items: center;
  2338. flex: 2;
  2339. font-size: 18px;
  2340. font-weight: 400;
  2341. width: 200px;
  2342. margin: 0 5px;
  2343. img {
  2344. height: 21px;
  2345. margin-right: 12px;
  2346. filter: invert(26%) sepia(54%) saturate(6317%)
  2347. hue-rotate(2deg) brightness(92%) contrast(115%);
  2348. }
  2349. }
  2350. .player-footer-right {
  2351. justify-content: right;
  2352. flex: 1;
  2353. #volume-control {
  2354. margin: 3px;
  2355. margin-top: 0;
  2356. display: flex;
  2357. align-items: center;
  2358. cursor: pointer;
  2359. .volume-slider {
  2360. width: 100%;
  2361. padding: 0 15px;
  2362. background: transparent;
  2363. min-width: 100px;
  2364. }
  2365. input[type="range"] {
  2366. -webkit-appearance: none;
  2367. margin: 7.3px 0;
  2368. }
  2369. input[type="range"]:focus {
  2370. outline: none;
  2371. }
  2372. input[type="range"]::-webkit-slider-runnable-track {
  2373. width: 100%;
  2374. height: 5.2px;
  2375. cursor: pointer;
  2376. box-shadow: 0;
  2377. background: var(--light-grey-3);
  2378. border-radius: @border-radius;
  2379. border: 0;
  2380. }
  2381. input[type="range"]::-webkit-slider-thumb {
  2382. box-shadow: 0;
  2383. border: 0;
  2384. height: 19px;
  2385. width: 19px;
  2386. border-radius: 100%;
  2387. background: var(--primary-color);
  2388. cursor: pointer;
  2389. -webkit-appearance: none;
  2390. margin-top: -6.5px;
  2391. }
  2392. input[type="range"]::-moz-range-track {
  2393. width: 100%;
  2394. height: 5.2px;
  2395. cursor: pointer;
  2396. box-shadow: 0;
  2397. background: var(--light-grey-3);
  2398. border-radius: @border-radius;
  2399. border: 0;
  2400. }
  2401. input[type="range"]::-moz-range-thumb {
  2402. box-shadow: 0;
  2403. border: 0;
  2404. height: 19px;
  2405. width: 19px;
  2406. border-radius: 100%;
  2407. background: var(--primary-color);
  2408. cursor: pointer;
  2409. -webkit-appearance: none;
  2410. margin-top: -6.5px;
  2411. }
  2412. input[type="range"]::-ms-track {
  2413. width: 100%;
  2414. height: 5.2px;
  2415. cursor: pointer;
  2416. box-shadow: 0;
  2417. background: var(--light-grey-3);
  2418. border-radius: @border-radius;
  2419. }
  2420. input[type="range"]::-ms-fill-lower {
  2421. background: var(--light-grey-3);
  2422. border: 0;
  2423. border-radius: 0;
  2424. box-shadow: 0;
  2425. }
  2426. input[type="range"]::-ms-fill-upper {
  2427. background: var(--light-grey-3);
  2428. border: 0;
  2429. border-radius: 0;
  2430. box-shadow: 0;
  2431. }
  2432. input[type="range"]::-ms-thumb {
  2433. box-shadow: 0;
  2434. border: 0;
  2435. height: 15px;
  2436. width: 15px;
  2437. border-radius: 100%;
  2438. background: var(--primary-color);
  2439. cursor: pointer;
  2440. -webkit-appearance: none;
  2441. margin-top: 1.5px;
  2442. }
  2443. }
  2444. }
  2445. }
  2446. }
  2447. :deep(.thumbnail-preview) {
  2448. width: 189px;
  2449. height: 189px;
  2450. margin-left: 16px;
  2451. }
  2452. .thumbnail-dummy {
  2453. opacity: 0;
  2454. height: 10px;
  2455. width: 10px;
  2456. }
  2457. }
  2458. .edit-section {
  2459. display: flex;
  2460. flex-wrap: wrap;
  2461. flex-grow: 1;
  2462. border: 1px solid var(--light-grey-3);
  2463. margin-top: 16px;
  2464. border-radius: @border-radius;
  2465. .album-get-button {
  2466. background-color: var(--purple);
  2467. color: var(--white);
  2468. width: 32px;
  2469. text-align: center;
  2470. border-width: 0;
  2471. }
  2472. .duration-fill-button,
  2473. .youtube-get-button {
  2474. background-color: var(--dark-red);
  2475. color: var(--white);
  2476. width: 32px;
  2477. text-align: center;
  2478. border-width: 0;
  2479. }
  2480. .add-button {
  2481. background-color: var(--primary-color) !important;
  2482. width: 32px;
  2483. i {
  2484. font-size: 32px;
  2485. }
  2486. }
  2487. .album-get-button,
  2488. .duration-fill-button,
  2489. .youtube-get-button,
  2490. .add-button {
  2491. &:focus,
  2492. &:hover {
  2493. filter: contrast(0.75);
  2494. border: 1px solid var(--black) !important;
  2495. }
  2496. }
  2497. .youtube-get-button {
  2498. padding-left: 4px;
  2499. padding-right: 4px;
  2500. .youtube-icon {
  2501. background: var(--white);
  2502. }
  2503. }
  2504. > div {
  2505. margin: 16px !important;
  2506. width: 100%;
  2507. }
  2508. input {
  2509. width: 100%;
  2510. }
  2511. .title-container {
  2512. width: calc((100% - 32px) / 2);
  2513. }
  2514. .duration-container {
  2515. margin-right: 16px;
  2516. margin-left: 16px;
  2517. width: calc((100% - 32px) / 4);
  2518. }
  2519. .skip-duration-container {
  2520. width: calc((100% - 32px) / 4);
  2521. }
  2522. .album-art-container {
  2523. margin-right: 16px;
  2524. width: 100%;
  2525. }
  2526. .youtube-id-container {
  2527. margin-right: 16px;
  2528. width: calc((100% - 16px) / 8 * 3);
  2529. }
  2530. .verified-container {
  2531. width: calc((100% - 16px) / 8);
  2532. .checkbox-control {
  2533. margin-top: 10px;
  2534. }
  2535. }
  2536. .artists-container {
  2537. width: calc((100% - 32px) / 3);
  2538. position: relative;
  2539. }
  2540. .genres-container {
  2541. width: calc((100% - 32px) / 3);
  2542. margin-left: 16px;
  2543. margin-right: 16px;
  2544. position: relative;
  2545. label {
  2546. display: flex;
  2547. i {
  2548. font-size: 15px;
  2549. align-self: center;
  2550. margin-left: 5px;
  2551. color: var(--primary-color);
  2552. cursor: pointer;
  2553. -webkit-user-select: none;
  2554. -moz-user-select: none;
  2555. -ms-user-select: none;
  2556. user-select: none;
  2557. }
  2558. }
  2559. }
  2560. .tags-container {
  2561. width: calc((100% - 32px) / 3);
  2562. position: relative;
  2563. }
  2564. .list-item-circle {
  2565. background-color: var(--primary-color);
  2566. width: 16px;
  2567. height: 16px;
  2568. border-radius: 8px;
  2569. cursor: pointer;
  2570. margin-right: 8px;
  2571. float: left;
  2572. -webkit-touch-callout: none;
  2573. -webkit-user-select: none;
  2574. -khtml-user-select: none;
  2575. -moz-user-select: none;
  2576. -ms-user-select: none;
  2577. user-select: none;
  2578. i {
  2579. color: var(--primary-color);
  2580. font-size: 14px;
  2581. margin-left: 1px;
  2582. position: relative;
  2583. top: -1px;
  2584. }
  2585. }
  2586. .list-item-circle:hover,
  2587. .list-item-circle:focus {
  2588. i {
  2589. color: var(--white);
  2590. }
  2591. }
  2592. .list-item > p {
  2593. line-height: 16px;
  2594. word-wrap: break-word;
  2595. width: calc(100% - 24px);
  2596. left: 24px;
  2597. float: left;
  2598. margin-bottom: 8px;
  2599. }
  2600. .list-item:last-child > p {
  2601. margin-bottom: 0;
  2602. }
  2603. .thumbnail-warning {
  2604. color: var(--red);
  2605. font-size: 18px;
  2606. margin: auto 0 auto 5px;
  2607. }
  2608. }
  2609. }
  2610. .right-section {
  2611. flex-basis: unset !important;
  2612. flex-grow: 0 !important;
  2613. display: flex;
  2614. height: 100%;
  2615. #tabs-container {
  2616. width: 376px;
  2617. #tab-selection {
  2618. display: flex;
  2619. overflow-x: auto;
  2620. .button {
  2621. border-radius: @border-radius @border-radius 0 0;
  2622. border: 0;
  2623. text-transform: uppercase;
  2624. font-size: 14px;
  2625. color: var(--dark-grey-3);
  2626. background-color: var(--light-grey-2);
  2627. flex-grow: 1;
  2628. height: 32px;
  2629. &:not(:first-of-type) {
  2630. margin-left: 5px;
  2631. }
  2632. }
  2633. .selected {
  2634. background-color: var(--primary-color) !important;
  2635. color: var(--white) !important;
  2636. font-weight: 600;
  2637. }
  2638. }
  2639. .tab {
  2640. border: 1px solid var(--light-grey-3);
  2641. border-radius: 0 0 @border-radius @border-radius;
  2642. padding: 15px;
  2643. height: calc(100% - 32px);
  2644. overflow: auto;
  2645. }
  2646. }
  2647. }
  2648. @media screen and (max-width: 1100px) {
  2649. .left-section,
  2650. .right-section {
  2651. height: unset;
  2652. max-height: unset;
  2653. }
  2654. .left-section {
  2655. margin-right: 0;
  2656. }
  2657. .right-section {
  2658. flex-basis: 100% !important;
  2659. #tabs-container {
  2660. width: 100%;
  2661. }
  2662. }
  2663. }
  2664. .modal-card-foot .is-primary {
  2665. width: 200px;
  2666. }
  2667. :deep(.autosuggest-container) {
  2668. top: unset;
  2669. }
  2670. .toggle-sidebar-icon {
  2671. display: none;
  2672. }
  2673. .sidebar {
  2674. width: 100%;
  2675. max-width: 350px;
  2676. z-index: 2000;
  2677. display: flex;
  2678. flex-direction: column;
  2679. position: relative;
  2680. height: 100%;
  2681. max-height: calc(100vh - 40px);
  2682. overflow: auto;
  2683. margin-right: 8px;
  2684. border-radius: @border-radius;
  2685. .sidebar-head,
  2686. .sidebar-foot {
  2687. display: flex;
  2688. flex-shrink: 0;
  2689. position: relative;
  2690. justify-content: flex-start;
  2691. align-items: center;
  2692. padding: 20px;
  2693. background-color: var(--light-grey);
  2694. }
  2695. .sidebar-head {
  2696. border-bottom: 1px solid var(--light-grey-2);
  2697. border-radius: @border-radius @border-radius 0 0;
  2698. .sidebar-title {
  2699. display: flex;
  2700. flex: 1;
  2701. margin: 0;
  2702. font-size: 26px;
  2703. font-weight: 600;
  2704. }
  2705. }
  2706. .sidebar-body {
  2707. background-color: var(--white);
  2708. display: flex;
  2709. flex-direction: column;
  2710. row-gap: 8px;
  2711. flex: 1;
  2712. overflow: auto;
  2713. padding: 10px;
  2714. .edit-songs-items {
  2715. display: flex;
  2716. flex-direction: column;
  2717. row-gap: 8px;
  2718. .item {
  2719. display: flex;
  2720. flex-direction: row;
  2721. align-items: center;
  2722. column-gap: 8px;
  2723. :deep(.song-item) {
  2724. .item-icon {
  2725. margin-right: 10px;
  2726. cursor: pointer;
  2727. }
  2728. .removed-icon,
  2729. .error-icon {
  2730. color: var(--red);
  2731. }
  2732. .saving-icon,
  2733. .todo-icon,
  2734. .editing-icon {
  2735. color: var(--primary-color);
  2736. }
  2737. .done-icon {
  2738. color: var(--green);
  2739. }
  2740. .flag-icon {
  2741. color: var(--orange);
  2742. &.flagged {
  2743. color: var(--grey);
  2744. }
  2745. }
  2746. &.removed {
  2747. filter: grayscale(100%);
  2748. cursor: not-allowed;
  2749. user-select: none;
  2750. }
  2751. }
  2752. }
  2753. }
  2754. .no-items {
  2755. text-align: center;
  2756. font-size: 18px;
  2757. }
  2758. }
  2759. .sidebar-foot {
  2760. border-top: 1px solid var(--light-grey-2);
  2761. border-radius: 0 0 @border-radius @border-radius;
  2762. .button {
  2763. flex: 1;
  2764. }
  2765. }
  2766. .sidebar-overlay {
  2767. display: none;
  2768. }
  2769. }
  2770. @media only screen and (max-width: 1580px) {
  2771. .toggle-sidebar-icon {
  2772. display: flex;
  2773. margin-right: 5px;
  2774. transform: rotate(90deg);
  2775. cursor: pointer;
  2776. }
  2777. .sidebar {
  2778. display: none;
  2779. &.active {
  2780. display: flex;
  2781. position: absolute;
  2782. z-index: 2010;
  2783. top: 20px;
  2784. left: 20px;
  2785. .sidebar-head .toggle-sidebar-icon {
  2786. display: flex;
  2787. margin-left: 5px;
  2788. transform: rotate(-90deg);
  2789. }
  2790. }
  2791. }
  2792. .sidebar-overlay {
  2793. display: flex;
  2794. position: absolute;
  2795. z-index: 2009;
  2796. top: 0;
  2797. left: 0;
  2798. right: 0;
  2799. bottom: 0;
  2800. background-color: rgba(10, 10, 10, 0.85);
  2801. }
  2802. }
  2803. </style>