1- import React from " react" ;
2- import { navigate , useLocation } from " @reach/router"
3- import { Account } from " api/apollo/generated/graphql" ;
4- import { EntityType } from " providers/Project" ;
5- import { SidebarSection as Root } from " layout/SidebarSection" ;
6- import { SidebarHeader as Header } from " layout/SidebarHeader" ;
7- import { SidebarItems as Items } from " layout/SidebarItems" ;
8- import { SidebarItem as Item } from " layout/SidebarItem" ;
9- import { Stack } from " layout/Stack" ;
10- import { useProject } from " providers/Project/projectHooks" ;
11- import Avatar from " components/Avatar" ;
12- import styled from " @emotion/styled" ;
13- import { ExportButton } from " components/ExportButton" ;
14- import { getParams , isUUUID , LOCAL_PROJECT_ID } from " ../util/url" ;
15- import { ResourcesExplorerButton } from " components/ResourcesExplorerButton" ;
1+ import React from ' react' ;
2+ import { navigate , useLocation } from ' @reach/router' ;
3+ import { Account } from ' api/apollo/generated/graphql' ;
4+ import { EntityType } from ' providers/Project' ;
5+ import { SidebarSection as Root } from ' layout/SidebarSection' ;
6+ import { SidebarHeader as Header } from ' layout/SidebarHeader' ;
7+ import { SidebarItems as Items } from ' layout/SidebarItems' ;
8+ import { SidebarItem as Item } from ' layout/SidebarItem' ;
9+ import { Stack } from ' layout/Stack' ;
10+ import { useProject } from ' providers/Project/projectHooks' ;
11+ import Avatar from ' components/Avatar' ;
12+ import styled from ' @emotion/styled' ;
13+ import { ExportButton } from ' components/ExportButton' ;
14+ import { getParams , isUUUID , LOCAL_PROJECT_ID } from ' ../util/url' ;
15+ import { ResourcesExplorerButton } from ' components/ResourcesExplorerButton' ;
1616
1717function getDeployedContracts ( account : Account ) : string {
1818 const contracts = account . deployedContracts . map (
19- contract => contract . split ( "." ) . slice ( - 1 ) [ 0 ]
19+ ( contract ) => contract . split ( '.' ) . slice ( - 1 ) [ 0 ] ,
2020 ) ;
21- return contracts . join ( ", " ) ;
21+ return contracts . join ( ', ' ) ;
2222}
2323
2424export const AccountCard = styled . div `
@@ -30,45 +30,45 @@ export const AccountCard = styled.div`
3030` ;
3131
3232const AccountList : React . FC = ( ) => {
33- const {
34- project,
35- active,
36- selectedResourceAccount
37- } = useProject ( ) ;
38- const accountSelected = active . type === EntityType . Account
33+ const { project, active, selectedResourceAccount } = useProject ( ) ;
34+ const accountSelected = active . type === EntityType . Account ;
3935
4036 const location = useLocation ( ) ;
41- const params = getParams ( location . search )
42- const projectPath = isUUUID ( project . id ) ? project . id : LOCAL_PROJECT_ID
37+ const params = getParams ( location . search ) ;
38+ const projectPath = isUUUID ( project . id ) ? project . id : LOCAL_PROJECT_ID ;
4339
4440 return (
4541 < Root >
4642 < Header > Accounts</ Header >
4743 < Items >
4844 { project . accounts . map ( ( account : Account , i : number ) => {
49- const { id } = account
50- const isActive = accountSelected && params . id === id
51- const accountAddress = `0x${ account . address . slice ( - 2 ) } `
52- const contractName = getDeployedContracts ( account )
45+ const { id } = account ;
46+ const isActive = accountSelected && params . id === id ;
47+ const accountAddress = `0x${ account . address . slice ( - 2 ) } ` ;
48+ const contractName = getDeployedContracts ( account ) ;
5349 const title = contractName
5450 ? `${ contractName } is deployed to this account`
55- : `This account don't have any contracts`
56- const typeName = account . __typename
51+ : `This account don't have any contracts` ;
52+ const typeName = account . __typename ;
5753 return (
58- < Item
59- title = { title }
60- active = { isActive }
61- key = { account . address }
62- >
54+ < Item title = { title } active = { isActive } key = { account . address } >
6355 < AccountCard
64- onClick = { ( ) => navigate ( `/${ projectPath } ?type=account&id=${ id } &storage=${ selectedResourceAccount || 'none' } ` ) }
56+ onClick = { ( ) =>
57+ navigate (
58+ `/${ projectPath } ?type=account&id=${ id } &storage=${
59+ selectedResourceAccount || 'none'
60+ } `,
61+ )
62+ }
6563 >
6664 < Avatar seed = { project . seed } index = { i } />
6765 < Stack >
6866 < strong > { accountAddress } </ strong >
6967 < small > { contractName || '--' } </ small >
7068 </ Stack >
71- { isActive && < ExportButton id = { account . id } typeName = { typeName } /> }
69+ { isActive && (
70+ < ExportButton id = { account . id } typeName = { typeName } />
71+ ) }
7272 </ AccountCard >
7373 < ResourcesExplorerButton address = { accountAddress } />
7474 </ Item >
0 commit comments