From 4eb29f376e069b925404bf92db67d88ac05e3847 Mon Sep 17 00:00:00 2001
From: Jack Kingsman
Date: Fri, 24 Apr 2026 14:44:27 -0700
Subject: [PATCH] Make clearer save button for advert interval
---
.../settings/SettingsRadioSection.tsx | 38 ++++++++++++++++---
1 file changed, 33 insertions(+), 5 deletions(-)
diff --git a/frontend/src/components/settings/SettingsRadioSection.tsx b/frontend/src/components/settings/SettingsRadioSection.tsx
index c3dc9d4..1278a6a 100644
--- a/frontend/src/components/settings/SettingsRadioSection.tsx
+++ b/frontend/src/components/settings/SettingsRadioSection.tsx
@@ -396,11 +396,6 @@ export function SettingsRadioSection({
try {
const update: AppSettingsUpdate = {};
- const hours = parseInt(advertIntervalHours, 10);
- const newAdvertInterval = isNaN(hours) ? 0 : hours * 3600;
- if (newAdvertInterval !== appSettings.advert_interval) {
- update.advert_interval = newAdvertInterval;
- }
if (floodScope !== stripRegionScopePrefix(appSettings.flood_scope)) {
update.flood_scope = floodScope;
}
@@ -419,6 +414,27 @@ export function SettingsRadioSection({
}
};
+ const [advertIntervalBusy, setAdvertIntervalBusy] = useState(false);
+ const [advertIntervalError, setAdvertIntervalError] = useState(null);
+
+ const handleSaveAdvertInterval = async () => {
+ setAdvertIntervalError(null);
+ setAdvertIntervalBusy(true);
+
+ try {
+ const hours = parseInt(advertIntervalHours, 10);
+ const newAdvertInterval = isNaN(hours) ? 0 : hours * 3600;
+ if (newAdvertInterval !== appSettings.advert_interval) {
+ await onSaveAppSettings({ advert_interval: newAdvertInterval });
+ }
+ toast.success('Advertising interval saved');
+ } catch (err) {
+ setAdvertIntervalError(err instanceof Error ? err.message : 'Failed to save');
+ } finally {
+ setAdvertIntervalBusy(false);
+ }
+ };
+
const handleAdvertise = async (mode: RadioAdvertMode) => {
setAdvertisingMode(mode);
try {
@@ -1109,6 +1125,18 @@ export function SettingsRadioSection({
How often to automatically advertise presence. Set to 0 to disable. Minimum: 1 hour.
Recommended: 24 hours or higher.
+ {advertIntervalError && (
+
+ {advertIntervalError}
+
+ )}
+