diff --git a/libs/remix-ui/tabs/src/lib/remix-ui-tabs.tsx b/libs/remix-ui/tabs/src/lib/remix-ui-tabs.tsx index 5662b0d05b..1c407149b7 100644 --- a/libs/remix-ui/tabs/src/lib/remix-ui-tabs.tsx +++ b/libs/remix-ui/tabs/src/lib/remix-ui-tabs.tsx @@ -27,20 +27,17 @@ interface ITabsState { selectedIndex: number, fileDecorations: fileDecoration[], currentExt: string - fileName: string } interface ITabsAction { type: string, payload: any, ext?: string, - fileName?: string } const initialTabsState: ITabsState = { selectedIndex: -1, fileDecorations: [], - currentExt: '', - fileName: '' + currentExt: '' } const tabsReducer = (state: ITabsState, action: ITabsAction) => { @@ -49,7 +46,6 @@ const tabsReducer = (state: ITabsState, action: ITabsAction) => { return { ...state, currentExt: action.ext, - fileName: action.fileName, selectedIndex: action.payload, } case 'SET_FILE_DECORATIONS': @@ -124,7 +120,7 @@ export const TabsUI = (props: TabsUIProps) => { const activateTab = (name: string) => { const index = tabs.current.findIndex((tab) => tab.name === name) currentIndexRef.current = index - dispatch({ type: 'SELECT_INDEX', payload: index, ext: getExt(name), fileName: name}) + dispatch({ type: 'SELECT_INDEX', payload: index, ext: getExt(name)}) } const setFileDecorations = (fileStates: fileDecoration[]) => { @@ -156,6 +152,7 @@ export const TabsUI = (props: TabsUIProps) => { if (ext) return ext[0].toLowerCase() else return '' } + return (
@@ -170,13 +167,10 @@ export const TabsUI = (props: TabsUIProps) => { if (tabsState.currentExt === 'js' || tabsState.currentExt === 'ts') { await props.plugin.call('scriptRunner', 'execute', content, path) _paq.push(['trackEvent', 'editor', 'clickRunFromEditor', tabsState.currentExt]) - } else if (path.endsWith('.script.sol')) { - await props.plugin.call('solidity-script', 'execute', path) - _paq.push(['trackEvent', 'editor', 'clickRunFromEditor', tabsState.currentExt]) } else if (tabsState.currentExt === 'sol' || tabsState.currentExt === 'yul') { await props.plugin.call('solidity', 'compile', path) _paq.push(['trackEvent', 'editor', 'clickRunFromEditor', tabsState.currentExt]) - } + } }} > { tooltipId="overlay-tooltip-run-script" tooltipText={ {(tabsState.currentExt === 'js' || tabsState.currentExt === 'ts') ? "Run script (CTRL + SHIFT + S)" : - (tabsState.fileName && tabsState.fileName.endsWith('.script.sol')) ? "Run Solidity code as a script (free function). This will run the function 'run'" : tabsState.currentExt === 'sol' || tabsState.currentExt === 'yul'? "Compile CTRL + S" : "Select .sol or .yul file to compile or a .ts or .js file and run it"} } >