diff --git a/.circleci/config.yml b/.circleci/config.yml index acc9a0ffb8..e7580743ae 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -72,6 +72,8 @@ jobs: parallelism: 12 steps: - checkout + - run: git submodule sync --recursive + - run: git submodule update --recursive --init - run: npm install - run: npx nx build remix-ide --with-deps - run: @@ -105,6 +107,8 @@ jobs: parallelism: 12 steps: - checkout + - run: git submodule sync --recursive + - run: git submodule update --recursive --init - run: npm install - run: npm run downloadsolc_assets - run: npx nx build remix-ide --with-deps @@ -139,6 +143,8 @@ jobs: parallelism: 12 steps: - checkout + - run: git submodule sync --recursive + - run: git submodule update --recursive --init - run: npm install - run: npx nx build remix-ide --with-deps - run: @@ -172,6 +178,8 @@ jobs: parallelism: 12 steps: - checkout + - run: git submodule sync --recursive + - run: git submodule update --recursive --init - run: npm install - run: npm run downloadsolc_assets - run: npx nx build remix-ide --with-deps @@ -206,6 +214,8 @@ jobs: steps: - checkout + - run: git submodule sync --recursive + - run: git submodule update --recursive --init - run: npm install - run: npx nx build remix-ide --with-deps - run: @@ -239,6 +249,8 @@ jobs: steps: - checkout + - run: git submodule sync --recursive + - run: git submodule update --recursive --init - run: npm install - run: npx nx build remix-ide --with-deps - run: npx nx build remix-ide-e2e-src-local-plugin @@ -254,6 +266,7 @@ jobs: path: ./reports/tests - store_artifacts: path: ./reports/screenshots + deploy-remix-live: docker: # specify the version you desire here @@ -272,6 +285,8 @@ jobs: steps: - checkout + - run: git submodule sync --recursive + - run: git submodule update --recursive --init - run: npm install - run: npm run downloadsolc_assets - run: npm run build:production @@ -300,6 +315,8 @@ jobs: steps: - checkout + - run: git submodule sync --recursive + - run: git submodule update --recursive --init - setup_remote_docker - run: npm install - run: npm run downloadsolc_assets @@ -326,6 +343,8 @@ jobs: steps: - checkout + - run: git submodule sync --recursive + - run: git submodule update --recursive --init - run: npm install - run: npm run downloadsolc_assets - run: npm run build:production @@ -354,6 +373,8 @@ jobs: steps: - checkout + - run: git submodule sync --recursive + - run: git submodule update --recursive --init - run: npm install - run: npm run build:libs - run: npm run downloadsolc_assets diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000000..f3b7f8e547 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "libs/remix-ui/tabs/react-tabs"] + path = libs/remix-ui/tabs/react-tabs + url = https://github.com/reactjs/react-tabs diff --git a/apps/remix-ide-e2e/src/tests/remixd.test.ts b/apps/remix-ide-e2e/src/tests/remixd.test.ts index 293bdb16c0..970a4f556a 100644 --- a/apps/remix-ide-e2e/src/tests/remixd.test.ts +++ b/apps/remix-ide-e2e/src/tests/remixd.test.ts @@ -152,7 +152,6 @@ function runTests (browser: NightwatchBrowser) { }) .clickLaunchIcon('filePanel') .waitForElementVisible('[data-path="folder1"]') - .click('[data-path="folder1"]') .waitForElementVisible('[data-path="folder1/contract1.sol"]') .waitForElementVisible('[data-path="folder1/renamed_contract_' + browserName + '.sol"]') // check if renamed file is preset .waitForElementNotPresent('[data-path="folder1/contract_' + browserName + '.sol"]') // check if renamed (old) file is not present diff --git a/apps/remix-ide/.babelrc b/apps/remix-ide/.babelrc index 2b7bafa5fa..e60d3036a3 100644 --- a/apps/remix-ide/.babelrc +++ b/apps/remix-ide/.babelrc @@ -1,3 +1,4 @@ { - "presets": ["@babel/preset-env", "@babel/preset-react"] + "presets": ["@babel/preset-env", "@babel/preset-react"], + "plugins": ["@babel/plugin-proposal-class-properties"] } diff --git a/apps/remix-ide/src/app/panels/tab-proxy.js b/apps/remix-ide/src/app/panels/tab-proxy.js index 4f5a030e04..5b65254830 100644 --- a/apps/remix-ide/src/app/panels/tab-proxy.js +++ b/apps/remix-ide/src/app/panels/tab-proxy.js @@ -229,19 +229,21 @@ export class TabProxy extends Plugin { }) formatPath.shift() if (formatPath.length > 0) { - const duplicateTabName = this.loadedTabs.find(({ title }) => title === formatPath.join('/')).name - const duplicateTabPath = duplicateTabName.split('/') - const duplicateTabFormatPath = [...duplicateTabPath].reverse() - const duplicateTabTitle = duplicateTabFormatPath.slice(0, titleLength).reverse().join('/') - - this.loadedTabs.push({ - id: duplicateTabName, - name: duplicateTabName, - title: duplicateTabTitle, - icon, - tooltip: duplicateTabName, - iconClass: helper.getPathIcon(duplicateTabName) - }) + const index = this.loadedTabs.findIndex(({ title }) => title === formatPath.join('/')) + if (index > -1) { + const duplicateTabName = this.loadedTabs[index].name + const duplicateTabPath = duplicateTabName.split('/') + const duplicateTabFormatPath = [...duplicateTabPath].reverse() + const duplicateTabTitle = duplicateTabFormatPath.slice(0, titleLength).reverse().join('/') + this.loadedTabs[index] = { + id: duplicateTabName, + name: duplicateTabName, + title: duplicateTabTitle, + icon, + tooltip: duplicateTabName, + iconClass: helper.getPathIcon(duplicateTabName) + } + } } break } @@ -306,13 +308,8 @@ export class TabProxy extends Plugin { } renderTabsbar () { - window.React = React - const script = document.createElement('script') - script.type = 'text/javascript' - script.src = 'assets/js/react-tabs.production.min.js' - document.head.appendChild(script) - script.addEventListener('load', () => this.renderComponent()) this.el = document.createElement('div') + this.renderComponent() return this.el } } diff --git a/apps/remix-ide/src/assets/js/react-tabs.production.min.js b/apps/remix-ide/src/assets/js/react-tabs.production.min.js deleted file mode 100644 index 59f4d0590c..0000000000 --- a/apps/remix-ide/src/assets/js/react-tabs.production.min.js +++ /dev/null @@ -1,2 +0,0 @@ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ReactTabs={},e.React)}(this,(function(e,t){"use strict";function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=n(t);function a(){return(a=Object.assign||function(e){for(var t=1;t=0||(a[n]=e[n]);return a}function i(e){return function(t){return!!t.type&&t.type.tabsRole===e}}var d=i("Tab"),c=i("TabList"),u=i("TabPanel");function f(e,n){return t.Children.map(e,(function(e){return null===e?null:function(e){return d(e)||c(e)||u(e)}(e)?n(e):e.props&&e.props.children&&"object"==typeof e.props.children?t.cloneElement(e,a({},e.props,{children:f(e.props.children,n)})):e}))}function p(e,n){return t.Children.forEach(e,(function(e){null!==e&&(d(e)||u(e)?n(e):e.props&&e.props.children&&"object"==typeof e.props.children&&(c(e)&&n(e),p(e.props.children,n)))}))}function b(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t=this.getTabsCount())){var n=this.props;(0,n.onSelect)(e,n.selectedIndex,t)}},o.getNextTab=function(e){for(var t=this.getTabsCount(),n=e+1;ne;)if(!N(this.getTab(t)))return t;return e},o.getFirstTab=function(){for(var e=this.getTabsCount(),t=0;t string } -declare var ReactTabs: any - export const TabsUI = (props: TabsUIProps) => { - const { Tab, Tabs, TabList, TabPanel } = ReactTabs const [selectedIndex, setSelectedIndex] = useState(-1) const currentIndexRef = useRef(-1) const tabsRef = useRef({}) diff --git a/libs/remix-ui/workspace/src/lib/reducers/workspace.ts b/libs/remix-ui/workspace/src/lib/reducers/workspace.ts index b92d7b041e..152b283fa9 100644 --- a/libs/remix-ui/workspace/src/lib/reducers/workspace.ts +++ b/libs/remix-ui/workspace/src/lib/reducers/workspace.ts @@ -504,11 +504,11 @@ export const browserReducer = (state = browserInitialState, action: Action) => { ...state, browser: { ...state.browser, - contextMenu: state.mode === 'browser' ? addContextMenuItem(state, payload) : state.browser.contextMenu + contextMenu: addContextMenuItem(state, payload) }, localhost: { ...state.localhost, - contextMenu: state.mode === 'localhost' ? addContextMenuItem(state, payload) : state.localhost.contextMenu + contextMenu: addContextMenuItem(state, payload) } } } @@ -520,11 +520,11 @@ export const browserReducer = (state = browserInitialState, action: Action) => { ...state, browser: { ...state.browser, - contextMenu: state.mode === 'browser' ? removeContextMenuItem(state, payload) : state.browser.contextMenu + contextMenu: removeContextMenuItem(state, payload) }, localhost: { ...state.localhost, - contextMenu: state.mode === 'localhost' ? removeContextMenuItem(state, payload) : state.localhost.contextMenu + contextMenu: removeContextMenuItem(state, payload) } } } @@ -536,11 +536,11 @@ export const browserReducer = (state = browserInitialState, action: Action) => { ...state, browser: { ...state.browser, - expandPath: state.mode === 'browser' ? payload : state.browser.expandPath + expandPath: payload }, localhost: { ...state.localhost, - expandPath: state.mode === 'localhost' ? payload : state.localhost.expandPath + expandPath: payload } } } diff --git a/package.json b/package.json index 8faaf4c999..e3fdd751bb 100644 --- a/package.json +++ b/package.json @@ -136,6 +136,7 @@ ] }, "dependencies": { + "@babel/plugin-proposal-class-properties": "^7.16.0", "@erebos/bzz-node": "^0.13.0", "@ethereumjs/block": "^3.5.1", "@ethereumjs/common": "^2.5.0",