Set clone repository dispatch

pull/2554/head
David Disu 2 years ago
parent 6d9feb5f3e
commit 0aa21b2a6a
  1. 4
      libs/remix-ui/workspace/src/lib/actions/workspace.ts
  2. 3
      libs/remix-ui/workspace/src/lib/contexts/index.ts
  3. 9
      libs/remix-ui/workspace/src/lib/providers/FileSystemProvider.tsx
  4. 3
      libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx

@ -321,3 +321,7 @@ export const getWorkspaces = async (): Promise<string[]> | undefined => {
return workspaces return workspaces
} catch (e) {} } catch (e) {}
} }
export const cloneRepository = async (url: string) => {
console.log('url: ', url)
}

@ -29,5 +29,6 @@ export const FileSystemContext = createContext<{
dispatchHandleClickFile: (path: string, type: 'file' | 'folder' | 'gist') => Promise<void> dispatchHandleClickFile: (path: string, type: 'file' | 'folder' | 'gist') => Promise<void>
dispatchHandleExpandPath: (paths: string[]) => Promise<void>, dispatchHandleExpandPath: (paths: string[]) => Promise<void>,
dispatchHandleDownloadFiles: () => Promise<void>, dispatchHandleDownloadFiles: () => Promise<void>,
dispatchHandleRestoreBackup: () => Promise<void> dispatchHandleRestoreBackup: () => Promise<void>,
dispatchCloneRepository: (url: string) => Promise<void>
}>(null) }>(null)

@ -5,7 +5,7 @@ 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 } 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'
@ -123,6 +123,10 @@ export const FileSystemProvider = (props: WorkspaceProps) => {
await restoreBackupZip() await restoreBackupZip()
} }
const dispatchCloneRepository = async (url: string) => {
await cloneRepository(url)
}
useEffect(() => { useEffect(() => {
dispatchInitWorkspace() dispatchInitWorkspace()
}, []) }, [])
@ -224,7 +228,8 @@ export const FileSystemProvider = (props: WorkspaceProps) => {
dispatchHandleClickFile, dispatchHandleClickFile,
dispatchHandleExpandPath, dispatchHandleExpandPath,
dispatchHandleDownloadFiles, dispatchHandleDownloadFiles,
dispatchHandleRestoreBackup dispatchHandleRestoreBackup,
dispatchCloneRepository
} }
return ( return (
<FileSystemContext.Provider value={value}> <FileSystemContext.Provider value={value}>

@ -215,7 +215,8 @@ export function Workspace () {
className='far fa-upload remixui_menuicon' className='far fa-upload remixui_menuicon'
title='Restore Workspaces Backup'> title='Restore Workspaces Backup'>
</span> </span>
<CloneRepository /> <CloneRepository>
</CloneRepository>
</span> </span>
<select id="workspacesSelect" value={currentWorkspace} data-id="workspacesSelect" onChange={(e) => switchWorkspace(e.target.value)} className="form-control custom-select"> <select id="workspacesSelect" value={currentWorkspace} data-id="workspacesSelect" onChange={(e) => switchWorkspace(e.target.value)} className="form-control custom-select">
{ {

Loading…
Cancel
Save