feat: move is valid funcs to utilities
This commit is contained in:
parent
965f59aac0
commit
bc3903b5b0
|
@ -6,6 +6,7 @@ import { CheckIcon } from '@status-im/icons'
|
|||
import { RootState } from '../../../redux/store'
|
||||
import PortInput from './PortInput'
|
||||
import { BEACON, VC } from '../../../constants'
|
||||
import { isAddressValid, isPortValid } from '../../../utilities'
|
||||
import styles from './index.module.css'
|
||||
|
||||
type InputsRowProps = {
|
||||
|
@ -35,18 +36,6 @@ const InputsRow = ({ addressType, portType, address, port, isSwitchOn }: InputsR
|
|||
dispatch({ type: 'pairDevice/setAddress', payload: { value, addressType } })
|
||||
}
|
||||
|
||||
const isAddressValid = (address: string) => {
|
||||
return address.length > 0
|
||||
}
|
||||
|
||||
const isPortValid = (port: string) => {
|
||||
if (port.length === 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
return !isNaN(Number(port))
|
||||
}
|
||||
|
||||
const isValidRow = () => {
|
||||
if (isAdvanced) {
|
||||
return isAddressValid(address) && isPortValid(port)
|
||||
|
|
|
@ -68,3 +68,15 @@ export const getHeightPercentages = (amountOfElements: number) => {
|
|||
|
||||
return `${percentages}%`
|
||||
}
|
||||
|
||||
export const isAddressValid = (address: string) => {
|
||||
return address.length > 0
|
||||
}
|
||||
|
||||
export const isPortValid = (port: string) => {
|
||||
if (port.length === 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
return !isNaN(Number(port))
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue