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} +
+ )} +