From ed441cbb82554f2ebf5629bb32c0f584afbb0eec Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Fri, 3 Jan 2025 16:31:46 +0530 Subject: [PATCH 01/10] delete forked state provider --- .../lib/components/environment-explorer-ui.tsx | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/libs/remix-ui/environment-explorer/src/lib/components/environment-explorer-ui.tsx b/libs/remix-ui/environment-explorer/src/lib/components/environment-explorer-ui.tsx index a76c319c5bc..9e7502e11bb 100644 --- a/libs/remix-ui/environment-explorer/src/lib/components/environment-explorer-ui.tsx +++ b/libs/remix-ui/environment-explorer/src/lib/components/environment-explorer-ui.tsx @@ -67,6 +67,10 @@ export const EnvironmentExplorerUI = (props: environmentExplorerUIProps) => { }) }, [state]) + const deleteForkedState = async (provider) => { + console.log(provider) + } + return ( <> { }} >
{(section.descriptionFn && section.descriptionFn(provider)) || provider.description}
+ { provider.isForkedState && + deleteForkedState(provider)} + className="btn btn-sm mt-1 border border-danger" + > + Delete + + + } ))} From 273a5487c2fbc7524978a7a98ac9960a4abe773e Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Fri, 3 Jan 2025 17:24:11 +0530 Subject: [PATCH 02/10] delete logic --- .../src/app/providers/environment-explorer.tsx | 16 +++++++++++++++- .../lib/components/environment-explorer-ui.tsx | 10 +++------- .../environment-explorer/src/lib/types/index.ts | 1 + 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/apps/remix-ide/src/app/providers/environment-explorer.tsx b/apps/remix-ide/src/app/providers/environment-explorer.tsx index a38c0d74d3e..cd66a9c405a 100644 --- a/apps/remix-ide/src/app/providers/environment-explorer.tsx +++ b/apps/remix-ide/src/app/providers/environment-explorer.tsx @@ -78,6 +78,15 @@ export class EnvironmentExplorer extends ViewPlugin { } } + async deleteForkedState (provider) { + const providerName = await this.call('blockchain', 'getProvider') + if (providerName !== provider.name) { + await this.call('fileManager', 'remove', `.states/forked_states/${provider.displayName}.json`) + await this.call('blockchain', 'removeProvider', provider.name) + this.call('notification', 'toast', `Environment "${provider.displayName}" deleted successfully.`) + } else this.call('notification', 'toast', 'Cannot delete the current selected environment') + } + renderComponent() { this.dispatch({ ...this.state @@ -86,7 +95,12 @@ export class EnvironmentExplorer extends ViewPlugin { updateComponent(state: EnvironmentExplorerState) { return (<> - + ) } } diff --git a/libs/remix-ui/environment-explorer/src/lib/components/environment-explorer-ui.tsx b/libs/remix-ui/environment-explorer/src/lib/components/environment-explorer-ui.tsx index e31acbf2721..aba9ca640b4 100644 --- a/libs/remix-ui/environment-explorer/src/lib/components/environment-explorer-ui.tsx +++ b/libs/remix-ui/environment-explorer/src/lib/components/environment-explorer-ui.tsx @@ -67,10 +67,6 @@ export const EnvironmentExplorerUI = (props: environmentExplorerUIProps) => { }) }, [state]) - const deleteForkedState = async (provider) => { - console.log(provider) - } - return ( <> { { provider.isForkedState && deleteForkedState(provider)} + onClick={async () => props.deleteForkedState(provider)} className="btn btn-sm mt-1 border border-danger" > - Delete + Delete Environment } diff --git a/libs/remix-ui/environment-explorer/src/lib/types/index.ts b/libs/remix-ui/environment-explorer/src/lib/types/index.ts index 706e577eddf..812a86a6bf9 100644 --- a/libs/remix-ui/environment-explorer/src/lib/types/index.ts +++ b/libs/remix-ui/environment-explorer/src/lib/types/index.ts @@ -8,6 +8,7 @@ export type environmentExplorerUIProps = { providersFlat: { [key: string]: Provider } pinnedProviders: string[] } + deleteForkedState (provider: Provider): Promise pinStateCallback (provider: Provider, pinned: boolean): Promise profile: Profile } From e05828dc1f63f674c9a52f15321e651c4d12614b Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Fri, 3 Jan 2025 17:24:59 +0530 Subject: [PATCH 03/10] fix linting --- .../components/environment-explorer-ui.tsx | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/libs/remix-ui/environment-explorer/src/lib/components/environment-explorer-ui.tsx b/libs/remix-ui/environment-explorer/src/lib/components/environment-explorer-ui.tsx index aba9ca640b4..aabdb6599df 100644 --- a/libs/remix-ui/environment-explorer/src/lib/components/environment-explorer-ui.tsx +++ b/libs/remix-ui/environment-explorer/src/lib/components/environment-explorer-ui.tsx @@ -103,17 +103,17 @@ export const EnvironmentExplorerUI = (props: environmentExplorerUIProps) => { >
{(section.descriptionFn && section.descriptionFn(provider)) || provider.description}
{ provider.isForkedState && - props.deleteForkedState(provider)} - className="btn btn-sm mt-1 border border-danger" - > + placement="auto" + tooltipId={`overlay-tooltip-${provider.name}`} + tooltipText="Delete Environment Immediately" + > + props.deleteForkedState(provider)} + className="btn btn-sm mt-1 border border-danger" + > Delete Environment - - + + } ))} From 7b8507c99ea83a030fb1c5451d20c148ff7ac66c Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Fri, 3 Jan 2025 17:40:03 +0530 Subject: [PATCH 04/10] fix linting for ide --- .../src/app/providers/environment-explorer.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/remix-ide/src/app/providers/environment-explorer.tsx b/apps/remix-ide/src/app/providers/environment-explorer.tsx index cd66a9c405a..dab429a6717 100644 --- a/apps/remix-ide/src/app/providers/environment-explorer.tsx +++ b/apps/remix-ide/src/app/providers/environment-explorer.tsx @@ -95,11 +95,11 @@ export class EnvironmentExplorer extends ViewPlugin { updateComponent(state: EnvironmentExplorerState) { return (<> - ) } From d90c5728c65d116c5859090bd07cde76eea3dfb2 Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Fri, 3 Jan 2025 17:49:09 +0530 Subject: [PATCH 05/10] delete from dropdown --- apps/remix-ide/src/blockchain/blockchain.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/remix-ide/src/blockchain/blockchain.tsx b/apps/remix-ide/src/blockchain/blockchain.tsx index 93c01355b42..85b5ccd9db8 100644 --- a/apps/remix-ide/src/blockchain/blockchain.tsx +++ b/apps/remix-ide/src/blockchain/blockchain.tsx @@ -687,6 +687,7 @@ export class Blockchain extends Plugin { } removeProvider(name) { + if (this.pinnedProviders.includes(name)) this.emit('shouldRemoveProviderFromUdapp', name, this.getProviderObjByName(name)) this.executionContext.removeProvider(name) this.emit('providersChanged') } From 6355f5324523d5ab4c0f284888dea6cedb46ba69 Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Tue, 14 Jan 2025 18:55:58 +0530 Subject: [PATCH 06/10] remove icons --- .../run-tab/src/lib/components/environment.tsx | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/libs/remix-ui/run-tab/src/lib/components/environment.tsx b/libs/remix-ui/run-tab/src/lib/components/environment.tsx index e3faf9938ef..2b3f37f43eb 100644 --- a/libs/remix-ui/run-tab/src/lib/components/environment.tsx +++ b/libs/remix-ui/run-tab/src/lib/components/environment.tsx @@ -117,16 +117,6 @@ export function EnvironmentUI(props: EnvironmentProps) {