Changed save settings button

This commit is contained in:
2026-07-14 00:57:36 +02:00
parent ba0e9f7a82
commit c1c40361a7
+13 -5
View File
@@ -60,7 +60,7 @@ function NotificationsTab() {
} }
async function handleSave(e) { async function handleSave(e) {
e.preventDefault(); if (e) e.preventDefault();
setSaving(true); setError(''); setSaved(false); setSaving(true); setError(''); setSaved(false);
try { try {
await saveSettings({ gotify: { ...form, priority: Number(form.priority) }, ntfy: { ...ntfy, priority: Number(ntfy.priority) }, smtp: { ...smtp, port: Number(smtp.port) }, webhook, notifications: events }); await saveSettings({ gotify: { ...form, priority: Number(form.priority) }, ntfy: { ...ntfy, priority: Number(ntfy.priority) }, smtp: { ...smtp, port: Number(smtp.port) }, webhook, notifications: events });
@@ -113,13 +113,23 @@ function NotificationsTab() {
if (loading) return <p className="hint">Loading</p>; if (loading) return <p className="hint">Loading</p>;
return ( return (
<>
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: 20, flexWrap: 'wrap', gap: 10 }}>
<p className="settings-desc" style={{ margin: 0 }}>Configure notification channels. All enabled channels receive the same events.</p>
<div style={{ display: 'flex', alignItems: 'center', gap: 12 }}>
{error && <span className="error" style={{ fontSize: 13 }}>{error}</span>}
{saved && <span className="test-ok" style={{ fontSize: 13 }}> Settings saved</span>}
<button className="btn-primary" onClick={handleSave} disabled={saving}>
{saving ? 'Saving…' : 'Save Settings'}
</button>
</div>
</div>
<div className="settings-grid"> <div className="settings-grid">
<section className="settings-section"> <section className="settings-section">
<h3>Gotify Notifications</h3> <h3>Gotify Notifications</h3>
<p className="settings-desc"> <p className="settings-desc">
Send a notification to a Gotify instance whenever a DNS record is added, updated, or deleted. Send a notification to a Gotify instance whenever a DNS record is added, updated, or deleted.
</p> </p>
{error && <p className="error" style={{ marginBottom: 12 }}>{error}</p>}
<form onSubmit={handleSave} className="settings-form"> <form onSubmit={handleSave} className="settings-form">
<label className="toggle-row"> <label className="toggle-row">
<span>Enable notifications</span> <span>Enable notifications</span>
@@ -201,9 +211,6 @@ function NotificationsTab() {
<button type="button" className="btn-secondary" onClick={handleTest} disabled={testing || !form.url || !form.token}> <button type="button" className="btn-secondary" onClick={handleTest} disabled={testing || !form.url || !form.token}>
{testing ? 'Sending…' : 'Send Test'} {testing ? 'Sending…' : 'Send Test'}
</button> </button>
<button type="submit" className="btn-primary" disabled={saving}>
{saving ? 'Saving…' : saved ? '✓ Saved' : 'Save Settings'}
</button>
</div> </div>
</form> </form>
</section> </section>
@@ -304,6 +311,7 @@ function NotificationsTab() {
</p> </p>
</section> </section>
</div> </div>
</>
); );
} }