File tree Expand file tree Collapse file tree 3 files changed +17
-2
lines changed Expand file tree Collapse file tree 3 files changed +17
-2
lines changed Original file line number Diff line number Diff line change 141
141
},
142
142
"restoring" : " Restoring backup…" ,
143
143
"selectedBackup" : " <strong>{{backupName}}</strong> created on {{createdDateTime}} will be restored." ,
144
+ "subtitle" : " Please select backup to continue" ,
144
145
"title" : " Restore" ,
145
146
"understand" : " I understand that an incorrect recovery password will create a different wallet"
146
147
},
Original file line number Diff line number Diff line change 15
15
* limitations under the License.
16
16
*/
17
17
18
- import { ReactNode , useState } from 'react' ;
18
+ import { ReactNode , useEffect , useState } from 'react' ;
19
19
import { useTranslation } from 'react-i18next' ;
20
20
import { useSync } from '../../../hooks/api' ;
21
21
import { restoreBackup } from '../../../api/bitbox02' ;
@@ -55,6 +55,18 @@ export const BackupsV2 = ({
55
55
56
56
const backups = useSync ( ( ) => getBackupList ( deviceID ) , subscribeBackupList ( deviceID ) ) ;
57
57
const hasBackups = backups && backups . success && backups !== undefined ;
58
+ const hasMoreThanOneBackups = hasBackups && backups . backups . length > 1 ;
59
+
60
+ useEffect ( ( ) => {
61
+ if ( ! hasBackups || backups . backups . length === 0 ) {
62
+ return ;
63
+ }
64
+
65
+ if ( backups . backups . length === 1 ) {
66
+ setSelectedBackup ( backups . backups [ 0 ] . id ) ;
67
+ }
68
+
69
+ } , [ backups , hasBackups ] ) ;
58
70
59
71
const restore = ( ) => {
60
72
if ( ! hasBackups ) {
@@ -96,6 +108,7 @@ export const BackupsV2 = ({
96
108
</ Toast >
97
109
)
98
110
}
111
+ { showRadio && hasMoreThanOneBackups ? < p className = "m-none m-bottom-large" > { t ( 'backup.restore.subtitle' ) } </ p > : null }
99
112
< div className = { backupStyle . backupsList } >
100
113
{
101
114
backups . backups . length ? (
Original file line number Diff line number Diff line change @@ -48,7 +48,8 @@ export const RestoreFromSDCardBackup = ({
48
48
showRestore = { true }
49
49
showRadio = { true }
50
50
onSelectBackup = { onSelectBackup }
51
- onRestoreBackup = { onRestoreBackup } >
51
+ onRestoreBackup = { onRestoreBackup }
52
+ >
52
53
< Button
53
54
secondary
54
55
onClick = { onBack } >
You can’t perform that action at this time.
0 commit comments