fixing conflicts and localhost case

pull/5370/head
lianahus 3 years ago committed by Aniket
parent 6191fd1bad
commit 086bfbe505
  1. 3
      apps/remix-ide/src/app/panels/file-panel.js
  2. 6
      libs/remix-ui/plugin-manager/src/lib/components/LocalPluginForm.tsx
  3. 8
      libs/remix-ui/workspace/src/lib/actions/index.ts
  4. 4
      libs/remix-ui/workspace/src/lib/providers/FileSystemProvider.tsx
  5. 14
      libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx

@ -152,6 +152,9 @@ module.exports = class Filepanel extends ViewPlugin {
const workspaceProvider = this.fileProviders.workspace const workspaceProvider = this.fileProviders.workspace
this.currentWorkspaceMetadata = { name: workspace.name, isLocalhost: workspace.isLocalhost, absolutePath: `${workspaceProvider.workspacesPath}/${workspace.name}` } 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) this.emit('setWorkspace', workspace)
} }

@ -191,7 +191,7 @@ function LocalPluginForm ({ closeModal, visible, pluginManager }: LocalPluginFor
type="radio" type="radio"
name="location" name="location"
value="sidePanel" value="sidePanel"
id="none" id="localPluginRadioButtonsidePanelSidePanel"
data-id='localPluginRadioButtonsidePanel' data-id='localPluginRadioButtonsidePanel'
checked={location === 'sidePanel'} checked={location === 'sidePanel'}
onChange={(e) => setLocation(e.target.value as 'sidePanel' | 'mainPanel' | 'none')} /> onChange={(e) => setLocation(e.target.value as 'sidePanel' | 'mainPanel' | 'none')} />
@ -203,7 +203,7 @@ function LocalPluginForm ({ closeModal, visible, pluginManager }: LocalPluginFor
type="radio" type="radio"
name="location" name="location"
value="mainPanel" value="mainPanel"
id="none" id="localPluginRadioButtonsidePanelMainPanel"
data-id='localPluginRadioButtonmainPanel' data-id='localPluginRadioButtonmainPanel'
checked={location === 'mainPanel'} checked={location === 'mainPanel'}
onChange={(e) => setLocation(e.target.value as 'sidePanel' | 'mainPanel' | 'none')} /> onChange={(e) => setLocation(e.target.value as 'sidePanel' | 'mainPanel' | 'none')} />
@ -215,7 +215,7 @@ function LocalPluginForm ({ closeModal, visible, pluginManager }: LocalPluginFor
type="radio" type="radio"
name="location" name="location"
value="none" value="none"
id="none" id="localPluginRadioButtonsidePanelNone"
data-id='localPluginRadioButtonnone' data-id='localPluginRadioButtonnone'
checked={location === 'none'} checked={location === 'none'}
onChange={(e) => setLocation(e.target.value as 'sidePanel' | 'mainPanel' | 'none')} /> onChange={(e) => setLocation(e.target.value as 'sidePanel' | 'mainPanel' | 'none')} />

@ -127,6 +127,14 @@ export const initWorkspace = (filePanelPlugin) => async (reducerDispatch: React.
plugin.on('editor', 'editorMounted', async () => await plugin.fileManager.openFile(route)) plugin.on('editor', 'editorMounted', async () => await plugin.fileManager.openFile(route))
} else await basicWorkspaceInit(workspaces, workspaceProvider) } else await basicWorkspaceInit(workspaces, workspaceProvider)
} 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 { } else {
await basicWorkspaceInit(workspaces, workspaceProvider) await basicWorkspaceInit(workspaces, workspaceProvider)
} }

@ -5,7 +5,9 @@ import { Toaster } from '@remix-ui/toaster' // eslint-disable-line
// eslint-disable-next-line @typescript-eslint/no-unused-vars // eslint-disable-next-line @typescript-eslint/no-unused-vars
import { FileSystemContext } from '../contexts' import { FileSystemContext } from '../contexts'
import { browserReducer, browserInitialState } from '../reducers/workspace' 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' import { Modal, WorkspaceProps, WorkspaceTemplate } from '../types'
// eslint-disable-next-line @typescript-eslint/no-unused-vars // eslint-disable-next-line @typescript-eslint/no-unused-vars
import { Workspace } from '../remix-ui-workspace' import { Workspace } from '../remix-ui-workspace'

@ -19,6 +19,7 @@ export function Workspace () {
const cloneUrlRef = useRef<HTMLInputElement>() const cloneUrlRef = useRef<HTMLInputElement>()
useEffect(() => { useEffect(() => {
setCurrentWorkspace(localStorage.getItem('currentWorkspace') ? localStorage.getItem('currentWorkspace') : '')
resetFocus() resetFocus()
}, []) }, [])
@ -102,6 +103,7 @@ export function Workspace () {
const workspaceTemplateName = workspaceCreateTemplateInput.current.value || 'remixDefault' const workspaceTemplateName = workspaceCreateTemplateInput.current.value || 'remixDefault'
try { try {
console.log("create workspace")
await global.dispatchCreateWorkspace(workspaceName, workspaceTemplateName) await global.dispatchCreateWorkspace(workspaceName, workspaceTemplateName)
} catch (e) { } catch (e) {
global.modal('Create Workspace', e.message, 'OK', () => {}, '') global.modal('Create Workspace', e.message, 'OK', () => {}, '')
@ -272,13 +274,13 @@ export function Workspace () {
}} }}
data-id={`dropdown-item-${name}`} data-id={`dropdown-item-${name}`}
> >
{ isGitRepo ? { isGitRepo ?
<div className='d-flex justify-content-between'> <div className='d-flex justify-content-between'>
<span>{ currentWorkspace === name ? <span>&#10003; { name } </span> : <span className="pl-3">{ name }</span> }</span>
<i className='fas fa-code-branch pt-1'></i>
</div> :
<span>{ currentWorkspace === name ? <span>&#10003; { name } </span> : <span className="pl-3">{ name }</span> }</span> <span>{ currentWorkspace === name ? <span>&#10003; { name } </span> : <span className="pl-3">{ name }</span> }</span>
} <i className='fas fa-code-branch pt-1'></i>
</div> :
<span>{ currentWorkspace === name ? <span>&#10003; { name } </span> : <span className="pl-3">{ name }</span> }</span>
}
</Dropdown.Item> </Dropdown.Item>
)) ))
} }

Loading…
Cancel
Save