From 8c592ecdcc27687fcc39f5739eb7b8d6eac4c2cc Mon Sep 17 00:00:00 2001 From: alexstotsky Date: Mon, 17 Oct 2022 11:43:32 +0300 Subject: [PATCH 01/14] Improve status fail description --- public/locales/en/translations.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/locales/en/translations.json b/public/locales/en/translations.json index 3b3542259..23fa10e4b 100644 --- a/public/locales/en/translations.json +++ b/public/locales/en/translations.json @@ -443,7 +443,7 @@ "status": { "success": "{{topic}} Success at {{time}}", "warn": "{{topic}}", - "fail": "{{topic}} fail {{detail}}", + "fail": "{{topic}} fail: {{detail}}", "noid": "dev: the status action should contain the id param", "request": { "error": "{{topic}} request fail {{detail}}" From 3951dde09b4a245d4667afd778d3ee1a9e675191 Mon Sep 17 00:00:00 2001 From: alexstotsky Date: Mon, 17 Oct 2022 11:49:51 +0300 Subject: [PATCH 02/14] Add merchant status constant --- src/state/invoices/constants.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/state/invoices/constants.js b/src/state/invoices/constants.js index e19662b14..ad17f5618 100644 --- a/src/state/invoices/constants.js +++ b/src/state/invoices/constants.js @@ -7,4 +7,5 @@ export default { REMOVE_SYMBOL: 'BITFINEX/INVOICES/SYMBOL/REMOVE', CLEAR_SYMBOLS: 'BITFINEX/INVOICES/SYMBOL/CLEAR', UPDATE_INVOICES: 'BITFINEX/INVOICES/UPDATE', + SET_MERCHANT: 'BITFINEX/INVOICES/MERCHANT/SET', } From 5e8ae45292809a6819d2843068646f74dfeca7b7 Mon Sep 17 00:00:00 2001 From: alexstotsky Date: Mon, 17 Oct 2022 12:54:20 +0300 Subject: [PATCH 03/14] Update invoices initial state and reducers handling cases --- src/state/invoices/reducer.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/state/invoices/reducer.js b/src/state/invoices/reducer.js index 83d87e2cb..bac436ff2 100644 --- a/src/state/invoices/reducer.js +++ b/src/state/invoices/reducer.js @@ -11,6 +11,7 @@ import { updateInvoices } from './utils' const initialState = { ...baseSymbolState, + isMerchant: true, } export function invoicesReducer(state = initialState, action) { @@ -60,6 +61,11 @@ export function invoicesReducer(state = initialState, action) { existingCoins: state.existingCoins, targetCategory: state.targetCategory, } + case types.SET_MERCHANT: + return { + ...state, + isMerchant: payload, + } case timeRangeTypes.SET_TIME_RANGE: return { ...initialState, From b2c0a1b05f4a6e8acb0cb76e4dd7df9b60955fd4 Mon Sep 17 00:00:00 2001 From: alexstotsky Date: Mon, 17 Oct 2022 12:56:09 +0300 Subject: [PATCH 04/14] [wip]Implement NoMerchant section --- src/ui/NoMerchant/NoMerchant.js | 27 +++++++++++++++++++++ src/ui/NoMerchant/_NoMerchant.scss | 38 ++++++++++++++++++++++++++++++ src/ui/NoMerchant/index.js | 1 + 3 files changed, 66 insertions(+) create mode 100644 src/ui/NoMerchant/NoMerchant.js create mode 100644 src/ui/NoMerchant/_NoMerchant.scss create mode 100644 src/ui/NoMerchant/index.js diff --git a/src/ui/NoMerchant/NoMerchant.js b/src/ui/NoMerchant/NoMerchant.js new file mode 100644 index 000000000..10c1ef27a --- /dev/null +++ b/src/ui/NoMerchant/NoMerchant.js @@ -0,0 +1,27 @@ +import React from 'react' +import PropTypes from 'prop-types' +import { withTranslation } from 'react-i18next' + +import Icon from 'icons' + +const NoMerchant = ({ t }) => ( +
+
+ +
+ This section is only available for + {' '} + + merchant accounts + + . +
+
+
+) + +NoMerchant.propTypes = { + t: PropTypes.func.isRequired, +} + +export default withTranslation('translations')(NoMerchant) diff --git a/src/ui/NoMerchant/_NoMerchant.scss b/src/ui/NoMerchant/_NoMerchant.scss new file mode 100644 index 000000000..297101d0f --- /dev/null +++ b/src/ui/NoMerchant/_NoMerchant.scss @@ -0,0 +1,38 @@ +.no-data { + position: relative; + + &-wrapper { + width: fit-content; + height: fit-content; + margin: 180px auto 0 auto; + text-align: center; + + svg { + display: block; + margin: 0 auto 38px auto; + } + } + + .no-data-update { + display: flex; + margin: 30px auto 0 auto; + width: unset; + min-width: 100px; + } +} + +@media screen and (min-width: 2560px) { + .no-data { + &-wrapper { + margin: 262px auto 0 auto; + } + } +} + +@media screen and (max-width: 390px) { + .no-data { + &-wrapper { + margin: 40px auto 0 auto; + } + } +} diff --git a/src/ui/NoMerchant/index.js b/src/ui/NoMerchant/index.js new file mode 100644 index 000000000..98236bd51 --- /dev/null +++ b/src/ui/NoMerchant/index.js @@ -0,0 +1 @@ +export { default } from './NoMerchant' From 2c68371c91f03069a20b2d8d7da44b7e15f1ecf4 Mon Sep 17 00:00:00 2001 From: alexstotsky Date: Mon, 17 Oct 2022 12:57:40 +0300 Subject: [PATCH 05/14] Add merchant status actions --- src/state/invoices/actions.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/state/invoices/actions.js b/src/state/invoices/actions.js index 8aaf3d98a..5d8181fce 100644 --- a/src/state/invoices/actions.js +++ b/src/state/invoices/actions.js @@ -86,6 +86,13 @@ export function clearTargetSymbols() { } } +export function setMerchantStatus(status) { + return { + type: types.SET_MERCHANT, + payload: status, + } +} + export default { addTargetSymbol, clearTargetSymbols, @@ -93,6 +100,7 @@ export default { fetchInvoices, refresh, removeTargetSymbol, + setMerchantStatus, setTargetSymbols, updateInvoices, } From 225a2c930f32b0a9c83675a10479556d91b1898e Mon Sep 17 00:00:00 2001 From: alexstotsky Date: Mon, 17 Oct 2022 13:07:00 +0300 Subject: [PATCH 06/14] Improve title and link --- src/ui/NoMerchant/NoMerchant.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/ui/NoMerchant/NoMerchant.js b/src/ui/NoMerchant/NoMerchant.js index 10c1ef27a..4160c44c6 100644 --- a/src/ui/NoMerchant/NoMerchant.js +++ b/src/ui/NoMerchant/NoMerchant.js @@ -8,14 +8,17 @@ const NoMerchant = ({ t }) => ( ) From 690ba880a3c650f1abef3e9fde89f49f7c736efa Mon Sep 17 00:00:00 2001 From: alexstotsky Date: Tue, 18 Oct 2022 15:03:25 +0300 Subject: [PATCH 07/14] Update locales --- public/locales/en/translations.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/public/locales/en/translations.json b/public/locales/en/translations.json index 23fa10e4b..c586d9da7 100644 --- a/public/locales/en/translations.json +++ b/public/locales/en/translations.json @@ -308,6 +308,10 @@ "title": "Movements" }, "nodata": "No related data in this time range. You can try another time range.", + "no_merchant": { + "title": "This section is only available for ", + "link": "merchant accounts" + }, "orders": { "title": "Orders" }, From 004a0bddb0a7fdac3efd6f384ed530054996f1cd Mon Sep 17 00:00:00 2001 From: alexstotsky Date: Tue, 18 Oct 2022 15:03:57 +0300 Subject: [PATCH 08/14] Fix missed styles import --- src/ui/_index.scss | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ui/_index.scss b/src/ui/_index.scss index d09b71213..c2f2802c9 100644 --- a/src/ui/_index.scss +++ b/src/ui/_index.scss @@ -14,6 +14,7 @@ @import "./NavMenu/_NavMenu.scss"; @import "./NavSwitcher/_NavSwitcher.scss"; @import "./NoData/_NoData.scss"; +@import "./NoMerchant/_NoMerchant.scss"; @import "./Pagination/_Pagination.scss"; @import "./PlatformLogo/_PlatformLogo.scss"; @import "./QueryButton/_QueryButton.scss"; From 795d70ca8609e325cd413ac4426a28a07266b3b3 Mon Sep 17 00:00:00 2001 From: alexstotsky Date: Wed, 19 Oct 2022 11:21:42 +0300 Subject: [PATCH 09/14] Fix class names --- src/ui/NoMerchant/NoMerchant.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ui/NoMerchant/NoMerchant.js b/src/ui/NoMerchant/NoMerchant.js index 4160c44c6..1ab34efdd 100644 --- a/src/ui/NoMerchant/NoMerchant.js +++ b/src/ui/NoMerchant/NoMerchant.js @@ -5,8 +5,8 @@ import { withTranslation } from 'react-i18next' import Icon from 'icons' const NoMerchant = ({ t }) => ( -
-
+
+
<> {t('no_merchant.title')} From bef829f54b55633b86da35381aef593b6a85d4b0 Mon Sep 17 00:00:00 2001 From: alexstotsky Date: Wed, 19 Oct 2022 11:23:03 +0300 Subject: [PATCH 10/14] Implement invoices additional err handling for non merchnt cases --- src/state/invoices/saga.js | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/state/invoices/saga.js b/src/state/invoices/saga.js index f92469b8f..4dad7ad69 100644 --- a/src/state/invoices/saga.js +++ b/src/state/invoices/saga.js @@ -58,11 +58,21 @@ function* fetchInvoices() { yield put(updatePagination(TYPE, result)) if (error) { - yield put(actions.fetchFail({ - id: 'status.fail', - topic: 'invoices.title', - detail: JSON.stringify(error), - })) + const { code, message } = error + if (code === 409) { + yield put(actions.setMerchantStatus(false)) + yield put(actions.fetchFail({ + id: 'status.fail', + topic: 'invoices.title', + detail: message, + })) + } else { + yield put(actions.fetchFail({ + id: 'status.fail', + topic: 'invoices.title', + detail: JSON.stringify(error), + })) + } } } catch (fail) { yield put(actions.fetchFail({ From 393d5390b8d7cb84e8c8f92b1721f77045701c35 Mon Sep 17 00:00:00 2001 From: alexstotsky Date: Tue, 25 Oct 2022 12:18:59 +0300 Subject: [PATCH 11/14] Add isMerchant selector --- src/state/invoices/selectors.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/state/invoices/selectors.js b/src/state/invoices/selectors.js index 64427dd84..5c4e470ab 100644 --- a/src/state/invoices/selectors.js +++ b/src/state/invoices/selectors.js @@ -5,12 +5,14 @@ export const getTargetSymbols = state => getInvoices(state).targetSymbols export const getDataReceived = state => getInvoices(state).dataReceived export const getEntries = state => getInvoices(state).entries export const getPageLoading = state => getInvoices(state).pageLoading +export const getIsMerchant = state => getInvoices(state).isMerchant export default { getDataReceived, getEntries, getExistingCoins, getInvoices, + getIsMerchant, getPageLoading, getTargetSymbols, } From 628471ab4d1eb602a6cb04d0d83b05cbc8139208 Mon Sep 17 00:00:00 2001 From: alexstotsky Date: Tue, 25 Oct 2022 12:19:35 +0300 Subject: [PATCH 12/14] Improve no merchant section styling --- src/ui/NoMerchant/_NoMerchant.scss | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/ui/NoMerchant/_NoMerchant.scss b/src/ui/NoMerchant/_NoMerchant.scss index 297101d0f..b80c2b43c 100644 --- a/src/ui/NoMerchant/_NoMerchant.scss +++ b/src/ui/NoMerchant/_NoMerchant.scss @@ -1,4 +1,4 @@ -.no-data { +.no_merchant { position: relative; &-wrapper { @@ -12,17 +12,10 @@ margin: 0 auto 38px auto; } } - - .no-data-update { - display: flex; - margin: 30px auto 0 auto; - width: unset; - min-width: 100px; - } } @media screen and (min-width: 2560px) { - .no-data { + .no_merchant { &-wrapper { margin: 262px auto 0 auto; } @@ -30,7 +23,7 @@ } @media screen and (max-width: 390px) { - .no-data { + .no_merchant { &-wrapper { margin: 40px auto 0 auto; } From 35d1189fd4a5a087775e274b2d7732d501480956 Mon Sep 17 00:00:00 2001 From: alexstotsky Date: Wed, 26 Oct 2022 11:41:21 +0300 Subject: [PATCH 13/14] Update mapped props --- src/components/Invoices/Invoices.container.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/components/Invoices/Invoices.container.js b/src/components/Invoices/Invoices.container.js index 77b1d1ea5..17f38596b 100644 --- a/src/components/Invoices/Invoices.container.js +++ b/src/components/Invoices/Invoices.container.js @@ -14,6 +14,7 @@ import { import { getFullTime, getTimeOffset } from 'state/base/selectors' import { getEntries, + getIsMerchant, getPageLoading, getDataReceived, getExistingCoins, @@ -29,6 +30,7 @@ import Invoices from './Invoices' const mapStateToProps = state => ({ getFullTime: getFullTime(state), timeOffset: getTimeOffset(state), + isMerchant: getIsMerchant(state), pageLoading: getPageLoading(state), dataReceived: getDataReceived(state), existingCoins: getExistingCoins(state), From a2dffe40dca7a480afa5ff0263ea87787910d52a Mon Sep 17 00:00:00 2001 From: alexstotsky Date: Mon, 31 Oct 2022 11:41:34 +0200 Subject: [PATCH 14/14] Implement invoices non-merchant case handling, update prop-types --- src/components/Invoices/Invoices.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/components/Invoices/Invoices.js b/src/components/Invoices/Invoices.js index 5f353cdca..70f0e814c 100644 --- a/src/components/Invoices/Invoices.js +++ b/src/components/Invoices/Invoices.js @@ -13,6 +13,7 @@ import NoData from 'ui/NoData' import Loading from 'ui/Loading' import DataTable from 'ui/DataTable' import TimeRange from 'ui/TimeRange' +import NoMerchant from 'ui/NoMerchant' import Pagination from 'ui/Pagination' import ColumnsFilter from 'ui/ColumnsFilter' import RefreshButton from 'ui/RefreshButton' @@ -52,6 +53,7 @@ class Invoices extends PureComponent { id: PropTypes.string.isRequired, width: PropTypes.number.isRequired, })), + dataReceived: PropTypes.bool.isRequired, entries: PropTypes.arrayOf(PropTypes.shape({ id: PropTypes.string.isRequired, amount: PropTypes.number.isRequired, @@ -68,7 +70,7 @@ class Invoices extends PureComponent { })).isRequired, existingCoins: PropTypes.arrayOf(PropTypes.string), getFullTime: PropTypes.func.isRequired, - dataReceived: PropTypes.bool.isRequired, + isMerchant: PropTypes.bool.isRequired, pageLoading: PropTypes.bool.isRequired, refresh: PropTypes.func.isRequired, t: PropTypes.func.isRequired, @@ -102,6 +104,7 @@ class Invoices extends PureComponent { refresh, columns, timeOffset, + isMerchant, getFullTime, pageLoading, columnsWidth, @@ -121,6 +124,8 @@ class Invoices extends PureComponent { let showContent if (!dataReceived && pageLoading) { showContent = + } else if (!isMerchant) { + showContent = } else if (!entries.length) { showContent = } else {