Replace threshold placeholder link with a real settings panel

Adds a "Loss thresholds" panel to the popup backed by the backend's
new GET/PATCH /me/settings endpoints, converting between the wire's
fractional percentages and whole-number form inputs only at that
boundary.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01RTorFQXMR9ZQtCKcMTXLHp
This commit is contained in:
2026-09-08 02:38:46 +02:00
co-authored by claude
parent ac421196e9
commit 7f8270a048
7 changed files with 335 additions and 17 deletions
+14 -1
View File
@@ -7,8 +7,9 @@ import {
requestWalletDisconnect,
requestWalletReconnect,
} from '@/background/wallet-auth';
import { getSettings, updateSettings } from '@/background/settings-client';
import { connectWsClient } from '@/background/ws-client';
import type { NexaMessage } from '@/shared/messaging';
import type { NexaMessage, SettingsResult } from '@/shared/messaging';
export default defineBackground(() => {
const ws = connectWsClient({
@@ -71,6 +72,18 @@ export default defineBackground(() => {
void requestAccountSwitch();
return false;
case 'nexa:get-settings':
getSettings()
.then((settings) => sendResponse({ settings } satisfies SettingsResult))
.catch((err) => sendResponse({ error: String(err) } satisfies SettingsResult));
return true; // keep the message channel open for the async response
case 'nexa:update-settings':
updateSettings(message.settings)
.then((settings) => sendResponse({ settings } satisfies SettingsResult))
.catch((err) => sendResponse({ error: String(err) } satisfies SettingsResult));
return true;
default:
return undefined;
}