feat: button item + search storage reset

This commit is contained in:
SethBurkart123
2025-05-20 21:03:55 +10:00
parent 25623339f8
commit d8512e44cf
7 changed files with 79 additions and 16 deletions
-1
View File
@@ -59,7 +59,6 @@
if (!standalone) return;
initializeSettingsState();
console.log('settingsState', $settingsState);
StandaloneStore.setStandalone(true);
});
</script>
+11 -2
View File
@@ -12,7 +12,7 @@
import hideSensitiveContent from "@/seqta/ui/dev/hideSensitiveContent"
import { getAllPluginSettings } from "@/plugins"
import type { BooleanSetting, StringSetting, NumberSetting, SelectSetting } from "@/plugins/core/types"
import type { BooleanSetting, StringSetting, NumberSetting, SelectSetting, ButtonSetting } from "@/plugins/core/types"
// Union type representing all possible settings
type SettingType =
@@ -23,6 +23,10 @@
type: 'select',
id: string,
options: string[]
}) |
(Omit<ButtonSetting, 'type'> & {
type: 'button',
id: string
});
interface Plugin {
@@ -45,7 +49,7 @@
pluginSettingsValues[plugin.pluginId] = stored[storageKey] || {};
for (const [key, setting] of Object.entries(plugin.settings)) {
if (pluginSettingsValues[plugin.pluginId][key] === undefined) {
if (pluginSettingsValues[plugin.pluginId][key] === undefined && setting.type !== 'button') {
pluginSettingsValues[plugin.pluginId][key] = setting.default;
}
}
@@ -241,6 +245,11 @@
label: opt.charAt(0).toUpperCase() + opt.slice(1)
}))}
/>
{:else if setting.type === 'button'}
<Button
onClick={() => setting.trigger?.()}
text={setting.title}
/>
{/if}
</div>
</div>