Commit a304f4bb authored by Max Alekseenko's avatar Max Alekseenko

fix dapp page top bar for mobiles

parent 56800288
...@@ -13,9 +13,10 @@ type Props = { ...@@ -13,9 +13,10 @@ type Props = {
height?: string | undefined; height?: string | undefined;
showContractList: () => void; showContractList: () => void;
isLoading?: boolean; isLoading?: boolean;
onlyIcon?: boolean;
} }
const AppSecurityReport = ({ securityReport, height, showContractList, isLoading }: Props) => { const AppSecurityReport = ({ securityReport, height, showContractList, isLoading, onlyIcon }: Props) => {
if (!securityReport && !isLoading) { if (!securityReport && !isLoading) {
return null; return null;
} }
...@@ -32,6 +33,7 @@ const AppSecurityReport = ({ securityReport, height, showContractList, isLoading ...@@ -32,6 +33,7 @@ const AppSecurityReport = ({ securityReport, height, showContractList, isLoading
isLoading={ isLoading } isLoading={ isLoading }
height={ height } height={ height }
score={ securityScore } score={ securityScore }
onlyIcon={ onlyIcon }
popoverContent={ ( popoverContent={ (
<> <>
<Box mb={ 5 }> <Box mb={ 5 }>
......
...@@ -22,7 +22,7 @@ const MarketplaceAppInfo = ({ data }: Props) => { ...@@ -22,7 +22,7 @@ const MarketplaceAppInfo = ({ data }: Props) => {
if (isMobile) { if (isMobile) {
return ( return (
<> <>
<TriggerButton onClick={ onToggle }/> <TriggerButton onClick={ onToggle } onlyIcon/>
<Modal isOpen={ isOpen } onClose={ onClose } size="full"> <Modal isOpen={ isOpen } onClose={ onClose } size="full">
<ModalContent> <ModalContent>
<ModalCloseButton/> <ModalCloseButton/>
......
...@@ -5,9 +5,10 @@ import IconSvg from 'ui/shared/IconSvg'; ...@@ -5,9 +5,10 @@ import IconSvg from 'ui/shared/IconSvg';
interface Props { interface Props {
onClick: () => void; onClick: () => void;
onlyIcon?: boolean;
} }
const TriggerButton = ({ onClick }: Props, ref: React.ForwardedRef<HTMLButtonElement>) => { const TriggerButton = ({ onClick, onlyIcon }: Props, ref: React.ForwardedRef<HTMLButtonElement>) => {
return ( return (
<Button <Button
ref={ ref } ref={ ref }
...@@ -17,11 +18,11 @@ const TriggerButton = ({ onClick }: Props, ref: React.ForwardedRef<HTMLButtonEle ...@@ -17,11 +18,11 @@ const TriggerButton = ({ onClick }: Props, ref: React.ForwardedRef<HTMLButtonEle
onClick={ onClick } onClick={ onClick }
aria-label="Show project info" aria-label="Show project info"
fontWeight={ 500 } fontWeight={ 500 }
px={ 2 } px={ onlyIcon ? 1 : 2 }
h="32px" h="32px"
> >
<IconSvg name="info" boxSize={ 6 } mr={ 1 }/> <IconSvg name="info" boxSize={ 6 } mr={ onlyIcon ? 0 : 1 }/>
<span>Info</span> { !onlyIcon && <span>Info</span> }
</Button> </Button>
); );
}; };
......
import { chakra, Flex, Tooltip, Skeleton, useBoolean } from '@chakra-ui/react'; import { chakra, Flex, Tooltip, Skeleton, useBoolean, Box } from '@chakra-ui/react';
import React from 'react'; import React from 'react';
import type { MarketplaceAppOverview } from 'types/client/marketplace'; import type { MarketplaceAppOverview } from 'types/client/marketplace';
...@@ -7,6 +7,7 @@ import { ContractListTypes } from 'types/client/marketplace'; ...@@ -7,6 +7,7 @@ import { ContractListTypes } from 'types/client/marketplace';
import { route } from 'nextjs-routes'; import { route } from 'nextjs-routes';
import { useAppContext } from 'lib/contexts/app'; import { useAppContext } from 'lib/contexts/app';
import useIsMobile from 'lib/hooks/useIsMobile';
import IconSvg from 'ui/shared/IconSvg'; import IconSvg from 'ui/shared/IconSvg';
import LinkExternal from 'ui/shared/LinkExternal'; import LinkExternal from 'ui/shared/LinkExternal';
import LinkInternal from 'ui/shared/LinkInternal'; import LinkInternal from 'ui/shared/LinkInternal';
...@@ -26,6 +27,7 @@ type Props = { ...@@ -26,6 +27,7 @@ type Props = {
const MarketplaceAppTopBar = ({ data, isLoading, isWalletConnected, securityReport }: Props) => { const MarketplaceAppTopBar = ({ data, isLoading, isWalletConnected, securityReport }: Props) => {
const [ showContractList, setShowContractList ] = useBoolean(false); const [ showContractList, setShowContractList ] = useBoolean(false);
const appProps = useAppContext(); const appProps = useAppContext();
const isMobile = useIsMobile();
const goBackUrl = React.useMemo(() => { const goBackUrl = React.useMemo(() => {
if (appProps.referrer && appProps.referrer.includes('/apps') && !appProps.referrer.includes('/apps/')) { if (appProps.referrer && appProps.referrer.includes('/apps') && !appProps.referrer.includes('/apps/')) {
...@@ -48,17 +50,24 @@ const MarketplaceAppTopBar = ({ data, isLoading, isWalletConnected, securityRepo ...@@ -48,17 +50,24 @@ const MarketplaceAppTopBar = ({ data, isLoading, isWalletConnected, securityRepo
<IconSvg name="arrows/east" boxSize={ 6 } transform="rotate(180deg)" margin="auto" color="gray.400"/> <IconSvg name="arrows/east" boxSize={ 6 } transform="rotate(180deg)" margin="auto" color="gray.400"/>
</LinkInternal> </LinkInternal>
</Tooltip> </Tooltip>
<Skeleton width={{ base: '100%', md: 'auto' }} order={{ base: 4, md: 2 }} isLoaded={ !isLoading }> <Skeleton width={{ base: '100%', md: 'auto' }} order={{ base: 5, md: 2 }} isLoaded={ !isLoading }>
<MarketplaceAppAlert internalWallet={ data?.internalWallet } isWalletConnected={ isWalletConnected }/> <MarketplaceAppAlert internalWallet={ data?.internalWallet } isWalletConnected={ isWalletConnected }/>
</Skeleton> </Skeleton>
<Skeleton order={{ base: 2, md: 3 }} isLoaded={ !isLoading }> <Skeleton order={{ base: 2, md: 3 }} isLoaded={ !isLoading }>
<MarketplaceAppInfo data={ data }/> <MarketplaceAppInfo data={ data }/>
</Skeleton> </Skeleton>
<Skeleton order={{ base: 2, md: 3 }} isLoaded={ !isLoading }> { (securityReport || isLoading) && (
<AppSecurityReport securityReport={ securityReport } showContractList={ setShowContractList.on }/> <Box order={{ base: 3, md: 4 }}>
</Skeleton> <AppSecurityReport
securityReport={ securityReport }
showContractList={ setShowContractList.on }
isLoading={ isLoading }
onlyIcon={ isMobile }
/>
</Box>
) }
<LinkExternal <LinkExternal
order={{ base: 3, md: 4 }} order={{ base: 4, md: 5 }}
href={ data?.url } href={ data?.url }
variant="subtle" variant="subtle"
fontSize="sm" fontSize="sm"
......
...@@ -20,9 +20,10 @@ interface Props { ...@@ -20,9 +20,10 @@ interface Props {
popoverContent?: React.ReactNode; popoverContent?: React.ReactNode;
isLoading?: boolean; isLoading?: boolean;
height?: string; height?: string;
onlyIcon?: boolean;
} }
const SolidityscanReportButton = ({ className, score, popoverContent, isLoading, height = '32px' }: Props) => { const SolidityscanReportButton = ({ className, score, popoverContent, isLoading, height = '32px', onlyIcon }: Props) => {
const { isOpen, onToggle, onClose } = useDisclosure(); const { isOpen, onToggle, onClose } = useDisclosure();
const { scoreColor } = useScoreLevelAndColor(score); const { scoreColor } = useScoreLevelAndColor(score);
...@@ -43,8 +44,8 @@ const SolidityscanReportButton = ({ className, score, popoverContent, isLoading, ...@@ -43,8 +44,8 @@ const SolidityscanReportButton = ({ className, score, popoverContent, isLoading,
h={ height } h={ height }
flexShrink={ 0 } flexShrink={ 0 }
> >
<IconSvg name={ score < 80 ? 'score/score-not-ok' : 'score/score-ok' } boxSize={ 5 } mr={ 1 }/> <IconSvg name={ score < 80 ? 'score/score-not-ok' : 'score/score-ok' } boxSize={ 5 } mr={ onlyIcon ? 0 : 1 }/>
{ score } { onlyIcon ? null : score }
</Button> </Button>
</Skeleton> </Skeleton>
</PopoverTrigger> </PopoverTrigger>
......
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