Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/remix-ide/src/app/files/remixDProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ module.exports = class RemixDProvider {
}

preInit () {
this._registerEvent()
this.event.trigger('loading')
}

init (cb) {
Expand Down
1 change: 1 addition & 0 deletions apps/remix-ide/src/app/files/remixd-handle.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ export class RemixdHandle extends WebsocketPlugin {
label: 'Connect',
fn: () => {
try {
this.locahostProvider.preInit()
super.activate()
setTimeout(() => {
if (!this.socket || (this.socket && this.socket.readyState === 3)) { // 3 means connection closed
Expand Down
45 changes: 29 additions & 16 deletions libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ export const Workspace = (props: WorkspaceProps) => {
setWorkspace(props.workspaces.length > 0 ? props.workspaces[0] : NO_WORKSPACE)
})

props.localhost.event.register('loading', () => {
remixdExplorer.loading()
})

if (props.initialWorkspace) {
props.workspace.setWorkspace(props.initialWorkspace)
setState(prevState => {
Expand Down Expand Up @@ -120,7 +124,8 @@ export const Workspace = (props: WorkspaceProps) => {
fn: () => {}
},
handleHide: null
}
},
loadingLocalhost: false
})

/* workspace creation, renaming and deletion */
Expand Down Expand Up @@ -231,13 +236,18 @@ export const Workspace = (props: WorkspaceProps) => {
if (state.currentWorkspace === LOCALHOST) setWorkspace(NO_WORKSPACE)
props.fileManager.setMode('browser')
setState(prevState => {
return { ...prevState, hideRemixdExplorer: true }
return { ...prevState, hideRemixdExplorer: true, loadingLocalhost: false }
})
},
show: () => {
props.fileManager.setMode('localhost')
setState(prevState => {
return { ...prevState, hideRemixdExplorer: false }
return { ...prevState, hideRemixdExplorer: false, loadingLocalhost: false }
})
},
loading: () => {
setState(prevState => {
return { ...prevState, loadingLocalhost: true }
})
}
}
Expand Down Expand Up @@ -372,19 +382,22 @@ export const Workspace = (props: WorkspaceProps) => {
/>
}
</div>
<div className='pl-2 filesystemexplorer remixui_treeview'>
{ !state.hideRemixdExplorer &&
<FileExplorer
name='localhost'
registry={props.registry}
filesProvider={props.localhost}
menuItems={['createNewFile', 'createNewFolder']}
plugin={props.plugin}
focusRoot={state.reset}
contextMenuItems={props.registeredMenuItems}
/>
}
</div>
{
state.loadingLocalhost ? <div className="text-center py-5"><i className="fas fa-spinner fa-pulse fa-2x"></i></div>
: <div className='pl-2 filesystemexplorer remixui_treeview'>
{ !state.hideRemixdExplorer &&
<FileExplorer
name='localhost'
registry={props.registry}
filesProvider={props.localhost}
menuItems={['createNewFile', 'createNewFolder']}
plugin={props.plugin}
focusRoot={state.reset}
contextMenuItems={props.registeredMenuItems}
/>
}
</div>
}
<div className='pl-2 remixui_treeview'>
{ false && <FileExplorer
name='browser'
Expand Down