Skip to content

Commit

Permalink
Merge branch 'x' into fix-expo-notification
Browse files Browse the repository at this point in the history
  • Loading branch information
huhuanming authored Sep 25, 2024
2 parents 2e2192f + 450ca22 commit 36c4244
Show file tree
Hide file tree
Showing 26 changed files with 201 additions and 132 deletions.
1 change: 1 addition & 0 deletions packages/components/src/actions/Trigger/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ function BasicTrigger(
<Stack ref={ref} onLayout={onLayout} onPress={handlePressWithStatus}>
{cloneElement(child, {
onPress: handlePressWithStatus,
disabled,
...props,
} as IButtonProps)}
</Stack>
Expand Down
177 changes: 90 additions & 87 deletions packages/kit/src/views/Earn/EarnHome.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
NumberSizeableText,
Page,
Popover,
ScrollView,
SizableText,
Skeleton,
XStack,
Expand Down Expand Up @@ -713,7 +714,7 @@ function BasicEarnHome() {
() => [
{
'title': intl.formatMessage({
id: ETranslations.earn_stake_in_babylon_ecosystem,
id: ETranslations.earn_banner_stake_in_babylon_ecosystem,
}),
'bannerId': '6f6ffc0e-8c7a-4d86-ad83-fe5629975916',
'imgSource': require('@onekeyhq/kit/assets/bg-mobile.png'),
Expand All @@ -733,114 +734,116 @@ function BasicEarnHome() {
);

return (
<Page scrollEnabled fullPage>
<Page fullPage>
<TabPageHeader
sceneName={EAccountSelectorSceneName.home}
showHeaderRight={false}
/>
<Page.Body py="$5">
{/* container */}
<YStack w="100%" maxWidth={EARN_PAGE_MAX_WIDTH} mx="auto" gap="$4">
{/* overview and banner */}
<YStack
px="$5"
gap="$8"
$gtLg={{
flexDirection: 'row',
}}
>
<Overview isFetchingAccounts={!!isFetchingAccounts} />
<Page.Body>
<ScrollView contentContainerStyle={{ py: '$5' }}>
{/* container */}
<YStack w="100%" maxWidth={EARN_PAGE_MAX_WIDTH} mx="auto" gap="$4">
{/* overview and banner */}
<YStack
minHeight="$36"
$md={{
minHeight: '$28',
}}
borderRadius="$3"
width="100%"
borderCurve="continuous"
px="$5"
gap="$8"
$gtLg={{
w: EARN_RIGHT_PANEL_WIDTH,
flexDirection: 'row',
}}
>
<Banner
height="$36"
<Overview isFetchingAccounts={!!isFetchingAccounts} />
<YStack
minHeight="$36"
$md={{
height: '$28',
minHeight: '$28',
}}
data={bannerData}
onItemPress={onBannerPress}
isLoading={false}
itemTitleContainerStyle={{
top: 0,
bottom: 0,
right: 0,
left: 20,
justifyContent: 'center',
borderRadius="$3"
width="100%"
borderCurve="continuous"
$gtLg={{
w: EARN_RIGHT_PANEL_WIDTH,
}}
/>
>
<Banner
height="$36"
$md={{
height: '$28',
}}
data={bannerData}
onItemPress={onBannerPress}
isLoading={false}
itemTitleContainerStyle={{
top: 0,
bottom: 0,
right: 0,
left: 20,
justifyContent: 'center',
}}
/>
</YStack>
</YStack>
</YStack>
{/* Recommended, available assets and introduction */}
<YStack
px="$5"
gap="$8"
$gtLg={{
flexDirection: 'row',
alignItems: 'flex-start',
}}
>
{/* Recommended, available assets and introduction */}
<YStack
pt="$3.5"
px="$5"
gap="$8"
$gtLg={{
flex: 1,
flexDirection: 'row',
alignItems: 'flex-start',
}}
>
<Recommended isFetchingAccounts={!!isFetchingAccounts} />
<AvailableAssets />
</YStack>
{media.gtLg ? (
<YStack
gap="$6"
p="$4"
borderWidth={StyleSheet.hairlineWidth}
borderColor="$transparent"
borderRadius="$3"
borderCurve="continuous"
bg="$bgSubdued"
$gtMd={{
w: EARN_RIGHT_PANEL_WIDTH,
pt="$3.5"
gap="$8"
$gtLg={{
flex: 1,
}}
>
<SizableText size="$headingSm">
{intl.formatMessage({
id: ETranslations.earn_feature_list_title,
})}
</SizableText>
{INTRODUCTION_ITEMS.map((item, index) => (
<YStack key={index} gap="$3" alignItems="flex-start">
<YStack
p="$2"
bg="$bgStrong"
borderRadius="$3"
borderCurve="continuous"
>
<Icon name={item.icon} color="$iconSubdued" />
</YStack>
<YStack gap="$1.5">
<SizableText size="$bodyMdMedium">
{item.title}
</SizableText>
<SizableText size="$bodyMd" color="$textSubdued">
{item.description}
</SizableText>
</YStack>
</YStack>
))}
<Recommended isFetchingAccounts={!!isFetchingAccounts} />
<AvailableAssets />
</YStack>
) : null}
{media.gtLg ? (
<YStack
gap="$6"
p="$4"
borderWidth={StyleSheet.hairlineWidth}
borderColor="$transparent"
borderRadius="$3"
borderCurve="continuous"
bg="$bgSubdued"
$gtMd={{
w: EARN_RIGHT_PANEL_WIDTH,
}}
>
<SizableText size="$headingSm">
{intl.formatMessage({
id: ETranslations.earn_feature_list_title,
})}
</SizableText>
{INTRODUCTION_ITEMS.map((item, index) => (
<YStack key={index} gap="$3" alignItems="flex-start">
<YStack
p="$2"
bg="$bgStrong"
borderRadius="$3"
borderCurve="continuous"
>
<Icon name={item.icon} color="$iconSubdued" />
</YStack>
<YStack gap="$1.5">
<SizableText size="$bodyMdMedium">
{item.title}
</SizableText>
<SizableText size="$bodyMd" color="$textSubdued">
{item.description}
</SizableText>
</YStack>
</YStack>
))}
</YStack>
) : null}
</YStack>
</YStack>
</YStack>
</ScrollView>
</Page.Body>
</Page>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export default function NotificationsSettings() {
}, [reloadSettings]);

return (
<Page scrollEnabled>
<Page scrollEnabled skipLoading>
<Page.Header
title={intl.formatMessage({ id: ETranslations.global_notifications })}
/>
Expand Down
71 changes: 38 additions & 33 deletions packages/kit/src/views/Staking/pages/AssetProtocolList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ function StakeTypeBadge({
borderCurve="continuous"
px="$2"
py="$0.5"
my="$0.5"
>
<SizableText size="$bodySmMedium" color={color}>
{label}
Expand Down Expand Up @@ -128,33 +129,6 @@ const ProviderTypeBadge = ({
return <StakeTypeBadge stakeType={stakeType} label={label} />;
};

const ProviderStakingBadge = ({ isStaking }: { isStaking?: boolean }) => {
const intl = useIntl();
if (!isStaking) return null;
return (
<StakeTypeBadge
stakeType="default"
label={intl.formatMessage({ id: ETranslations.earn_currently_staking })}
/>
);
};

const ProviderBadges = ({
provider,
}: {
provider?: IStakeProtocolListItem['provider'];
}) => {
if (provider?.type || provider?.isStaking) {
return (
<XStack flexWrap="wrap" gap="$1">
<ProviderTypeBadge type={provider.type} />
<ProviderStakingBadge isStaking={provider.isStaking} />
</XStack>
);
}
return null;
};

const AssetProtocolListContent = ({
items,
}: {
Expand All @@ -164,6 +138,7 @@ const AssetProtocolListContent = ({
IModalStakingParamList,
EModalStakingRoutes.AssetProtocolList
>();
const intl = useIntl();
const { accountId, indexedAccountId, symbol } = appRoute.params;
const appNavigation = useAppNavigation();
const onPress = useCallback(
Expand Down Expand Up @@ -202,8 +177,21 @@ const AssetProtocolListContent = ({
/>
<ListItem.Text
flex={1}
primary={capitalizeString(item.provider.name)}
secondary={<ProviderBadges provider={item.provider} />}
primary={
<XStack gap="$1.5" ai="center">
<SizableText>
{capitalizeString(item.provider.name)}
</SizableText>
<ProviderTypeBadge type={item.provider.type} />
</XStack>
}
secondary={`TVL ${currencySymbol}${formatNumber(
Number(item.provider.totalFiatValue),
)}`}
secondaryTextProps={{
color: '$textSubdued',
size: '$bodyMd',
}}
/>
<ListItem.Text
align="right"
Expand All @@ -212,9 +200,17 @@ const AssetProtocolListContent = ({
? `APR ${BigNumber(item.provider.apr ?? 0).toFixed(2)}%`
: null
}
secondary={`TVL ${currencySymbol}${formatNumber(
Number(item.provider.totalFiatValue),
)}`}
secondary={
item.provider.isStaking
? intl.formatMessage({
id: ETranslations.earn_currently_staking,
})
: ' '
}
secondaryTextProps={{
color: '$textInfo',
size: '$bodyMd',
}}
/>
</ListItem>
)}
Expand Down Expand Up @@ -273,7 +269,16 @@ const AssetProtocolList = () => {
return (
<Page scrollEnabled>
<Page.Header
title={intl.formatMessage({ id: ETranslations.provider_title })}
title={intl.formatMessage(
{
id: symbol
? ETranslations.earn_symbol_staking_provider
: ETranslations.provider_title,
},
{
symbol,
},
)}
headerRight={headerRight}
/>
<Page.Body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -304,12 +304,9 @@ const SwapTokenSelectPage = () => {
moreComponent={
<ActionList
title={tokenItem.tokenSymbol ?? ''}
disabled={rawItem.isNative}
renderTrigger={
<IconButton
variant="tertiary"
icon="DotVerSolid"
disabled={rawItem.isNative}
/>
<IconButton variant="tertiary" icon="DotVerSolid" />
}
items={[
{
Expand Down
3 changes: 3 additions & 0 deletions packages/shared/src/locale/enum/translations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,7 @@
earn_automatically = 'earn.automatically',
earn_available_assets = 'earn.available_assets',
earn_available_assets_desc = 'earn.available_assets_desc',
earn_banner_stake_in_babylon_ecosystem = 'earn.banner_stake_in_babylon_ecosystem',
earn_check_staking_results_overflow = 'earn.check_staking_results_overflow',
earn_claim = 'earn.claim',
earn_claim_assets_after_processing = 'earn.claim_assets_after_processing',
Expand Down Expand Up @@ -424,6 +425,7 @@
earn_staked = 'earn.staked',
earn_staked_value = 'earn.staked_value',
earn_staking_methods = 'earn.staking_methods',
earn_symbol_staking_provider = 'earn.symbol_staking_provider',
earn_term = 'earn.term',
earn_term_tooltip = 'earn.term_tooltip',
earn_token_available_to_stake = 'earn.token_available_to_stake',
Expand Down Expand Up @@ -462,6 +464,7 @@
earn_withdrawal_requested = 'earn.withdrawal_requested',
earn_withdrawal_take_up_to_number_days = 'earn.withdrawal_take_up_to_number_days',
earn_withdrawal_up_to_number_days = 'earn.withdrawal_up_to_number_days',
earn_withdrawn = 'earn.withdrawn',
energy_consumed = 'energy_consumed',
enter_password = 'enter_password',
enter_pin_desc = 'enter_pin.desc',
Expand Down
Loading

0 comments on commit 36c4244

Please sign in to comment.