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:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user