Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8e7b3f0

Browse files
feat: upgrade WC approval sheet designs (rainbow-me#4579)
1 parent d68b704 commit 8e7b3f0

File tree

3 files changed

+73
-56
lines changed

3 files changed

+73
-56
lines changed

‎src/languages/_english.json‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1938,7 +1938,9 @@
19381938
"requesting_network": "Requesting %{num} network",
19391939
"requesting_networks": "Requesting %{num} networks",
19401940
"unknown_dapp": "Unknown Dapp",
1941-
"unknown_url": "Unknown URL"
1941+
"unknown_url": "Unknown URL",
1942+
"approval_sheet_network": "Network",
1943+
"approval_sheet_networks": "%{length} Networks"
19421944
},
19431945
"warning": {
19441946
"user_is_offline": "Connection offline, please check your internet connection",

‎src/languages/_french.json‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1939,7 +1939,9 @@
19391939
"requesting_network": "Requesting %{num} network :)",
19401940
"requesting_networks": "Requesting %{num} networks :)",
19411941
"unknown_dapp": "Unknown Dapp :)",
1942-
"unknown_url": "Unknown URL :)"
1942+
"unknown_url": "Unknown URL :)",
1943+
"approval_sheet_network": "Network :)",
1944+
"approval_sheet_networks": "%{length} Networks :)"
19431945
},
19441946
"warning": {
19451947
"user_is_offline": "Hors connexion, veuillez vérifier votre connexion Internet",

‎src/screens/WalletConnectApprovalSheet.js‎

Lines changed: 67 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -153,31 +153,30 @@ const NetworkPill = ({ chainIds }) => {
153153
scaleTo={0.96}
154154
onPress={() => {}}
155155
testID={'available-networks-v2'}
156+
paddingTop="8px"
157+
marginRight={{ custom: -2 }}
156158
>
157159
<Box
158-
borderRadius={99}
159-
paddingVertical="8px"
160-
paddingHorizontal="12px"
161-
justifyContent="center"
160+
flexDirection="row"
161+
justifyContent="flex-end"
162+
alignItems="center"
163+
width="100%"
162164
>
163-
<RadialGradient
164-
{...radialGradientProps}
165-
// @ts-expect-error overloaded props RadialGradient
166-
borderRadius={99}
167-
radius={600}
168-
/>
169-
<Inline alignVertical="center" width="100%">
170-
<Box style={{ flexDirection: 'row' }}>
171-
{availableNetworks?.map((network, index) => {
165+
{availableNetworks.length > 1 ? (
166+
<>
167+
{availableNetworks.map((network, index) => {
172168
return (
173169
<Box
174-
background="body (Deprecated)"
175170
key={`availableNetwork-${network}`}
176-
marginLeft={{ custom: index > 0 ? -4 : 0 }}
171+
marginTop={{ custom: -2 }}
172+
marginLeft={{ custom: index > 0 ? -6 : 0 }}
177173
style={{
174+
position: 'relative',
178175
backgroundColor: colors.transparent,
179-
zIndex: availableNetworks?.length - index,
176+
zIndex: availableNetworks.length - index,
180177
borderRadius: 30,
178+
borderWidth: 2,
179+
borderColor: 'white',
181180
}}
182181
>
183182
{network !== Network.mainnet ? (
@@ -197,26 +196,36 @@ const NetworkPill = ({ chainIds }) => {
197196
</Box>
198197
);
199198
})}
200-
</Box>
201-
202-
<Box paddingHorizontal="12px">
203-
<Text
204-
color="secondary60 (Deprecated)"
205-
size="14px / 19px (Deprecated)"
206-
weight="semibold"
207-
numberOfLines={2}
208-
>
209-
{lang.t(
210-
availableNetworks.length > 1
211-
? lang.l.walletconnect.requesting_networks
212-
: lang.l.walletconnect.requesting_network,
213-
{
214-
num: availableNetworks?.length,
215-
}
216-
)}
217-
</Text>
218-
</Box>
219-
</Inline>
199+
</>
200+
) : (
201+
<Inline alignVertical="center">
202+
{availableNetworks[0] !== Network.mainnet ? (
203+
<ChainBadge
204+
assetType={availableNetworks[0]}
205+
position="relative"
206+
size="small"
207+
/>
208+
) : (
209+
<CoinIcon
210+
address={ETH_ADDRESS}
211+
size={20}
212+
symbol={ETH_SYMBOL}
213+
type={AssetType.token}
214+
/>
215+
)}
216+
217+
<Box paddingLeft="6px">
218+
<Text
219+
color="primary (Deprecated)"
220+
numberOfLines={1}
221+
size="18px / 27px (Deprecated)"
222+
weight="bold"
223+
>
224+
{networkInfo[availableNetworks[0]].name}
225+
</Text>
226+
</Box>
227+
</Inline>
228+
)}
220229
</Box>
221230
</Box>
222231
</ContextMenuButton>
@@ -520,10 +529,12 @@ export default function WalletConnectApprovalSheet() {
520529
weight="heavy"
521530
/>
522531
</SheetActionButtonRow>
523-
<Row justify="space-between" paddingBottom={8} paddingHorizontal={24}>
524-
<Column
525-
style={{ flex: 1, marginRight: isWalletConnectV2 ? 0 : 16 }}
526-
>
532+
<Row
533+
justify="space-between"
534+
paddingBottom={21}
535+
paddingHorizontal={24}
536+
>
537+
<Column style={{ marginRight: 16 }}>
527538
<SwitchText>{lang.t('wallet.wallet_title')}</SwitchText>
528539
<ButtonPressAnimation
529540
onPress={handlePressChangeWallet}
@@ -562,13 +573,20 @@ export default function WalletConnectApprovalSheet() {
562573
)}
563574
</ButtonPressAnimation>
564575
</Column>
565-
{isWalletConnectV2 ? null : (
566-
<Column>
567-
<Flex justify="end">
568-
<SwitchText align="right">
569-
{lang.t('wallet.network_title')}
570-
</SwitchText>
571-
</Flex>
576+
577+
<Column>
578+
<Flex justify="end">
579+
<SwitchText align="right">
580+
{chainIds.length > 1
581+
? lang.t(lang.l.walletconnect.approval_sheet_networks, {
582+
length: chainIds.length,
583+
})
584+
: lang.t(lang.l.walletconnect.approval_sheet_network)}
585+
</SwitchText>
586+
</Flex>
587+
{isWalletConnectV2 ? (
588+
<NetworkPill chainIds={chainIds} />
589+
) : (
572590
<NetworkSwitcherParent
573591
activeOpacity={0}
574592
isMenuPrimaryAction
@@ -612,14 +630,9 @@ export default function WalletConnectApprovalSheet() {
612630
)}
613631
</ButtonPressAnimation>
614632
</NetworkSwitcherParent>
615-
</Column>
616-
)}
633+
)}
634+
</Column>
617635
</Row>
618-
{isWalletConnectV2 && (
619-
<Row paddingBottom={21} paddingHorizontal={24}>
620-
<NetworkPill chainIds={chainIds} />
621-
</Row>
622-
)}
623636
</Flex>
624637
)}
625638
</Sheet>

0 commit comments

Comments
 (0)