Skip to content

Commit

Permalink
hide voltage option for new wallets
Browse files Browse the repository at this point in the history
remove voltage lsp option if not using voltage
  • Loading branch information
futurepaul committed Sep 3, 2024
1 parent 187932e commit 9f6efc3
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion src/routes/settings/Servers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,36 @@ function SettingsStringsEditor(props: {
}
];

const LSP_OPTIONS =
const LSP_OPTIONS_WITH_VOLTAGE =
props.initialSettings.network === "signet"
? SIGNET_LSP_OPTIONS
: MAINNET_LSP_OPTIONS;

// If the user already has a non-voltage LSP, remove Voltage from the list
function filterOutVoltage(lspOptions: { value: string; label: string }[]) {
if (
props.initialSettings.network === "signet" &&
props.initialSettings.lsp &&
props.initialSettings.lsp !== "https://signet-lsp.mutinywallet.com"
) {
return lspOptions.filter(
(option) =>
option.value !== "https://signet-lsp.mutinywallet.com"
);
}

if (
props.initialSettings.lsp &&
props.initialSettings.lsp !== "https://lsp.voltageapi.com"
) {
return lspOptions.filter(
(option) => option.value !== "https://lsp.voltageapi.com"
);
}
}

const LSP_OPTIONS = filterOutVoltage(LSP_OPTIONS_WITH_VOLTAGE);

return (
<Card title={i18n.t("settings.servers.title")}>
<Form onSubmit={handleSubmit} class="flex flex-col gap-4">
Expand Down

0 comments on commit 9f6efc3

Please sign in to comment.