Skip to content

Commit 3f8bd99

Browse files
author
ci-bot
committed
disable remix compiler if external framework
1 parent 652ad9f commit 3f8bd99

File tree

2 files changed

+86
-22
lines changed

2 files changed

+86
-22
lines changed

libs/remix-ui/solidity-compiler/src/lib/compiler-container.tsx

Lines changed: 72 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -775,39 +775,81 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
775775
tooltipClasses="text-nowrap"
776776
tooltipText={<FormattedMessage id="solidity.addACustomCompilerWithURL" />}
777777
>
778-
<span className="fas fa-plus border-0 p-0 ms-3" onClick={() => promptCompiler()}></span>
778+
<span
779+
className={`fas fa-plus border-0 p-0 ms-3 ${(hhCompilation || foundryCompilation) ? 'text-muted' : ''}`}
780+
onClick={() => !(hhCompilation || foundryCompilation) && promptCompiler()}
781+
style={{
782+
cursor: (hhCompilation || foundryCompilation) ? 'not-allowed' : 'pointer',
783+
opacity: (hhCompilation || foundryCompilation) ? 0.5 : 1
784+
}}
785+
></span>
779786
</CustomTooltip>
780787
<CustomTooltip
781788
placement="bottom"
782789
tooltipId="showCompilerTooltip"
783790
tooltipClasses="text-nowrap"
784791
tooltipText={<FormattedMessage id="solidity.seeCompilerLicense" />}
785792
>
786-
<span className="far fa-file-certificate border-0 p-0 ms-2" onClick={() => showCompilerLicense()}></span>
793+
<span
794+
className={`far fa-file-certificate border-0 p-0 ms-2 ${(hhCompilation || foundryCompilation) ? 'text-muted' : ''}`}
795+
onClick={() => !(hhCompilation || foundryCompilation) && showCompilerLicense()}
796+
style={{
797+
cursor: (hhCompilation || foundryCompilation) ? 'not-allowed' : 'pointer',
798+
opacity: (hhCompilation || foundryCompilation) ? 0.5 : 1
799+
}}
800+
></span>
787801
</CustomTooltip>
788802
{ solJsonBinData && solJsonBinData.selectorList && solJsonBinData.selectorList.length > 0 ? (
789-
<CompilerDropdown
790-
allversions={solJsonBinData.selectorList}
791-
customVersions={state.customVersions}
792-
selectedVersion={state.selectedVersion}
793-
defaultVersion={state.defaultVersion}
794-
handleLoadVersion={handleLoadVersion}
795-
_shouldBeAdded={_shouldBeAdded}
796-
onlyDownloaded={state.onlyDownloaded}
797-
></CompilerDropdown>):null}
803+
<div style={{
804+
pointerEvents: (hhCompilation || foundryCompilation) ? 'none' : 'auto'
805+
}}>
806+
<CompilerDropdown
807+
allversions={solJsonBinData.selectorList}
808+
customVersions={state.customVersions}
809+
selectedVersion={state.selectedVersion}
810+
defaultVersion={state.defaultVersion}
811+
handleLoadVersion={handleLoadVersion}
812+
_shouldBeAdded={_shouldBeAdded}
813+
onlyDownloaded={state.onlyDownloaded}
814+
disabled={hhCompilation || foundryCompilation}
815+
></CompilerDropdown>
816+
</div>
817+
):null}
798818
</div>
799-
<div className="mb-2 flex-row-reverse d-flex flex-row form-check">
819+
<div className={`mb-2 flex-row-reverse d-flex flex-row form-check ${(hhCompilation || foundryCompilation) ? 'text-muted' : ''}`}>
800820
<label htmlFor="nightlies" data-id="compilerNightliesBuild" className="pt-0 form-check-label">
801821
<FormattedMessage id="solidity.includeNightlyBuilds" />
802822
</label>
803-
<input className="me-2 form-check-input" id="nightlies" type="checkbox" onChange={handleNightliesChange} checked={state.includeNightlies} />
823+
<input
824+
className="me-2 form-check-input"
825+
id="nightlies"
826+
type="checkbox"
827+
onChange={handleNightliesChange}
828+
checked={state.includeNightlies}
829+
disabled={hhCompilation || foundryCompilation}
830+
style={{
831+
cursor: (hhCompilation || foundryCompilation) ? 'not-allowed' : 'pointer',
832+
opacity: (hhCompilation || foundryCompilation) ? 0.5 : 1
833+
}}
834+
/>
804835
</div>
805836
{platform === appPlatformTypes.desktop ?
806-
<div className="mb-2 flex-row-reverse d-flex flex-row form-check">
807-
<input className="me-2 form-check-input" id="downloadedcompilers" type="checkbox" onChange={handleOnlyDownloadedChange} checked={state.onlyDownloaded} />
837+
<div className={`mb-2 flex-row-reverse d-flex flex-row form-check ${(hhCompilation || foundryCompilation) ? 'text-muted' : ''}`}>
808838
<label htmlFor="downloadedcompilers" data-id="compilerNightliesBuild" className="form-check-label">
809839
<FormattedMessage id="solidity.downloadedCompilers" />
810840
</label>
841+
<input
842+
className="me-2 form-check-input"
843+
id="downloadedcompilers"
844+
type="checkbox"
845+
onChange={handleOnlyDownloadedChange}
846+
checked={state.onlyDownloaded}
847+
disabled={hhCompilation || foundryCompilation}
848+
style={{
849+
cursor: (hhCompilation || foundryCompilation) ? 'not-allowed' : 'pointer',
850+
opacity: (hhCompilation || foundryCompilation) ? 0.5 : 1
851+
}}
852+
/>
811853
</div>:null}
812854
<div className="mt-2 remixui_compilerConfig form-check">
813855
<input
@@ -924,18 +966,28 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
924966
</div>
925967
)}
926968
</div>
927-
<div className="d-flex px-4 remixui_compilerConfigSection justify-content-between" onClick={() => {
928-
// Track advanced configuration toggle
929-
trackMatomoEvent({ category: 'compilerContainer', action: 'advancedConfigToggle', name: !toggleExpander ? 'expanded' : 'collapsed', isClick: true })
930-
toggleConfigurations()
931-
}}>
969+
<div
970+
className={`d-flex px-4 remixui_compilerConfigSection justify-content-between ${(hhCompilation || foundryCompilation) ? 'text-muted' : ''}`}
971+
onClick={() => {
972+
if (hhCompilation || foundryCompilation) return
973+
// Track advanced configuration toggle
974+
trackMatomoEvent({ category: 'compilerContainer', action: 'advancedConfigToggle', name: !toggleExpander ? 'expanded' : 'collapsed', isClick: true })
975+
toggleConfigurations()
976+
}}
977+
style={{
978+
cursor: (hhCompilation || foundryCompilation) ? 'not-allowed' : 'pointer',
979+
opacity: (hhCompilation || foundryCompilation) ? 0.5 : 1,
980+
pointerEvents: (hhCompilation || foundryCompilation) ? 'none' : 'auto'
981+
}}
982+
>
932983
<div className="d-flex">
933984
<label className="remixui_compilerConfigSection">
934985
<FormattedMessage id="solidity.advancedConfigurations" />
935986
</label>
936987
</div>
937988
<div>
938989
<span data-id="scConfigExpander" onClick={() => {
990+
if (hhCompilation || foundryCompilation) return
939991
// Track advanced configuration toggle
940992
trackMatomoEvent({ category: 'compilerContainer', action: 'advancedConfigToggle', name: !toggleExpander ? 'expanded' : 'collapsed', isClick: true })
941993
toggleConfigurations()

libs/remix-ui/solidity-compiler/src/lib/components/compiler-dropdown.tsx

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ interface compilerDropdownProps {
1919
handleLoadVersion: (url: string) => void,
2020
_shouldBeAdded: (version: string) => boolean,
2121
onlyDownloaded: boolean
22+
disabled: boolean
2223
}
2324

2425
export const CompilerDropdown = (props: compilerDropdownProps) => {
@@ -27,9 +28,20 @@ export const CompilerDropdown = (props: compilerDropdownProps) => {
2728
const { customVersions, selectedVersion, defaultVersion, allversions, handleLoadVersion, _shouldBeAdded, onlyDownloaded } = props
2829
return (
2930
<Dropdown id="versionSelector" data-id="versionSelector">
30-
<Dropdown.Toggle as={CompilerMenuToggle} id="dropdown-custom-components" className="btn btn-light w-100 d-inline-block border form-select" icon={null}>
31+
<Dropdown.Toggle
32+
disabled={props.disabled}
33+
as={CompilerMenuToggle}
34+
id="dropdown-custom-components"
35+
className="btn btn-light w-100 d-inline-block border form-select"
36+
icon={null}
37+
style={{
38+
opacity: props.disabled ? 0.5 : 1,
39+
cursor: props.disabled ? 'not-allowed' : 'pointer',
40+
pointerEvents: props.disabled ? 'none' : 'auto'
41+
}}
42+
>
3143
<div style={{ flexGrow: 1, overflow: 'hidden', display:'flex', justifyContent:'left' }}>
32-
<div className="text-truncate font-sm">
44+
<div className={`text-truncate font-sm ${props.disabled ? 'text-muted' : ''}`}>
3345
{customVersions.map((url, i) => {
3446
if (selectedVersion === url) return (<span data-id="selectedVersion" key={i}>custom</span>)
3547
})}

0 commit comments

Comments
 (0)