@@ -58,8 +58,8 @@ const RenderAccountsListByBitcoinBased = (
5858 className = { `py-1.5 px-5 w-max backface-visibility-hidden flex items-center text-white text-sm
5959 font-medium active:bg-opacity-40 focus:outline-none cursor-pointer transform
6060 transition duration-300` }
61- onClick = { ( ) => {
62- setActiveAccount (
61+ onClick = { async ( ) => {
62+ await setActiveAccount (
6363 account . id ,
6464 KeyringAccountType . HDAccount
6565 ) ;
@@ -72,7 +72,7 @@ const RenderAccountsListByBitcoinBased = (
7272 style = { { maxWidth : '16.25rem' , textOverflow : 'ellipsis' } }
7373 className = "w-max gap-[2px] flex items-center justify-start whitespace-nowrap overflow-hidden"
7474 >
75- < img src = { logo } className = "mr-1 w-7" > </ img >
75+ < img src = { logo } className = "mr-1 w-7" alt = "" / >
7676 { account . label } ({ ellipsis ( account . address , 4 , 4 ) } )
7777 </ span >
7878 < span className = "text-xs ml-2 px-2 py-0.5 text-white bg-brand-blue500 rounded-full" >
@@ -89,6 +89,44 @@ const RenderAccountsListByBitcoinBased = (
8989 </ li >
9090 ) ) }
9191
92+ { Object . values ( accounts . Imported )
93+ . filter ( ( acc ) => ! acc . address . startsWith ( '0x' ) )
94+ . map ( ( account , index ) => (
95+ < li
96+ className = { `py-1.5 px-5 w-max backface-visibility-hidden flex items-center text-white text-sm
97+ font-medium active:bg-opacity-40 focus:outline-none cursor-pointer transform
98+ transition duration-300` }
99+ onClick = { async ( ) => {
100+ await setActiveAccount (
101+ account . id ,
102+ KeyringAccountType . Imported
103+ ) ;
104+ close ( ) ;
105+ } }
106+ id = { `account-${ index } ` }
107+ key = { account . id }
108+ >
109+ < span
110+ style = { { maxWidth : '16.25rem' , textOverflow : 'ellipsis' } }
111+ className = "w-max gap-[2px] flex items-center justify-start whitespace-nowrap overflow-hidden"
112+ >
113+ < img src = { logo } className = "mr-1 w-7" alt = "" />
114+ { account . label } ({ ellipsis ( account . address , 4 , 4 ) } )
115+ </ span >
116+ < span className = "text-xs ml-2 px-2 py-0.5 text-white bg-brand-blue500 rounded-full" >
117+ Imported
118+ </ span >
119+ { activeAccount . id === account . id &&
120+ activeAccount . type === KeyringAccountType . Imported && (
121+ < Icon
122+ name = "check"
123+ className = "mb-1 ml-2 w-4"
124+ color = "#8EC100"
125+ />
126+ ) }
127+ </ li >
128+ ) ) }
129+
92130 { Object . values ( accounts . Trezor )
93131 . filter ( ( acc ) => acc . isImported === false ) //todo we don't have account.isImported anymore
94132 . map ( ( account , index ) => (
@@ -100,11 +138,14 @@ const RenderAccountsListByBitcoinBased = (
100138 : 'cursor-pointer'
101139 } transform
102140 transition duration-300` }
103- onClick = { ( ) => {
141+ onClick = { async ( ) => {
104142 if ( account ?. originNetwork . url !== activeNetwork . url ) {
105143 return ;
106144 }
107- setActiveAccount ( account . id , KeyringAccountType . Trezor ) ;
145+ await setActiveAccount (
146+ account . id ,
147+ KeyringAccountType . Trezor
148+ ) ;
108149 close ( ) ;
109150 } }
110151 id = { `account-${ index } ` }
@@ -119,12 +160,13 @@ const RenderAccountsListByBitcoinBased = (
119160 >
120161 < img
121162 src = { trezorLogo }
163+ alt = ""
122164 style = { {
123165 filter :
124166 'invert(100%) sepia(0%) saturate(0%) hue-rotate(44deg) brightness(108%) contrast(102%)' ,
125167 } }
126168 className = "mr-1 w-7"
127- > </ img >
169+ / >
128170 { account . label } { ' ' }
129171 { ! ( account ?. originNetwork . url !== activeNetwork . url ) &&
130172 `(${ ellipsis ( account . address , 4 , 4 ) } )` }
@@ -156,11 +198,14 @@ const RenderAccountsListByBitcoinBased = (
156198 : 'cursor-pointer'
157199 } transform
158200 transition duration-300` }
159- onClick = { ( ) => {
201+ onClick = { async ( ) => {
160202 if ( account ?. originNetwork . url !== activeNetwork . url ) {
161203 return ;
162204 }
163- setActiveAccount ( account . id , KeyringAccountType . Ledger ) ;
205+ await setActiveAccount (
206+ account . id ,
207+ KeyringAccountType . Ledger
208+ ) ;
164209 close ( ) ;
165210 } }
166211 id = { `account-${ index } ` }
@@ -175,12 +220,13 @@ const RenderAccountsListByBitcoinBased = (
175220 >
176221 < img
177222 src = { ledgerLogo }
223+ alt = ""
178224 style = { {
179225 filter :
180226 'invert(100%) sepia(0%) saturate(0%) hue-rotate(44deg) brightness(108%) contrast(102%)' ,
181227 } }
182228 className = "mr-2 w-7"
183- > </ img >
229+ / >
184230 { account . label } { ' ' }
185231 { ! ( account ?. originNetwork . url !== activeNetwork . url ) &&
186232 `(${ ellipsis ( account . address , 4 , 4 ) } )` }
@@ -206,7 +252,7 @@ const RenderAccountsListByBitcoinBased = (
206252 ( [ keyringAccountType , accountTypeAccounts ] ) => (
207253 < div key = { keyringAccountType } >
208254 { Object . values ( accountTypeAccounts )
209- . filter ( ( account ) => account . xpub !== '' )
255+ . filter ( ( account ) => account . address . startsWith ( '0x' ) )
210256 . map ( ( account , index ) => (
211257 < li
212258 className = { `py-1.5 px-5 w-max backface-visibility-hidden flex items-center justify-start text-white text-sm
@@ -219,7 +265,7 @@ const RenderAccountsListByBitcoinBased = (
219265 : 'cursor-pointer'
220266 } transform
221267 transition duration-300` }
222- onClick = { ( ) => {
268+ onClick = { async ( ) => {
223269 if (
224270 ( account . isTrezorWallet &&
225271 account ?. originNetwork ?. isBitcoinBased ) ||
@@ -228,7 +274,7 @@ const RenderAccountsListByBitcoinBased = (
228274 ) {
229275 return ;
230276 }
231- setActiveAccount (
277+ await setActiveAccount (
232278 account . id ,
233279 keyringAccountType as KeyringAccountType
234280 ) ;
@@ -245,27 +291,29 @@ const RenderAccountsListByBitcoinBased = (
245291 className = "w-full flex items-center justify-start whitespace-nowrap overflow-hidden"
246292 >
247293 { account . isImported ? (
248- < img src = { importIcon } className = "mr-1 w-7" > </ img >
294+ < img src = { importIcon } className = "mr-1 w-7" alt = "" / >
249295 ) : account . isTrezorWallet ? (
250296 < img
251297 src = { trezorLogo }
298+ alt = ""
252299 style = { {
253300 filter :
254301 'invert(100%) sepia(0%) saturate(0%) hue-rotate(44deg) brightness(108%) contrast(102%)' ,
255302 } }
256303 className = "mr-1 w-7"
257- > </ img >
304+ / >
258305 ) : account . isLedgerWallet ? (
259306 < img
260307 src = { ledgerLogo }
308+ alt = ""
261309 style = { {
262310 filter :
263311 'invert(100%) sepia(0%) saturate(0%) hue-rotate(44deg) brightness(108%) contrast(102%)' ,
264312 } }
265313 className = "mr-1 w-7"
266- > </ img >
314+ / >
267315 ) : (
268- < img src = { logo } className = "mr-1 w-7" > </ img >
316+ < img src = { logo } className = "mr-1 w-7" alt = "" / >
269317 ) } { ' ' }
270318 { account . label } { ' ' }
271319 { ! (
@@ -328,8 +376,6 @@ export const AccountMenu: React.FC = () => {
328376 await controllerEmitter ( [ 'wallet' , 'setAccount' ] , [ Number ( id ) , type ] ) ;
329377 } ;
330378
331- const cursorType = isBitcoinBased ? 'cursor-not-allowed' : 'cursor-pointer' ;
332-
333379 return (
334380 < div className = "flex flex-col justify-start items-start" >
335381 < span className = "disabled text-xs flex justify-start px-5 mt-5 mb-1" >
@@ -394,27 +440,13 @@ export const AccountMenu: React.FC = () => {
394440 < Menu . Item >
395441 < div className = "flex flex-col gap-2" >
396442 < li
397- onClick = { ( ) => {
398- isBitcoinBased ? null : navigate ( '/settings/account/import' ) ;
399- } }
400- className = { `py-1.5 ${ cursorType } px-6 w-full backface-visibility-hidden flex items-center justify-start gap-3 text-white text-sm font-medium active:bg-opacity-40 focus:outline-none` }
443+ onClick = { ( ) => navigate ( '/settings/account/import' ) }
444+ className = { `py-1.5 cursor-pointer px-6 w-full backface-visibility-hidden flex items-center justify-start gap-3 text-white text-sm font-medium active:bg-opacity-40 focus:outline-none` }
401445 >
402- < Icon
403- name = "ImportUser"
404- isSvg
405- className = "mb-1 text-brand-white"
406- opacity = { isBitcoinBased ? 0.6 : 1 }
407- />
408-
409- < span className = { isBitcoinBased ? 'disabled' : '' } >
410- { t ( 'accountMenu.importAccount' ) }
411- </ span >
446+ < Icon name = "ImportUser" isSvg className = "mb-1 text-brand-white" />
447+
448+ < span > { t ( 'accountMenu.importAccount' ) } </ span >
412449 </ li >
413- { isBitcoinBased && (
414- < span className = "disabled text-xs px-5 text-left" >
415- { t ( 'accountMenu.importAccMessage' ) }
416- </ span >
417- ) }
418450 </ div >
419451 </ Menu . Item >
420452 </ div >
0 commit comments