enable pinning for VM

flakycookbook
aniket-engg 8 months ago committed by Aniket
parent c9513986f3
commit d648928491
  1. 15
      libs/remix-ui/run-tab/src/lib/components/instanceContainerUI.tsx
  2. 5
      libs/remix-ui/run-tab/src/lib/components/universalDappUI.tsx

@ -7,14 +7,10 @@ import { UniversalDappUI } from './universalDappUI'
export function InstanceContainerUI(props: InstanceContainerProps) { export function InstanceContainerUI(props: InstanceContainerProps) {
const { instanceList } = props.instances const { instanceList } = props.instances
const enableSave = useRef(false)
const chainId = useRef() const chainId = useRef()
useEffect(() => { useEffect(() => {
const fetchSavedContracts = async () => { const fetchSavedContracts = async () => {
if (props.plugin.REACT_API.selectExEnv && props.plugin.REACT_API.selectExEnv.startsWith('vm-')) enableSave.current = false
else enableSave.current = true
if (enableSave.current) {
const { network } = await props.plugin.call('blockchain', 'getCurrentNetworkStatus') const { network } = await props.plugin.call('blockchain', 'getCurrentNetworkStatus')
chainId.current = network.id chainId.current = network.id
// Move contract saved in localstorage to Remix FE // Move contract saved in localstorage to Remix FE
@ -54,7 +50,6 @@ export function InstanceContainerUI(props: InstanceContainerProps) {
console.log(err) console.log(err)
} }
} }
}
} }
fetchSavedContracts() fetchSavedContracts()
}, [props.plugin.REACT_API.selectExEnv, props.plugin.REACT_API.networkName]) }, [props.plugin.REACT_API.selectExEnv, props.plugin.REACT_API.networkName])
@ -65,7 +60,6 @@ export function InstanceContainerUI(props: InstanceContainerProps) {
return ( return (
<div className="udapp_instanceContainer mt-3 border-0 list-group-item"> <div className="udapp_instanceContainer mt-3 border-0 list-group-item">
{ enableSave.current ? (
<div className="d-flex justify-content-between align-items-center pl-2"> <div className="d-flex justify-content-between align-items-center pl-2">
<CustomTooltip placement="top-start" tooltipClasses="text-nowrap" tooltipId="deployAndRunPinnedContractsTooltip" tooltipText={<FormattedMessage id="udapp.tooltipTextPinnedContracts" />}> <CustomTooltip placement="top-start" tooltipClasses="text-nowrap" tooltipId="deployAndRunPinnedContractsTooltip" tooltipText={<FormattedMessage id="udapp.tooltipTextPinnedContracts" />}>
<label className="udapp_deployedContracts"> <label className="udapp_deployedContracts">
@ -73,9 +67,9 @@ export function InstanceContainerUI(props: InstanceContainerProps) {
<span style={{fontSize: '0.75rem'}}> (chain id: {chainId.current})</span> <span style={{fontSize: '0.75rem'}}> (chain id: {chainId.current})</span>
</label> </label>
</CustomTooltip> </CustomTooltip>
</div>) : null } </div>
{ enableSave.current ? (
props.savedInstances.instanceList.length > 0 ? ( {props.savedInstances.instanceList.length > 0 ? (
<div> <div>
{' '} {' '}
{props.savedInstances.instanceList.map((instance, index) => { {props.savedInstances.instanceList.map((instance, index) => {
@ -104,8 +98,7 @@ export function InstanceContainerUI(props: InstanceContainerProps) {
<span className="mx-2 mt-2 text-dark" data-id="NoSavedInstanceText"> <span className="mx-2 mt-2 text-dark" data-id="NoSavedInstanceText">
<FormattedMessage id="udapp.NoSavedInstanceText" /> <FormattedMessage id="udapp.NoSavedInstanceText" />
</span> </span>
) )}
) : null }
<div className="d-flex justify-content-between align-items-center pl-2 mb-2 mt-2"> <div className="d-flex justify-content-between align-items-center pl-2 mb-2 mt-2">
<CustomTooltip placement="top-start" tooltipClasses="text-nowrap" tooltipId="deployAndRunClearInstancesTooltip" tooltipText={<FormattedMessage id="udapp.tooltipText6" />}> <CustomTooltip placement="top-start" tooltipClasses="text-nowrap" tooltipId="deployAndRunClearInstancesTooltip" tooltipText={<FormattedMessage id="udapp.tooltipText6" />}>

@ -269,8 +269,7 @@ export function UniversalDappUI(props: UdappProps) {
<div className="btn" style={{padding: '0.15rem'}}> <div className="btn" style={{padding: '0.15rem'}}>
<CopyToClipboard tip={intl.formatMessage({id: 'udapp.copy'})} content={address} direction={'top'} /> <CopyToClipboard tip={intl.formatMessage({id: 'udapp.copy'})} content={address} direction={'top'} />
</div> </div>
{ !(props.plugin.REACT_API.selectExEnv && props.plugin.REACT_API.selectExEnv.startsWith('vm-')) ? { props.isSavedContract ? ( <div className="btn" style={{padding: '0.15rem', marginLeft: '-0.5rem'}}>
props.isSavedContract ? ( <div className="btn" style={{padding: '0.15rem', marginLeft: '-0.5rem'}}>
<CustomTooltip placement="top" tooltipClasses="text-nowrap" tooltipId="udapp_udappUnpinTooltip" tooltipText={<FormattedMessage id="udapp.tooltipTextUnpin" />}> <CustomTooltip placement="top" tooltipClasses="text-nowrap" tooltipId="udapp_udappUnpinTooltip" tooltipText={<FormattedMessage id="udapp.tooltipTextUnpin" />}>
<i className="fas fa-thumbtack p-2 text-success" aria-hidden="true" data-id="universalDappUiUdappUnpin" onClick={remove}></i> <i className="fas fa-thumbtack p-2 text-success" aria-hidden="true" data-id="universalDappUiUdappUnpin" onClick={remove}></i>
</CustomTooltip> </CustomTooltip>
@ -279,7 +278,7 @@ export function UniversalDappUI(props: UdappProps) {
<i className="far fa-thumbtack p-2" aria-hidden="true" data-id="universalDappUiUdappPin" onClick={pinContract}></i> <i className="far fa-thumbtack p-2" aria-hidden="true" data-id="universalDappUiUdappPin" onClick={pinContract}></i>
</CustomTooltip> </CustomTooltip>
</div> ) </div> )
: null} }
</div> </div>
{ props.isSavedContract ? ( <div className="btn" style={{padding: '0.15rem', marginLeft: '-0.5rem'}}> { props.isSavedContract ? ( <div className="btn" style={{padding: '0.15rem', marginLeft: '-0.5rem'}}>
<CustomTooltip placement="top" tooltipClasses="text-nowrap" tooltipId="udapp_udappDeleteTooltip" tooltipText={<FormattedMessage id="udapp.tooltipTextDelete" />}> <CustomTooltip placement="top" tooltipClasses="text-nowrap" tooltipId="udapp_udappDeleteTooltip" tooltipText={<FormattedMessage id="udapp.tooltipTextDelete" />}>

Loading…
Cancel
Save