feat(app): persist customization settings
test / workspace (push) Successful in 12m6s

This commit is contained in:
Tom You
2026-07-09 00:18:56 -05:00
parent a215d91f40
commit 6e08e0e7bc
4 changed files with 101 additions and 2 deletions
+26
View File
@@ -136,6 +136,31 @@ function wireVaultActions() {
if (button) button.addEventListener('click', saveDemoVault);
}
async function loadAppConfig() {
return invokeOrFallback('load_app_config', { theme_id: 'rabby-light', restore_workspace: true, profiles: [], shortcuts: [] });
}
async function saveSettings() {
const theme = document.getElementById('theme-select').value;
const output = document.getElementById('settings-status');
output.textContent = 'Saving settings…';
try {
const tauri = window.__TAURI__?.core;
if (!tauri) throw new Error('Tauri bridge unavailable in browser preview');
const config = await loadAppConfig();
config.theme_id = theme;
const saved = await tauri.invoke('save_app_config', { config, path: null });
output.textContent = `Saved ${saved.theme_id}`;
} catch (error) {
output.textContent = String(error);
}
}
function wireSettingsActions() {
const button = document.getElementById('save-settings');
if (button) button.addEventListener('click', saveSettings);
}
async function runLocalTerminalCommand() {
const command = document.getElementById('terminal-command').value;
const output = document.getElementById('terminal-output');
@@ -168,6 +193,7 @@ async function boot() {
renderDashboard(dashboard);
renderFeatures(features);
wireVaultActions();
wireSettingsActions();
wireTerminalActions();
}