index.vue 71 KB

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