diff --git a/static/app-strings.json b/static/app-strings.json
index ec678cb98..6f6a62448 100644
--- a/static/app-strings.json
+++ b/static/app-strings.json
@@ -909,7 +909,6 @@
"Choose a different provider's wallet server.": "Choose a different provider's wallet server.",
"Host": "Host",
"Port": "Port",
- "Available": "Available",
"Unable to load your saved preferences.": "Unable to load your saved preferences.",
"Add/Delete": "Add/Delete",
"%numberOfMonthsSincePublish% years ago": "%numberOfMonthsSincePublish% years ago",
@@ -919,12 +918,11 @@
"%numberOfMonthsSincePublish% month ago": "%numberOfMonthsSincePublish% month ago",
"%numberOfMonthsSincePublish% months ago": "%numberOfMonthsSincePublish% months ago",
"%numberOfDaysSincePublish% days ago": "%numberOfDaysSincePublish% days ago",
+ "%numberOfDaysSincePublish% day ago": "%numberOfDaysSincePublish% day ago",
"The wallet server took a bit too long. Resetting defaults just in case. Shutdown (Cmd/Ctrl+Q) LBRY and restart if this continues.": "The wallet server took a bit too long. Resetting defaults just in case. Shutdown (Cmd/Ctrl+Q) LBRY and restart if this continues.",
"Provide a description and link to your license": "Provide a description and link to your license",
- "Walletserver preference": "Walletserver preference",
"Wallet servers": "Wallet servers",
"In response to a complaint we received under the US Digital Millennium Copyright Act, we have blocked access to this content from our applications.": "In response to a complaint we received under the US Digital Millennium Copyright Act, we have blocked access to this content from our applications.",
"Followers": "Followers",
- "%numberOfDaysSincePublish% day ago": "%numberOfDaysSincePublish% day ago",
"%number% files hidden due to your %content_viewing_preferences_link%": "%number% files hidden due to your %content_viewing_preferences_link%"
}
diff --git a/ui/component/settingWalletServer/internal/inputRow.jsx b/ui/component/settingWalletServer/internal/inputRow.jsx
index aaafda5a9..99f4038e2 100644
--- a/ui/component/settingWalletServer/internal/inputRow.jsx
+++ b/ui/component/settingWalletServer/internal/inputRow.jsx
@@ -1,47 +1,63 @@
// @flow
-import * as ICONS from 'constants/icons';
import React, { useState, useEffect } from 'react';
import Button from 'component/button';
-import { FormField } from 'component/common/form';
+import { Form, FormField } from 'component/common/form';
type Props = {
- update: (string) => void,
+ update: ([string, string]) => void,
};
-const VALID_IPADDRESS_REGEX = new RegExp('^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\\.)){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$');
-const VALID_HOSTNAME_REGEX = new RegExp('^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9])(\\.))+([A-Za-z]|[A-Za-z][A-Za-z]*[A-Za-z])$');
+const VALID_IPADDRESS_REGEX = new RegExp(
+ '^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\\.)){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$'
+);
+const VALID_HOSTNAME_REGEX = new RegExp(
+ '^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9])(\\.))+([A-Za-z]|[A-Za-z][A-Za-z]*[A-Za-z])$'
+);
const VALID_PORT_REGEX = new RegExp('^([0-9]){1,5}$');
function ServerInputRow(props: Props) {
const { update } = props;
-
const [hostString, setHostString] = useState('');
const [portString, setPortString] = useState('');
const [validServerString, setValidServerString] = useState(false);
useEffect(() => {
- setValidServerString((VALID_IPADDRESS_REGEX.test(hostString) || VALID_HOSTNAME_REGEX.test(hostString)) && VALID_PORT_REGEX.test(portString));
+ setValidServerString(
+ (VALID_IPADDRESS_REGEX.test(hostString) || VALID_HOSTNAME_REGEX.test(hostString)) &&
+ VALID_PORT_REGEX.test(portString)
+ );
}, [hostString, portString, validServerString, setValidServerString]);
- function onClick() {
+ function onSubmit() {
update([hostString, portString]);
setHostString('');
setPortString('');
}
return (
-
-
- setHostString(e.target.value)} />
-
-
- setPortString(e.target.value)} />
-
-
-
-
-
-
+
);
}
diff --git a/ui/component/settingWalletServer/view.jsx b/ui/component/settingWalletServer/view.jsx
index f0eb7b346..8b7cc5bec 100644
--- a/ui/component/settingWalletServer/view.jsx
+++ b/ui/component/settingWalletServer/view.jsx
@@ -4,12 +4,11 @@ import React, { useState, useEffect } from 'react';
import { FormField } from 'component/common/form';
import Button from 'component/button';
import * as ICONS from 'constants/icons';
-import Icon from 'component/common/icon';
import ServerInputRow from './internal/inputRow';
type DaemonSettings = {
- lbryum_servers: Array<>,
+ lbryum_servers: Array,
};
type DaemonStatus = {
@@ -33,7 +32,7 @@ type Props = {
setCustomWalletServers: any => void,
clearWalletServers: () => void,
customWalletServers: ServerConfig,
- saveServerConfig: string => void,
+ saveServerConfig: (Array) => void,
fetchDaemonSettings: () => void,
hasWalletServerPrefs: boolean,
daemonStatus: DaemonStatus,
@@ -88,13 +87,13 @@ function SettingWalletServer(props: Props) {
clearWalletServers();
}
- function onAdd(serverTuple) {
+ function onAdd(serverTuple: Array) {
let newServerConfig = serverConfig.concat();
newServerConfig.push(serverTuple);
updateServers(newServerConfig);
}
- function onDelete(i) {
+ function onDelete(i: number) {
const newServerConfig = serverConfig.concat();
newServerConfig.splice(i, 1);
updateServers(newServerConfig);
@@ -107,13 +106,12 @@ function SettingWalletServer(props: Props) {
return (
-
-
- {advancedMode && (
-