add reducer dispatch function

pull/5065/head
Joseph Izang 4 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>, dispatchDeleteWorkspace: (workspaceName: string) => Promise<void>,
dispatchDeleteAllWorkspaces: () => Promise<void>, dispatchDeleteAllWorkspaces: () => Promise<void>,
dispatchPublishToGist: (path?: string, type?: string) => 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>, dispatchUploadFile: (target?: SyntheticEvent, targetFolder?: string) => Promise<void>,
dispatchUploadFolder: (target?: SyntheticEvent, targetFolder?: string) => Promise<void>, dispatchUploadFolder: (target?: SyntheticEvent, targetFolder?: string) => Promise<void>,
dispatchCreateNewFile: (path: string, rootDir: string) => Promise<void>, dispatchCreateNewFile: (path: string, rootDir: string) => Promise<void>,

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

Loading…
Cancel
Save