diff --git a/src/components/CreateWallet.test.tsx b/src/components/CreateWallet.test.tsx
index 49c0eafe..89d1a454 100644
--- a/src/components/CreateWallet.test.tsx
+++ b/src/components/CreateWallet.test.tsx
@@ -41,6 +41,22 @@ describe('', () => {
;(apiMock.getSession as jest.Mock).mockResolvedValue(neverResolvingPromise)
})
+ it('should display alert when rescanning is active', async () => {
+ ;(apiMock.getSession as jest.Mock).mockResolvedValueOnce({
+ ok: true,
+ json: () =>
+ Promise.resolve({
+ rescanning: true,
+ }),
+ })
+
+ await act(async () => setup({}))
+
+ expect(screen.getByText('create_wallet.title')).toBeVisible()
+ expect(screen.getByTestId('alert-rescanning')).toBeVisible()
+ expect(screen.queryByText('create_wallet.button_create')).not.toBeInTheDocument()
+ })
+
it('should render without errors', () => {
act(() => setup({}))
diff --git a/src/components/CreateWallet.tsx b/src/components/CreateWallet.tsx
index 5ae21a7e..5cfdb400 100644
--- a/src/components/CreateWallet.tsx
+++ b/src/components/CreateWallet.tsx
@@ -106,6 +106,12 @@ export default function CreateWallet({ parentRoute, startWallet }: CreateWalletP
const [alert, setAlert] = useState()
const [createdWallet, setCreatedWallet] = useState()
+ const isCreated = useMemo(() => !!createdWallet?.walletFileName && !!createdWallet?.auth, [createdWallet])
+ const canCreate = useMemo(
+ () => !createdWallet && !serviceInfo?.walletFileName && !serviceInfo?.rescanning,
+ [isCreated, serviceInfo],
+ )
+
const createWallet = useCallback(
async ({ walletName, password }) => {
setAlert(undefined)
@@ -152,17 +158,33 @@ export default function CreateWallet({ parentRoute, startWallet }: CreateWalletP
)}
{alert && {alert.message}}
- {serviceInfo?.walletFileName && !createdWallet ? (
-
-
- Currently {{ walletName: walletDisplayName(serviceInfo.walletFileName) }} is active. You
- need to lock it first.
-
- Go back
-
- .
-
-
+ {!canCreate && !isCreated ? (
+ <>
+ {serviceInfo?.walletFileName && (
+
+
+ Currently {{ walletName: walletDisplayName(serviceInfo.walletFileName) }} is active.
+ You need to lock it first.
+
+ Go back
+
+ .
+
+
+ )}
+ {serviceInfo?.rescanning === true && (
+
+
+ Rescanning the timechain is currently in progress. Please wait until the process finishes and then try
+ again.
+
+ Go back
+
+ .
+
+
+ )}
+ >
) : (
<>
diff --git a/src/components/ImportWallet.tsx b/src/components/ImportWallet.tsx
index 5ae94bbe..c103abf2 100644
--- a/src/components/ImportWallet.tsx
+++ b/src/components/ImportWallet.tsx
@@ -394,7 +394,7 @@ export default function ImportWallet({ parentRoute, startWallet }: ImportWalletP
const [importDetailsFormValues, setImportDetailsFormValues] = useState()
const [recoveredWallet, setRecoveredWallet] = useState()
- const isRecovered = useMemo(() => !!recoveredWallet?.walletFileName && recoveredWallet?.auth, [recoveredWallet])
+ const isRecovered = useMemo(() => !!recoveredWallet?.walletFileName && !!recoveredWallet?.auth, [recoveredWallet])
const canRecover = useMemo(
() => !isRecovered && !serviceInfo?.walletFileName && !serviceInfo?.rescanning,
[isRecovered, serviceInfo],
@@ -571,7 +571,7 @@ export default function ImportWallet({ parentRoute, startWallet }: ImportWalletP
)}
{serviceInfo?.rescanning === true && (
-
+
Rescanning the timechain is currently in progress. Please wait until the process finishes and then try
again.
diff --git a/src/i18n/locales/en/translation.json b/src/i18n/locales/en/translation.json
index d736f6d9..423c6dcb 100644
--- a/src/i18n/locales/en/translation.json
+++ b/src/i18n/locales/en/translation.json
@@ -125,6 +125,7 @@
"title_wallet_created": "Wallet created successfully!",
"subtitle_wallet_created": "Please write down your seed phrase and password! Without this information you will not be able to access and recover your wallet!",
"alert_other_wallet_unlocked": "Currently <1>{{ walletName }}1> is active. You need to lock it first. <3>Go back3>.",
+ "alert_rescan_in_progress": "Rescanning the timechain is currently in progress. Please wait until the process finishes and then try again. <1>Go back1>.",
"feedback_valid": "Looks good!",
"label_wallet_name": "Wallet name",
"placeholder_wallet_name": "Your Wallet...",