From 3ec72b187d78def597399ccb49573bfeae855a9a Mon Sep 17 00:00:00 2001 From: Nischal Shetty Date: Sat, 7 Sep 2024 18:48:25 +0530 Subject: [PATCH] feat(rescan): ability to rescan timechain (#838) --- src/components/RescanChain.tsx | 19 +++++++++---------- src/components/Settings.tsx | 14 ++++---------- src/i18n/locales/en/translation.json | 11 +++++++++++ 3 files changed, 24 insertions(+), 20 deletions(-) diff --git a/src/components/RescanChain.tsx b/src/components/RescanChain.tsx index 6cdb10ef..a1aa6203 100644 --- a/src/components/RescanChain.tsx +++ b/src/components/RescanChain.tsx @@ -46,7 +46,7 @@ const RescanChainForm = ({ disabled, submitButtonText, onSubmit }: RescanChainFo validate={(values) => { const errors = {} as FormikErrors if (typeof values.blockheight !== 'number' || values.blockheight < 0) { - errors.blockheight = t('Please provide a valid blockheight value greater than or equal to {{ min }}.', { + errors.blockheight = t('rescan_chain.feedback_invalid_blockheight', { min: 0, }) } @@ -57,16 +57,16 @@ const RescanChainForm = ({ disabled, submitButtonText, onSubmit }: RescanChainFo {({ handleSubmit, handleBlur, handleChange, values, touched, errors, isSubmitting }) => ( - {t('Blockheight')} + {t('rescan_chain.label_blockheight')} - {t('The height of the chain at which the rescan process is started.')} + {t('rescan_chain.description_blockheight')} - + {alert && {alert.message}}
{serviceInfo?.rescanning === true && {t('app.alert_rescan_in_progress')}} t(isSubmitting ? 'Rescan timechain' : 'Rescan timechain')} + submitButtonText={(isSubmitting) => + t(isSubmitting ? 'rescan_chain.text_button_submitting' : 'rescan_chain.text_button_submit') + } onSubmit={async (values) => { const abortCtrl = new AbortController() diff --git a/src/components/Settings.tsx b/src/components/Settings.tsx index aeed2f20..06539730 100644 --- a/src/components/Settings.tsx +++ b/src/components/Settings.tsx @@ -16,7 +16,7 @@ import languages from '../i18n/languages' import styles from './Settings.module.css' import SeedModal from './settings/SeedModal' import FeeConfigModal from './settings/FeeConfigModal' -import { isDebugFeatureEnabled, isDevMode } from '../constants/debugFeatures' +import { isDevMode } from '../constants/debugFeatures' import { isFeatureEnabled } from '../constants/features' import { CurrentWallet } from '../context/WalletContext' @@ -213,16 +213,10 @@ export default function Settings({ wallet, stopWallet }: SettingsProps) { {t('settings.button_switch_wallet')} - {serviceInfo && isFeatureEnabled('rescanChain', serviceInfo) && isDebugFeatureEnabled('rescanChainPage') && ( - + {serviceInfo && isFeatureEnabled('rescanChain', serviceInfo) && ( + - Rescan chain - - dev - + {t('settings.rescan_chain')} )} diff --git a/src/i18n/locales/en/translation.json b/src/i18n/locales/en/translation.json index db1efc05..701aa507 100644 --- a/src/i18n/locales/en/translation.json +++ b/src/i18n/locales/en/translation.json @@ -236,6 +236,7 @@ "confirm_locking_modal_title": "Lock Wallet", "confirm_locking_modal_body_earn": "Earn is active. Locking the wallet will stop the service. You can close the browser window to let it run in the background.", "confirm_locking_modal_body_jam": "A collaborative transaction is being executed. Locking the wallet will stop the service. You can close the browser window to let it run in the background.", + "rescan_chain": "Rescan chain", "fees": { "title": "Fee Limits", "description": "Adjust mining fees and collaborator fees according to your needs. These settings will be reset to default values when the JoinMarket service restarts, e.g. on a system reboot. For more information, <1>see the documentation on fees.", @@ -270,6 +271,16 @@ "error_saving_fee_config_failed": "Error while saving fee config values. Reason: {{ reason }}" } }, + "rescan_chain": { + "title": "Rescan timechain (Experimental)", + "subtitle": "Rescan the local timechain for wallet related transactions.", + "label_blockheight": "Rescan height", + "description_blockheight": "The height of the chain at which the rescan process is started.", + "error_rescanning_failed": "Error while starting the rescan process. Reason: {{ reason }}", + "feedback_invalid_blockheight": "Please provide a valid value between {{ min }} and the current blockheight.", + "text_button_submit": "Rescan timechain", + "text_button_submitting": "Rescanning timechain..." + }, "logs": { "title": "Logs", "error_loading_logs_failed": "Could not retrieve log file."