feat: remove theme toggle

This commit is contained in:
SethBurkart123
2025-03-29 22:33:06 +11:00
parent 09855c9ef5
commit 6147e96cc9
+5 -42
View File
@@ -1,53 +1,16 @@
import type { Plugin } from '../../core/types'; import type { Plugin } from '../../core/types';
import { BasePlugin, BooleanSetting } from '../../core/settings';
import { ThemeManager } from './theme-manager'; import { ThemeManager } from './theme-manager';
// Define only the typed settings - no need for redundant interface const themesPlugin: Plugin = {
class ThemePluginClass extends BasePlugin {
@BooleanSetting({
default: true,
title: "Themes",
description: "Adds a theme selector to the settings page"
})
enabled!: boolean;
}
// Create an instance to extract settings
const settingsInstance = new ThemePluginClass();
const themesPlugin: Plugin<typeof settingsInstance.settings> = {
id: 'themes', id: 'themes',
name: 'Themes', name: 'Themes',
description: 'Adds a theme selector to the settings page', description: 'Adds a theme selector to the settings page',
version: '1.0.0', version: '1.0.0',
settings: settingsInstance.settings, settings: {},
run: async (api) => {
console.debug('[ThemesPlugin] Starting plugin'); run: async (_) => {
const themeManager = ThemeManager.getInstance(); const themeManager = ThemeManager.getInstance();
await themeManager.initialize();
if (api.settings.enabled) {
console.debug('[ThemesPlugin] Plugin enabled, initializing theme manager');
await themeManager.initialize();
}
const enabledCallback = (value: string | number | boolean) => {
console.debug('[ThemesPlugin] Enabled setting changed:', value);
if (value === true) {
console.debug('[ThemesPlugin] Plugin enabled, initializing theme manager');
void themeManager.initialize();
} else if (value === false) {
console.debug('[ThemesPlugin] Plugin disabled, cleaning up theme manager');
void themeManager.cleanup();
}
}
api.settings.onChange('enabled', enabledCallback);
return () => {
console.debug('[ThemesPlugin] Plugin cleanup');
api.settings.offChange('enabled', enabledCallback);
void themeManager.cleanup();
}
} }
}; };