diff --git a/package.json b/package.json index 660b4118..8a58c362 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,8 @@ "server": "./bin/run.sh", "test": "react-scripts test", "eject": "react-scripts eject", - "local_release": "yarn run build && tar -zcvf dist.tar.gz build/" + "local_release": "yarn run build && tar -zcvf dist.tar.gz build/", + "lint": "eslint src --ext .js,.jsx,.ts,.tsx" }, "proxy": "http://127.0.0.1:4449/", "browserslist": { @@ -126,4 +127,4 @@ "prettier": "^2.1.2", "tailwindcss": "^3.4.1" } -} +} \ No newline at end of file diff --git a/src/pages/Authenticated/SettingsPage/BandwidthControlCard.tsx b/src/pages/Authenticated/SettingsPage/BandwidthControlCard.tsx index 0c0e4842..98abc65a 100644 --- a/src/pages/Authenticated/SettingsPage/BandwidthControlCard.tsx +++ b/src/pages/Authenticated/SettingsPage/BandwidthControlCard.tsx @@ -58,7 +58,7 @@ export const BandwidthControlCard = () => { }, []) return ( - +
diff --git a/src/pages/Authenticated/SettingsPage/PortForwardingCard.tsx b/src/pages/Authenticated/SettingsPage/PortForwardingCard.tsx new file mode 100644 index 00000000..8d8f9fc1 --- /dev/null +++ b/src/pages/Authenticated/SettingsPage/PortForwardingCard.tsx @@ -0,0 +1,43 @@ +/** + * Copyright (c) 2024 BlockDev AG + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +import { useState } from 'react' +import errors from '../../../commons/errors' +import { useAppSelector } from '../../../commons/hooks' +import complexActions from '../../../redux/complex.actions' +import { selectors } from '../../../redux/selectors' +import Card from '../../../components/Cards/Card' +import Button from '../../../components/Buttons/Button' +import { Form } from '../../../components/Inputs/Form' +import { LabeledInput } from '../../../components/Inputs/LabeledInput' + +export default function PortForwardingCard() { + const config = useAppSelector(selectors.currentConfig) + const [loading, setLoading] = useState(false) + const [value, setValue] = useState(config.data.udp.ports) + async function handleConfigSave() { + setLoading(true) + try { + await complexActions.setUserConfig({ udp: { ports: value } }) + } catch (err) { + errors.parseToastError(err) + } finally { + setLoading(false) + } + } + return ( + +
+
+ +
+
+
+
+
+ ) +} diff --git a/src/pages/Authenticated/SettingsPage/SettingsPage.tsx b/src/pages/Authenticated/SettingsPage/SettingsPage.tsx index f788462b..972920b1 100644 --- a/src/pages/Authenticated/SettingsPage/SettingsPage.tsx +++ b/src/pages/Authenticated/SettingsPage/SettingsPage.tsx @@ -12,6 +12,7 @@ import Label from '../../../components/Typography/Label' import PasswordChangeCard from './PasswordChangeCard' import { NodeStatusControlCard } from './NodeStatusControlCard' import BandwidthControlCard from './BandwidthControlCard' +import PortForwardingCard from './PortForwardingCard' const SettingsPage = () => { return ( @@ -25,6 +26,8 @@ const SettingsPage = () => {