diff --git a/apps/remix-ide/src/app/tabs/locales/en/home.json b/apps/remix-ide/src/app/tabs/locales/en/home.json
index 066270ef0a..99389282e1 100644
--- a/apps/remix-ide/src/app/tabs/locales/en/home.json
+++ b/apps/remix-ide/src/app/tabs/locales/en/home.json
@@ -68,7 +68,7 @@
"home.seeAllTutorials": "See all tutorials",
"home.maintainedByRemix": "Maintained by Remix",
"home.gitCloneTooltip": "Clone a Github repo to a new workspace",
- "home.gistTooltip": "Import gist to a workspace",
+ "home.gistTooltip": "Open Gist repo",
"home.newFileTooltip": "Add a new file to a workspace"
}
diff --git a/libs/remix-ui/home-tab/src/lib/components/homeTabFile.tsx b/libs/remix-ui/home-tab/src/lib/components/homeTabFile.tsx
index ba7124ae00..e8c01e1891 100644
--- a/libs/remix-ui/home-tab/src/lib/components/homeTabFile.tsx
+++ b/libs/remix-ui/home-tab/src/lib/components/homeTabFile.tsx
@@ -168,7 +168,11 @@ function HomeTabFile({ plugin }: HomeTabFileProps) {
} tooltipTextClasses="border bg-light text-dark p-1 pr-3">
- await plugin.call('filePanel', 'createNewFile')}>
+ {
+ _paq.push(['trackEvent', 'hometab', 'filesSection', 'newFile'])
+ await plugin.call('menuicons', 'select', 'filePanel')
+ await plugin.call('filePanel', 'createNewFile')
+ }}>
@@ -181,9 +185,9 @@ function HomeTabFile({ plugin }: HomeTabFileProps) {
title="open file"
type="file"
id="openFileInput"
- onChange={(event) => {
+ onChange={async (event) => {
event.stopPropagation()
- plugin.verticalIcons.select('filePanel')
+ await plugin.call('menuicons', 'select', 'filePanel')
uploadFile(event.target)
}}
multiple
@@ -193,6 +197,7 @@ function HomeTabFile({ plugin }: HomeTabFileProps) {
} tooltipTextClasses="border bg-light text-dark p-1 pr-3"
>
{
+ _paq.push(['trackEvent', 'hometab', 'filesSection', 'Git Clone'])
await plugin.call('filePanel', 'clone')
}}>
Git Clone
diff --git a/libs/remix-ui/workspace/src/lib/components/file-explorer-menu.tsx b/libs/remix-ui/workspace/src/lib/components/file-explorer-menu.tsx
index 1f4c16da03..63d8c92024 100644
--- a/libs/remix-ui/workspace/src/lib/components/file-explorer-menu.tsx
+++ b/libs/remix-ui/workspace/src/lib/components/file-explorer-menu.tsx
@@ -159,8 +159,10 @@ export const FileExplorerMenu = (props: FileExplorerMenuProps) => {
} else if (action === 'publishToGist' || action == 'updateGist') {
props.publishToGist()
} else if (action === 'importFromIpfs') {
+ _paq.push(['trackEvent', 'fileExplorer', 'fileAction', action])
props.importFromIpfs('Ipfs', 'ipfs hash', ['ipfs://QmQQfBMkpDgmxKzYaoAtqfaybzfgGm9b2LWYyT56Chv6xH'], 'ipfs://')
} else if (action === 'importFromHttps') {
+ _paq.push(['trackEvent', 'fileExplorer', 'fileAction', action])
props.importFromHttps('Https', 'http/https raw content', ['https://raw.githubusercontent.com/OpenZeppelin/openzeppelin-contracts/master/contracts/token/ERC20/ERC20.sol'])
} else {
state.actions[action]()
diff --git a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx
index 3faaf402a6..3da9063576 100644
--- a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx
+++ b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx
@@ -152,7 +152,7 @@ export function Workspace() {
})
}
- const showFullMessage = (title: string, loadItem: string, examples: Array, prefix = '') => {
+ const showFullMessage = async (title: string, loadItem: string, examples: Array, prefix = '') => {
setModalState((prevState) => {
return {
...prevState,
@@ -186,18 +186,11 @@ export function Workspace() {
const workspace = global.plugin.fileManager.getProvider('workspace')
const startsWith = modalState.importSource.substring(0, 4)
if ((type === 'ipfs' || type === 'IPFS') && startsWith !== 'ipfs' && startsWith !== 'IPFS') {
- setState((prevState) => {
+ setModalState((prevState) => {
return { ...prevState, importSource: startsWith + modalState.importSource }
})
- } else {
- global.plugin.call('notification', 'alert', { id: 'homeTabAlert', message: 'The provided value is invalid!' })
- return
}
- if (!startsWith.startsWith('https://') || !startsWith.startsWith('http://')) {
- global.plugin.call('notification', 'alert', { id: 'homeTabAlert', message: 'The provided value is invalid!' })
- return
- }
contentImport.import(
modalState.modalInfo.prefix + modalState.importSource,
(loadingMsg) => dispatch({ tooltip: loadingMsg }),
@@ -232,15 +225,14 @@ export function Workspace() {
/**
* Validate the url fed into the modal for ipfs and https imports
+ * @returns {ValidationResult}
*/
const validateUrlForImport = (input: any) => {
if ((input.trim().startsWith('ipfs://') && input.length > 7) || input.trim().startsWith('https://') || input.trim() !== '') {
- setValidationResult({ valid: true, message: '' })
- return validationResult
+ return { valid: true, message: '' }
} else {
global.plugin.call('notification', 'alert', { id: 'homeTabAlert', message: 'The provided value is invalid!' })
- setValidationResult({ valid: false, message: 'The provided value is invalid!' })
- return validationResult
+ return { valid: false, message: 'The provided value is invalid!' }
}
}
@@ -1477,6 +1469,7 @@ export function Workspace() {
downloadPath={downloadPath}
/>
)}
+
hideFullMessage()}
okFn={() => processLoading(modalState.modalInfo.title)} validationFn={validateUrlForImport}