Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Celo: Epoch rewards tab bugs on mobile #2346

Merged
merged 2 commits into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 2 additions & 10 deletions ui/address/contract/methods/ContractAbiItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,6 @@ const ContractAbiItem = ({ data, index, id, addressHash, sourceAddress, tab, onS
});
}, [ addressHash, data, tab, sourceAddress ]);

const handleCopyLinkClick = React.useCallback((event: React.MouseEvent) => {
event.stopPropagation();
}, []);

const handleCopyMethodIdClick = React.useCallback((event: React.MouseEvent) => {
event.stopPropagation();
}, []);

const handleReset = React.useCallback(() => {
setAttempt((prev) => prev + 1);
}, []);
Expand All @@ -71,7 +63,7 @@ const ContractAbiItem = ({ data, index, id, addressHash, sourceAddress, tab, onS
alignItems="center"
columnGap={ 2 }
>
<CopyToClipboard text={ url } onClick={ handleCopyLinkClick } type="link" ml={ 0 } color="text_secondary"/>
<CopyToClipboard text={ url } type="link" ml={ 0 } color="text_secondary"/>
<Box as="div" fontWeight={ 500 } display="flex" alignItems="center">
{ index + 1 }. { data.type === 'fallback' || data.type === 'receive' ? data.type : data.name }
{ data.type === 'fallback' && (
Expand Down Expand Up @@ -101,7 +93,7 @@ const ContractAbiItem = ({ data, index, id, addressHash, sourceAddress, tab, onS
{ 'method_id' in data && (
<Tag display="inline-flex" alignItems="center" flexShrink={ 0 }>
{ data.method_id }
<CopyToClipboard text={ data.method_id } onClick={ handleCopyMethodIdClick }/>
<CopyToClipboard text={ data.method_id }/>
</Tag>
) }
<AccordionIcon transform={ isExpanded ? 'rotate(0deg)' : 'rotate(-90deg)' } color="gray.500"/>
Expand Down
4 changes: 2 additions & 2 deletions ui/block/epochRewards/BlockEpochElectionRewardsListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const BlockEpochElectionRewardsListItem = ({ data, isLoading, type }: Props) =>
onClick={ isLoading || !data.count ? undefined : section.onToggle }
cursor={ isLoading || !data.count ? undefined : 'pointer' }
>
<Flex my="3px" columnGap={ 3 } alignItems="center" flexWrap="wrap" rowGap={ 1 }>
<Flex my="3px" columnGap={ 3 } alignItems="center" flexWrap="wrap" rowGap={ 2 }>
{ data.count ? (
<Skeleton isLoaded={ !isLoading } display="flex" borderRadius="sm">
<IconButton
Expand All @@ -55,7 +55,7 @@ const BlockEpochElectionRewardsListItem = ({ data, isLoading, type }: Props) =>
) : <Box boxSize={ 6 }/> }
<EpochRewardTypeTag type={ type } isLoading={ isLoading }/>
<Skeleton isLoaded={ !isLoading }>{ data.count }</Skeleton>
<Flex columnGap={ 2 } alignItems="center" ml="auto" fontWeight={ 500 }>
<Flex columnGap={ 2 } alignItems="center" ml={{ base: 9, lg: 'auto' }} w={{ base: '100%', lg: 'fit-content' }} fontWeight={ 500 }>
<Skeleton isLoaded={ !isLoading }>{ valueStr }</Skeleton>
<TokenEntity
token={ data.token }
Expand Down
8 changes: 5 additions & 3 deletions ui/block/epochRewards/BlockEpochRewardsDistribution.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import React from 'react';

import type { BlockEpoch } from 'types/api/block';

import useIsMobile from 'lib/hooks/useIsMobile';
import * as DetailsInfoItem from 'ui/shared/DetailsInfoItem';
import TokenTransferSnippet from 'ui/shared/TokenTransferSnippet/TokenTransferSnippet';

Expand All @@ -12,6 +13,7 @@ interface Props {
}

const BlockEpochRewardsDistribution = ({ data, isLoading }: Props) => {
const isMobile = useIsMobile();

if (!data.distribution.community_transfer && !data.distribution.carbon_offsetting_transfer && !data.distribution.reserve_bolster_transfer) {
return null;
Expand All @@ -33,7 +35,7 @@ const BlockEpochRewardsDistribution = ({ data, isLoading }: Props) => {
Community fund
</DetailsInfoItem.Label>
<DetailsInfoItem.Value>
<TokenTransferSnippet data={ data.distribution.community_transfer } isLoading={ isLoading } noAddressIcons={ false }/>
<TokenTransferSnippet data={ data.distribution.community_transfer } isLoading={ isLoading } noAddressIcons={ isMobile }/>
</DetailsInfoItem.Value>
</>
) }
Expand All @@ -46,7 +48,7 @@ const BlockEpochRewardsDistribution = ({ data, isLoading }: Props) => {
Carbon offset fund
</DetailsInfoItem.Label>
<DetailsInfoItem.Value>
<TokenTransferSnippet data={ data.distribution.carbon_offsetting_transfer } isLoading={ isLoading } noAddressIcons={ false }/>
<TokenTransferSnippet data={ data.distribution.carbon_offsetting_transfer } isLoading={ isLoading } noAddressIcons={ isMobile }/>
</DetailsInfoItem.Value>
</>
) }
Expand All @@ -59,7 +61,7 @@ const BlockEpochRewardsDistribution = ({ data, isLoading }: Props) => {
Reserve bolster
</DetailsInfoItem.Label>
<DetailsInfoItem.Value>
<TokenTransferSnippet data={ data.distribution.reserve_bolster_transfer } isLoading={ isLoading } noAddressIcons={ false }/>
<TokenTransferSnippet data={ data.distribution.reserve_bolster_transfer } isLoading={ isLoading } noAddressIcons={ isMobile }/>
</DetailsInfoItem.Value>
</>
) }
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions ui/shared/CopyToClipboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ const CopyToClipboard = ({ text, className, isLoading, onClick, size = 5, type,
}, [ hasCopied ]);

const handleClick = React.useCallback((event: React.MouseEvent) => {
event.stopPropagation();
onCopy();
onClick?.(event);
}, [ onClick, onCopy ]);
Expand Down
1 change: 0 additions & 1 deletion ui/shared/address/AddressFromTo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ const AddressFromTo = ({ from, to, current, mode: modeProp, className, isLoading
truncation="constant"
maxW="calc(100% - 28px)"
w="min-content"

/>
</Flex>
{ to && (
Expand Down
Loading