desktopmerge
filip mertens 1 year ago
parent a92a3dee4d
commit ce89b149a1
  1. 17
      apps/remix-ide/src/app.js
  2. 48
      apps/remix-ide/src/app/files/dgitProvider.ts
  3. 8
      apps/remix-ide/src/app/files/fileManager.ts
  4. 3
      apps/remix-ide/src/app/panels/terminal.js
  5. 4
      apps/remix-ide/src/app/plugins/parser/services/code-parser-antlr-service.ts
  6. 4
      apps/remix-ide/src/app/plugins/parser/services/code-parser-imports.ts
  7. 6
      apps/remix-ide/src/app/plugins/remixd-handle.tsx
  8. 2
      apps/remix-ide/src/app/state/registry.ts
  9. 10
      apps/remix-ide/src/remixAppManager.js
  10. 2
      libs/remix-ui/app/src/index.ts
  11. 8
      libs/remix-ui/app/src/lib/remix-app/context/context.tsx
  12. 5
      libs/remix-ui/home-tab/src/lib/components/homeTabGetStarted.tsx
  13. 7
      libs/remix-ui/home-tab/src/lib/remix-ui-home-tab.tsx
  14. 5
      libs/remix-ui/panel/src/lib/main/main-panel.tsx
  15. 4
      libs/remix-ui/search/src/lib/components/results/SearchHelper.ts
  16. 7
      libs/remix-ui/solidity-compiler/src/lib/compiler-container.tsx
  17. 8
      libs/remix-ui/solidity-unit-testing/src/lib/solidity-unit-testing.tsx
  18. 8
      libs/remix-ui/workspace/src/lib/actions/index.ts
  19. 5
      libs/remix-ui/workspace/src/lib/actions/workspace.ts
  20. 7
      libs/remix-ui/workspace/src/lib/components/electron-menu.tsx
  21. 7
      libs/remix-ui/workspace/src/lib/components/file-explorer-context-menu.tsx
  22. 7
      libs/remix-ui/workspace/src/lib/components/workspace-hamburger-item.tsx
  23. 27
      libs/remix-ui/workspace/src/lib/components/workspace-hamburger.tsx
  24. 6
      libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx
  25. 3
      libs/remix-ui/workspace/src/lib/types/index.ts
  26. 15
      libs/remix-ui/workspace/src/lib/utils/index.ts

@ -71,6 +71,7 @@ const Config = require('./config')
const FileManager = require('./app/files/fileManager') const FileManager = require('./app/files/fileManager')
import FileProvider from "./app/files/fileProvider" import FileProvider from "./app/files/fileProvider"
import { appPlatformTypes } from '@remix-ui/app'
const DGitProvider = require('./app/files/dgitProvider') const DGitProvider = require('./app/files/dgitProvider')
const WorkspaceFileProvider = require('./app/files/workspaceFileProvider') const WorkspaceFileProvider = require('./app/files/workspaceFileProvider')
@ -87,10 +88,22 @@ const Terminal = require('./app/panels/terminal')
const {TabProxy} = require('./app/panels/tab-proxy.js') const {TabProxy} = require('./app/panels/tab-proxy.js')
export class platformApi {
get name () {
return isElectron() ? appPlatformTypes.desktop : appPlatformTypes.web
}
isDesktop () {
return isElectron()
}
}
class AppComponent { class AppComponent {
constructor() { constructor() {
const PlatFormAPi = new platformApi()
Registry.getInstance().put({
api: PlatFormAPi,
name: 'platform'
})
this.appManager = new RemixAppManager({}) this.appManager = new RemixAppManager({})
this.queryParams = new QueryParams() this.queryParams = new QueryParams()
this._components = {} this._components = {}
@ -129,6 +142,8 @@ class AppComponent {
api: this._components.filesProviders, api: this._components.filesProviders,
name: 'fileproviders' name: 'fileproviders'
}) })
} }
async run() { async run() {

@ -14,7 +14,7 @@ import JSZip from 'jszip'
import path from 'path' import path from 'path'
import FormData from 'form-data' import FormData from 'form-data'
import axios from 'axios' import axios from 'axios'
import isElectron from 'is-electron' import Registry from '../state/registry'
const profile = { const profile = {
name: 'dGitProvider', name: 'dGitProvider',
@ -57,7 +57,7 @@ class DGitProvider extends Plugin {
async getGitConfig() { async getGitConfig() {
if (isElectron()) { if ((Registry.getInstance().get('platform').api.isDesktop())) {
return { return {
fs: window.remixFileSystem, fs: window.remixFileSystem,
dir: '/' dir: '/'
@ -89,7 +89,7 @@ class DGitProvider extends Plugin {
} }
async init(input?) { async init(input?) {
if (isElectron()) { if ((Registry.getInstance().get('platform').api.isDesktop())) {
await this.call('isogit', 'init', { await this.call('isogit', 'init', {
defaultBranch: (input && input.branch) || 'main' defaultBranch: (input && input.branch) || 'main'
}) })
@ -105,7 +105,7 @@ class DGitProvider extends Plugin {
} }
async version() { async version() {
if (isElectron()) { if ((Registry.getInstance().get('platform').api.isDesktop())) {
return await this.call('isogit', 'version') return await this.call('isogit', 'version')
} }
@ -115,7 +115,7 @@ class DGitProvider extends Plugin {
async status(cmd) { async status(cmd) {
if (isElectron()) { if ((Registry.getInstance().get('platform').api.isDesktop())) {
const status = await this.call('isogit', 'status', cmd) const status = await this.call('isogit', 'status', cmd)
return status return status
@ -132,7 +132,7 @@ class DGitProvider extends Plugin {
async add(cmd) { async add(cmd) {
if (isElectron()) { if ((Registry.getInstance().get('platform').api.isDesktop())) {
await this.call('isogit', 'add', cmd) await this.call('isogit', 'add', cmd)
} else { } else {
await git.add({ await git.add({
@ -146,7 +146,7 @@ class DGitProvider extends Plugin {
async rm(cmd) { async rm(cmd) {
if (isElectron()) { if ((Registry.getInstance().get('platform').api.isDesktop())) {
await this.call('isogit', 'rm', cmd) await this.call('isogit', 'rm', cmd)
} else { } else {
await git.remove({ await git.remove({
@ -160,7 +160,7 @@ class DGitProvider extends Plugin {
async reset(cmd) { async reset(cmd) {
if (isElectron()) { if ((Registry.getInstance().get('platform').api.isDesktop())) {
await this.call('isogit', 'reset', cmd) await this.call('isogit', 'reset', cmd)
} else { } else {
await git.resetIndex({ await git.resetIndex({
@ -174,7 +174,7 @@ class DGitProvider extends Plugin {
async checkout(cmd, refresh = true) { async checkout(cmd, refresh = true) {
if (isElectron()) { if ((Registry.getInstance().get('platform').api.isDesktop())) {
await this.call('isogit', 'checkout', cmd) await this.call('isogit', 'checkout', cmd)
} else { } else {
await git.checkout({ await git.checkout({
@ -192,7 +192,7 @@ class DGitProvider extends Plugin {
async log(cmd) { async log(cmd) {
if (isElectron()) { if ((Registry.getInstance().get('platform').api.isDesktop())) {
const status = await this.call('isogit', 'log', { const status = await this.call('isogit', 'log', {
...cmd, ...cmd,
depth: 10 depth: 10
@ -211,7 +211,7 @@ class DGitProvider extends Plugin {
} }
async remotes(config) { async remotes(config) {
if (isElectron()) { if ((Registry.getInstance().get('platform').api.isDesktop())) {
return await this.call('isogit', 'remotes', config) return await this.call('isogit', 'remotes', config)
} }
@ -227,7 +227,7 @@ class DGitProvider extends Plugin {
async branch(cmd, refresh = true) { async branch(cmd, refresh = true) {
let status let status
if (isElectron()) { if ((Registry.getInstance().get('platform').api.isDesktop())) {
status = await this.call('isogit', 'branch', cmd) status = await this.call('isogit', 'branch', cmd)
} else { } else {
status = await git.branch({ status = await git.branch({
@ -248,7 +248,7 @@ class DGitProvider extends Plugin {
if (isElectron()) { if ((Registry.getInstance().get('platform').api.isDesktop())) {
return await this.call('isogit', 'currentbranch') return await this.call('isogit', 'currentbranch')
} }
@ -265,7 +265,7 @@ class DGitProvider extends Plugin {
async branches(config) { async branches(config) {
if (isElectron()) { if ((Registry.getInstance().get('platform').api.isDesktop())) {
return await this.call('isogit', 'branches') return await this.call('isogit', 'branches')
} }
@ -288,7 +288,7 @@ class DGitProvider extends Plugin {
async commit(cmd) { async commit(cmd) {
if (isElectron()) { if ((Registry.getInstance().get('platform').api.isDesktop())) {
try { try {
await this.call('isogit', 'init') await this.call('isogit', 'init')
const sha = await this.call('isogit', 'commit', cmd) const sha = await this.call('isogit', 'commit', cmd)
@ -315,7 +315,7 @@ class DGitProvider extends Plugin {
async lsfiles(cmd) { async lsfiles(cmd) {
if (isElectron()) { if ((Registry.getInstance().get('platform').api.isDesktop())) {
return await this.call('isogit', 'lsfiles', cmd) return await this.call('isogit', 'lsfiles', cmd)
} }
@ -328,7 +328,7 @@ class DGitProvider extends Plugin {
async resolveref(cmd) { async resolveref(cmd) {
if (isElectron()) { if ((Registry.getInstance().get('platform').api.isDesktop())) {
return await this.call('isogit', 'resolveref', cmd) return await this.call('isogit', 'resolveref', cmd)
} }
@ -340,7 +340,7 @@ class DGitProvider extends Plugin {
} }
async readblob(cmd) { async readblob(cmd) {
if (isElectron()) { if ((Registry.getInstance().get('platform').api.isDesktop())) {
const readBlobResult = await this.call('isogit', 'readblob', cmd) const readBlobResult = await this.call('isogit', 'readblob', cmd)
return readBlobResult return readBlobResult
} }
@ -370,7 +370,7 @@ class DGitProvider extends Plugin {
} }
async addremote(input) { async addremote(input) {
if (isElectron()) { if ((Registry.getInstance().get('platform').api.isDesktop())) {
await this.call('isogit', 'addremote', { url: input.url, remote: input.remote }) await this.call('isogit', 'addremote', { url: input.url, remote: input.remote })
return return
} }
@ -378,7 +378,7 @@ class DGitProvider extends Plugin {
} }
async delremote(input) { async delremote(input) {
if (isElectron()) { if ((Registry.getInstance().get('platform').api.isDesktop())) {
await this.call('isogit', 'delremote', { remote: input.remote }) await this.call('isogit', 'delremote', { remote: input.remote })
return return
} }
@ -391,7 +391,7 @@ class DGitProvider extends Plugin {
async clone(input, workspaceName, workspaceExists = false) { async clone(input, workspaceName, workspaceExists = false) {
if (isElectron()) { if ((Registry.getInstance().get('platform').api.isDesktop())) {
const folder = await this.call('fs', 'selectFolder') const folder = await this.call('fs', 'selectFolder')
if (!folder) return false if (!folder) return false
const cmd = { const cmd = {
@ -442,7 +442,7 @@ class DGitProvider extends Plugin {
}, },
input, input,
} }
if (isElectron()) { if ((Registry.getInstance().get('platform').api.isDesktop())) {
return await this.call('isogit', 'push', cmd) return await this.call('isogit', 'push', cmd)
} else { } else {
@ -470,7 +470,7 @@ class DGitProvider extends Plugin {
input, input,
} }
let result let result
if (isElectron()) { if ((Registry.getInstance().get('platform').api.isDesktop())) {
result = await this.call('isogit', 'pull', cmd) result = await this.call('isogit', 'pull', cmd)
} }
else { else {
@ -501,7 +501,7 @@ class DGitProvider extends Plugin {
input input
} }
let result let result
if (isElectron()) { if ((Registry.getInstance().get('platform').api.isDesktop())) {
result = await this.call('isogit', 'fetch', cmd) result = await this.call('isogit', 'fetch', cmd)
} else { } else {
const cmd2 = { const cmd2 = {

@ -10,8 +10,6 @@ import { fileChangedToastMsg, recursivePasteToastMsg, storageFullMessage } from
import helper from '../../lib/helper.js' import helper from '../../lib/helper.js'
import { RemixAppManager } from '../../remixAppManager' import { RemixAppManager } from '../../remixAppManager'
import isElectron from 'is-electron'
/* /*
attach to files event (removed renamed) attach to files event (removed renamed)
trigger: currentFileChanged trigger: currentFileChanged
@ -157,7 +155,7 @@ class FileManager extends Plugin {
refresh() { refresh() {
const provider = this.fileProviderOf('/') const provider = this.fileProviderOf('/')
// emit rootFolderChanged so that File Explorer reloads the file tree // emit rootFolderChanged so that File Explorer reloads the file tree
if(isElectron()){ if(Registry.getInstance().get('platform').api.isDesktop()){
provider.event.emit('refresh') provider.event.emit('refresh')
}else{ }else{
provider.event.emit('rootFolderChanged', provider.workspace || '/') provider.event.emit('rootFolderChanged', provider.workspace || '/')
@ -791,7 +789,7 @@ class FileManager extends Plugin {
return this._deps.filesProviders.localhost return this._deps.filesProviders.localhost
} }
if(isElectron()){ if(Registry.getInstance().get('platform').api.isDesktop()){
return this._deps.filesProviders.electron return this._deps.filesProviders.electron
} }
return this._deps.filesProviders.workspace return this._deps.filesProviders.workspace
@ -916,7 +914,7 @@ class FileManager extends Plugin {
} }
currentWorkspace() { currentWorkspace() {
if(isElectron()){ if(Registry.getInstance().get('platform').api.isDesktop()){
return '' return ''
} }

@ -6,7 +6,6 @@ import * as packageJson from '../../../../../package.json'
import Registry from '../state/registry' import Registry from '../state/registry'
import { PluginViewWrapper } from '@remix-ui/helper' import { PluginViewWrapper } from '@remix-ui/helper'
import vm from 'vm' import vm from 'vm'
import isElectron from 'is-electron'
const EventManager = require('../../lib/events') const EventManager = require('../../lib/events')
import { CompilerImports } from '@remix-project/core-plugin' // eslint-disable-line import { CompilerImports } from '@remix-project/core-plugin' // eslint-disable-line
@ -115,7 +114,7 @@ class Terminal extends Plugin {
} }
updateComponent(state) { updateComponent(state) {
return isElectron() ? <RemixUiXterminals onReady={state.onReady} plugin={state.plugin}> return (Registry.getInstance().get('platform').api.isDesktop()) ? <RemixUiXterminals onReady={state.onReady} plugin={state.plugin}>
</RemixUiXterminals> </RemixUiXterminals>
: <RemixUiTerminal : <RemixUiTerminal
plugin={state.plugin} plugin={state.plugin}

@ -4,7 +4,7 @@ import { AstNode } from "@remix-project/remix-solidity"
import { CodeParser } from "../code-parser" import { CodeParser } from "../code-parser"
import { antlr } from '../types' import { antlr } from '../types'
import { pathToFileURL } from 'url' import { pathToFileURL } from 'url'
import isElectron from 'is-electron' import Registry from "../../../state/registry"
const SolidityParser = (window as any).SolidityParser = (window as any).SolidityParser || [] const SolidityParser = (window as any).SolidityParser = (window as any).SolidityParser || []
@ -46,7 +46,7 @@ export default class CodeParserAntlrService {
this.worker = new Worker(new URL('./antlr-worker', import.meta.url)) this.worker = new Worker(new URL('./antlr-worker', import.meta.url))
this.worker.postMessage({ this.worker.postMessage({
cmd: 'load', cmd: 'load',
url: isElectron() ? 'assets/js/parser/antlr.js' : document.location.protocol + '//' + document.location.host + '/assets/js/parser/antlr.js', url: Registry.getInstance().get('platform').api.isDesktop() ? 'assets/js/parser/antlr.js' : document.location.protocol + '//' + document.location.host + '/assets/js/parser/antlr.js',
}) })
const self = this const self = this

@ -1,6 +1,6 @@
'use strict' 'use strict'
import Registry from "../../../state/registry";
import { CodeParser } from "../code-parser"; import { CodeParser } from "../code-parser";
import isElectron from 'is-electron'
export type CodeParserImportsData = { export type CodeParserImportsData = {
files?: string[], files?: string[],
@ -40,7 +40,7 @@ export default class CodeParserImports {
} }
setFileTree = async () => { setFileTree = async () => {
if (isElectron()) { if (Registry.getInstance().get('platform').api.isDesktop()) {
const files = await this.plugin.call('ripgrep', 'glob', '/', '**/*.sol') const files = await this.plugin.call('ripgrep', 'glob', '/', '**/*.sol')
// only get path property of files // only get path property of files
this.data.files = files.map((x) => x.path) this.data.files = files.map((x) => x.path)

@ -1,12 +1,12 @@
/* eslint-disable no-unused-vars */ /* eslint-disable no-unused-vars */
import React, {useRef, useState, useEffect} from 'react' // eslint-disable-line import React, {useRef, useState, useEffect} from 'react' // eslint-disable-line
import isElectron from 'is-electron'
import {WebsocketPlugin} from '@remixproject/engine-web' import {WebsocketPlugin} from '@remixproject/engine-web'
import * as packageJson from '../../../../../package.json' import * as packageJson from '../../../../../package.json'
// eslint-disable-next-line @nrwl/nx/enforce-module-boundaries // eslint-disable-next-line @nrwl/nx/enforce-module-boundaries
import {version as remixdVersion} from '../../../../../libs/remixd/package.json' import {version as remixdVersion} from '../../../../../libs/remixd/package.json'
import {PluginManager} from '@remixproject/engine' import {PluginManager} from '@remixproject/engine'
import {AppModal, AlertModal} from '@remix-ui/app' import {AppModal, AlertModal, appPlatformTypes} from '@remix-ui/app'
import Registry from '../state/registry'
const LOCALHOST = ' - connect to localhost - ' const LOCALHOST = ' - connect to localhost - '
@ -112,7 +112,7 @@ export class RemixdHandle extends WebsocketPlugin {
} }
if (this.localhostProvider.isConnected()) { if (this.localhostProvider.isConnected()) {
this.deactivate() this.deactivate()
} else if (!isElectron()) { } else if (!(Registry.getInstance().get('platform').api.isDektop())) {
// warn the user only if he/she is in the browser context // warn the user only if he/she is in the browser context
const mod: AppModal = { const mod: AppModal = {
id: 'remixdConnect', id: 'remixdConnect',

@ -29,7 +29,7 @@ export default class Registry {
return server return server
} }
public get (name: string) { public get (name: string): registryEntry {
const state = this.state[name] const state = this.state[name]
if (!state) return if (!state) return
const server = state.server const server = state.server

@ -2,7 +2,8 @@ import {PluginManager} from '@remixproject/engine'
import {EventEmitter} from 'events' import {EventEmitter} from 'events'
import {QueryParams} from '@remix-project/remix-lib' import {QueryParams} from '@remix-project/remix-lib'
import {IframePlugin} from '@remixproject/engine-web' import {IframePlugin} from '@remixproject/engine-web'
const isElectron = require('is-electron') import Registry from './app/state/registry'
const _paq = (window._paq = window._paq || []) const _paq = (window._paq = window._paq || [])
// requiredModule removes the plugin from the plugin manager list on UI // requiredModule removes the plugin from the plugin manager list on UI
@ -78,9 +79,6 @@ let requiredModules = [ // services + layout views + system views
'home' 'home'
] ]
if (isElectron()) {
requiredModules = [...requiredModules, 'fs', 'electronTemplates', 'isogit', 'remix-templates', 'electronconfig']
}
// dependentModules shouldn't be manually activated (e.g hardhat is activated by remixd) // dependentModules shouldn't be manually activated (e.g hardhat is activated by remixd)
@ -146,6 +144,10 @@ export class RemixAppManager extends PluginManager {
this.event = new EventEmitter() this.event = new EventEmitter()
this.pluginsDirectory = 'https://raw.githubusercontent.com/ethereum/remix-plugins-directory/master/build/metadata.json' this.pluginsDirectory = 'https://raw.githubusercontent.com/ethereum/remix-plugins-directory/master/build/metadata.json'
this.pluginLoader = new PluginLoader() this.pluginLoader = new PluginLoader()
if (Registry.getInstance().get('platform').api.isDesktop()) {
requiredModules = [...requiredModules, 'fs', 'electronTemplates', 'isogit', 'remix-templates', 'electronconfig']
}
} }
async canActivatePlugin(from, to) { async canActivatePlugin(from, to) {

@ -1,5 +1,5 @@
export { default as RemixApp } from './lib/remix-app/remix-app' export { default as RemixApp } from './lib/remix-app/remix-app'
export { dispatchModalContext, dispatchModalInterface, AppContext } from './lib/remix-app/context/context' export { dispatchModalContext, dispatchModalInterface, AppContext, appProviderContextType, appPlatformTypes } from './lib/remix-app/context/context'
export { ModalProvider, useDialogDispatchers } from './lib/remix-app/context/provider' export { ModalProvider, useDialogDispatchers } from './lib/remix-app/context/provider'
export { AppModal } from './lib/remix-app/interface/index' export { AppModal } from './lib/remix-app/interface/index'
export { AlertModal } from './lib/remix-app/interface/index' export { AlertModal } from './lib/remix-app/interface/index'

@ -1,7 +1,6 @@
import React from 'react' import React from 'react'
import {AlertModal, AppModal} from '../interface' import {AlertModal, AppModal} from '../interface'
import {ModalInitialState} from '../state/modals' import {ModalInitialState} from '../state/modals'
import { Plugin } from '@remixproject/engine'
export type appProviderContextType = { export type appProviderContextType = {
settings: any, settings: any,
@ -9,10 +8,13 @@ export type appProviderContextType = {
appManager: any appManager: any
modal: any modal: any
layout: any layout: any
platform: appPlatformType platform: appPlatformTypes
} }
export type appPlatformType = 'web' | 'desktop' export enum appPlatformTypes {
web = 'web',
desktop = 'desktop'
}
export const AppContext = React.createContext<appProviderContextType>(null) export const AppContext = React.createContext<appProviderContextType>(null)

@ -7,7 +7,7 @@ import Carousel from 'react-multi-carousel'
import WorkspaceTemplate from './workspaceTemplate' import WorkspaceTemplate from './workspaceTemplate'
import 'react-multi-carousel/lib/styles.css' import 'react-multi-carousel/lib/styles.css'
import CustomNavButtons from './customNavButtons' import CustomNavButtons from './customNavButtons'
import isElectron from 'is-electron' import { AppContext, appPlatformTypes } from '@remix-ui/app'
declare global { declare global {
interface Window { interface Window {
_paq: any _paq: any
@ -19,6 +19,7 @@ interface HomeTabGetStartedProps {
} }
function HomeTabGetStarted({plugin}: HomeTabGetStartedProps) { function HomeTabGetStarted({plugin}: HomeTabGetStartedProps) {
const {platform} = useContext(AppContext)
const themeFilter = useContext(ThemeContext) const themeFilter = useContext(ThemeContext)
const carouselRef = useRef<any>({}) const carouselRef = useRef<any>({})
const carouselRefDiv = useRef(null) const carouselRefDiv = useRef(null)
@ -59,7 +60,7 @@ function HomeTabGetStarted({plugin}: HomeTabGetStartedProps) {
} }
const createWorkspace = async (templateName) => { const createWorkspace = async (templateName) => {
if(isElectron()){ if(platform === appPlatformTypes.desktop){
await plugin.call('remix-templates', 'loadTemplateInNewWindow', templateName) await plugin.call('remix-templates', 'loadTemplateInNewWindow', templateName)
return return
} }

@ -1,4 +1,4 @@
import React, {useState, useEffect} from 'react' // eslint-disable-line import React, {useState, useEffect, useContext} from 'react' // eslint-disable-line
import './remix-ui-home-tab.css' import './remix-ui-home-tab.css'
import {ThemeContext, themes} from './themeContext' import {ThemeContext, themes} from './themeContext'
@ -9,7 +9,7 @@ import HomeTabScamAlert from './components/homeTabScamAlert'
import HomeTabGetStarted from './components/homeTabGetStarted' import HomeTabGetStarted from './components/homeTabGetStarted'
import HomeTabFeatured from './components/homeTabFeatured' import HomeTabFeatured from './components/homeTabFeatured'
import HomeTabFeaturedPlugins from './components/homeTabFeaturedPlugins' import HomeTabFeaturedPlugins from './components/homeTabFeaturedPlugins'
import isElectron from 'is-electron' import { AppContext, appPlatformTypes } from '@remix-ui/app'
import { HomeTabFileElectron } from './components/homeTabFileElectron' import { HomeTabFileElectron } from './components/homeTabFileElectron'
import { LanguageOptions } from './components/homeTablangOptions' import { LanguageOptions } from './components/homeTablangOptions'
@ -24,6 +24,7 @@ export interface RemixUiHomeTabProps {
} }
export const RemixUiHomeTab = (props: RemixUiHomeTabProps) => { export const RemixUiHomeTab = (props: RemixUiHomeTabProps) => {
const {platform} = useContext(AppContext)
const {plugin} = props const {plugin} = props
const [state, setState] = useState<{ const [state, setState] = useState<{
@ -59,7 +60,7 @@ export const RemixUiHomeTab = (props: RemixUiHomeTabProps) => {
<div className="d-flex flex-row w-100 custom_home_bg"> <div className="d-flex flex-row w-100 custom_home_bg">
<div className="px-2 pl-3 justify-content-start d-flex border-right flex-column" id="remixUIHTLeft" style={{width: 'inherit'}}> <div className="px-2 pl-3 justify-content-start d-flex border-right flex-column" id="remixUIHTLeft" style={{width: 'inherit'}}>
<HomeTabTitle /> <HomeTabTitle />
{!isElectron()? {!(platform === appPlatformTypes.desktop) ?
<HomeTabFile plugin={plugin} />: <HomeTabFile plugin={plugin} />:
<HomeTabFileElectron plugin={plugin}></HomeTabFileElectron>} <HomeTabFileElectron plugin={plugin}></HomeTabFileElectron>}
<HomeTabLearn plugin={plugin} /> <HomeTabLearn plugin={plugin} />

@ -1,9 +1,9 @@
/* eslint-disable no-unused-expressions */ /* eslint-disable no-unused-expressions */
import isElectron from 'is-electron'
import React, {useContext, useEffect, useRef, useState} from 'react' // eslint-disable-line import React, {useContext, useEffect, useRef, useState} from 'react' // eslint-disable-line
import DragBar from '../dragbar/dragbar' import DragBar from '../dragbar/dragbar'
import RemixUIPanelPlugin from '../plugins/panel-plugin' import RemixUIPanelPlugin from '../plugins/panel-plugin'
import {PluginRecord} from '../types' import {PluginRecord} from '../types'
import { AppContext, appPlatformTypes } from '@remix-ui/app'
import './main-panel.css' import './main-panel.css'
@ -12,6 +12,7 @@ export type RemixUIMainPanelProps = {
} }
const RemixUIMainPanel = (props: RemixUIMainPanelProps) => { const RemixUIMainPanel = (props: RemixUIMainPanelProps) => {
const {platform} = useContext(AppContext)
const appContext = useContext(props.Context) const appContext = useContext(props.Context)
const [plugins, setPlugins] = useState<PluginRecord[]>([]) const [plugins, setPlugins] = useState<PluginRecord[]>([])
const editorRef = useRef<HTMLDivElement>(null) const editorRef = useRef<HTMLDivElement>(null)
@ -29,7 +30,7 @@ const RemixUIMainPanel = (props: RemixUIMainPanelProps) => {
profile: panel.plugin.profile, profile: panel.plugin.profile,
active: panel.active, active: panel.active,
view: panel.plugin.profile.name === 'tabs' ? panel.plugin.renderTabsbar() : panel.plugin.render(), view: panel.plugin.profile.name === 'tabs' ? panel.plugin.renderTabsbar() : panel.plugin.render(),
class: panel.plugin.profile.name + '-wrap ' + (panel.minimized ? 'minimized ' : ' ') + (isElectron()? 'desktop' : ''), class: panel.plugin.profile.name + '-wrap ' + (panel.minimized ? 'minimized ' : ' ') + ((platform === appPlatformTypes.desktop)? 'desktop' : ''),
minimized: panel.minimized minimized: panel.minimized
}) })
}) })

@ -1,12 +1,12 @@
import { EOL } from 'os' import { EOL } from 'os'
import { SearchResultLineLine } from '../../types' import { SearchResultLineLine } from '../../types'
import isElectron from 'is-electron' import Registry from 'apps/remix-ide/src/app/state/registry'
export const getDirectory = async (dir: string, plugin: any) => { export const getDirectory = async (dir: string, plugin: any) => {
let result = [] let result = []
if (isElectron()) { if (Registry.getInstance().get('platform').api.isDesktop()) {
const files = await plugin.call('ripgrep', 'glob', dir, '**/*') const files = await plugin.call('ripgrep', 'glob', dir, '**/*')
// only get path property of files // only get path property of files

@ -1,4 +1,4 @@
import React, {useEffect, useState, useRef, useReducer} from 'react' // eslint-disable-line import React, {useEffect, useState, useRef, useReducer, useContext} from 'react' // eslint-disable-line
import {FormattedMessage, useIntl} from 'react-intl' import {FormattedMessage, useIntl} from 'react-intl'
import semver from 'semver' import semver from 'semver'
import {CompilerContainerProps} from './types' import {CompilerContainerProps} from './types'
@ -11,9 +11,9 @@ import {getValidLanguage} from '@remix-project/remix-solidity'
import {CopyToClipboard} from '@remix-ui/clipboard' import {CopyToClipboard} from '@remix-ui/clipboard'
import {configFileContent} from './compilerConfiguration' import {configFileContent} from './compilerConfiguration'
import axios, {AxiosResponse} from 'axios' import axios, {AxiosResponse} from 'axios'
import { AppContext, appPlatformTypes } from '@remix-ui/app'
import './css/style.css' import './css/style.css'
import isElectron from 'is-electron'
const defaultPath = 'compiler_config.json' const defaultPath = 'compiler_config.json'
declare global { declare global {
@ -25,6 +25,7 @@ declare global {
const _paq = (window._paq = window._paq || []) //eslint-disable-line const _paq = (window._paq = window._paq || []) //eslint-disable-line
export const CompilerContainer = (props: CompilerContainerProps) => { export const CompilerContainer = (props: CompilerContainerProps) => {
const {platform} = useContext(AppContext)
const { const {
api, api,
compileTabLogic, compileTabLogic,
@ -576,7 +577,7 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
// "Uncaught RangeError: Maximum call stack size exceeded" error on Chromium, // "Uncaught RangeError: Maximum call stack size exceeded" error on Chromium,
// resort to non-worker version in that case. // resort to non-worker version in that case.
if (selectedVersion === 'builtin') selectedVersion = state.defaultVersion if (selectedVersion === 'builtin') selectedVersion = state.defaultVersion
if (selectedVersion !== 'builtin' && (canUseWorker(selectedVersion) || isElectron())) { if (selectedVersion !== 'builtin' && (canUseWorker(selectedVersion) || platform === appPlatformTypes.desktop)) {
compileTabLogic.compiler.loadVersion(true, url) compileTabLogic.compiler.loadVersion(true, url)
} else { } else {
compileTabLogic.compiler.loadVersion(false, url) compileTabLogic.compiler.loadVersion(false, url)

@ -1,4 +1,4 @@
import React, { useState, useRef, useEffect, ReactElement } from 'react' // eslint-disable-line import React, { useState, useRef, useEffect, ReactElement, useContext } from 'react' // eslint-disable-line
import { FormattedMessage, useIntl } from 'react-intl' import { FormattedMessage, useIntl } from 'react-intl'
import * as semver from 'semver' import * as semver from 'semver'
import { eachOfSeries } from 'async' // eslint-disable-line import { eachOfSeries } from 'async' // eslint-disable-line
@ -9,7 +9,7 @@ import { Toaster } from '@remix-ui/toaster' // eslint-disable-line
import { format } from 'util' import { format } from 'util'
import './css/style.css' import './css/style.css'
import { CustomTooltip } from '@remix-ui/helper' import { CustomTooltip } from '@remix-ui/helper'
import isElectron from 'is-electron' import { AppContext, appPlatformTypes } from '@remix-ui/app'
const _paq = ((window as any)._paq = (window as any)._paq || []) // eslint-disable-line @typescript-eslint/no-explicit-any const _paq = ((window as any)._paq = (window as any)._paq || []) // eslint-disable-line @typescript-eslint/no-explicit-any
@ -44,7 +44,7 @@ interface FinalResult {
export const SolidityUnitTesting = (props: Record<string, any>) => { export const SolidityUnitTesting = (props: Record<string, any>) => {
// eslint-disable-line @typescript-eslint/no-explicit-any // eslint-disable-line @typescript-eslint/no-explicit-any
const {platform} = useContext(AppContext)
const { helper, testTab, initialPath } = props const { helper, testTab, initialPath } = props
const { testTabLogic } = testTab const { testTabLogic } = testTab
@ -608,7 +608,7 @@ export const SolidityUnitTesting = (props: Record<string, any>) => {
currentCompilerUrl, currentCompilerUrl,
evmVersion, evmVersion,
optimize, optimize,
usingWorker: canUseWorker(currentVersion) || isElectron(), usingWorker: canUseWorker(currentVersion) || platform === appPlatformTypes.desktop,
runs, runs,
} }
const deployCb = async (file: string, contractAddress: string) => { const deployCb = async (file: string, contractAddress: string) => {

@ -8,8 +8,8 @@ import { createWorkspaceTemplate, getWorkspaces, loadWorkspacePreset, setPlugin,
import { QueryParams } from '@remix-project/remix-lib' import { QueryParams } from '@remix-project/remix-lib'
import { fetchContractFromEtherscan } from '@remix-project/core-plugin' // eslint-disable-line import { fetchContractFromEtherscan } from '@remix-project/core-plugin' // eslint-disable-line
import JSZip from 'jszip' import JSZip from 'jszip'
import isElectron from 'is-electron'
import { Actions, FileTree } from '../types' import { Actions, FileTree } from '../types'
import Registry from 'apps/remix-ide/src/app/state/registry'
export * from './events' export * from './events'
export * from './workspace' export * from './workspace'
@ -55,7 +55,7 @@ export const initWorkspace = (filePanelPlugin) => async (reducerDispatch: React.
const electrOnProvider = filePanelPlugin.fileProviders.electron const electrOnProvider = filePanelPlugin.fileProviders.electron
const params = queryParams.get() as UrlParametersType const params = queryParams.get() as UrlParametersType
let workspaces = [] let workspaces = []
if (!isElectron()) { if (!(Registry.getInstance().get('platform').api.isDesktop())) {
workspaces = await getWorkspaces() || [] workspaces = await getWorkspaces() || []
dispatch(setWorkspaces(workspaces)) dispatch(setWorkspaces(workspaces))
} }
@ -118,7 +118,7 @@ export const initWorkspace = (filePanelPlugin) => async (reducerDispatch: React.
await basicWorkspaceInit(workspaces, workspaceProvider) await basicWorkspaceInit(workspaces, workspaceProvider)
} }
} else await basicWorkspaceInit(workspaces, workspaceProvider) } else await basicWorkspaceInit(workspaces, workspaceProvider)
} else if (isElectron()) { } else if (Registry.getInstance().get('platform').api.isDesktop()) {
if (params.opendir) { if (params.opendir) {
params.opendir = decodeURIComponent(params.opendir) params.opendir = decodeURIComponent(params.opendir)
plugin.call('notification', 'toast', `opening ${params.opendir}...`) plugin.call('notification', 'toast', `opening ${params.opendir}...`)
@ -154,7 +154,7 @@ export const initWorkspace = (filePanelPlugin) => async (reducerDispatch: React.
listenOnProviderEvents(workspaceProvider)(dispatch) listenOnProviderEvents(workspaceProvider)(dispatch)
listenOnProviderEvents(localhostProvider)(dispatch) listenOnProviderEvents(localhostProvider)(dispatch)
listenOnProviderEvents(electrOnProvider)(dispatch) listenOnProviderEvents(electrOnProvider)(dispatch)
if (isElectron()) { if (Registry.getInstance().get('platform').api.isDesktop()) {
dispatch(setMode('browser')) dispatch(setMode('browser'))
} else { } else {
dispatch(setMode('browser')) dispatch(setMode('browser'))

@ -38,7 +38,6 @@ import { IndexedDBStorage } from '../../../../../../apps/remix-ide/src/app/files
import { getUncommittedFiles } from '../utils/gitStatusFilter' import { getUncommittedFiles } from '../utils/gitStatusFilter'
import { AppModal, ModalTypes } from '@remix-ui/app' import { AppModal, ModalTypes } from '@remix-ui/app'
import { contractDeployerScripts, etherscanScripts } from '@remix-project/remix-ws-templates' import { contractDeployerScripts, etherscanScripts } from '@remix-project/remix-ws-templates'
import isElectron from 'is-electron'
declare global { declare global {
interface Window { interface Window {
@ -120,7 +119,7 @@ export const createWorkspace = async (
isGitRepo: boolean = false, isGitRepo: boolean = false,
createCommit: boolean = true createCommit: boolean = true
) => { ) => {
if (isElectron()) { if (plugin.registry.get('platform').api.isDesktop()) {
if (workspaceTemplateName) { if (workspaceTemplateName) {
await plugin.call('remix-templates', 'loadTemplateInNewWindow', workspaceTemplateName, opts) await plugin.call('remix-templates', 'loadTemplateInNewWindow', workspaceTemplateName, opts)
} }
@ -577,7 +576,7 @@ export const cloneRepository = async (url: string) => {
const token = config.get('settings/gist-access-token') const token = config.get('settings/gist-access-token')
const repoConfig = { url, token } const repoConfig = { url, token }
if (isElectron()) { if (plugin.registry.get('platform').api.isDesktop()) {
try { try {
await plugin.call('dGitProvider', 'clone', repoConfig) await plugin.call('dGitProvider', 'clone', repoConfig)
} catch (e) { } catch (e) {

@ -1,15 +1,16 @@
import React, { MouseEventHandler, useContext, useEffect, useState } from "react" import React, { MouseEventHandler, useContext, useEffect, useState } from "react"
import { FileSystemContext } from "../contexts" import { FileSystemContext } from "../contexts"
import isElectron from 'is-electron' import { AppContext, appPlatformTypes } from '@remix-ui/app'
import { FormattedMessage } from "react-intl" import { FormattedMessage } from "react-intl"
import '../css/electron-menu.css' import '../css/electron-menu.css'
import { CustomTooltip } from '@remix-ui/helper' import { CustomTooltip } from '@remix-ui/helper'
export const ElectronMenu = () => { export const ElectronMenu = () => {
const {platform} = useContext(AppContext)
const global = useContext(FileSystemContext) const global = useContext(FileSystemContext)
useEffect(() => { useEffect(() => {
if (isElectron()) { if (platform === appPlatformTypes.desktop) {
global.dispatchGetElectronRecentFolders() global.dispatchGetElectronRecentFolders()
} }
}, []) }, [])
@ -24,7 +25,7 @@ export const ElectronMenu = () => {
} }
return ( return (
!isElectron() ? null : (platform !== appPlatformTypes.desktop) ? null :
(global.fs.browser.isSuccessfulWorkspace ? null : (global.fs.browser.isSuccessfulWorkspace ? null :
<> <>
<div onClick={async () => { await openFolderElectron(null) }} className='btn btn-primary'><FormattedMessage id="electron.openFolder" /></div> <div onClick={async () => { await openFolderElectron(null) }} className='btn btn-primary'><FormattedMessage id="electron.openFolder" /></div>

@ -1,11 +1,11 @@
import React, {useRef, useEffect, useState} from 'react' // eslint-disable-line import React, {useRef, useEffect, useState, useContext} from 'react' // eslint-disable-line
import {useIntl} from 'react-intl' import {useIntl} from 'react-intl'
import {action, FileExplorerContextMenuProps} from '../types' import {action, FileExplorerContextMenuProps} from '../types'
import '../css/file-explorer-context-menu.css' import '../css/file-explorer-context-menu.css'
import {customAction} from '@remixproject/plugin-api' import {customAction} from '@remixproject/plugin-api'
import UploadFile from './upload-file' import UploadFile from './upload-file'
import isElectron from 'is-electron' import { AppContext, appPlatformTypes } from '@remix-ui/app'
declare global { declare global {
interface Window { interface Window {
@ -15,6 +15,7 @@ declare global {
const _paq = (window._paq = window._paq || []) //eslint-disable-line const _paq = (window._paq = window._paq || []) //eslint-disable-line
export const FileExplorerContextMenu = (props: FileExplorerContextMenuProps) => { export const FileExplorerContextMenu = (props: FileExplorerContextMenuProps) => {
const {platform} = useContext(AppContext)
const { const {
actions, actions,
createNewFile, createNewFile,
@ -83,7 +84,7 @@ export const FileExplorerContextMenu = (props: FileExplorerContextMenuProps) =>
} }
const itemMatchesCondition = (item: action, itemType: string, itemPath: string) => { const itemMatchesCondition = (item: action, itemType: string, itemPath: string) => {
if( isElectron() && item.platform && item.platform === 'browser') return false if( platform === appPlatformTypes.desktop && item.platform && item.platform === appPlatformTypes.web) return false
else if (item.type && Array.isArray(item.type) && (item.type.findIndex(name => name === itemType) !== -1)) return true 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.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.extension && Array.isArray(item.extension) && (item.extension.findIndex(ext => itemPath.endsWith(ext)) !== -1)) return true

@ -2,8 +2,7 @@ import React, { useContext } from 'react'
import {CustomTooltip, CustomMenu, CustomIconsToggle} from '@remix-ui/helper' import {CustomTooltip, CustomMenu, CustomIconsToggle} from '@remix-ui/helper'
import {Dropdown, NavDropdown} from 'react-bootstrap' import {Dropdown, NavDropdown} from 'react-bootstrap'
import {FormattedMessage} from 'react-intl' import {FormattedMessage} from 'react-intl'
import { AppContext, appPlatformType } from 'libs/remix-ui/app/src/lib/remix-app/context/context' import { AppContext, appPlatformTypes } from '@remix-ui/app'
const _paq = (window._paq = window._paq || []) const _paq = (window._paq = window._paq || [])
export interface HamburgerMenuItemProps { export interface HamburgerMenuItemProps {
@ -11,7 +10,7 @@ export interface HamburgerMenuItemProps {
kind: string kind: string
actionOnClick: () => void actionOnClick: () => void
fa: string fa: string
platforms: appPlatformType[] platforms: appPlatformTypes[]
} }
export function HamburgerMenuItem(props: HamburgerMenuItemProps) { export function HamburgerMenuItem(props: HamburgerMenuItemProps) {
@ -73,7 +72,7 @@ export interface HamburgerSubMenuItemProps {
id: string id: string
title: string title: string
subMenus: Array<HamburgerMenuItemProps> subMenus: Array<HamburgerMenuItemProps>
platforms: appPlatformType[] platforms: appPlatformTypes[]
} }
export function HamburgerSubMenuItem(props: HamburgerSubMenuItemProps) { export function HamburgerSubMenuItem(props: HamburgerSubMenuItemProps) {

@ -1,3 +1,4 @@
import { appPlatformTypes } from 'libs/remix-ui/app/src/lib/remix-app/context/context'
import React from 'react' import React from 'react'
import {Dropdown} from 'react-bootstrap' import {Dropdown} from 'react-bootstrap'
import {HamburgerMenuItem, HamburgerSubMenuItem} from './workspace-hamburger-item' import {HamburgerMenuItem, HamburgerSubMenuItem} from './workspace-hamburger-item'
@ -33,7 +34,7 @@ export function HamburgerMenu(props: HamburgerMenuProps) {
props.createWorkspace() props.createWorkspace()
props.hideIconsMenu(!showIconsMenu) props.hideIconsMenu(!showIconsMenu)
}} }}
platforms={['web', 'desktop']} platforms={[appPlatformTypes.web, appPlatformTypes.desktop]}
></HamburgerMenuItem> ></HamburgerMenuItem>
<HamburgerMenuItem <HamburgerMenuItem
kind="clone" kind="clone"
@ -43,7 +44,7 @@ export function HamburgerMenu(props: HamburgerMenuProps) {
props.cloneGitRepository() props.cloneGitRepository()
props.hideIconsMenu(!showIconsMenu) props.hideIconsMenu(!showIconsMenu)
}} }}
platforms={['web', 'desktop']} platforms={[appPlatformTypes.web, appPlatformTypes.desktop]}
></HamburgerMenuItem> ></HamburgerMenuItem>
<HamburgerMenuItem <HamburgerMenuItem
kind="rename" kind="rename"
@ -53,7 +54,7 @@ export function HamburgerMenu(props: HamburgerMenuProps) {
props.renameCurrentWorkspace() props.renameCurrentWorkspace()
props.hideIconsMenu(!showIconsMenu) props.hideIconsMenu(!showIconsMenu)
}} }}
platforms={['web']} platforms={[appPlatformTypes.web]}
></HamburgerMenuItem> ></HamburgerMenuItem>
<HamburgerMenuItem <HamburgerMenuItem
kind="download" kind="download"
@ -63,7 +64,7 @@ export function HamburgerMenu(props: HamburgerMenuProps) {
props.downloadCurrentWorkspace() props.downloadCurrentWorkspace()
props.hideIconsMenu(!showIconsMenu) props.hideIconsMenu(!showIconsMenu)
}} }}
platforms={['web']} platforms={[appPlatformTypes.web]}
></HamburgerMenuItem> ></HamburgerMenuItem>
<HamburgerMenuItem <HamburgerMenuItem
kind="delete" kind="delete"
@ -73,7 +74,7 @@ export function HamburgerMenu(props: HamburgerMenuProps) {
props.deleteCurrentWorkspace() props.deleteCurrentWorkspace()
props.hideIconsMenu(!showIconsMenu) props.hideIconsMenu(!showIconsMenu)
}} }}
platforms={['web']} platforms={[appPlatformTypes.web]}
></HamburgerMenuItem> ></HamburgerMenuItem>
<Dropdown.Divider className="border mb-0 mt-0 remixui_menuhr" style={{pointerEvents: 'none'}} /> <Dropdown.Divider className="border mb-0 mt-0 remixui_menuhr" style={{pointerEvents: 'none'}} />
<HamburgerMenuItem <HamburgerMenuItem
@ -84,7 +85,7 @@ export function HamburgerMenu(props: HamburgerMenuProps) {
props.deleteAllWorkspaces() props.deleteAllWorkspaces()
props.hideIconsMenu(!showIconsMenu) props.hideIconsMenu(!showIconsMenu)
}} }}
platforms={['web']} platforms={[appPlatformTypes.web]}
></HamburgerMenuItem> ></HamburgerMenuItem>
<HamburgerMenuItem <HamburgerMenuItem
kind="backup" kind="backup"
@ -94,7 +95,7 @@ export function HamburgerMenu(props: HamburgerMenuProps) {
props.downloadWorkspaces() props.downloadWorkspaces()
props.hideIconsMenu(!showIconsMenu) props.hideIconsMenu(!showIconsMenu)
}} }}
platforms={['web']} platforms={[appPlatformTypes.web]}
></HamburgerMenuItem> ></HamburgerMenuItem>
<HamburgerMenuItem <HamburgerMenuItem
kind="restore" kind="restore"
@ -104,7 +105,7 @@ export function HamburgerMenu(props: HamburgerMenuProps) {
props.restoreBackup() props.restoreBackup()
props.hideIconsMenu(!showIconsMenu) props.hideIconsMenu(!showIconsMenu)
}} }}
platforms={['web']} platforms={[appPlatformTypes.web]}
></HamburgerMenuItem> ></HamburgerMenuItem>
<Dropdown.Divider className="border mt-0 mb-0 remixui_menuhr" style={{pointerEvents: 'none'}} /> <Dropdown.Divider className="border mt-0 mb-0 remixui_menuhr" style={{pointerEvents: 'none'}} />
<HamburgerMenuItem <HamburgerMenuItem
@ -115,7 +116,7 @@ export function HamburgerMenu(props: HamburgerMenuProps) {
props.addGithubAction() props.addGithubAction()
props.hideIconsMenu(!showIconsMenu) props.hideIconsMenu(!showIconsMenu)
}} }}
platforms={['web', 'desktop']} platforms={[appPlatformTypes.web, appPlatformTypes.desktop]}
></HamburgerMenuItem> ></HamburgerMenuItem>
<HamburgerMenuItem <HamburgerMenuItem
kind="tssoltestghaction" kind="tssoltestghaction"
@ -125,7 +126,7 @@ export function HamburgerMenu(props: HamburgerMenuProps) {
props.addTsSolTestGithubAction() props.addTsSolTestGithubAction()
props.hideIconsMenu(!showIconsMenu) props.hideIconsMenu(!showIconsMenu)
}} }}
platforms={['web', 'desktop']} platforms={[appPlatformTypes.web, appPlatformTypes.desktop]}
></HamburgerMenuItem> ></HamburgerMenuItem>
<HamburgerMenuItem <HamburgerMenuItem
kind="slitherghaction" kind="slitherghaction"
@ -135,7 +136,7 @@ export function HamburgerMenu(props: HamburgerMenuProps) {
props.addSlitherGithubAction() props.addSlitherGithubAction()
props.hideIconsMenu(!showIconsMenu) props.hideIconsMenu(!showIconsMenu)
}} }}
platforms={['web', 'desktop']} platforms={[appPlatformTypes.web, appPlatformTypes.desktop]}
></HamburgerMenuItem> ></HamburgerMenuItem>
<Dropdown.Divider className="border mb-0 mt-0 remixui_menuhr" style={{pointerEvents: 'none'}} /> <Dropdown.Divider className="border mb-0 mt-0 remixui_menuhr" style={{pointerEvents: 'none'}} />
<HamburgerMenuItem <HamburgerMenuItem
@ -146,7 +147,7 @@ export function HamburgerMenu(props: HamburgerMenuProps) {
props.addHelperScripts('etherscan') props.addHelperScripts('etherscan')
props.hideIconsMenu(!showIconsMenu) props.hideIconsMenu(!showIconsMenu)
}} }}
platforms={['web', 'desktop']} platforms={[appPlatformTypes.web, appPlatformTypes.desktop]}
></HamburgerMenuItem> ></HamburgerMenuItem>
<HamburgerMenuItem <HamburgerMenuItem
kind="addscriptdeployer" kind="addscriptdeployer"
@ -156,7 +157,7 @@ export function HamburgerMenu(props: HamburgerMenuProps) {
props.addHelperScripts('deployer') props.addHelperScripts('deployer')
props.hideIconsMenu(!showIconsMenu) props.hideIconsMenu(!showIconsMenu)
}} }}
platforms={['web', 'desktop']} platforms={[appPlatformTypes.web, appPlatformTypes.desktop]}
></HamburgerMenuItem> ></HamburgerMenuItem>
</> </>
) )

@ -12,7 +12,7 @@ import {MenuItems, WorkSpaceState} from './types'
import {contextMenuActions} from './utils' import {contextMenuActions} from './utils'
import FileExplorerContextMenu from './components/file-explorer-context-menu' import FileExplorerContextMenu from './components/file-explorer-context-menu'
import { customAction } from '@remixproject/plugin-api' import { customAction } from '@remixproject/plugin-api'
import isElectron from 'is-electron' import { AppContext, appPlatformTypes } from '@remix-ui/app'
import { ElectronMenu } from './components/electron-menu' import { ElectronMenu } from './components/electron-menu'
const _paq = (window._paq = window._paq || []) const _paq = (window._paq = window._paq || [])
@ -20,6 +20,7 @@ const _paq = (window._paq = window._paq || [])
const canUpload = window.File || window.FileReader || window.FileList || window.Blob const canUpload = window.File || window.FileReader || window.FileList || window.Blob
export function Workspace() { export function Workspace() {
const {platform} = useContext(AppContext)
const LOCALHOST = ' - connect to localhost - ' const LOCALHOST = ' - connect to localhost - '
const NO_WORKSPACE = ' - none - ' const NO_WORKSPACE = ' - none - '
const ELECTRON = 'electron' const ELECTRON = 'electron'
@ -229,7 +230,6 @@ export function Workspace() {
} }
const cloneGitRepository = () => { const cloneGitRepository = () => {
console.log('clone from workspace modal')
global.modal( global.modal(
intl.formatMessage({id: 'filePanel.workspace.clone'}), intl.formatMessage({id: 'filePanel.workspace.clone'}),
cloneModalMessage(), cloneModalMessage(),
@ -935,7 +935,7 @@ export function Workspace() {
</span> </span>
</div> </div>
<div className='mx-2'> <div className='mx-2'>
{!isElectron() ? ( {(platform !== appPlatformTypes.desktop) ? (
<Dropdown id="workspacesSelect" data-id="workspacesSelect" onToggle={toggleDropdown} show={showDropdown}> <Dropdown id="workspacesSelect" data-id="workspacesSelect" onToggle={toggleDropdown} show={showDropdown}>
<Dropdown.Toggle <Dropdown.Toggle
as={CustomToggle} as={CustomToggle}

@ -4,8 +4,9 @@ import { customAction } from '@remixproject/plugin-api'
import { fileDecoration } from '@remix-ui/file-decorators' import { fileDecoration } from '@remix-ui/file-decorators'
import { RemixAppManager } from 'libs/remix-ui/plugin-manager/src/types' import { RemixAppManager } from 'libs/remix-ui/plugin-manager/src/types'
import { ViewPlugin } from '@remixproject/engine-web' import { ViewPlugin } from '@remixproject/engine-web'
import { appPlatformTypes } from '@remix-ui/app'
export type action = { name: string, type?: Array<WorkspaceElement>, path?: string[], extension?: string[], pattern?: string[], id: string, multiselect: boolean, label: string, sticky?: boolean, group: number, platform?: 'electron' | 'browser' } export type action = { name: string, type?: Array<WorkspaceElement>, path?: string[], extension?: string[], pattern?: string[], id: string, multiselect: boolean, label: string, sticky?: boolean, group: number, platform?: appPlatformTypes }
export interface JSONStandardInput { export interface JSONStandardInput {
language: 'Solidity' language: 'Solidity'
settings?: any settings?: any

@ -1,3 +1,4 @@
import { appPlatformTypes } from '@remix-ui/app'
import { FileType } from '@remix-ui/file-decorators' import { FileType } from '@remix-ui/file-decorators'
import { WorkspaceProps, MenuItems } from '../types' import { WorkspaceProps, MenuItems } from '../types'
@ -64,7 +65,7 @@ export const contextMenuActions: MenuItems = [{
multiselect: false, multiselect: false,
label: '', label: '',
group: 2, group: 2,
platform: 'browser' platform: appPlatformTypes.web
}, { }, {
id: 'run', id: 'run',
name: 'Run', name: 'Run',
@ -79,7 +80,7 @@ export const contextMenuActions: MenuItems = [{
multiselect: false, multiselect: false,
label: '', label: '',
group: 4, group: 4,
platform: 'browser' platform: appPlatformTypes.web
}, { }, {
id: 'publishFolderToGist', id: 'publishFolderToGist',
name: 'Publish folder to gist', name: 'Publish folder to gist',
@ -87,7 +88,7 @@ export const contextMenuActions: MenuItems = [{
multiselect: false, multiselect: false,
label: '', label: '',
group: 4, group: 4,
platform: 'browser' platform: appPlatformTypes.web
}, { }, {
id: 'publishFileToGist', id: 'publishFileToGist',
name: 'Publish file to gist', name: 'Publish file to gist',
@ -95,7 +96,7 @@ export const contextMenuActions: MenuItems = [{
multiselect: false, multiselect: false,
label: '', label: '',
group: 4, group: 4,
platform: 'browser' platform: appPlatformTypes.web
}, { }, {
id: 'uploadFile', id: 'uploadFile',
name: 'Load a Local File', name: 'Load a Local File',
@ -103,7 +104,7 @@ export const contextMenuActions: MenuItems = [{
multiselect: false, multiselect: false,
label: 'Load a Local File', label: 'Load a Local File',
group: 4, group: 4,
platform: 'browser' platform: appPlatformTypes.web
}, { }, {
id: 'publishToGist', id: 'publishToGist',
name: 'Push changes to gist', name: 'Push changes to gist',
@ -111,7 +112,7 @@ export const contextMenuActions: MenuItems = [{
multiselect: false, multiselect: false,
label: 'Publish all to Gist', label: 'Publish all to Gist',
group: 4, group: 4,
platform: 'browser' platform: appPlatformTypes.web
}, },
{ {
id: 'publishWorkspace', id: 'publishWorkspace',
@ -120,7 +121,7 @@ export const contextMenuActions: MenuItems = [{
multiselect: false, multiselect: false,
label: '', label: '',
group: 4, group: 4,
platform: 'browser' platform: appPlatformTypes.web
}] }]
export const fileKeySort = (children: FileType[]): string[] => { export const fileKeySort = (children: FileType[]): string[] => {

Loading…
Cancel
Save