diff --git a/apps/remix-ide/src/app/panels/file-panel.js b/apps/remix-ide/src/app/panels/file-panel.js index b25fe16c82..08e4d8edff 100644 --- a/apps/remix-ide/src/app/panels/file-panel.js +++ b/apps/remix-ide/src/app/panels/file-panel.js @@ -152,6 +152,9 @@ module.exports = class Filepanel extends ViewPlugin { const workspaceProvider = this.fileProviders.workspace this.currentWorkspaceMetadata = { name: workspace.name, isLocalhost: workspace.isLocalhost, absolutePath: `${workspaceProvider.workspacesPath}/${workspace.name}` } + if (workspace.name !== " - connect to localhost - ") { + localStorage.setItem('currentWorkspace', workspace.name) + } else {console.log("ciurrent is")} this.emit('setWorkspace', workspace) } diff --git a/libs/remix-ui/plugin-manager/src/lib/components/LocalPluginForm.tsx b/libs/remix-ui/plugin-manager/src/lib/components/LocalPluginForm.tsx index b9a2a84932..5bac19b432 100644 --- a/libs/remix-ui/plugin-manager/src/lib/components/LocalPluginForm.tsx +++ b/libs/remix-ui/plugin-manager/src/lib/components/LocalPluginForm.tsx @@ -191,7 +191,7 @@ function LocalPluginForm ({ closeModal, visible, pluginManager }: LocalPluginFor type="radio" name="location" value="sidePanel" - id="none" + id="localPluginRadioButtonsidePanelSidePanel" data-id='localPluginRadioButtonsidePanel' checked={location === 'sidePanel'} onChange={(e) => setLocation(e.target.value as 'sidePanel' | 'mainPanel' | 'none')} /> @@ -203,7 +203,7 @@ function LocalPluginForm ({ closeModal, visible, pluginManager }: LocalPluginFor type="radio" name="location" value="mainPanel" - id="none" + id="localPluginRadioButtonsidePanelMainPanel" data-id='localPluginRadioButtonmainPanel' checked={location === 'mainPanel'} onChange={(e) => setLocation(e.target.value as 'sidePanel' | 'mainPanel' | 'none')} /> @@ -215,7 +215,7 @@ function LocalPluginForm ({ closeModal, visible, pluginManager }: LocalPluginFor type="radio" name="location" value="none" - id="none" + id="localPluginRadioButtonsidePanelNone" data-id='localPluginRadioButtonnone' checked={location === 'none'} onChange={(e) => setLocation(e.target.value as 'sidePanel' | 'mainPanel' | 'none')} /> diff --git a/libs/remix-ui/workspace/src/lib/actions/index.ts b/libs/remix-ui/workspace/src/lib/actions/index.ts index 7a5387474b..51e7e68567 100644 --- a/libs/remix-ui/workspace/src/lib/actions/index.ts +++ b/libs/remix-ui/workspace/src/lib/actions/index.ts @@ -127,6 +127,14 @@ export const initWorkspace = (filePanelPlugin) => async (reducerDispatch: React. plugin.on('editor', 'editorMounted', async () => await plugin.fileManager.openFile(route)) } else await basicWorkspaceInit(workspaces, workspaceProvider) } else await basicWorkspaceInit(workspaces, workspaceProvider) + } else if (localStorage.getItem("currentWorkspace")) { + const index = workspaces.indexOf(localStorage.getItem("currentWorkspace")) + if (index !== -1) { + const name = localStorage.getItem("currentWorkspace") + workspaceProvider.setWorkspace(name) + plugin.setWorkspace({ name, isLocalhost: false }) + dispatch(setCurrentWorkspace(name)) + } } else { await basicWorkspaceInit(workspaces, workspaceProvider) } diff --git a/libs/remix-ui/workspace/src/lib/providers/FileSystemProvider.tsx b/libs/remix-ui/workspace/src/lib/providers/FileSystemProvider.tsx index 86f4cccaf2..f754869931 100644 --- a/libs/remix-ui/workspace/src/lib/providers/FileSystemProvider.tsx +++ b/libs/remix-ui/workspace/src/lib/providers/FileSystemProvider.tsx @@ -5,7 +5,9 @@ import { Toaster } from '@remix-ui/toaster' // eslint-disable-line // eslint-disable-next-line @typescript-eslint/no-unused-vars import { FileSystemContext } from '../contexts' import { browserReducer, browserInitialState } from '../reducers/workspace' -import { initWorkspace, fetchDirectory, removeInputField, deleteWorkspace, clearPopUp, publishToGist, createNewFile, setFocusElement, createNewFolder, deletePath, renamePath, copyFile, copyFolder, runScript, emitContextMenuEvent, handleClickFile, handleExpandPath, addInputField, createWorkspace, fetchWorkspaceDirectory, renameWorkspace, switchToWorkspace, uploadFile, handleDownloadFiles, restoreBackupZip, cloneRepository } from '../actions' +import { initWorkspace, fetchDirectory, removeInputField, deleteWorkspace, clearPopUp, publishToGist, createNewFile, setFocusElement, createNewFolder, + deletePath, renamePath, copyFile, copyFolder, runScript, emitContextMenuEvent, handleClickFile, handleExpandPath, addInputField, createWorkspace, + fetchWorkspaceDirectory, renameWorkspace, switchToWorkspace, uploadFile, handleDownloadFiles, restoreBackupZip, cloneRepository } from '../actions' import { Modal, WorkspaceProps, WorkspaceTemplate } from '../types' // eslint-disable-next-line @typescript-eslint/no-unused-vars import { Workspace } from '../remix-ui-workspace' 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 0870442cb2..cd85975ba1 100644 --- a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx +++ b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx @@ -19,6 +19,7 @@ export function Workspace () { const cloneUrlRef = useRef() useEffect(() => { + setCurrentWorkspace(localStorage.getItem('currentWorkspace') ? localStorage.getItem('currentWorkspace') : '') resetFocus() }, []) @@ -102,6 +103,7 @@ export function Workspace () { const workspaceTemplateName = workspaceCreateTemplateInput.current.value || 'remixDefault' try { + console.log("create workspace") await global.dispatchCreateWorkspace(workspaceName, workspaceTemplateName) } catch (e) { global.modal('Create Workspace', e.message, 'OK', () => {}, '') @@ -272,13 +274,13 @@ export function Workspace () { }} data-id={`dropdown-item-${name}`} > - { isGitRepo ? -
- { currentWorkspace === name ? ✓ { name } : { name } } - -
: + { isGitRepo ? +
{ currentWorkspace === name ? ✓ { name } : { name } } - } + +
: + { currentWorkspace === name ? ✓ { name } : { name } } + } )) }