diff --git a/libs/remix-ui/run-tab/src/lib/components/environment.tsx b/libs/remix-ui/run-tab/src/lib/components/environment.tsx index be6b4a3f94..0a311deb30 100644 --- a/libs/remix-ui/run-tab/src/lib/components/environment.tsx +++ b/libs/remix-ui/run-tab/src/lib/components/environment.tsx @@ -1,8 +1,13 @@ // eslint-disable-next-line no-use-before-define import React from 'react' import { EnvironmentProps } from '../types' +import { Dropdown } from 'react-bootstrap' +import { CustomMenu, CustomToggle } from '@remix-ui/helper' +import { OverlayTrigger, Tooltip } from 'react-bootstrap' // eslint-disable-line export function EnvironmentUI (props: EnvironmentProps) { + + const handleChangeExEnv = (env: string) => { const provider = props.providers.providerList.find(exEnv => exEnv.value === env) const fork = provider.fork // can be undefined if connected to an external source (web3 provider / injected) @@ -13,22 +18,55 @@ export function EnvironmentUI (props: EnvironmentProps) { props.setExecutionContext({ context, fork }) } + const currentProvider = props.providers.providerList.find(exEnv => exEnv.value === props.selectedEnv) + const bridges = { + 'Optimism Provider': 'https://www.optimism.io/apps/bridges', + 'Arbitrum One Provider': 'https://bridge.arbitrum.io/' + } + + + const isL2 = (provider) => provider && (provider.value === 'Optimism Provider' || provider.value === 'Arbitrum One Provider') return (
- + + + + { isL2(currentProvider) && 'L2 - '} + { currentProvider && currentProvider.content } + { currentProvider && bridges[currentProvider.value] && + Click here to open a bridge. + + }> + + } + + + { + props.providers.providerList.map(({ content, value }, index) => ( + { + handleChangeExEnv(value) + }} + data-id={`dropdown-item-${value}`} + > + { isL2({ value }) && 'L2 - ' }{ content } + + )) + } + +
diff --git a/libs/remix-ui/run-tab/src/lib/css/run-tab.css b/libs/remix-ui/run-tab/src/lib/css/run-tab.css index c4c65e4e01..2921381007 100644 --- a/libs/remix-ui/run-tab/src/lib/css/run-tab.css +++ b/libs/remix-ui/run-tab/src/lib/css/run-tab.css @@ -529,4 +529,7 @@ text-decoration: none; background-color: #007aa6; } +.udapp_selectExEnvOptions { + width: 100%; +}