Skip to content

Commit

Permalink
[Issue-2569] Update actions related to Astar
Browse files Browse the repository at this point in the history
  • Loading branch information
lw committed Feb 6, 2024
1 parent 2cad12a commit 46c7793
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import { _ChainInfo } from '@subwallet/chain-list/types';
import { useTranslation } from '@subwallet/extension-koni-ui/hooks';
import { ThemeProps, YieldGroupInfo } from '@subwallet/extension-koni-ui/types';
import { isRelatedToAstar } from '@subwallet/extension-koni-ui/utils';
import { Icon, Logo, Number } from '@subwallet/react-ui';
import CN from 'classnames';
import { CaretRight } from 'phosphor-react';
Expand All @@ -21,7 +22,9 @@ const Component: React.FC<Props> = (props: Props) => {
const { chain, className, isShowBalance, onClick, poolGroup } = props;
const { t } = useTranslation();

const { balance, maxApy, symbol, token } = poolGroup;
const { balance, group, maxApy, symbol, token } = poolGroup;

const _isRelatedToAstar = isRelatedToAstar(group);

return (
<div
Expand Down Expand Up @@ -52,7 +55,7 @@ const Component: React.FC<Props> = (props: Props) => {
</div>

{
!!maxApy && (
!_isRelatedToAstar && !!maxApy && (
<div className='__item-upto'>
<div className='__item-upto-label'>
{t('Up to')}:
Expand Down Expand Up @@ -83,7 +86,7 @@ const Component: React.FC<Props> = (props: Props) => {
</div>
</div>
{
!!maxApy && (
!_isRelatedToAstar && !!maxApy && (
<div className='__item-time'>
{t('per year')}
</div>
Expand All @@ -94,6 +97,14 @@ const Component: React.FC<Props> = (props: Props) => {
</div>

<div className={'__item-right-part'}>
{
_isRelatedToAstar && (
<div className={'__visit-dapp'}>
{t('View on dApp')}
</div>
)
}

<Icon
phosphorIcon={CaretRight}
size='sm'
Expand Down Expand Up @@ -126,7 +137,8 @@ const EarningOptionItem = styled(Component)<Props>(({ theme: { token } }: Props)
'.__item-right-part': {
display: 'flex',
alignItems: 'center',
paddingLeft: 10
paddingLeft: 10,
gap: 10
},

'.__item-logo': {
Expand Down Expand Up @@ -220,6 +232,12 @@ const EarningOptionItem = styled(Component)<Props>(({ theme: { token } }: Props)
fontSize: token.fontSizeSM,
lineHeight: token.lineHeightSM,
color: token.colorTextLight4
},

'.__visit-dapp': {
color: token.colorTextLight4,
fontSize: token.fontSizeSM,
lineHeight: token.lineHeightSM
}
});
});
Expand Down
9 changes: 8 additions & 1 deletion packages/extension-koni-ui/src/utils/earning.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,14 @@ import { Database, HandsClapping, Leaf, User, Users } from 'phosphor-react';

// todo: after supporting Astar v3, remove this
export function isRelatedToAstar (slug: string) {
return ['ASTR___native_staking___astar', 'SDN___native_staking___shiden', 'SDN-Shiden', 'ASTR-Astar'].includes(slug);
return [
'ASTR___native_staking___astar',
'SDN___native_staking___shiden',
'SBY___native_staking___shibuya',
'SDN-Shiden',
'ASTR-Astar',
'shibuya-NATIVE-SBY'
].includes(slug);
}

// todo: About label, will convert to key for i18n later
Expand Down

0 comments on commit 46c7793

Please sign in to comment.