diff --git a/libs/remix-ui/workspace/src/lib/components/electron-menu.tsx b/libs/remix-ui/workspace/src/lib/components/electron-menu.tsx index c633d636a9..3c0a6d2631 100644 --- a/libs/remix-ui/workspace/src/lib/components/electron-menu.tsx +++ b/libs/remix-ui/workspace/src/lib/components/electron-menu.tsx @@ -30,7 +30,8 @@ export const ElectronMenu = () => { } return ( - (isElectron() && global.fs.browser.isSuccessfulWorkspace ? null : + !isElectron() ? null : + (global.fs.browser.isSuccessfulWorkspace ? null : <>
{await openFolderElectron(null)}} className='btn btn-primary'>
{global.fs.browser.recentFolders.length > 0 ? diff --git a/libs/remix-ui/workspace/src/lib/components/file-explorer-context-menu.tsx b/libs/remix-ui/workspace/src/lib/components/file-explorer-context-menu.tsx index 146721b3b4..445778e2ad 100644 --- a/libs/remix-ui/workspace/src/lib/components/file-explorer-context-menu.tsx +++ b/libs/remix-ui/workspace/src/lib/components/file-explorer-context-menu.tsx @@ -5,6 +5,7 @@ import { action, FileExplorerContextMenuProps } from '../types' import '../css/file-explorer-context-menu.css' import { customAction } from '@remixproject/plugin-api' import UploadFile from './upload-file' +import isElectron from 'is-electron' declare global { interface Window { @@ -56,7 +57,8 @@ export const FileExplorerContextMenu = (props: FileExplorerContextMenuProps) => } const itemMatchesCondition = (item: action, itemType: string, itemPath: string) => { - if (item.type && Array.isArray(item.type) && (item.type.findIndex(name => name === itemType) !== -1)) return true + if( isElectron() && item.platform && item.platform === 'browser') return false + else if (item.type && Array.isArray(item.type) && (item.type.findIndex(name => name === itemType) !== -1)) return true else if (item.path && Array.isArray(item.path) && (item.path.findIndex(key => key === itemPath) !== -1)) return true else if (item.extension && Array.isArray(item.extension) && (item.extension.findIndex(ext => itemPath.endsWith(ext)) !== -1)) return true else if (item.pattern && Array.isArray(item.pattern) && (item.pattern.filter(value => itemPath.match(new RegExp(value))).length > 0)) return true diff --git a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx index 74fa74dfda..f4975d3d7e 100644 --- a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx +++ b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx @@ -702,7 +702,7 @@ export function Workspace() { : null} - {currentWorkspace !== LOCALHOST ? ( + {currentWorkspace !== LOCALHOST && !isElectron() ? ( , path?: string[], extension?: string[], pattern?: string[], id: string, multiselect: boolean, label: string, sticky?: boolean, group: number } +export type action = { name: string, type?: Array<'folder' | 'gist' | 'file' | 'workspace'>, path?: string[], extension?: string[], pattern?: string[], id: string, multiselect: boolean, label: string, sticky?: boolean, group: number, platform?: 'electron' | 'browser' } export interface JSONStandardInput { language: "Solidity"; settings?: any, diff --git a/libs/remix-ui/workspace/src/lib/utils/index.ts b/libs/remix-ui/workspace/src/lib/utils/index.ts index 9069e827e0..cdcf7e9d9a 100644 --- a/libs/remix-ui/workspace/src/lib/utils/index.ts +++ b/libs/remix-ui/workspace/src/lib/utils/index.ts @@ -62,7 +62,8 @@ export const contextMenuActions: MenuItems = [{ type: ['file', 'folder', 'workspace'], multiselect: false, label: '', - group: 2 + group: 2, + platform: 'browser' }, { id: 'run', name: 'Run', @@ -76,35 +77,40 @@ export const contextMenuActions: MenuItems = [{ type: ['gist'], multiselect: false, label: '', - group: 4 + group: 4, + platform: 'browser' }, { id: 'publishFolderToGist', name: 'Publish folder to gist', type: ['folder'], multiselect: false, label: '', - group: 4 + group: 4, + platform: 'browser' }, { id: 'publishFileToGist', name: 'Publish file to gist', type: ['file'], multiselect: false, label: '', - group: 4 + group: 4, + platform: 'browser' }, { id: 'uploadFile', name: 'Load a Local File', type: ['folder', 'gist', 'workspace'], multiselect: false, label: 'Load a Local File', - group: 4 + group: 4, + platform: 'browser' }, { id: 'publishToGist', name: 'Push changes to gist', type: ['folder', 'gist'], multiselect: false, label: 'Publish all to Gist', - group: 4 + group: 4, + platform: 'browser' }, { id: 'publishWorkspace', @@ -112,5 +118,6 @@ export const contextMenuActions: MenuItems = [{ type: ['workspace'], multiselect: false, label: '', - group: 4 + group: 4, + platform: 'browser' }] \ No newline at end of file