Skip to content

Commit

Permalink
wallet-ext: hide staging based on environment variable (MystenLabs#2880)
Browse files Browse the repository at this point in the history
  • Loading branch information
666lcz authored Jun 30, 2022
1 parent 6a274da commit 081b281
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
5 changes: 3 additions & 2 deletions wallet/configs/environment/.env.defaults
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# Default values for some env variables. Use .env to add/change variables for the
# current environment.

API_ENV=staging
API_ENV=devNet
API_ENDPOINT_LOCAL=http://127.0.0.1:5001/
API_ENDPOINT_LOCAL_FULLNODE=http://127.0.0.1:9000/
API_ENDPOINT_DEV_NET=https://gateway.devnet.sui.io/
API_ENDPOINT_DEV_NET_FULLNODE=https://fullnode.devnet.sui.io/
API_ENDPOINT_DEV_NET_FULLNODE=https://fullnode.devnet.sui.io/
API_ENDPOINT_STAGING=https://gateway.staging.sui.io/
API_ENDPOINT_STAGING_FULLNODE=https://fullnode.staging.sui.io/
EXPLORER_URL_LOCAL=http://localhost:8080/
EXPLORER_URL_DEV_NET=https://explorer.devnet.sui.io/
EXPLORER_URL_STAGING=https://explorer.staging.sui.io/
SHOW_STAGING=false
21 changes: 14 additions & 7 deletions wallet/src/ui/app/components/network-switch/NetworkSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,20 @@ const NetworkSelector = () => {
const dispatch = useAppDispatch();
const netWorks = useMemo(
() =>
Object.keys(API_ENV).map((itm) => ({
style: {
color: API_ENV_TO_INFO[itm as keyof typeof API_ENV].color,
},
...API_ENV_TO_INFO[itm as keyof typeof API_ENV],
networkName: itm,
})),
Object.keys(API_ENV)
.filter(
(env) =>
process.env.SHOW_STAGING !== 'false' ||
env !== API_ENV.staging
)
.map((itm) => ({
style: {
color: API_ENV_TO_INFO[itm as keyof typeof API_ENV]
.color,
},
...API_ENV_TO_INFO[itm as keyof typeof API_ENV],
networkName: itm,
})),
[]
);

Expand Down

0 comments on commit 081b281

Please sign in to comment.