1
1
/**
2
2
* Copyright 2018 Shift Devices AG
3
- * Copyright 2024 Shift Crypto AG
3
+ * Copyright 2024-2025 Shift Crypto AG
4
4
*
5
5
* Licensed under the Apache License, Version 2.0 (the "License");
6
6
* you may not use this file except in compliance with the License.
16
16
*/
17
17
18
18
import React , { ReactNode , useContext , useState } from 'react' ;
19
+ import { useTranslation } from 'react-i18next' ;
19
20
import { AppContext } from '@/contexts/AppContext' ;
20
21
import { registerTest } from '@/api/keystores' ;
21
22
import { Button } from '@/components/forms' ;
22
23
import { PasswordSingleInput } from '@/components/password' ;
23
24
import { Dialog , DialogButtons } from '@/components/dialog/dialog' ;
24
- import { debug , runningInIOS } from '@/utils/env' ;
25
25
26
26
type TProps = {
27
27
children ?: ReactNode ;
@@ -32,38 +32,40 @@ export const SkipForTesting = ({
32
32
children,
33
33
className,
34
34
} : TProps ) => {
35
+ const { t } = useTranslation ( ) ;
35
36
const { isTesting } = useContext ( AppContext ) ;
36
37
const [ dialog , setDialog ] = useState ( false ) ;
37
- const show = ( debug || runningInIOS ( ) ) && isTesting ;
38
38
const [ testPIN , setTestPIN ] = useState ( '' ) ;
39
39
const registerTestingDevice = async ( e : React . SyntheticEvent ) => {
40
40
e . preventDefault ( ) ;
41
41
await registerTest ( testPIN ) ;
42
42
setDialog ( false ) ;
43
43
} ;
44
44
45
- if ( ! show ) {
45
+ if ( ! isTesting ) {
46
46
return null ;
47
47
}
48
- const title = 'Unlock software keystore' ;
49
48
return (
50
49
< >
51
50
< Button
52
51
className = { className }
53
52
onClick = { ( ) => setDialog ( true ) }
54
53
primary
55
54
>
56
- { children ? children : title }
55
+ { children ? children : t ( 'testWallet.prompt. title' ) }
57
56
</ Button >
58
- < Dialog open = { dialog } title = { title } onClose = { ( ) => setDialog ( false ) } >
57
+ < Dialog
58
+ open = { dialog }
59
+ title = { t ( 'testWallet.prompt.title' ) }
60
+ onClose = { ( ) => setDialog ( false ) } >
59
61
< form onSubmit = { registerTestingDevice } >
60
62
< PasswordSingleInput
61
63
autoFocus
62
- label = "Test Password"
63
- onValidPassword = { ( pw ) => pw ? setTestPIN ( pw ) : setTestPIN ( '' ) } />
64
+ label = { t ( 'testWallet.prompt.passwordLabel' ) }
65
+ onValidPassword = { ( pw ) => setTestPIN ( pw ? pw : '' ) } />
64
66
< DialogButtons >
65
67
< Button primary type = "submit" >
66
- Unlock
68
+ { t ( 'testWallet.prompt.button' ) }
67
69
</ Button >
68
70
</ DialogButtons >
69
71
</ form >
0 commit comments