Use better behavior on disconnected radio and allow deeplinking into settings. Closes #66.

This commit is contained in:
Jack Kingsman
2026-03-16 17:46:12 -07:00
parent ffb5fa51c1
commit b68bfc41d6
14 changed files with 359 additions and 56 deletions
+28 -1
View File
@@ -63,6 +63,7 @@ const baseSettings: AppSettings = {
};
function renderModal(overrides?: {
config?: RadioConfig | null;
appSettings?: AppSettings;
health?: HealthStatus;
onSaveAppSettings?: (update: AppSettingsUpdate) => Promise<void>;
@@ -97,7 +98,7 @@ function renderModal(overrides?: {
const commonProps = {
open: overrides?.open ?? true,
pageMode: overrides?.pageMode,
config: baseConfig,
config: overrides?.config === undefined ? baseConfig : overrides.config,
health: overrides?.health ?? baseHealth,
appSettings: overrides?.appSettings ?? baseSettings,
onClose,
@@ -205,6 +206,32 @@ describe('SettingsModal', () => {
expect(screen.getByText(/Configured radio contact capacity/i)).toBeInTheDocument();
});
it('keeps non-radio settings available when radio config is unavailable', () => {
renderModal({ config: null });
const radioToggle = screen.getByRole('button', { name: /Radio/i });
expect(radioToggle).toBeDisabled();
openLocalSection();
expect(screen.getByLabelText('Local label text')).toBeInTheDocument();
openDatabaseSection();
expect(screen.getByText('Delete Undecrypted Packets')).toBeInTheDocument();
});
it('shows a radio-unavailable message instead of blocking the whole settings page', () => {
renderModal({
config: null,
externalSidebarNav: true,
desktopSection: 'radio',
});
expect(
screen.getByText('Radio settings are unavailable until a radio connects.')
).toBeInTheDocument();
expect(screen.queryByText('Loading configuration...')).not.toBeInTheDocument();
});
it('shows cached radio firmware and capacity info under the connection status', () => {
renderModal({
health: {