Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added rescan page translations and removed dev mode tag #838

Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 9 additions & 12 deletions src/components/RescanChain.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const RescanChainForm = ({ disabled, submitButtonText, onSubmit }: RescanChainFo
validate={(values) => {
const errors = {} as FormikErrors<RescanChainFormValues>
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.valid_blockheight_error', {
min: 0,
})
}
Expand All @@ -57,16 +57,14 @@ const RescanChainForm = ({ disabled, submitButtonText, onSubmit }: RescanChainFo
{({ handleSubmit, handleBlur, handleChange, values, touched, errors, isSubmitting }) => (
<rb.Form onSubmit={handleSubmit} noValidate lang={i18n.resolvedLanguage || i18n.language}>
<rb.Form.Group controlId="blockheight" className="mb-4">
<rb.Form.Label>{t('Blockheight')}</rb.Form.Label>
<rb.Form.Text className="d-block text-secondary mb-2">
{t('The height of the chain at which the rescan process is started.')}
</rb.Form.Text>
<rb.Form.Label>{t('rescan_chain.blockheight_label')}</rb.Form.Label>
<rb.Form.Text className="d-block text-secondary mb-2">{t('rescan_chain.blockheight_info')}</rb.Form.Text>
<rb.InputGroup hasValidation>
<rb.InputGroup.Text id="blockheight-addon1">
<Sprite symbol="block" width="24" height="24" name="Block" />
</rb.InputGroup.Text>
<rb.Form.Control
aria-label={t('Blockheight')}
aria-label={t('rescan_chain.blockheight_label')}
className="slashed-zeroes"
name="blockheight"
type="number"
Expand Down Expand Up @@ -131,7 +129,7 @@ export default function RescanChain({ wallet }: RescanChainProps) {
} catch (e: any) {
if (signal.aborted) return

const message = t('Error while starting the rescan process. Reason: {{ reason }}', {
const message = t('rescan_chain.error_rescanning_failed', {
reason: e.message || t('global.errors.reason_unknown'),
})
setAlert({ variant: 'danger', message })
Expand All @@ -142,16 +140,15 @@ export default function RescanChain({ wallet }: RescanChainProps) {

return (
<div className="import-wallet">
<PageTitle
title={t('Rescan timechain (Experimental)')}
subtitle={t('Rescan the local timechain for wallet related transactions.')}
/>
<PageTitle title={t('rescan_chain.title')} subtitle={t('rescan_chain.subtitle')} />
{alert && <rb.Alert variant={alert.variant}>{alert.message}</rb.Alert>}
<div className="mb-4">
{serviceInfo?.rescanning === true && <rb.Alert variant="success">{t('app.alert_rescan_in_progress')}</rb.Alert>}
<RescanChainForm
disabled={serviceInfo?.rescanning}
submitButtonText={(isSubmitting) => t(isSubmitting ? 'Rescan timechain' : 'Rescan timechain')}
submitButtonText={(isSubmitting) =>
t(isSubmitting ? 'rescan_chain.submitting_button' : 'rescan_chain.submit_button')
}
onSubmit={async (values) => {
const abortCtrl = new AbortController()

Expand Down
14 changes: 4 additions & 10 deletions src/components/Settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down Expand Up @@ -213,16 +213,10 @@ export default function Settings({ wallet, stopWallet }: SettingsProps) {
{t('settings.button_switch_wallet')}
</Link>

{serviceInfo && isFeatureEnabled('rescanChain', serviceInfo) && isDebugFeatureEnabled('rescanChainPage') && (
<Link
to={routes.rescanChain}
className={`btn btn-outline-dark ${styles['settings-btn']} position-relative`}
>
{serviceInfo && isFeatureEnabled('rescanChain', serviceInfo) && (
<Link to={routes.rescanChain} className={`btn btn-outline-dark ${styles['settings-btn']}`}>
<Sprite symbol="block" width="24" height="24" />
Rescan chain
<span className="position-absolute top-50 start-0 translate-middle badge rounded-pill bg-warning">
dev
</span>
{t('settings.rescan_chain_option')}
</Link>
)}

Expand Down
11 changes: 11 additions & 0 deletions src/i18n/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -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_option": "Rescan chain",
nischal-shetty2 marked this conversation as resolved.
Show resolved Hide resolved
"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</1>.",
Expand Down Expand Up @@ -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.",
"blockheight_label": "Blockheight",
nischal-shetty2 marked this conversation as resolved.
Show resolved Hide resolved
"blockheight_info": "The height of the chain at which the rescan process is started.",
nischal-shetty2 marked this conversation as resolved.
Show resolved Hide resolved
"error_rescanning_failed": "Error while starting the rescan process. Reason: {{ reason }}",
"valid_blockheight_error": "Please provide a valid blockheight value greater than or equal to {{ min }}.",
nischal-shetty2 marked this conversation as resolved.
Show resolved Hide resolved
"submit_button": "Rescan timechain",
nischal-shetty2 marked this conversation as resolved.
Show resolved Hide resolved
"submitting_button": "Rescaning timechain"
nischal-shetty2 marked this conversation as resolved.
Show resolved Hide resolved
},
"logs": {
"title": "Logs",
"error_loading_logs_failed": "Could not retrieve log file."
Expand Down