Commit 8c974a46 authored by Max Alekseenko's avatar Max Alekseenko

move components

parent 50db854a
...@@ -6,18 +6,18 @@ import config from 'configs/app'; ...@@ -6,18 +6,18 @@ import config from 'configs/app';
import type { IconName } from 'ui/shared/IconSvg'; import type { IconName } from 'ui/shared/IconSvg';
import IconSvg from 'ui/shared/IconSvg'; import IconSvg from 'ui/shared/IconSvg';
export enum LinkButtonVariants { export enum ContractListButtonVariants {
ALL_CONTRACTS = 'all contracts', ALL_CONTRACTS = 'all contracts',
VERIFIED_CONTRACTS = 'verified contracts', VERIFIED_CONTRACTS = 'verified contracts',
} }
const values = { const values = {
[LinkButtonVariants.ALL_CONTRACTS]: { [ContractListButtonVariants.ALL_CONTRACTS]: {
icon: 'contracts' as IconName, icon: 'contracts' as IconName,
iconColor: 'gray.500', iconColor: 'gray.500',
tooltip: `Total number of contracts deployed by the protocol on ${ config.chain.name }`, tooltip: `Total number of contracts deployed by the protocol on ${ config.chain.name }`,
}, },
[LinkButtonVariants.VERIFIED_CONTRACTS]: { [ContractListButtonVariants.VERIFIED_CONTRACTS]: {
icon: 'contracts_verified' as IconName, icon: 'contracts_verified' as IconName,
iconColor: 'green.500', iconColor: 'green.500',
tooltip: `Number of verified contracts on ${ config.chain.name }`, tooltip: `Number of verified contracts on ${ config.chain.name }`,
...@@ -27,10 +27,10 @@ const values = { ...@@ -27,10 +27,10 @@ const values = {
interface Props { interface Props {
children: string; children: string;
onClick: (event: MouseEvent) => void; onClick: (event: MouseEvent) => void;
variant: LinkButtonVariants; variant: ContractListButtonVariants;
} }
const LinkButton = ({ children, onClick, variant }: Props) => { const ContractListButton = ({ children, onClick, variant }: Props) => {
const { icon, iconColor, tooltip } = values[variant]; const { icon, iconColor, tooltip } = values[variant];
return ( return (
<Tooltip <Tooltip
...@@ -54,4 +54,4 @@ const LinkButton = ({ children, onClick, variant }: Props) => { ...@@ -54,4 +54,4 @@ const LinkButton = ({ children, onClick, variant }: Props) => {
); );
}; };
export default LinkButton; export default ContractListButton;
...@@ -9,9 +9,9 @@ import * as mixpanel from 'lib/mixpanel/index'; ...@@ -9,9 +9,9 @@ import * as mixpanel from 'lib/mixpanel/index';
import IconSvg from 'ui/shared/IconSvg'; import IconSvg from 'ui/shared/IconSvg';
import ListItemMobile from 'ui/shared/ListItemMobile/ListItemMobile'; import ListItemMobile from 'ui/shared/ListItemMobile/ListItemMobile';
import AppSecurityReport from '../AppSecurityReport';
import ContractListButton, { ContractListButtonVariants } from '../ContractListButton';
import AppLink from './AppLink'; import AppLink from './AppLink';
import AppSecurityReport from './AppSecurityReport';
import LinkButton, { LinkButtonVariants } from './LinkButton';
import MoreInfoButton from './MoreInfoButton'; import MoreInfoButton from './MoreInfoButton';
type Props = { type Props = {
...@@ -99,8 +99,12 @@ const ListItem = ({ app, onInfoClick, isFavorite, onFavoriteClick, isLoading, on ...@@ -99,8 +99,12 @@ const ListItem = ({ app, onInfoClick, isFavorite, onFavoriteClick, isLoading, on
<Flex alignItems="center"> <Flex alignItems="center">
<Flex flex={ 1 } gap={ 3 } alignItems="center"> <Flex flex={ 1 } gap={ 3 } alignItems="center">
<AppSecurityReport id={ id } securityReport={ securityReport } showContractList={ showContractList }/> <AppSecurityReport id={ id } securityReport={ securityReport } showContractList={ showContractList }/>
<LinkButton onClick={ showAllContracts } variant={ LinkButtonVariants.ALL_CONTRACTS }>{ totalContractsNumber }</LinkButton> <ContractListButton onClick={ showAllContracts } variant={ ContractListButtonVariants.ALL_CONTRACTS }>
<LinkButton onClick={ showVerifiedContracts } variant={ LinkButtonVariants.VERIFIED_CONTRACTS }>{ verifiedNumber }</LinkButton> { totalContractsNumber }
</ContractListButton>
<ContractListButton onClick={ showVerifiedContracts } variant={ ContractListButtonVariants.VERIFIED_CONTRACTS }>
{ verifiedNumber }
</ContractListButton>
</Flex> </Flex>
{ !isLoading && ( { !isLoading && (
<MoreInfoButton onClick={ handleInfoClick }/> <MoreInfoButton onClick={ handleInfoClick }/>
......
...@@ -8,9 +8,9 @@ import { ContractListTypes } from 'types/client/marketplace'; ...@@ -8,9 +8,9 @@ import { ContractListTypes } from 'types/client/marketplace';
import * as mixpanel from 'lib/mixpanel/index'; import * as mixpanel from 'lib/mixpanel/index';
import IconSvg from 'ui/shared/IconSvg'; import IconSvg from 'ui/shared/IconSvg';
import AppSecurityReport from '../AppSecurityReport';
import ContractListButton, { ContractListButtonVariants } from '../ContractListButton';
import AppLink from './AppLink'; import AppLink from './AppLink';
import AppSecurityReport from './AppSecurityReport';
import LinkButton, { LinkButtonVariants } from './LinkButton';
import MoreInfoButton from './MoreInfoButton'; import MoreInfoButton from './MoreInfoButton';
type Props = { type Props = {
...@@ -86,12 +86,14 @@ const TableItem = ({ ...@@ -86,12 +86,14 @@ const TableItem = ({
<AppSecurityReport id={ id } securityReport={ securityReport } showContractList={ showContractList } isLarge/> <AppSecurityReport id={ id } securityReport={ securityReport } showContractList={ showContractList } isLarge/>
</Td> </Td>
<Td verticalAlign="middle"> <Td verticalAlign="middle">
<LinkButton onClick={ showAllContracts } variant={ LinkButtonVariants.ALL_CONTRACTS }> <ContractListButton onClick={ showAllContracts } variant={ ContractListButtonVariants.ALL_CONTRACTS }>
{ totalContractsNumber } { totalContractsNumber }
</LinkButton> </ContractListButton>
</Td> </Td>
<Td verticalAlign="middle"> <Td verticalAlign="middle">
<LinkButton onClick={ showVerifiedContracts } variant={ LinkButtonVariants.VERIFIED_CONTRACTS }>{ verifiedNumber }</LinkButton> <ContractListButton onClick={ showVerifiedContracts } variant={ ContractListButtonVariants.VERIFIED_CONTRACTS }>
{ verifiedNumber }
</ContractListButton>
</Td> </Td>
<Td verticalAlign="middle" isNumeric> <Td verticalAlign="middle" isNumeric>
<MoreInfoButton onClick={ handleInfoClick }/> <MoreInfoButton onClick={ handleInfoClick }/>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment