mirror of
https://github.com/BetterSEQTA/BetterSEQTA-Plus.git
synced 2026-06-05 19:24:39 +00:00
Revert "add debouncing to selected theme"
This reverts commit ad7255efcc.
This commit is contained in:
@@ -25,17 +25,14 @@ export const ThemeCover: React.FC<ThemeCoverProps> = ({
|
||||
const handleThemeClick = async () => {
|
||||
if (isEditMode) return;
|
||||
if (downloaded) {
|
||||
// move the theme from temporary storage to SEQTAs storage
|
||||
await sendThemeUpdate(theme as DownloadedTheme, true)
|
||||
// remove from temp storage
|
||||
await browser.runtime.sendMessage({
|
||||
type: 'DeleteDownloadedTheme',
|
||||
body: theme.id
|
||||
})
|
||||
// set it!
|
||||
setTheme(theme.id);
|
||||
} else {
|
||||
console.debug(theme)
|
||||
console.log(theme)
|
||||
onThemeSelect(theme.id);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -79,20 +79,10 @@ const ThemeSelector: ForwardRefExoticComponent<Omit<ThemeSelectorProps, "ref"> &
|
||||
|
||||
useEffect(() => {
|
||||
fetchThemes();
|
||||
|
||||
/* const interval = setInterval(() => {
|
||||
console.log("Done!");
|
||||
if (isLoading == true) {
|
||||
fetchThemes();
|
||||
} else {
|
||||
clearInterval(interval);
|
||||
}
|
||||
}, 1000); */
|
||||
}, []);
|
||||
|
||||
const handleThemeSelect = useCallback(
|
||||
async (themeId: string) => {
|
||||
console.log(themeId === settingsState.selectedTheme);
|
||||
if (themeId === settingsState.selectedTheme) {
|
||||
await disableTheme();
|
||||
setSelectedTheme('');
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import browser from 'webextension-polyfill'
|
||||
import { debounce } from 'lodash';
|
||||
|
||||
import {
|
||||
CreateBackground,
|
||||
@@ -12,18 +11,13 @@ import {
|
||||
} from '../../../SEQTA';
|
||||
import { updateBgDurations } from '../../ui/Animation';
|
||||
import { getDarkMode, updateAllColors } from '../../ui/colors/Manager';
|
||||
//import { appendBackgroundToUI } from '../../ui/ImageBackgrounds';
|
||||
import { setTheme } from '../../ui/themes/setTheme';
|
||||
import { disableTheme } from '../../ui/themes/disableTheme';
|
||||
import { appendBackgroundToUI } from '../../ui/ImageBackgrounds';
|
||||
|
||||
|
||||
export default class StorageListener {
|
||||
darkMode: any;
|
||||
debouncedSetTheme: any;
|
||||
|
||||
constructor() {
|
||||
this.darkMode = getDarkMode();
|
||||
this.debouncedSetTheme = debounce(this.applyTheme, 300); // 300 ms debounce period
|
||||
browser.storage.onChanged.addListener(this.handleStorageChanges.bind(this));
|
||||
}
|
||||
|
||||
@@ -88,23 +82,15 @@ export default class StorageListener {
|
||||
}
|
||||
break;
|
||||
|
||||
case 'selectedTheme':
|
||||
this.debouncedSetTheme(changes.selectedTheme.newValue);
|
||||
case 'theme':
|
||||
console.log(changes.theme.newValue)
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
applyTheme(theme: string) {
|
||||
if (theme === '') {
|
||||
disableTheme();
|
||||
} else {
|
||||
setTheme(theme);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
handleSelectedColorChange(newColor: any) {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user