diff --git a/src/core/ui/settings/pages/PluginBrowser/index.tsx b/src/core/ui/settings/pages/PluginBrowser/index.tsx index 85a78a3..1afb2c7 100644 --- a/src/core/ui/settings/pages/PluginBrowser/index.tsx +++ b/src/core/ui/settings/pages/PluginBrowser/index.tsx @@ -45,14 +45,14 @@ function normalizeIdFromInstallUrl(url: string) { // @ts-ignore (i cant be bothered to type these) function InstallButton({ addon, isPluginMode, installing, setInstalling, setRefreshTick }) { const normId = normalizeIdFromInstallUrl(addon.installUrl); - const [installed, setInstalled] = React.useState(() => + const [installed, setInstalled] = React.useState(() => isPluginMode ? Boolean(VdPluginManager.plugins[normId]) : Boolean(themes[addon.installUrl]) ); React.useEffect(() => { setInstalled(isPluginMode ? Boolean(VdPluginManager.plugins[normId]) : Boolean(themes[addon.installUrl])); }, [addon.installUrl, setRefreshTick, isPluginMode]); - + const installAddon = async () => { if (installing.has(normId)) return; setInstalling((prev: Iterable | null | undefined) => new Set(prev).add(normId)); @@ -90,7 +90,7 @@ function InstallButton({ addon, isPluginMode, installing, setInstalling, setRefr const promptInstall = () => { if (!isPluginMode) return installAddon(); - + const plugin = addon as PluginData; const needsWarn = (plugin.status && plugin.status !== "working") || (plugin.warningMessage && plugin.warningMessage.trim().length > 0); if (!needsWarn) return installAddon(); @@ -197,12 +197,12 @@ function TrailingButtons({ addon, isPluginMode, installing, setInstalling, setRe variant="secondary" icon={findAssetId("MoreHorizontalIcon")} /> - ); @@ -238,12 +238,12 @@ function AddonCard({ addon, isPluginMode, installing, setInstalling, setRefreshT )} - @@ -296,7 +296,7 @@ export default function BrowserPage() { const response = await safeFetch(url); if (!response.ok) throw new Error(`HTTP ${response.status}: ${response.statusText}`); const data = await response.json(); - + let addonList: AddonData[] = []; if (Array.isArray(data)) { addonList = data; @@ -306,7 +306,7 @@ export default function BrowserPage() { // Handle any other structure for themes - try common property names addonList = data.OFFICIAL_THEMES || data.themes || data.THEMES || data.items || []; } - + if (isPluginMode) { setPlugins(addonList as PluginData[]); } else { @@ -411,34 +411,38 @@ export default function BrowserPage() { return ( - + - - + +