From 180cdd0c34c0eb234a6ea880aa18b87c03d6e72a Mon Sep 17 00:00:00 2001 From: alexstotsky Date: Wed, 4 Dec 2024 13:38:34 +0200 Subject: [PATCH 01/11] Implement custom label support for refresh btn --- src/ui/RefreshButton/RefreshButton.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ui/RefreshButton/RefreshButton.js b/src/ui/RefreshButton/RefreshButton.js index 8840e31ef..9d1057f9b 100644 --- a/src/ui/RefreshButton/RefreshButton.js +++ b/src/ui/RefreshButton/RefreshButton.js @@ -5,7 +5,7 @@ import { Button, Intent } from '@blueprintjs/core' import { tracker } from 'utils/trackers' -const RefreshButton = ({ onClick, disabled }) => { +const RefreshButton = ({ onClick, disabled, label }) => { const { t } = useTranslation() const handleClick = () => { @@ -20,18 +20,20 @@ const RefreshButton = ({ onClick, disabled }) => { intent={Intent.SUCCESS} className='refresh-button' > - {t('columnsfilter.title')} + {label || t('columnsfilter.title')} ) } RefreshButton.propTypes = { + label: PropTypes.string, disabled: PropTypes.bool, onClick: PropTypes.func.isRequired, } RefreshButton.defaultProps = { disabled: false, + label: undefined, } export default memo(RefreshButton) From f8fe32012c85460957fa30befe70e4a88cae4d60 Mon Sep 17 00:00:00 2001 From: alexstotsky Date: Wed, 4 Dec 2024 14:15:25 +0200 Subject: [PATCH 02/11] Update tax report keys/descriptions --- public/locales/en/translations.json | 1 + 1 file changed, 1 insertion(+) diff --git a/public/locales/en/translations.json b/public/locales/en/translations.json index b0d6c466d..46ae5e570 100644 --- a/public/locales/en/translations.json +++ b/public/locales/en/translations.json @@ -773,6 +773,7 @@ "message": "The tax reports generated by this app are for informational purposes only. We do not guarantee accuracy or completeness. Always consult a qualified tax advisor to ensure compliance with current tax laws and personalized advice. Your reliance on the generated reports is at your own risk." }, "generation": { + "btn": "Generate", "success": "Tax Report generated", "title": "Your tax report is being generated. This process can take a while.", "note": "If you have a large history it's recommended to keep the window open in the background until it's completed." From f6cc06e575eaa4c5f582b7348bdf678306b992d8 Mon Sep 17 00:00:00 2001 From: alexstotsky Date: Wed, 4 Dec 2024 14:16:43 +0200 Subject: [PATCH 03/11] Actualize tax refresh btn label --- src/components/TaxReport/TaxReport.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/TaxReport/TaxReport.js b/src/components/TaxReport/TaxReport.js index 4387e56eb..e0b80cc0e 100644 --- a/src/components/TaxReport/TaxReport.js +++ b/src/components/TaxReport/TaxReport.js @@ -22,9 +22,9 @@ import { getTransactionsDataReceived, getTransactionsShowDisclaimer, } from 'state/taxReport/selectors' -import { getIsSyncRequired } from 'state/sync/selectors' import { getColumnsWidth } from 'state/columns/selectors' import { getFullTime as getFullTimeSelector } from 'state/base/selectors' +import { getIsSyncRequired, getIsFirstSyncing } from 'state/sync/selectors' import queryConstants from 'state/query/constants' @@ -46,6 +46,7 @@ const TaxReport = () => { const columnsWidth = useSelector((state) => getColumnsWidth(state, TYPE)) const isNoData = isEmpty(entries) const isLoading = !dataReceived && pageLoading + // const isFirstSyncing = useSelector(getIsFirstSyncing) const shouldFetchTaxReport = !isSyncRequired && !dataReceived && !isLoading useEffect(() => { @@ -121,6 +122,7 @@ const TaxReport = () => { From d691c3c1d13c01970fdd99c6afb35899e79da648 Mon Sep 17 00:00:00 2001 From: alexstotsky Date: Wed, 4 Dec 2024 14:17:47 +0200 Subject: [PATCH 04/11] Disable gen btn during initial sync --- src/components/TaxReport/TaxReport.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/TaxReport/TaxReport.js b/src/components/TaxReport/TaxReport.js index e0b80cc0e..ebf603bc4 100644 --- a/src/components/TaxReport/TaxReport.js +++ b/src/components/TaxReport/TaxReport.js @@ -46,7 +46,7 @@ const TaxReport = () => { const columnsWidth = useSelector((state) => getColumnsWidth(state, TYPE)) const isNoData = isEmpty(entries) const isLoading = !dataReceived && pageLoading - // const isFirstSyncing = useSelector(getIsFirstSyncing) + const isFirstSyncing = useSelector(getIsFirstSyncing) const shouldFetchTaxReport = !isSyncRequired && !dataReceived && !isLoading useEffect(() => { @@ -121,8 +121,8 @@ const TaxReport = () => { From c0405ea526b48ff80daa5d9fae3cc261a5ab2060 Mon Sep 17 00:00:00 2001 From: alexstotsky Date: Wed, 4 Dec 2024 14:22:25 +0200 Subject: [PATCH 05/11] [wip] Tax sync note --- src/components/TaxReport/TaxReport.note.js | 46 ++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 src/components/TaxReport/TaxReport.note.js diff --git a/src/components/TaxReport/TaxReport.note.js b/src/components/TaxReport/TaxReport.note.js new file mode 100644 index 000000000..2097887ff --- /dev/null +++ b/src/components/TaxReport/TaxReport.note.js @@ -0,0 +1,46 @@ +import React, { useCallback } from 'react' +import { useSelector, useDispatch } from 'react-redux' +import { useTranslation } from 'react-i18next' +import { Button, Spinner } from '@blueprintjs/core' +import { isNil } from '@bitfinex/lib-js-util-base' + +import { cancelTaxReportGeneration } from 'state/taxReport/actions' +import { getTransactionsGenerationProgress } from 'state/taxReport/selectors' + +export const SyncNote = () => { + const { t } = useTranslation() + const dispatch = useDispatch() + const progress = useSelector(getTransactionsGenerationProgress) + const spinnerContent = isNil(progress) ? '' : `${progress}%` + + const onCancel = useCallback( + () => dispatch(cancelTaxReportGeneration()), + [dispatch], + ) + + return ( +
+
+
+ {spinnerContent} +
+ +
+
+

{t('taxreport.generation.title')}

+

{t('taxreport.generation.note')}

+
+ +
+ ) +} + +export default SyncNote From 2d3fc0d1b0c4f79865d94d4649c973d912c5a458 Mon Sep 17 00:00:00 2001 From: alexstotsky Date: Wed, 4 Dec 2024 14:47:18 +0200 Subject: [PATCH 06/11] Add sync note description --- public/locales/en/translations.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/public/locales/en/translations.json b/public/locales/en/translations.json index 46ae5e570..598352229 100644 --- a/public/locales/en/translations.json +++ b/public/locales/en/translations.json @@ -776,7 +776,8 @@ "btn": "Generate", "success": "Tax Report generated", "title": "Your tax report is being generated. This process can take a while.", - "note": "If you have a large history it's recommended to keep the window open in the background until it's completed." + "note": "If you have a large history it's recommended to keep the window open in the background until it's completed.", + "sync": "Sync in progress. Please wait until it’s complete to generate your tax report." } }, "theme": { From 1ba3b151a438a6b2230ed1bde9e95ab2e6eac2d8 Mon Sep 17 00:00:00 2001 From: alexstotsky Date: Wed, 4 Dec 2024 14:54:39 +0200 Subject: [PATCH 07/11] Update locales --- public/locales/en/translations.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/public/locales/en/translations.json b/public/locales/en/translations.json index 598352229..0a47178bb 100644 --- a/public/locales/en/translations.json +++ b/public/locales/en/translations.json @@ -777,7 +777,8 @@ "success": "Tax Report generated", "title": "Your tax report is being generated. This process can take a while.", "note": "If you have a large history it's recommended to keep the window open in the background until it's completed.", - "sync": "Sync in progress. Please wait until it’s complete to generate your tax report." + "sync_1": "Sync in progress." , + "sync_2": "Please wait until it’s complete to generate your tax report." } }, "theme": { From f5145e368d25bcd20348c6d189fe61fedff32013 Mon Sep 17 00:00:00 2001 From: alexstotsky Date: Wed, 4 Dec 2024 14:55:07 +0200 Subject: [PATCH 08/11] Improve sync note structure, cleanup --- src/components/TaxReport/TaxReport.note.js | 39 +++------------------- 1 file changed, 5 insertions(+), 34 deletions(-) diff --git a/src/components/TaxReport/TaxReport.note.js b/src/components/TaxReport/TaxReport.note.js index 2097887ff..6e0f13571 100644 --- a/src/components/TaxReport/TaxReport.note.js +++ b/src/components/TaxReport/TaxReport.note.js @@ -1,44 +1,15 @@ -import React, { useCallback } from 'react' -import { useSelector, useDispatch } from 'react-redux' +import React from 'react' import { useTranslation } from 'react-i18next' -import { Button, Spinner } from '@blueprintjs/core' -import { isNil } from '@bitfinex/lib-js-util-base' - -import { cancelTaxReportGeneration } from 'state/taxReport/actions' -import { getTransactionsGenerationProgress } from 'state/taxReport/selectors' export const SyncNote = () => { const { t } = useTranslation() - const dispatch = useDispatch() - const progress = useSelector(getTransactionsGenerationProgress) - const spinnerContent = isNil(progress) ? '' : `${progress}%` - - const onCancel = useCallback( - () => dispatch(cancelTaxReportGeneration()), - [dispatch], - ) return ( -
-
-
- {spinnerContent} -
- -
-
-

{t('taxreport.generation.title')}

-

{t('taxreport.generation.note')}

+
+
+

{t('taxreport.generation.sync_1')}

+

{t('taxreport.generation.sync_2')}

-
) } From d3c7ea1eb49a50895d523359f6ab5a9bd9d29f6e Mon Sep 17 00:00:00 2001 From: alexstotsky Date: Wed, 4 Dec 2024 14:55:22 +0200 Subject: [PATCH 09/11] Add sync note styling --- src/components/TaxReport/_TaxReport.scss | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/components/TaxReport/_TaxReport.scss b/src/components/TaxReport/_TaxReport.scss index 9234403cd..4b30cd216 100644 --- a/src/components/TaxReport/_TaxReport.scss +++ b/src/components/TaxReport/_TaxReport.scss @@ -78,3 +78,16 @@ position: absolute; } } + +.sync-note { + min-width: 340px; + text-align: center; + + &-container { + height: 50%; + display: flex; + align-items: center; + flex-direction: column; + justify-content: center; + } +} From 4e28d8bf4c539ee07a2d62214f599c1d504b2e1e Mon Sep 17 00:00:00 2001 From: alexstotsky Date: Wed, 4 Dec 2024 14:56:49 +0200 Subject: [PATCH 10/11] Minor tweak --- src/components/TaxReport/_TaxReport.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/TaxReport/_TaxReport.scss b/src/components/TaxReport/_TaxReport.scss index 4b30cd216..4102842b9 100644 --- a/src/components/TaxReport/_TaxReport.scss +++ b/src/components/TaxReport/_TaxReport.scss @@ -84,7 +84,7 @@ text-align: center; &-container { - height: 50%; + height: 45%; display: flex; align-items: center; flex-direction: column; From e009cea5a20fd0dcc11ae792e2f0ec353158030e Mon Sep 17 00:00:00 2001 From: alexstotsky Date: Wed, 4 Dec 2024 14:59:46 +0200 Subject: [PATCH 11/11] Add sync note to the tax report --- src/components/TaxReport/TaxReport.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/TaxReport/TaxReport.js b/src/components/TaxReport/TaxReport.js index ebf603bc4..61a11391c 100644 --- a/src/components/TaxReport/TaxReport.js +++ b/src/components/TaxReport/TaxReport.js @@ -29,6 +29,7 @@ import { getIsSyncRequired, getIsFirstSyncing } from 'state/sync/selectors' import queryConstants from 'state/query/constants' import Loader from './TaxReport.loader' +import SyncNote from './TaxReport.note' import Disclaimer from './TaxReport.disclaimer' import { getColumns } from './TaxReport.columns' @@ -66,7 +67,9 @@ const TaxReport = () => { ) let showContent - if (isLoading) { + if (isFirstSyncing) { + showContent = + } else if (isLoading) { showContent = } else if (isNoData) { showContent = (