From db7b4e381e26db9590259d1d5994bec49da2f6b5 Mon Sep 17 00:00:00 2001 From: ioedeveloper Date: Wed, 10 Nov 2021 15:20:57 +0100 Subject: [PATCH 1/8] Show registered context menu items for both browser and localhost --- libs/remix-ui/workspace/src/lib/reducers/workspace.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libs/remix-ui/workspace/src/lib/reducers/workspace.ts b/libs/remix-ui/workspace/src/lib/reducers/workspace.ts index b92d7b041e..3839d89dbc 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) } } } From 3452454f11cfb09b13809aa435de9741bc03580a Mon Sep 17 00:00:00 2001 From: ioedeveloper Date: Wed, 10 Nov 2021 15:43:04 +0100 Subject: [PATCH 2/8] Expand file path for both browser and localhost --- libs/remix-ui/workspace/src/lib/reducers/workspace.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/remix-ui/workspace/src/lib/reducers/workspace.ts b/libs/remix-ui/workspace/src/lib/reducers/workspace.ts index 3839d89dbc..152b283fa9 100644 --- a/libs/remix-ui/workspace/src/lib/reducers/workspace.ts +++ b/libs/remix-ui/workspace/src/lib/reducers/workspace.ts @@ -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 } } } From c1eb48dd9872db455c3e9993f2a7e6f9bf8d7382 Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 10 Nov 2021 16:44:32 +0100 Subject: [PATCH 3/8] fix tabs appearing twice --- apps/remix-ide/src/app/panels/tab-proxy.js | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/apps/remix-ide/src/app/panels/tab-proxy.js b/apps/remix-ide/src/app/panels/tab-proxy.js index 4f5a030e04..db83672020 100644 --- a/apps/remix-ide/src/app/panels/tab-proxy.js +++ b/apps/remix-ide/src/app/panels/tab-proxy.js @@ -227,22 +227,6 @@ export class TabProxy extends Plugin { tooltip: name, iconClass: helper.getPathIcon(name) }) - 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) - }) - } break } } From 77abc0c21f6d278a679b1dca8d52d4f213975c55 Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 10 Nov 2021 16:59:56 +0100 Subject: [PATCH 4/8] fix linting --- apps/remix-ide/src/app/panels/tab-proxy.js | 1 - 1 file changed, 1 deletion(-) diff --git a/apps/remix-ide/src/app/panels/tab-proxy.js b/apps/remix-ide/src/app/panels/tab-proxy.js index db83672020..a92f89f59a 100644 --- a/apps/remix-ide/src/app/panels/tab-proxy.js +++ b/apps/remix-ide/src/app/panels/tab-proxy.js @@ -218,7 +218,6 @@ export class TabProxy extends Plugin { if (index === -1) { title = formatPath.join('/') - const titleLength = formatPath.length this.loadedTabs.push({ id: name, name, From d9e6a8f663e5e12095127f4fc5701e354e8d594e Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 10 Nov 2021 17:25:57 +0100 Subject: [PATCH 5/8] readd handling duplicate path --- apps/remix-ide/src/app/panels/tab-proxy.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/apps/remix-ide/src/app/panels/tab-proxy.js b/apps/remix-ide/src/app/panels/tab-proxy.js index a92f89f59a..5d053ec3f3 100644 --- a/apps/remix-ide/src/app/panels/tab-proxy.js +++ b/apps/remix-ide/src/app/panels/tab-proxy.js @@ -218,6 +218,7 @@ export class TabProxy extends Plugin { if (index === -1) { title = formatPath.join('/') + const titleLength = formatPath.length this.loadedTabs.push({ id: name, name, @@ -226,6 +227,25 @@ export class TabProxy extends Plugin { tooltip: name, iconClass: helper.getPathIcon(name) }) + formatPath.shift() + if (formatPath.length > 0) { + 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 } } From 9d2e6449eea08767826b57a062c308c59f84f888 Mon Sep 17 00:00:00 2001 From: ioedeveloper Date: Thu, 11 Nov 2021 10:52:25 +0100 Subject: [PATCH 6/8] Fix test --- apps/remix-ide-e2e/src/tests/remixd.test.ts | 1 - 1 file changed, 1 deletion(-) 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 From 7f4bb04dbdfd57cc09fb2a4ea71c928b1705eeb4 Mon Sep 17 00:00:00 2001 From: yann300 Date: Thu, 11 Nov 2021 11:55:50 +0100 Subject: [PATCH 7/8] fix linting --- apps/remix-ide/src/app/panels/tab-proxy.js | 1 - 1 file changed, 1 deletion(-) diff --git a/apps/remix-ide/src/app/panels/tab-proxy.js b/apps/remix-ide/src/app/panels/tab-proxy.js index 5d053ec3f3..f4cc6408c0 100644 --- a/apps/remix-ide/src/app/panels/tab-proxy.js +++ b/apps/remix-ide/src/app/panels/tab-proxy.js @@ -230,7 +230,6 @@ export class TabProxy extends Plugin { formatPath.shift() if (formatPath.length > 0) { const index = this.loadedTabs.findIndex(({ title }) => title === formatPath.join('/')) - if (index > -1) { const duplicateTabName = this.loadedTabs[index].name const duplicateTabPath = duplicateTabName.split('/') From cce3fb941e2d5bd6466006a1e2d0be68441edb4e Mon Sep 17 00:00:00 2001 From: yann300 Date: Thu, 11 Nov 2021 12:27:20 +0100 Subject: [PATCH 8/8] fix production build --- .circleci/config.yml | 21 +++++++++++++++++++ .gitmodules | 3 +++ apps/remix-ide/.babelrc | 3 ++- apps/remix-ide/src/app/panels/tab-proxy.js | 7 +------ .../assets/js/react-tabs.production.min.js | 2 -- babel.config.js | 2 +- libs/remix-ui/tabs/.babelrc | 3 ++- libs/remix-ui/tabs/react-tabs | 1 + libs/remix-ui/tabs/src/lib/remix-ui-tabs.tsx | 5 +---- package.json | 1 + 10 files changed, 33 insertions(+), 15 deletions(-) create mode 100644 .gitmodules delete mode 100644 apps/remix-ide/src/assets/js/react-tabs.production.min.js create mode 160000 libs/remix-ui/tabs/react-tabs 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/.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 f4cc6408c0..5b65254830 100644 --- a/apps/remix-ide/src/app/panels/tab-proxy.js +++ b/apps/remix-ide/src/app/panels/tab-proxy.js @@ -308,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/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",