Skip to content

Commit 56dc8e2

Browse files
committed
Don't show env select when custom params for wallet url and project key are passed in
1 parent 4c39dee commit 56dc8e2

File tree

1 file changed

+64
-31
lines changed

1 file changed

+64
-31
lines changed

src/App.tsx

+64-31
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,11 @@ const environments: Environment[] = [
5454
name: 'local',
5555
walletUrl: 'http://localhost:3333',
5656
projectAccessKey: 'AQAAAAAAAAVCXiQ9f_57R44MjorZ4SmGdhA'
57+
},
58+
{
59+
name: 'custom',
60+
walletUrl: '',
61+
projectAccessKey: ''
5762
}
5863
]
5964

@@ -79,6 +84,8 @@ const walletAppURL = urlParams.get('walletAppURL') ?? envConfig.walletUrl
7984
const projectAccessKey = urlParams.get('projectAccessKey') ?? envConfig.projectAccessKey
8085
const showProhibitedActions = urlParams.has('showProhibitedActions')
8186

87+
const isCustom = walletAppURL !== envConfig.walletUrl || projectAccessKey !== envConfig.projectAccessKey
88+
8289
if (walletAppURL && walletAppURL.length > 0) {
8390
// Wallet can point to a custom wallet app url
8491
// NOTICE: this is not needed, unless testing an alpha version of the wallet
@@ -993,37 +1000,39 @@ And that has made all the difference.
9931000

9941001
<Divider background="buttonGlass" />
9951002

996-
<Box marginBottom="4">
997-
<Select
998-
name="environment"
999-
label={'Environment'}
1000-
labelLocation="top"
1001-
onValueChange={value => {
1002-
// Disconnect the wallet
1003-
disconnect()
1004-
1005-
// Set the new env url param
1006-
urlParams.set('env', value)
1007-
1008-
// Clear any existing walletAppURL overrides
1009-
urlParams.delete('walletAppURL')
1010-
1011-
// Update the url with the new params and refresh the page
1012-
window.location.search = urlParams.toString()
1013-
}}
1014-
value={env}
1015-
options={[
1016-
...Object.values(environments).map(env => ({
1017-
label: (
1018-
<Box alignItems="center" gap="2">
1019-
<Text capitalize>{env.name}</Text>
1020-
</Box>
1021-
),
1022-
value: String(env.name)
1023-
}))
1024-
]}
1025-
/>
1026-
</Box>
1003+
{!isCustom && (
1004+
<Box marginBottom="4">
1005+
<Select
1006+
name="environment"
1007+
label={'Environment'}
1008+
labelLocation="top"
1009+
onValueChange={value => {
1010+
// Disconnect the wallet
1011+
disconnect()
1012+
1013+
// Set the new env url param
1014+
urlParams.set('env', value)
1015+
1016+
// Clear any existing walletAppURL overrides
1017+
urlParams.delete('walletAppURL')
1018+
1019+
// Update the url with the new params and refresh the page
1020+
window.location.search = urlParams.toString()
1021+
}}
1022+
value={env}
1023+
options={[
1024+
...Object.values(environments).map(env => ({
1025+
label: (
1026+
<Box alignItems="center" gap="2">
1027+
<Text capitalize>{env.name}</Text>
1028+
</Box>
1029+
),
1030+
value: String(env.name)
1031+
}))
1032+
]}
1033+
/>
1034+
</Box>
1035+
)}
10271036

10281037
<Box marginBottom="4">
10291038
<Text as="div" variant="small" color="text100">
@@ -1050,6 +1059,30 @@ And that has made all the difference.
10501059

10511060
<Divider background="buttonGlass" />
10521061

1062+
<Box marginBottom="4">
1063+
<Text as="div" variant="small" color="text100">
1064+
Project Access Key
1065+
</Text>
1066+
1067+
<Box
1068+
as="a"
1069+
href={walletAppURL}
1070+
target="_blank"
1071+
rel="noopener"
1072+
textDecoration="none"
1073+
gap="1"
1074+
marginTop="1"
1075+
alignItems="center"
1076+
color="text80"
1077+
>
1078+
<Text as="div" variant="normal" color="text80">
1079+
{projectAccessKey}
1080+
</Text>
1081+
</Box>
1082+
</Box>
1083+
1084+
<Divider background="buttonGlass" />
1085+
10531086
<Box marginBottom="4">
10541087
<Select
10551088
name="chainId"

0 commit comments

Comments
 (0)