index.vue 71 KB

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