mirror of
https://github.com/status-im/nimbus-gui.git
synced 2025-02-10 10:26:53 +00:00
feat: delete state and reducer for checked addresses
This commit is contained in:
parent
efd4e26cf2
commit
00ff0138ac
@ -20,8 +20,6 @@ const ConnectViaIP = () => {
|
|||||||
vcAddress,
|
vcAddress,
|
||||||
isBeaconSwitchOn,
|
isBeaconSwitchOn,
|
||||||
isVcSwitchOn,
|
isVcSwitchOn,
|
||||||
isBeaconChecked,
|
|
||||||
isVcChecked,
|
|
||||||
} = useSelector((state: RootState) => state.pairDevice)
|
} = useSelector((state: RootState) => state.pairDevice)
|
||||||
|
|
||||||
const changeApiToken = (value: string) => {
|
const changeApiToken = (value: string) => {
|
||||||
@ -56,7 +54,6 @@ const ConnectViaIP = () => {
|
|||||||
port={vcPort}
|
port={vcPort}
|
||||||
isAdvanced={isAdvanced}
|
isAdvanced={isAdvanced}
|
||||||
isSwitchOn={isVcSwitchOn}
|
isSwitchOn={isVcSwitchOn}
|
||||||
isChecked={isVcChecked}
|
|
||||||
/>
|
/>
|
||||||
<InputsRow
|
<InputsRow
|
||||||
addressType={BEACON}
|
addressType={BEACON}
|
||||||
@ -65,7 +62,6 @@ const ConnectViaIP = () => {
|
|||||||
port={beaconPort}
|
port={beaconPort}
|
||||||
isAdvanced={isAdvanced}
|
isAdvanced={isAdvanced}
|
||||||
isSwitchOn={isBeaconSwitchOn}
|
isSwitchOn={isBeaconSwitchOn}
|
||||||
isChecked={isBeaconChecked}
|
|
||||||
/>
|
/>
|
||||||
</YStack>
|
</YStack>
|
||||||
) : (
|
) : (
|
||||||
|
@ -25,9 +25,8 @@ const InputsRow = ({
|
|||||||
address,
|
address,
|
||||||
port,
|
port,
|
||||||
isSwitchOn,
|
isSwitchOn,
|
||||||
isChecked,
|
|
||||||
}: InputsRowProps) => {
|
}: InputsRowProps) => {
|
||||||
const { beaconPort, vcPort, isNodeChecked, isNodeSwitchOn } = useSelector(
|
const { beaconPort, vcPort, isNodeSwitchOn } = useSelector(
|
||||||
(state: RootState) => state.pairDevice,
|
(state: RootState) => state.pairDevice,
|
||||||
)
|
)
|
||||||
const dispatch = useDispatch()
|
const dispatch = useDispatch()
|
||||||
@ -40,10 +39,6 @@ const InputsRow = ({
|
|||||||
dispatch({ type: 'pairDevice/setIsSwitchOn', payload: { value, switchType: addressType } })
|
dispatch({ type: 'pairDevice/setIsSwitchOn', payload: { value, switchType: addressType } })
|
||||||
}
|
}
|
||||||
|
|
||||||
const onCheckboxChange = (value: boolean) => {
|
|
||||||
dispatch({ type: 'pairDevice/setIsChecked', payload: { value, checkType: addressType } })
|
|
||||||
}
|
|
||||||
|
|
||||||
const onAddressChange = (value: string) => {
|
const onAddressChange = (value: string) => {
|
||||||
dispatch({ type: 'pairDevice/setAddress', payload: { value, addressType } })
|
dispatch({ type: 'pairDevice/setAddress', payload: { value, addressType } })
|
||||||
}
|
}
|
||||||
|
@ -11,9 +11,6 @@ type PairDeviceStateType = {
|
|||||||
isNodeSwitchOn: boolean
|
isNodeSwitchOn: boolean
|
||||||
isBeaconSwitchOn: boolean
|
isBeaconSwitchOn: boolean
|
||||||
isVcSwitchOn: boolean
|
isVcSwitchOn: boolean
|
||||||
isNodeChecked: boolean
|
|
||||||
isBeaconChecked: boolean
|
|
||||||
isVcChecked: boolean
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const initialState: PairDeviceStateType = {
|
const initialState: PairDeviceStateType = {
|
||||||
@ -25,9 +22,6 @@ const initialState: PairDeviceStateType = {
|
|||||||
isNodeSwitchOn: true,
|
isNodeSwitchOn: true,
|
||||||
isBeaconSwitchOn: true,
|
isBeaconSwitchOn: true,
|
||||||
isVcSwitchOn: true,
|
isVcSwitchOn: true,
|
||||||
isNodeChecked: true,
|
|
||||||
isBeaconChecked: true,
|
|
||||||
isVcChecked: true,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const pairDeviceSlice = createSlice({
|
const pairDeviceSlice = createSlice({
|
||||||
@ -59,15 +53,6 @@ const pairDeviceSlice = createSlice({
|
|||||||
state.isNodeSwitchOn = action.payload.value
|
state.isNodeSwitchOn = action.payload.value
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
setIsChecked: (state, action) => {
|
|
||||||
if (action.payload.checkType === BEACON) {
|
|
||||||
state.isBeaconChecked = action.payload.value
|
|
||||||
} else if (action.payload.checkType === VALIDATOR_CLIENT) {
|
|
||||||
state.isVcChecked = action.payload.value
|
|
||||||
} else {
|
|
||||||
state.isNodeChecked = action.payload.value
|
|
||||||
}
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user