From bdaef856f585e89a6f5883b3bd6ff608c0b4fc4d Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Wed, 18 Dec 2024 18:56:11 +0530 Subject: [PATCH] ux and text update --- apps/remix-dapp/src/locales/en/udapp.json | 6 ++--- .../src/app/tabs/locales/en/udapp.json | 6 ++--- .../src/lib/components/environment.tsx | 23 ++++++++++--------- 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/apps/remix-dapp/src/locales/en/udapp.json b/apps/remix-dapp/src/locales/en/udapp.json index ebe7f61e8a..92e2f362e5 100644 --- a/apps/remix-dapp/src/locales/en/udapp.json +++ b/apps/remix-dapp/src/locales/en/udapp.json @@ -51,10 +51,10 @@ "udapp.signature": "signature", "udapp.saveVmStateTitle": "Save VM state", "udapp.saveVmStateLabel": "State Name", - "udapp.saveVmStateTip": "Saved VM states can be pinned as environment using Environment Explorer", + "udapp.saveVmStateTip": "VM state, saved for current workspace, can be pinned as an environment using Environment Explorer", "udapp.resetVmStateTitle": "Reset VM state", - "udapp.resetVmStateDesc1": "Resetting state of selected environment will delete all your previously saved transaction details for selected workspace.", - "udapp.resetVmStateDesc2": "It will also delete data for deployed and pinned contracts.", + "udapp.resetVmStateDesc1": "Resetting state of the selected environment will delete all your previously saved transaction details for current workspace.", + "udapp.resetVmStateDesc2": "It will also delete the data for contracts deployed and pinned for this workspace.", "udapp.resetVmStateDesc3": "Do you want to continue?", "udapp.reset": "Reset", "udapp.injectedTitle": "Unfortunately it's not possible to create an account using injected provider. Please create the account directly from your provider (i.e metamask or other of the same type).", diff --git a/apps/remix-ide/src/app/tabs/locales/en/udapp.json b/apps/remix-ide/src/app/tabs/locales/en/udapp.json index 5de86bb254..6febd2d367 100644 --- a/apps/remix-ide/src/app/tabs/locales/en/udapp.json +++ b/apps/remix-ide/src/app/tabs/locales/en/udapp.json @@ -51,10 +51,10 @@ "udapp.signature": "signature", "udapp.saveVmStateTitle": "Save VM state", "udapp.saveVmStateLabel": "State Name", - "udapp.saveVmStateTip": "Saved VM states can be pinned as environment using Environment Explorer", + "udapp.saveVmStateTip": "VM state, saved for current workspace, can be pinned as an environment using Environment Explorer", "udapp.resetVmStateTitle": "Reset VM state", - "udapp.resetVmStateDesc1": "Resetting state of selected environment will delete all your previously saved transaction details for selected workspace.", - "udapp.resetVmStateDesc2": "It will also delete data for deployed and pinned contracts.", + "udapp.resetVmStateDesc1": "Resetting state of the selected environment will delete all your previously saved transaction details for current workspace.", + "udapp.resetVmStateDesc2": "It will also delete the data for contracts deployed and pinned for this workspace.", "udapp.resetVmStateDesc3": "Do you want to continue?", "udapp.injectedTitle": "Unfortunately it's not possible to create an account using injected provider. Please create the account directly from your provider (i.e metamask or other of the same type).", "udapp.createNewAccount": "Create new account", 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 b329b0c803..61b41d300e 100644 --- a/libs/remix-ui/run-tab/src/lib/components/environment.tsx +++ b/libs/remix-ui/run-tab/src/lib/components/environment.tsx @@ -48,14 +48,14 @@ export function EnvironmentUI(props: EnvironmentProps) { ) } - const resetVmStatePrompt = (context: string) => { + const resetVmStatePrompt = () => { return (
-
-
-

- -
+ +
) } @@ -91,19 +91,20 @@ export function EnvironmentUI(props: EnvironmentProps) { if (contextExists) { props.modal( intl.formatMessage({ id: 'udapp.resetVmStateTitle' }), - resetVmStatePrompt(context), + resetVmStatePrompt(), intl.formatMessage({ id: 'udapp.reset' }), async () => { const currentProvider = await props.runTabPlugin.call('blockchain', 'getCurrentProvider') // Reset environment blocks and account data - currentProvider.resetEnvironment() + await currentProvider.resetEnvironment() // Remove deployed and pinned contracts from UI props.runTabPlugin.REACT_API.instances.instanceList = {} // Delete environment state file await props.runTabPlugin.call('fileManager', 'remove', `.states/${context}/state.json`) - // Delete pinned contracts folder - await props.runTabPlugin.call('fileManager', 'remove', `.deploys/pinned-contracts/${context}`) - props.runTabPlugin.call('notification', 'toast', `VM state reset successfully`) + // If there are pinned contracts, delete pinned contracts folder + const isPinnedContracts = await props.runTabPlugin.call('fileManager', 'exists', `.deploys/pinned-contracts/${context}`) + if(isPinnedContracts) await props.runTabPlugin.call('fileManager', 'remove', `.deploys/pinned-contracts/${context}`) + props.runTabPlugin.call('notification', 'toast', `VM state reset successfully.`) }, intl.formatMessage({ id: 'udapp.cancel' }), null