From 48ee8abd478da3806fa14239176550e9542c9853 Mon Sep 17 00:00:00 2001 From: RadoslavDimchev Date: Fri, 5 Jan 2024 14:27:39 +0200 Subject: [PATCH] feat: use new port input component --- .../PairDevice/ConnectViaIP/ConnectViaIP.tsx | 2 +- .../PairDevice/ConnectViaIP/InputsRow.tsx | 37 +++---------------- 2 files changed, 7 insertions(+), 32 deletions(-) diff --git a/src/pages/PairDevice/ConnectViaIP/ConnectViaIP.tsx b/src/pages/PairDevice/ConnectViaIP/ConnectViaIP.tsx index 9890cb40..3a82e6eb 100644 --- a/src/pages/PairDevice/ConnectViaIP/ConnectViaIP.tsx +++ b/src/pages/PairDevice/ConnectViaIP/ConnectViaIP.tsx @@ -67,7 +67,7 @@ const ConnectViaIP = () => { /> ) : ( - + )} diff --git a/src/pages/PairDevice/ConnectViaIP/InputsRow.tsx b/src/pages/PairDevice/ConnectViaIP/InputsRow.tsx index b39d8372..8a72cfc5 100644 --- a/src/pages/PairDevice/ConnectViaIP/InputsRow.tsx +++ b/src/pages/PairDevice/ConnectViaIP/InputsRow.tsx @@ -3,13 +3,14 @@ import { useDispatch, useSelector } from 'react-redux' import { Stack, Switch, XStack, YStack } from 'tamagui' import { RootState } from '../../../redux/store' +import PortInput from './PortInput' type InputsRowProps = { addressType: string - portType?: string + portType: string isAdvanced?: boolean address: string - port?: string + port: string isSwitchOn?: boolean isChecked?: boolean } @@ -40,14 +41,6 @@ const InputsRow = ({ dispatch({ type: 'pairDevice/setIsChecked', payload: { value, checkType: addressType } }) } - const onPortChange = (value: string, portType: string) => { - if (isNaN(Number(value))) { - return - } - - dispatch({ type: 'pairDevice/setPort', payload: { value, portType } }) - } - const onAddressChange = (value: string) => { dispatch({ type: 'pairDevice/setAddress', payload: { value, addressType } }) } @@ -87,29 +80,11 @@ const InputsRow = ({ {isAdvanced ? ( - - - {portType} Port - - onPortChange(value, portType ? portType : '')} - /> - + ) : ( - - - VC Port - - onPortChange(value, 'VC')} /> - - - - Beacon Port - - onPortChange(value, 'Beacon')} /> - + + )}