From 4b35c5f1aae44a06c90012c32ac2feb5ab91dcae Mon Sep 17 00:00:00 2001 From: Jack Mallers Date: Wed, 4 Apr 2018 10:05:48 -0500 Subject: [PATCH] fix(channelform): remove old unused reducer --- app/main.dev.js | 2 +- app/reducers/channelform.js | 130 --------------------------------- app/reducers/channels.js | 1 - app/reducers/index.js | 2 - test/reducers/channels.spec.js | 4 - 5 files changed, 1 insertion(+), 138 deletions(-) delete mode 100644 app/reducers/channelform.js diff --git a/app/main.dev.js b/app/main.dev.js index 4e5dfcf3..265933a0 100644 --- a/app/main.dev.js +++ b/app/main.dev.js @@ -164,7 +164,7 @@ const startLnd = (alias, autopilot) => { '--bitcoin.active', '--bitcoin.testnet', '--bitcoin.node=neutrino', - '--neutrino.connect=btcd.jackmallers.com:18333', + '--neutrino.connect=btcd0.lightning.computer:18333', '--neutrino.addpeer=btcd.jackmallers.com:18333', '--neutrino.addpeer=159.65.48.139:18333', '--neutrino.connect=127.0.0.1:18333', diff --git a/app/reducers/channelform.js b/app/reducers/channelform.js deleted file mode 100644 index 50a92848..00000000 --- a/app/reducers/channelform.js +++ /dev/null @@ -1,130 +0,0 @@ -import { createSelector } from 'reselect' - -// Initial State -const initialState = { - isOpen: false, - node_key: '', - local_amt: 0, - push_amt: 0, - - step: 1 -} - -// Constants -// ------------------------------------ -export const OPEN_CHANNEL_FORM = 'OPEN_CHANNEL_FORM' -export const CLOSE_CHANNEL_FORM = 'CLOSE_CHANNEL_FORM' - -export const SET_NODE_KEY = 'SET_NODE_KEY' -export const SET_LOCAL_AMOUNT = 'SET_LOCAL_AMOUNT' -export const SET_PUSH_AMOUNT = 'SET_PUSH_AMOUNT' - -export const CHANGE_STEP = 'CHANGE_STEP' - -export const RESET_CHANNEL_FORM = 'RESET_CHANNEL_FORM' - -// ------------------------------------ -// Actions -// ------------------------------------ -export function openChannelForm() { - return { - type: OPEN_CHANNEL_FORM - } -} - -export function closeChannelForm() { - return { - type: CLOSE_CHANNEL_FORM - } -} - -export function setNodeKey(node_key) { - return { - type: SET_NODE_KEY, - node_key - } -} - -export function setLocalAmount(local_amt) { - return { - type: SET_LOCAL_AMOUNT, - local_amt - } -} - -export function setPushAmount(push_amt) { - return { - type: SET_PUSH_AMOUNT, - push_amt - } -} - -export function changeStep(step) { - return { - type: CHANGE_STEP, - step - } -} - -export function resetChannelForm() { - return { - type: RESET_CHANNEL_FORM - } -} - -// ------------------------------------ -// Action Handlers -// ------------------------------------ -const ACTION_HANDLERS = { - [OPEN_CHANNEL_FORM]: state => ({ ...state, isOpen: true }), - [CLOSE_CHANNEL_FORM]: state => ({ ...state, isOpen: false }), - - [SET_NODE_KEY]: (state, { node_key }) => ({ ...state, node_key }), - [SET_LOCAL_AMOUNT]: (state, { local_amt }) => ({ ...state, local_amt }), - [SET_PUSH_AMOUNT]: (state, { push_amt }) => ({ ...state, push_amt }), - - [CHANGE_STEP]: (state, { step }) => ({ ...state, step }), - - [RESET_CHANNEL_FORM]: () => (initialState) -} - -const channelFormSelectors = {} -const channelFormStepSelector = state => state.channelform.step -const channelFormLocalAmountSelector = state => state.channelform.local_amt - -channelFormSelectors.channelFormHeader = createSelector( - channelFormStepSelector, - (step) => { - switch (step) { - case 1: - return 'Step 1: Select a peer' - case 2: - return 'Step 2: Set your local amount' - case 3: - return 'Step 3: Set your push amount' - default: - return 'Step 4: Create your channel' - } - } -) - -channelFormSelectors.channelFormProgress = createSelector( - channelFormStepSelector, - step => ((step - 1) / 3) * 100 -) - -channelFormSelectors.stepTwoIsValid = createSelector( - channelFormLocalAmountSelector, - local_amt => local_amt > 0 -) - -export { channelFormSelectors } - -// ------------------------------------ -// Reducer -// ------------------------------------ -export default function channelFormReducer(state = initialState, action) { - const handler = ACTION_HANDLERS[action.type] - - return handler ? handler(state, action) : state -} diff --git a/app/reducers/channels.js b/app/reducers/channels.js index 6c255519..fc96de0f 100644 --- a/app/reducers/channels.js +++ b/app/reducers/channels.js @@ -3,7 +3,6 @@ import { ipcRenderer } from 'electron' import filter from 'lodash/filter' import { btc } from 'utils' import { showNotification } from 'notifications' -import { closeChannelForm, resetChannelForm } from './channelform' import { setError } from './error' // ------------------------------------ // Constants diff --git a/app/reducers/index.js b/app/reducers/index.js index ea131b2e..0bb57dc8 100644 --- a/app/reducers/index.js +++ b/app/reducers/index.js @@ -8,7 +8,6 @@ import balance from './balance' import payment from './payment' import peers from './peers' import channels from './channels' -import channelform from './channelform' import contactsform from './contactsform' @@ -34,7 +33,6 @@ const rootReducer = combineReducers({ payment, peers, channels, - channelform, contactsform, form, diff --git a/test/reducers/channels.spec.js b/test/reducers/channels.spec.js index 757c63c1..26120e99 100644 --- a/test/reducers/channels.spec.js +++ b/test/reducers/channels.spec.js @@ -46,10 +46,6 @@ describe('reducers', () => { expect(channelsReducer(undefined, { type: SET_CHANNEL, channel: 'channel' })).toMatchSnapshot() }) - it('should correctly setChannelForm', () => { - expect(channelsReducer(undefined, { type: SET_CHANNEL_FORM, form: { isOpen: true } })).toMatchSnapshot() - }) - it('should correctly getChannels', () => { expect(channelsReducer(undefined, { type: GET_CHANNELS })).toMatchSnapshot() })