From 37056e27e4637a6a0154bca18e57cc4dadd03c88 Mon Sep 17 00:00:00 2001 From: SethBurkart123 Date: Sun, 5 Nov 2023 11:39:59 +1100 Subject: [PATCH] remove console logging --- .eslintrc.json | 2 +- .../src/components/BackgroundSelector.tsx | 1 - src/seqta/ui/Themes.js | 22 ++++--------------- 3 files changed, 5 insertions(+), 20 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index a987e508..00d7d26a 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -11,7 +11,7 @@ "sourceType": "module" // add this line to allow 'import' and 'export' statements }, "rules": { - "indent": ["warning", 2], + "indent": ["error", 2], "quotes": ["error", "double"], "semi": ["error", "always"] } diff --git a/interface/src/components/BackgroundSelector.tsx b/interface/src/components/BackgroundSelector.tsx index 60b9ed6d..a11a5629 100644 --- a/interface/src/components/BackgroundSelector.tsx +++ b/interface/src/components/BackgroundSelector.tsx @@ -58,7 +58,6 @@ export default function BackgroundSelector({ selectedType, setSelectedType, isEd if (!alreadyExists) { setDownloadProgress(prev => ({ ...prev, [bg.id]: 0 })); const downloadedBg = await downloadPresetBackground(bg, progress => { - console.log(`${bg}, ${progress}`); setDownloadProgress(prev => ({ ...prev, [bg.id]: progress })); }); setDownloadProgress(prev => { diff --git a/src/seqta/ui/Themes.js b/src/seqta/ui/Themes.js index 0518c663..eb110695 100644 --- a/src/seqta/ui/Themes.js +++ b/src/seqta/ui/Themes.js @@ -1,6 +1,5 @@ import localforage from "localforage"; -let currentThemeStyle = null; let currentThemeClass = ""; // Utility function to fetch and parse JSON @@ -80,7 +79,6 @@ const applyTheme = async (themeName) => { export const listThemes = async () => { const themes = await localforage.keys(); - console.log("Themes in IndexedDB:", themes); return { themes: themes.filter((key) => key.startsWith("css_")).map((key) => key.replace("css_", "")), selectedTheme: await localforage.getItem("selectedTheme") @@ -88,15 +86,12 @@ export const listThemes = async () => { }; export const downloadTheme = async (themeName, themeUrl) => { - console.log(`Fetching theme ${themeName} from ${themeUrl}...`); const themeData = await fetchThemeJSON(themeUrl); await saveToIndexedDB(themeData, themeName); - console.log(`Theme ${themeName} saved to IndexedDB`); await setTheme(themeName, themeUrl); }; export const deleteTheme = async (themeName) => { - console.log(`Deleting theme ${themeName}...`); const currentTheme = await localforage.getItem("selectedTheme"); if (currentTheme === themeName) { await disableTheme(); @@ -105,8 +100,7 @@ export const deleteTheme = async (themeName) => { await Promise.all( (await localforage.keys()).filter((key) => key.startsWith(`images_${themeName}`)).map((key) => localforage.removeItem(key)) ); - console.log(`Theme ${themeName} deleted.`); -} +}; export const setTheme = async (themeName, themeUrl) => { if (!(await themeExistsInDB(themeName))) { @@ -120,32 +114,26 @@ export const setTheme = async (themeName, themeUrl) => { }; export const enableCurrentTheme = async () => { - console.log("Enabling current theme..."); const currentTheme = await localforage.getItem("selectedTheme"); if (currentTheme) { - console.log(`Enabling current theme: ${currentTheme}`); await applyTheme(currentTheme).catch((error) => { console.error(`Failed to apply current theme: ${error}`); }); - } else { - console.log("No current theme set in localforage."); } }; export const disableTheme = async () => { // Remove current theme's style if it exists - if (currentThemeStyle) { - document.head.removeChild(currentThemeStyle); - currentThemeStyle = null; - console.log("Current theme's style removed."); + if (window.currentThemeStyle) { + document.head.removeChild(window.currentThemeStyle); + window.currentThemeStyle = null; } // Remove current theme's class if it exists if (currentThemeClass) { document.body.classList.remove(currentThemeClass); currentThemeClass = ""; - console.log("Current theme's class removed."); } // Remove any applied image URLs from the root element @@ -157,10 +145,8 @@ export const disableTheme = async () => { document.documentElement.style.removeProperty(cssVar); }); } - console.log("Current theme's images removed."); } // Clear the selected theme from localforage localforage.removeItem("selectedTheme"); - console.log("Current theme disabled."); }; \ No newline at end of file