2
2
/* eslint-disable react/no-multi-comp */
3
3
import React , { useCallback , useEffect , useRef , useState } from 'react' ;
4
4
5
+ import { WalletType } from '@cardano-sdk/web-extension' ;
5
6
import {
6
7
ChevronLeftIcon ,
7
8
ChevronRightIcon ,
@@ -44,6 +45,7 @@ import type { UseAccount } from '../../../adapters/account';
44
45
import type { OutsideHandlesContextValue } from '../../../features/outside-handles-provider' ;
45
46
import type { ChangePasswordModalComponentRef } from '../components/changePasswordModal' ;
46
47
import type { Wallet } from '@lace/cardano' ;
48
+ import type { CommonOutsideHandlesContextValue } from 'features/common-outside-handles-provider' ;
47
49
48
50
type Props = Pick <
49
51
OutsideHandlesContextValue ,
@@ -60,17 +62,18 @@ type Props = Pick<
60
62
| 'setTheme'
61
63
| 'switchNetwork'
62
64
| 'theme'
63
- > & {
64
- currency : CurrencyCode ;
65
- setCurrency : ( currency : CurrencyCode ) => void ;
66
- changePassword : (
67
- currentPassword : string ,
68
- newPassword : string ,
69
- ) => Promise < void > ;
70
- accountName : string ;
71
- accountAvatar ?: string ;
72
- updateAccountMetadata : UseAccount [ 'updateAccountMetadata' ] ;
73
- } ;
65
+ > &
66
+ Pick < CommonOutsideHandlesContextValue , 'walletType' > & {
67
+ currency : CurrencyCode ;
68
+ setCurrency : ( currency : CurrencyCode ) => void ;
69
+ changePassword : (
70
+ currentPassword : string ,
71
+ newPassword : string ,
72
+ ) => Promise < void > ;
73
+ accountName : string ;
74
+ accountAvatar ?: string ;
75
+ updateAccountMetadata : UseAccount [ 'updateAccountMetadata' ] ;
76
+ } ;
74
77
75
78
const Settings = ( {
76
79
currency,
@@ -92,6 +95,7 @@ const Settings = ({
92
95
getCustomSubmitApiForNetwork,
93
96
defaultSubmitApi,
94
97
isValidURL,
98
+ walletType,
95
99
} : Readonly < Props > ) => {
96
100
const history = useHistory ( ) ;
97
101
const location = useLocation ( ) ;
@@ -136,6 +140,7 @@ const Settings = ({
136
140
accountAvatar = { accountAvatar }
137
141
accountName = { accountName }
138
142
updateAccountMetadata = { updateAccountMetadata }
143
+ walletType = { walletType }
139
144
/>
140
145
</ Route >
141
146
< Route path = "/settings/whitelisted" exact >
@@ -275,6 +280,7 @@ const GeneralSettings = ({
275
280
accountAvatar,
276
281
changePassword,
277
282
updateAccountMetadata,
283
+ walletType,
278
284
} : Readonly <
279
285
Pick <
280
286
Props ,
@@ -286,6 +292,7 @@ const GeneralSettings = ({
286
292
| 'setTheme'
287
293
| 'theme'
288
294
| 'updateAccountMetadata'
295
+ | 'walletType'
289
296
>
290
297
> ) => {
291
298
const capture = useCaptureEvent ( ) ;
@@ -395,20 +402,24 @@ const GeneralSettings = ({
395
402
</ Box >
396
403
< Box height = "15" />
397
404
< Box height = "5" />
398
- < Button
399
- colorScheme = "orange"
400
- size = "sm"
401
- onClick = { ( ) => {
402
- capture ( Events . SettingsChangePasswordClick ) ;
403
- changePasswordRef . current ?. openModal ( ) ;
404
- } }
405
- >
406
- Change Password
407
- </ Button >
408
- < ChangePasswordModal
409
- ref = { changePasswordRef }
410
- changePassword = { changePassword }
411
- />
405
+ { walletType === WalletType . InMemory && (
406
+ < >
407
+ < Button
408
+ colorScheme = "orange"
409
+ size = "sm"
410
+ onClick = { ( ) => {
411
+ capture ( Events . SettingsChangePasswordClick ) ;
412
+ changePasswordRef . current ?. openModal ( ) ;
413
+ } }
414
+ >
415
+ Change Password
416
+ </ Button >
417
+ < ChangePasswordModal
418
+ ref = { changePasswordRef }
419
+ changePassword = { changePassword }
420
+ />
421
+ </ >
422
+ ) }
412
423
</ >
413
424
) ;
414
425
} ;
0 commit comments