From c9f5dc91c9d587cd75bfa740abf26b88e8fb0b59 Mon Sep 17 00:00:00 2001 From: Alessandro DiMarco Date: Fri, 3 Feb 2017 14:18:13 -0500 Subject: [PATCH 1/4] Hide download button if utility bill does not exisit --- src/components/UtilityAccount/index.js | 55 +++++++++++++++----------- 1 file changed, 32 insertions(+), 23 deletions(-) diff --git a/src/components/UtilityAccount/index.js b/src/components/UtilityAccount/index.js index 48e067ff..4f1c04ef 100644 --- a/src/components/UtilityAccount/index.js +++ b/src/components/UtilityAccount/index.js @@ -61,29 +61,38 @@ class UtilityAccount extends Component { ) - renderFetchAndDownloadBtn = () => ( -
- - Download - - - -
- ) + renderFetchAndDownloadBtn = () => { + const { downloadURL } = this.state; + let visibility = 'hidden'; + if (downloadURL !== undefined && downloadURL !== '#') { + visibility = 'visible'; + } + + return ( +
+ + Download + + + +
+ ); + } renderNatGrid = () => { if (this.state.form.utility !== 'national_grid_gas') { -- GitLab From fe6bac99036de77e344ce6d1705c95c108d2a8c8 Mon Sep 17 00:00:00 2001 From: Alessandro DiMarco Date: Fri, 3 Feb 2017 14:27:23 -0500 Subject: [PATCH 2/4] Remove hash from download url if empty --- src/components/Utilities/index.js | 2 +- src/components/UtilityAccount/index.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/Utilities/index.js b/src/components/Utilities/index.js index 107dedf2..ff141136 100644 --- a/src/components/Utilities/index.js +++ b/src/components/Utilities/index.js @@ -137,7 +137,7 @@ class Utilities extends Component { }); } - createUtilityComponent = (incForm, downloadURL = '#') => { + createUtilityComponent = (incForm, downloadURL = '') => { let accountProps = {}; const { accountsCounter } = this.state; diff --git a/src/components/UtilityAccount/index.js b/src/components/UtilityAccount/index.js index 4f1c04ef..a9eec87f 100644 --- a/src/components/UtilityAccount/index.js +++ b/src/components/UtilityAccount/index.js @@ -64,7 +64,7 @@ class UtilityAccount extends Component { renderFetchAndDownloadBtn = () => { const { downloadURL } = this.state; let visibility = 'hidden'; - if (downloadURL !== undefined && downloadURL !== '#') { + if (downloadURL !== undefined && downloadURL !== '') { visibility = 'visible'; } -- GitLab From 02ce4a0470d4c49edd9e94baa6aeb55c1a162469 Mon Sep 17 00:00:00 2001 From: Alessandro DiMarco Date: Fri, 3 Feb 2017 14:35:40 -0500 Subject: [PATCH 3/4] Update error message for creating util account --- src/components/Utilities/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Utilities/index.js b/src/components/Utilities/index.js index ff141136..2ba1e21a 100644 --- a/src/components/Utilities/index.js +++ b/src/components/Utilities/index.js @@ -100,7 +100,7 @@ class Utilities extends Component { }), }).then((res) => { if (res.err) { - this.setState({ error: `Failed to create account. | ${res.err.message}` }); + this.setState({ error: `There was a error creating the account. | ${res.err.message}` }); } else { /* NOTE: The reason to remove the last item and re-add it is to update the props of that component. If the user decides to delete the newly -- GitLab From 9c95236c457bfc4bbc3991213a2a997c5402f690 Mon Sep 17 00:00:00 2001 From: Alessandro DiMarco Date: Fri, 3 Feb 2017 14:45:13 -0500 Subject: [PATCH 4/4] Fix grammar for error message --- src/components/Utilities/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Utilities/index.js b/src/components/Utilities/index.js index 2ba1e21a..4969a8e5 100644 --- a/src/components/Utilities/index.js +++ b/src/components/Utilities/index.js @@ -100,7 +100,7 @@ class Utilities extends Component { }), }).then((res) => { if (res.err) { - this.setState({ error: `There was a error creating the account. | ${res.err.message}` }); + this.setState({ error: `There was an error while creating the account. | ${res.err.message}` }); } else { /* NOTE: The reason to remove the last item and re-add it is to update the props of that component. If the user decides to delete the newly -- GitLab