-
Notifications
You must be signed in to change notification settings - Fork 481
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implementation name behind proxy name (#2071)
* icon for proxy contract * add custom tooltip for proxy contract * add name to tooltip and refactor * tests * center the popup content
- Loading branch information
Showing
18 changed files
with
173 additions
and
29 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
export const multiple = [ | ||
{ address: '0xA84d24bD8ACE4d349C5f8c5DeeDd8bc071Ce5e2b', name: null }, | ||
{ address: '0xc9e91eDeA9DC16604022e4E5b437Df9c64EdB05A', name: 'Diamond' }, | ||
{ address: '0x2041832c62C0F89426b48B5868146C0b1fcd23E7', name: null }, | ||
{ address: '0x5f7DC6ECcF05594429671F83cc0e42EE18bC0974', name: 'VariablePriceFacet' }, | ||
{ address: '0x7abC92E242e88e4B0d6c5Beb4Df80e94D2c8A78c', name: null }, | ||
{ address: '0x84178a0c58A860eCCFB7E3aeA64a09543062A356', name: 'MultiSaleFacet' }, | ||
{ address: '0x33aD95537e63e9f09d96dE201e10715Ed40D9400', name: 'SVGTemplatesFacet' }, | ||
{ address: '0xfd86Aa7f902185a8Df9859c25E4BF52D3DaDd9FA', name: 'ERC721AReceiverFacet' }, | ||
{ address: '0x6945a35df18e59Ce09fec4B6cD3C4F9cFE6369de', name: null }, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import { Box, DarkMode, Popover, PopoverBody, PopoverContent, PopoverTrigger, Portal, useColorModeValue, Flex, PopoverArrow } from '@chakra-ui/react'; | ||
import React from 'react'; | ||
|
||
import * as EntityBase from 'ui/shared/entities/base/components'; | ||
|
||
import type { ContentProps } from './AddressEntity'; | ||
import AddressEntity from './AddressEntity'; | ||
|
||
const AddressEntityContentProxy = (props: ContentProps) => { | ||
const bgColor = useColorModeValue('gray.700', 'gray.900'); | ||
|
||
const implementations = props.address.implementations; | ||
|
||
const handleClick = React.useCallback((event: React.MouseEvent) => { | ||
event.stopPropagation(); | ||
}, []); | ||
|
||
if (!implementations || implementations.length === 0) { | ||
return null; | ||
} | ||
|
||
const colNum = Math.min(implementations.length, 3); | ||
const implementationName = implementations.length === 1 && implementations[0].name ? implementations[0].name : undefined; | ||
|
||
return ( | ||
<Popover trigger="hover" isLazy> | ||
<PopoverTrigger> | ||
<Box display="inline-flex" w="100%"> | ||
<EntityBase.Content | ||
{ ...props } | ||
truncation={ implementationName || props.address.name ? 'tail' : 'dynamic' } | ||
text={ implementationName || props.address.name || props.address.hash } | ||
/> | ||
</Box> | ||
</PopoverTrigger> | ||
<Portal> | ||
<DarkMode> | ||
<PopoverContent bgColor={ bgColor } w="fit-content" borderRadius="sm" maxW={{ base: '100vw', lg: '410px' }} onClick={ handleClick }> | ||
<PopoverArrow bgColor={ bgColor }/> | ||
<PopoverBody color="white" p={ 2 } fontSize="sm" lineHeight={ 5 } textAlign="center"> | ||
<Box fontWeight={ 600 }> | ||
Proxy contract | ||
{ props.address.name ? ` (${ props.address.name })` : '' } | ||
</Box> | ||
<AddressEntity address={{ hash: props.address.hash }} noLink noIcon noHighlight justifyContent="center"/> | ||
<Box fontWeight={ 600 } mt={ 2 }> | ||
Implementation{ implementations.length > 1 ? 's' : '' } | ||
{ implementationName ? ` (${ implementationName })` : '' } | ||
</Box> | ||
<Flex flexWrap="wrap" columnGap={ 3 }> | ||
{ implementations.map((item) => ( | ||
<AddressEntity | ||
key={ item.address } | ||
address={{ hash: item.address }} | ||
noLink | ||
noIcon | ||
noHighlight | ||
minW={ `calc((100% - ${ colNum - 1 } * 12px) / ${ colNum })` } | ||
flex={ 1 } | ||
justifyContent={ colNum === 1 ? 'center' : undefined } | ||
/> | ||
)) } | ||
</Flex> | ||
</PopoverBody> | ||
</PopoverContent> | ||
</DarkMode> | ||
</Portal> | ||
</Popover> | ||
); | ||
}; | ||
|
||
export default React.memo(AddressEntityContentProxy); |
Binary file added
BIN
+22 KB
...ts__/AddressEntity.pw.tsx_default_proxy-contract-with-implementation-name-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+29.2 KB
...AddressEntity.pw.tsx_default_proxy-contract-with-multiple-implementations-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+24.9 KB
...creenshots__/AddressEntity.pw.tsx_default_proxy-contract-without-any-name-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+21.9 KB
..._/AddressEntity.pw.tsx_default_proxy-contract-without-implementation-name-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters