From 8ff7806f1b471a90fa3f45ebc10f0f4452ade541 Mon Sep 17 00:00:00 2001 From: Dan Date: Thu, 26 Apr 2018 14:08:38 -0230 Subject: Core of the refactor complete --- ui/app/ducks/send.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'ui/app/ducks') diff --git a/ui/app/ducks/send.js b/ui/app/ducks/send.js index aeca9f92f..c4874aa8c 100644 --- a/ui/app/ducks/send.js +++ b/ui/app/ducks/send.js @@ -10,10 +10,11 @@ const CLOSE_TO_DROPDOWN = 'metamask/send/CLOSE_TO_DROPDOWN'; const initState = { fromDropdownOpen: false, toDropdownOpen: false, + errors: {}, } // Reducer -export default function reducer(state = initState, action = {}) { +export default function reducer({ send: sendState = initState }, action = {}) { switch (action.type) { case OPEN_FROM_DROPDOWN: return extend(sendState, { -- cgit From 91c201aa72581a59a0d2ef73a225b1768584dea7 Mon Sep 17 00:00:00 2001 From: Dan Date: Thu, 26 Apr 2018 22:08:14 -0230 Subject: Lint fixes and alphabetization for i3725-refactor-send-component --- ui/app/ducks/send.js | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'ui/app/ducks') diff --git a/ui/app/ducks/send.js b/ui/app/ducks/send.js index c4874aa8c..e0feb9f06 100644 --- a/ui/app/ducks/send.js +++ b/ui/app/ducks/send.js @@ -1,10 +1,10 @@ import extend from 'xtend' // Actions -const OPEN_FROM_DROPDOWN = 'metamask/send/OPEN_FROM_DROPDOWN'; -const CLOSE_FROM_DROPDOWN = 'metamask/send/CLOSE_FROM_DROPDOWN'; -const OPEN_TO_DROPDOWN = 'metamask/send/OPEN_TO_DROPDOWN'; -const CLOSE_TO_DROPDOWN = 'metamask/send/CLOSE_TO_DROPDOWN'; +const OPEN_FROM_DROPDOWN = 'metamask/send/OPEN_FROM_DROPDOWN' +const CLOSE_FROM_DROPDOWN = 'metamask/send/CLOSE_FROM_DROPDOWN' +const OPEN_TO_DROPDOWN = 'metamask/send/OPEN_TO_DROPDOWN' +const CLOSE_TO_DROPDOWN = 'metamask/send/CLOSE_TO_DROPDOWN' // TODO: determine if this approach to initState is consistent with conventional ducks pattern const initState = { @@ -14,7 +14,7 @@ const initState = { } // Reducer -export default function reducer({ send: sendState = initState }, action = {}) { +export default function reducer ({ send: sendState = initState }, action = {}) { switch (action.type) { case OPEN_FROM_DROPDOWN: return extend(sendState, { @@ -38,18 +38,18 @@ export default function reducer({ send: sendState = initState }, action = {}) { } // Action Creators -export function openFromDropdown() { - return { type: OPEN_FROM_DROPDOWN }; +export function openFromDropdown () { + return { type: OPEN_FROM_DROPDOWN } } -export function closeFromDropdown() { - return { type: CLOSE_FROM_DROPDOWN }; +export function closeFromDropdown () { + return { type: CLOSE_FROM_DROPDOWN } } -export function openToDropdown() { - return { type: OPEN_TO_DROPDOWN }; +export function openToDropdown () { + return { type: OPEN_TO_DROPDOWN } } -export function closeToDropdown() { - return { type: CLOSE_TO_DROPDOWN }; -} \ No newline at end of file +export function closeToDropdown () { + return { type: CLOSE_TO_DROPDOWN } +} -- cgit From 26f965bcceb26ce7cdec9df9f213b44be8d9acac Mon Sep 17 00:00:00 2001 From: Dan Date: Fri, 27 Apr 2018 16:33:00 -0230 Subject: Further refactors; includes refactor of send-v2.js and associated container --- ui/app/ducks/send.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'ui/app/ducks') diff --git a/ui/app/ducks/send.js b/ui/app/ducks/send.js index e0feb9f06..aef493ea0 100644 --- a/ui/app/ducks/send.js +++ b/ui/app/ducks/send.js @@ -5,6 +5,7 @@ const OPEN_FROM_DROPDOWN = 'metamask/send/OPEN_FROM_DROPDOWN' const CLOSE_FROM_DROPDOWN = 'metamask/send/CLOSE_FROM_DROPDOWN' const OPEN_TO_DROPDOWN = 'metamask/send/OPEN_TO_DROPDOWN' const CLOSE_TO_DROPDOWN = 'metamask/send/CLOSE_TO_DROPDOWN' +const UPDATE_SEND_ERRORS = 'metamask/send/UPDATE_SEND_ERRORS' // TODO: determine if this approach to initState is consistent with conventional ducks pattern const initState = { @@ -32,6 +33,13 @@ export default function reducer ({ send: sendState = initState }, action = {}) { return extend(sendState, { toDropdownOpen: false, }) + case UPDATE_SEND_ERRORS: + return extend(sendState, { + errors: { + ...sendState.errors, + ...action.value, + }, + }) default: return sendState } @@ -53,3 +61,10 @@ export function openToDropdown () { export function closeToDropdown () { return { type: CLOSE_TO_DROPDOWN } } + +export function updateSendErrors (errorObject) { + return { + type: UPDATE_SEND_ERRORS, + value: errorObject, + } +} -- cgit