fix vreating workspace

fixinganerror
yann300 2 years ago committed by lianahus
parent 0acfc5269e
commit 82e50cea74
  1. 2
      apps/remix-ide/src/app/panels/file-panel.js
  2. 33
      libs/remix-ui/home-tab/src/lib/components/homeTabFile.tsx

@ -165,7 +165,7 @@ module.exports = class Filepanel extends ViewPlugin {
saveRecent (workspace) {
if (!localStorage.getItem('recentWorkspaces')) {
localStorage.setItem('recentWorkspaces', JSON.stringify('"first": "", "second": "", "third": ""'))
localStorage.setItem('recentWorkspaces', JSON.stringify(workspace))
} else {
const recents = JSON.parse(localStorage.getItem('recentWorkspaces'))
if (recents.first !== workspace.name && recents.second !== workspace.name && recents.third !== workspace.name) {

@ -115,21 +115,22 @@ function HomeTabFile({plugin}: HomeTabFileProps) {
_paq.push(['trackEvent', 'hometab', 'filesSection', 'startCoding'])
plugin.verticalIcons.select('filePanel')
const wName = 'Coding playground'
const wName = 'Playground'
const workspaces = await plugin.call('filePanel', 'getWorkspaces')
if (!workspaces.find(workspace => workspace.name === wName)) {
await plugin.call('filePanel', 'createWorkspace', wName, 'remixDefault')
await plugin.call('filePanel', 'setWorkspace', wName)
} else {
await plugin.call('filePanel', 'switchToWorkspace', { name: wName, isLocalHost: false })
}
await plugin.call('filePanel', 'switchToWorkspace', { name: wName, isLocalHost: false })
await plugin.call('filePanel', 'switchToWorkspace', { name: wName, isLocalHost: false }) // don't ask why
const content = `
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.0 <0.9.0;
const content = `// SPDX-License-Identifier: MIT
pragma solidity >=0.7.0 <0.9.0;
contract helloWorld {
}
`
contract helloWorld {
}
`
const {newContent, newPath} = await plugin.call('fileManager', 'writeFileNoRewrite', '/contracts/helloWorld.sol', content)
await plugin.call('fileManager', 'open', newPath)
}
@ -173,7 +174,20 @@ function HomeTabFile({plugin}: HomeTabFileProps) {
const handleSwichToRecentWorkspace = async (e, workspaceName) => {
e.preventDefault();
<<<<<<< HEAD
await plugin.call('filePanel', 'switchToWorkspace', { name: workspaceName, isLocalhost: false })
=======
<<<<<<< HEAD
<<<<<<< HEAD
await plugin.call('filePanel', 'switchToWorkspace', { name: workspaceName, isLocalhost: false })
console.log('The link was clicked.');
=======
await plugin.call('filePanel', 'switchToWorkspace', { name: workspaceName, isLocalhost: false })
>>>>>>> e9b2848c5... cleanup fix undefined workspaces. Creating default Workspace
=======
await plugin.call('filePanel', 'switchToWorkspace', { name: workspaceName, isLocalhost: false })
>>>>>>> 06483cab7... fix vreating workspace
>>>>>>> 1b238a875... fix vreating workspace
}
const examples = state.modalInfo.examples.map((urlEl, key) => (
@ -255,7 +269,6 @@ function HomeTabFile({plugin}: HomeTabFileProps) {
/>
</span>
</CustomTooltip>
<CustomTooltip
placement={'top'}
tooltipId="overlay-tooltip"

Loading…
Cancel
Save