Add zero-hop impulse advert. Closes #83.

This commit is contained in:
Jack Kingsman
2026-03-18 19:59:08 -07:00
parent d8e22ef4af
commit b832239e22
13 changed files with 159 additions and 45 deletions
+7 -5
View File
@@ -4,6 +4,7 @@ import { takePrefetchOrFetch } from '../prefetch';
import { toast } from '../components/ui/sonner';
import type {
HealthStatus,
RadioAdvertMode,
RadioConfig,
RadioConfigUpdate,
RadioDiscoveryResponse,
@@ -93,13 +94,14 @@ export function useRadioControl() {
}
}, [fetchConfig]);
const handleAdvertise = useCallback(async () => {
const handleAdvertise = useCallback(async (mode: RadioAdvertMode = 'flood') => {
try {
await api.sendAdvertisement();
toast.success('Advertisement sent');
await api.sendAdvertisement(mode);
toast.success(mode === 'zero_hop' ? 'Zero-hop advertisement sent' : 'Advertisement sent');
} catch (err) {
console.error('Failed to send advertisement:', err);
toast.error('Failed to send advertisement', {
const label = mode === 'zero_hop' ? 'zero-hop advertisement' : 'advertisement';
console.error(`Failed to send ${label}:`, err);
toast.error(`Failed to send ${label}`, {
description: err instanceof Error ? err.message : 'Check radio connection',
});
}