add reducer dispatch function

pull/5065/head
Joseph Izang 3 months ago committed by Aniket
parent 3bb5002b7b
commit 26c8b2b305
  1. 1
      libs/remix-ui/workspace/src/lib/contexts/index.ts
  2. 6
      libs/remix-ui/workspace/src/lib/providers/FileSystemProvider.tsx

@ -19,6 +19,7 @@ export const FileSystemContext = createContext<{
dispatchDeleteWorkspace: (workspaceName: string) => Promise<void>,
dispatchDeleteAllWorkspaces: () => Promise<void>,
dispatchPublishToGist: (path?: string, type?: string) => Promise<void>,
dispatchPublishFilesToGist: (selectedFiles: { key: string, type: 'file' | 'folder', content: string }[]) => void,
dispatchUploadFile: (target?: SyntheticEvent, targetFolder?: string) => Promise<void>,
dispatchUploadFolder: (target?: SyntheticEvent, targetFolder?: string) => Promise<void>,
dispatchCreateNewFile: (path: string, rootDir: string) => Promise<void>,

@ -14,6 +14,7 @@ import {
deleteAllWorkspaces,
clearPopUp,
publishToGist,
publishFilesToGist,
createNewFile,
setFocusElement,
createNewFolder,
@ -118,6 +119,10 @@ export const FileSystemProvider = (props: WorkspaceProps) => {
await publishToGist(path)
}
const dispatchPublishFilesToGist = (selectedFiles: { key: string, type: 'file' | 'folder', content: string }[]) => {
publishFilesToGist(selectedFiles)
}
const dispatchUploadFile = async (target?: SyntheticEvent, targetFolder?: string) => {
await uploadFile(target, targetFolder)
}
@ -340,6 +345,7 @@ export const FileSystemProvider = (props: WorkspaceProps) => {
dispatchDeleteWorkspace,
dispatchDeleteAllWorkspaces,
dispatchPublishToGist,
dispatchPublishFilesToGist,
dispatchUploadFile,
dispatchUploadFolder,
dispatchCreateNewFile,

Loading…
Cancel
Save