Skip to content

Commit

Permalink
new URL and get feature flag from selector
Browse files Browse the repository at this point in the history
  • Loading branch information
bergeron committed Jun 14, 2024
1 parent 1ca4eac commit 68bd5bc
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions ui/pages/onboarding-flow/privacy-settings/privacy-settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ import {
CHAIN_ID_TO_NETWORK_IMAGE_URL_MAP,
NETWORK_TO_NAME_MAP,
} from '../../../../shared/constants/network';
import { getLocalNetworkMenuRedesignFeatureFlag } from '../../../helpers/utils/feature-flags';
import { Setting } from './setting';

/**
Expand Down Expand Up @@ -170,6 +171,10 @@ export default function PrivacySettings() {
externalServicesOnboardingToggleState,
);

const networkMenuRedesign = useSelector(
getLocalNetworkMenuRedesignFeatureFlag,
);

const handleSubmit = () => {
dispatch(toggleExternalServices(externalServicesOnboardingToggleState));
dispatch(setUsePhishDetect(phishingToggleState));
Expand Down Expand Up @@ -396,7 +401,7 @@ export default function PrivacySettings() {
</a>,
])}

{window.metamaskFeatureFlags?.networkMenuRedesign ? (
{networkMenuRedesign ? (
<Box paddingTop={4}>
<Box
display={Display.Flex}
Expand Down Expand Up @@ -430,17 +435,15 @@ export default function PrivacySettings() {
variant={TextVariant.bodyXs}
color={TextColor.textAlternative}
>
{(function () {
const url = allNetworks.find(
(network) => network.chainId === chainId,
)?.rpcUrl;

// Get just the domain, not the infura key
return url?.slice(
0,
url.indexOf('/', url.indexOf('://') + 3),
);
})()}
{
// Get just the protocol + domain, not the infura key in path
new URL(
allNetworks.find(
(network) =>
network.chainId === chainId,
)?.rpcUrl,
)?.origin
}
</Text>
</Box>
</Box>
Expand Down

0 comments on commit 68bd5bc

Please sign in to comment.