fix auto clearing matching themes

This commit is contained in:
SethBurkart123
2024-05-07 13:31:38 +10:00
parent 085f2b945c
commit f60cac8bbe
3 changed files with 8 additions and 10 deletions
+3 -3
View File
@@ -76,14 +76,14 @@ export const ThemeCover: React.FC<ThemeCoverProps> = ({
{ isEditMode || !downloaded &&
<>
<div
className="absolute z-20 flex w-8 h-8 p-2 text-white transition-all rounded-full delay-[20ms] opacity-0 top-1 right-2 dark:bg-black/50 place-items-center group-hover:opacity-100 group-hover:top-[1.25rem]"
className="absolute z-20 flex w-8 h-8 p-2 text-white transition-all rounded-full delay-[20ms] opacity-0 top-1 right-2 bg-black/50 place-items-center group-hover:opacity-100 group-hover:top-[1.25rem]"
onClick={(event) => { event?.preventDefault(), browser.runtime.sendMessage({ type: 'currentTab', info: 'OpenThemeCreator', body: { themeID: theme.id } }) }}
>
<PencilIcon className="w-4 h-4" />
</div>
<div
className="absolute z-20 flex w-8 h-8 p-2 text-white transition-all rounded-full opacity-0 top-1 right-12 dark:bg-black/50 place-items-center group-hover:opacity-100 group-hover:top-[1.25rem]"
className="absolute z-20 flex w-8 h-8 p-2 text-white transition-all rounded-full opacity-0 top-1 right-12 bg-black/50 place-items-center group-hover:opacity-100 group-hover:top-[1.25rem]"
onClick={handleShareClick}
>
{uploading ? <LoadingSpinner size={16} /> : <ArrowUpOnSquareIcon className="w-4 h-4" />}
@@ -101,7 +101,7 @@ export const ThemeCover: React.FC<ThemeCoverProps> = ({
}
{
theme.hideThemeName ? <></> :
<div className="z-10">{theme.name}</div>
<div className={`z-10 ${theme.coverImage && 'text-white'}`}>{theme.name}</div>
}
</div>
</button>
+5 -2
View File
@@ -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<Omit<ThemeSelectorProps, "ref"> &
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({
-5
View File
@@ -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 (