Add save confirmation and fix saveConfig -> updateConfig
All checks were successful
Release / Bump version and tag (push) Successful in 16s
All checks were successful
Release / Bump version and tag (push) Successful in 16s
- Fixed method call from saveConfig (doesn't exist) to updateConfig - Save button shows "Saving..." while in progress, disabled during save - Green "Settings saved!" message appears on success before closing - Red error message shown on failure - Cancel button disabled during save Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -42,6 +42,9 @@
|
|||||||
let managedPassword = $state("");
|
let managedPassword = $state("");
|
||||||
let autoCheckUpdates = $state(true);
|
let autoCheckUpdates = $state(true);
|
||||||
|
|
||||||
|
let saving = $state(false);
|
||||||
|
let saveMessage = $state("");
|
||||||
|
|
||||||
// Fetched device lists
|
// Fetched device lists
|
||||||
let audioDevices = $state<{ id: string; name: string }[]>([]);
|
let audioDevices = $state<{ id: string; name: string }[]>([]);
|
||||||
let computeDevices = $state<{ id: string; name: string }[]>([]);
|
let computeDevices = $state<{ id: string; name: string }[]>([]);
|
||||||
@@ -192,11 +195,16 @@
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
saving = true;
|
||||||
|
saveMessage = "";
|
||||||
try {
|
try {
|
||||||
await configStore.saveConfig(updates);
|
await configStore.updateConfig(updates);
|
||||||
onClose();
|
saveMessage = "Settings saved!";
|
||||||
|
setTimeout(() => onClose(), 600);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error("Failed to save settings:", err);
|
console.error("Failed to save settings:", err);
|
||||||
|
saveMessage = `Error: ${err}`;
|
||||||
|
saving = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -643,8 +651,13 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="settings-footer">
|
<div class="settings-footer">
|
||||||
<button onclick={handleCancel}>Cancel</button>
|
{#if saveMessage}
|
||||||
<button class="primary" onclick={handleSave}>Save</button>
|
<span class="save-message" class:error={saveMessage.startsWith("Error")}>{saveMessage}</span>
|
||||||
|
{/if}
|
||||||
|
<button onclick={handleCancel} disabled={saving}>Cancel</button>
|
||||||
|
<button class="primary" onclick={handleSave} disabled={saving}>
|
||||||
|
{saving ? "Saving..." : "Save"}
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -788,10 +801,21 @@
|
|||||||
|
|
||||||
.settings-footer {
|
.settings-footer {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
gap: 8px;
|
gap: 8px;
|
||||||
padding: 16px 20px;
|
padding: 16px 20px;
|
||||||
border-top: 1px solid var(--border-color);
|
border-top: 1px solid var(--border-color);
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.save-message {
|
||||||
|
margin-right: auto;
|
||||||
|
font-size: 13px;
|
||||||
|
color: #4CAF50;
|
||||||
|
}
|
||||||
|
|
||||||
|
.save-message.error {
|
||||||
|
color: #f44336;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user