From f60cac8bbe211d52db836f2c7f8722e50b742c7f Mon Sep 17 00:00:00 2001 From: SethBurkart123 Date: Tue, 7 May 2024 13:31:38 +1000 Subject: [PATCH] fix auto clearing matching themes --- src/interface/components/ThemeCover.tsx | 6 +++--- src/interface/components/ThemeSelector.tsx | 7 +++++-- src/interface/pages/Store.tsx | 5 ----- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/interface/components/ThemeCover.tsx b/src/interface/components/ThemeCover.tsx index 6de97dc8..1b1e362f 100644 --- a/src/interface/components/ThemeCover.tsx +++ b/src/interface/components/ThemeCover.tsx @@ -76,14 +76,14 @@ export const ThemeCover: React.FC = ({ { isEditMode || !downloaded && <>
{ event?.preventDefault(), browser.runtime.sendMessage({ type: 'currentTab', info: 'OpenThemeCreator', body: { themeID: theme.id } }) }} >
{uploading ? : } @@ -101,7 +101,7 @@ export const ThemeCover: React.FC = ({ } { theme.hideThemeName ? <> : -
{theme.name}
+
{theme.name}
}
diff --git a/src/interface/components/ThemeSelector.tsx b/src/interface/components/ThemeSelector.tsx index 8ae94462..0a4e0ed4 100644 --- a/src/interface/components/ThemeSelector.tsx +++ b/src/interface/components/ThemeSelector.tsx @@ -1,5 +1,5 @@ import React, { useEffect, useState, useCallback, forwardRef, useImperativeHandle, ForwardRefExoticComponent, RefAttributes } from 'react'; -import { listThemes, deleteTheme, setTheme, disableTheme, getDownloadedThemes } from '../hooks/ThemeManagment'; +import { listThemes, deleteTheme, setTheme, disableTheme, getDownloadedThemes, sendThemeUpdate } from '../hooks/ThemeManagment'; import { ThemeCover } from './ThemeCover'; import browser from 'webextension-polyfill'; import { CustomTheme, DownloadedTheme } from '../types/CustomThemes'; @@ -61,7 +61,10 @@ const ThemeSelector: ForwardRefExoticComponent & setDownloadedThemes(await getDownloadedThemes()); setSelectedTheme(selectedTheme ? selectedTheme : ''); - const matchingThemes = themes.filter(theme => downloadedThemes.some((downloadedTheme: DownloadedTheme) => downloadedTheme.id === theme.id)); + const matchingThemes = themes.filter(theme => + downloadedThemes.some(downloadedTheme => downloadedTheme.id === theme.id) + ); + if (matchingThemes.length > 0) { matchingThemes.forEach((theme) => { browser.runtime.sendMessage({ diff --git a/src/interface/pages/Store.tsx b/src/interface/pages/Store.tsx index cd786c02..983127e0 100644 --- a/src/interface/pages/Store.tsx +++ b/src/interface/pages/Store.tsx @@ -95,11 +95,6 @@ const Store = () => { setInstallingThemes(installingThemes.filter(theme => theme !== id)); setCurrentThemes(currentThemes.filter(theme => theme !== id)); }); - - /* browser.runtime.sendMessage({ type: 'StoreRemoveTheme', body: { themeContent } }).then(async () => { - await new Promise(resolve => setTimeout(resolve, 1000)); - setInstallingThemes(installingThemes.filter(theme => theme !== id)); - }); */ } return (