diff --git a/apps/remix-ide/src/app/files/workspaceFileProvider.js b/apps/remix-ide/src/app/files/workspaceFileProvider.js index bf81a92332..5e59ff4855 100644 --- a/apps/remix-ide/src/app/files/workspaceFileProvider.js +++ b/apps/remix-ide/src/app/files/workspaceFileProvider.js @@ -31,7 +31,6 @@ class WorkspaceFileProvider extends FileProvider { } removePrefix (path) { - // if (!this.workspace) this.createWorkspace() path = path.replace(/^\/|\/$/g, '') // remove first and last slash if (path.startsWith(this.workspacesPath + '/' + this.workspace)) return path if (path.startsWith(this.workspace)) return path.replace(this.workspace, this.workspacesPath + '/' + this.workspace) @@ -52,7 +51,6 @@ class WorkspaceFileProvider extends FileProvider { } resolveDirectory (path, callback) { - // if (!this.workspace) this.createWorkspace() super.resolveDirectory(path, (error, files) => { if (error) return callback(error) const unscoped = {} @@ -77,7 +75,6 @@ class WorkspaceFileProvider extends FileProvider { } _normalizePath (path) { - // if (!this.workspace) this.createWorkspace() return path.replace(this.workspacesPath + '/' + this.workspace + '/', '') } diff --git a/apps/remix-ide/src/app/panels/file-panel.js b/apps/remix-ide/src/app/panels/file-panel.js index c1442aa696..0ab6c0dbc4 100644 --- a/apps/remix-ide/src/app/panels/file-panel.js +++ b/apps/remix-ide/src/app/panels/file-panel.js @@ -54,7 +54,7 @@ module.exports = class Filepanel extends ViewPlugin { this.slitherHandle = new SlitherHandle() this.workspaces = [] this.appManager = appManager - this.workspaceStatus = {} + this.currentWorkspaceInfo = {} } onActivation () { @@ -84,7 +84,7 @@ module.exports = class Filepanel extends ViewPlugin { } getCurrentWorkspace () { - return this.workspaceStatus + return this.currentWorkspaceInfo } getWorkspaces () { @@ -120,7 +120,7 @@ module.exports = class Filepanel extends ViewPlugin { setWorkspace (workspace) { const workspaceProvider = this.fileProviders.workspace - this.workspaceStatus = { name: workspace.name, isLocalhost: workspace.isLocalhost, absolutePath: `${workspaceProvider.workspacesPath}/${workspace.name}` } + this.currentWorkspaceInfo = { name: workspace.name, isLocalhost: workspace.isLocalhost, absolutePath: `${workspaceProvider.workspacesPath}/${workspace.name}` } } workspaceDeleted (workspace) { diff --git a/libs/remix-ui/workspace/src/lib/components/file-label.tsx b/libs/remix-ui/workspace/src/lib/components/file-label.tsx index fe1163e470..0e2fb83829 100644 --- a/libs/remix-ui/workspace/src/lib/components/file-label.tsx +++ b/libs/remix-ui/workspace/src/lib/components/file-label.tsx @@ -1,4 +1,4 @@ -// eslint-disable-next-line @typescript-eslint/no-unused-vars +// eslint-disable-next-line no-use-before-define import React, { useEffect, useRef, useState } from 'react' import { FileType } from '../types' diff --git a/libs/remix-ui/workspace/src/lib/components/file-render.tsx b/libs/remix-ui/workspace/src/lib/components/file-render.tsx index a8fb469373..ac0054e96b 100644 --- a/libs/remix-ui/workspace/src/lib/components/file-render.tsx +++ b/libs/remix-ui/workspace/src/lib/components/file-render.tsx @@ -1,4 +1,4 @@ -// eslint-disable-next-line @typescript-eslint/no-unused-vars +// eslint-disable-next-line no-use-before-define import React, { SyntheticEvent, useEffect, useState } from 'react' import { FileType } from '../types' // eslint-disable-next-line @typescript-eslint/no-unused-vars diff --git a/libs/remix-ui/workspace/src/lib/contexts/index.ts b/libs/remix-ui/workspace/src/lib/contexts/index.ts index 1aedce98b5..6e189693a9 100644 --- a/libs/remix-ui/workspace/src/lib/contexts/index.ts +++ b/libs/remix-ui/workspace/src/lib/contexts/index.ts @@ -4,6 +4,7 @@ import { BrowserState } from '../reducers/workspace' export const FileSystemContext = createContext<{ fs: BrowserState, + // eslint-disable-next-line no-undef modal:(title: string, message: string | JSX.Element, okLabel: string, okFn: () => void, cancelLabel?: string, cancelFn?: () => void) => void, dispatchInitWorkspace:() => Promise, dispatchFetchDirectory:(path: string) => Promise, diff --git a/libs/remix-ui/workspace/src/lib/providers/FileSystemProvider.tsx b/libs/remix-ui/workspace/src/lib/providers/FileSystemProvider.tsx index f2e18f3c07..7d17bdef7f 100644 --- a/libs/remix-ui/workspace/src/lib/providers/FileSystemProvider.tsx +++ b/libs/remix-ui/workspace/src/lib/providers/FileSystemProvider.tsx @@ -1,4 +1,4 @@ -// eslint-disable-next-line @typescript-eslint/no-unused-vars +// eslint-disable-next-line no-use-before-define import React, { useReducer, useState, useEffect, SyntheticEvent } from 'react' import { ModalDialog } from '@remix-ui/modal-dialog' // eslint-disable-line import { Toaster } from '@remix-ui/toaster' // eslint-disable-line @@ -166,6 +166,7 @@ export const FileSystemProvider = (props: WorkspaceProps) => { }) } + // eslint-disable-next-line no-undef const modal = (title: string, message: string | JSX.Element, okLabel: string, okFn: () => void, cancelLabel?: string, cancelFn?: () => void) => { setModals(modals => { modals.push({ message, title, okLabel, okFn, cancelLabel, cancelFn }) diff --git a/libs/remix-ui/workspace/src/lib/types/index.ts b/libs/remix-ui/workspace/src/lib/types/index.ts index 313b705d3b..37f6c22833 100644 --- a/libs/remix-ui/workspace/src/lib/types/index.ts +++ b/libs/remix-ui/workspace/src/lib/types/index.ts @@ -1,4 +1,9 @@ +import React from 'react' import { customAction } from '@remixproject/plugin-api/lib/file-system/file-panel' + +export type action = { name: string, type?: Array<'folder' | 'gist' | 'file'>, path?: string[], extension?: string[], pattern?: string[], id: string, multiselect: boolean, label: string, sticky?: boolean } + +export type MenuItems = action[] export interface WorkspaceProps { plugin: { setWorkspace: ({ name: string, isLocalhost: boolean }, setEvent: boolean) => void, @@ -36,6 +41,7 @@ export interface WorkspaceState { export interface Modal { hide?: boolean title: string + // eslint-disable-next-line no-undef message: string | JSX.Element okLabel: string okFn: () => void @@ -62,6 +68,7 @@ export interface FileExplorerProps { focusEdit: string, focusElement: { key: string, type: 'file' | 'folder' | 'gist' }[], dispatchCreateNewFile: (path: string, rootDir: string) => Promise, + // eslint-disable-next-line no-undef modal:(title: string, message: string | JSX.Element, okLabel: string, okFn: () => void, cancelLabel?: string, cancelFn?: () => void) => void, dispatchCreateNewFolder: (path: string, rootDir: string) => Promise, readonly: boolean, @@ -90,10 +97,6 @@ export interface FileExplorerMenuProps { publishToGist: (path?: string) => void, uploadFile: (target: EventTarget & HTMLInputElement) => void } - -export type action = { name: string, type?: Array<'folder' | 'gist' | 'file'>, path?: string[], extension?: string[], pattern?: string[], id: string, multiselect: boolean, label: string, sticky?: boolean } - -export type MenuItems = action[] export interface FileExplorerContextMenuProps { actions: action[], createNewFile: (folder?: string) => void,