From 5a2e06e41d410512ef4c69e428c75f01fb423422 Mon Sep 17 00:00:00 2001 From: Felix Egbert <47861849+fegbert@users.noreply.github.com> Date: Wed, 23 Feb 2022 15:05:30 +0100 Subject: [PATCH] feat: List localhost:8545 only in dev mode (#109) --- core/src/constants/NETWORKS.ts | 9 ++++++++- frontend/components/layout/Header.stories.js | 10 ++++++++++ frontend/components/layout/Header.vue | 5 +++++ .../modals/ChangePageNetworkModal.stories.js | 13 +++++++++---- .../components/modals/ChangePageNetworkModal.vue | 8 ++++++-- .../components/modals/ChangeWalletNetworkModal.vue | 12 ++++++++---- frontend/components/utils/FormatAddress.vue | 6 +++--- .../components/utils/NetworkSelector.stories.js | 13 +++++++++---- frontend/components/utils/NetworkSelector.vue | 8 ++++++-- frontend/layouts/default.vue | 6 ++++++ 10 files changed, 70 insertions(+), 20 deletions(-) diff --git a/core/src/constants/NETWORKS.ts b/core/src/constants/NETWORKS.ts index fee51a709..38b42c051 100644 --- a/core/src/constants/NETWORKS.ts +++ b/core/src/constants/NETWORKS.ts @@ -81,4 +81,11 @@ export const getNetworkTitleByChainId = function (chainId: string | undefined) { return NETWORK_TITLES[chainId]; }; -export default NETWORKS; +export const getNetworks = function (isDev: boolean): Record { + if (isDev) { + return NETWORKS; + } + //eslint-disable-next-line @typescript-eslint/no-unused-vars + const { localhost, ...otherNetworks } = NETWORKS; + return otherNetworks; +}; diff --git a/frontend/components/layout/Header.stories.js b/frontend/components/layout/Header.stories.js index 9d977feec..8f72ad257 100644 --- a/frontend/components/layout/Header.stories.js +++ b/frontend/components/layout/Header.stories.js @@ -24,6 +24,16 @@ storiesOf('Layout/Header', module) @update:isExplanationsShown="updateIsExplanationsShown" />`, })) + .add('Dev Mode', () => ({ + ...common, + template: `
`, + })) .add('Unified Auctions Page', () => ({ ...common, template: `
@@ -109,6 +110,10 @@ export default Vue.extend({ type: String, default: undefined, }, + isDev: { + type: Boolean, + default: false, + }, }, computed: { isUnifiedPage() { diff --git a/frontend/components/modals/ChangePageNetworkModal.stories.js b/frontend/components/modals/ChangePageNetworkModal.stories.js index 71ef89115..e0a4cea60 100644 --- a/frontend/components/modals/ChangePageNetworkModal.stories.js +++ b/frontend/components/modals/ChangePageNetworkModal.stories.js @@ -12,7 +12,12 @@ const common = { }, }; -storiesOf('Modals/ChangePageNetworkModal', module).add('Default', () => ({ - ...common, - template: '', -})); +storiesOf('Modals/ChangePageNetworkModal', module) + .add('Default', () => ({ + ...common, + template: '', + })) + .add('Dev Mode', () => ({ + ...common, + template: '', + })); diff --git a/frontend/components/modals/ChangePageNetworkModal.vue b/frontend/components/modals/ChangePageNetworkModal.vue index c228b8f9c..20200a088 100644 --- a/frontend/components/modals/ChangePageNetworkModal.vue +++ b/frontend/components/modals/ChangePageNetworkModal.vue @@ -30,7 +30,7 @@