desktopmerge
filip mertens 1 year ago
parent d8a5c7f92d
commit a92a3dee4d
  1. 1
      apps/remix-ide/src/app.js
  2. 15
      libs/remix-ui/app/src/lib/remix-app/context/context.tsx
  3. 2
      libs/remix-ui/app/src/lib/remix-app/context/provider.tsx
  4. 8
      libs/remix-ui/app/src/lib/remix-app/remix-app.tsx
  5. 11
      libs/remix-ui/workspace/src/lib/components/workspace-hamburger-item.tsx
  6. 13
      libs/remix-ui/workspace/src/lib/components/workspace-hamburger.tsx

@ -148,6 +148,7 @@ class AppComponent {
}
this.showMatamo = matomoDomains[window.location.hostname] && !Registry.getInstance().get('config').api.exists('settings/matomo-analytics')
this.walkthroughService = new WalkthroughService(appManager, this.showMatamo)
this.platform = isElectron() ? 'desktop' : 'web'
const hosts = ['127.0.0.1:8080', '192.168.0.101:8080', 'localhost:8080']
// workaround for Electron support

@ -1,8 +1,21 @@
import React from 'react'
import {AlertModal, AppModal} from '../interface'
import {ModalInitialState} from '../state/modals'
import { Plugin } from '@remixproject/engine'
export const AppContext = React.createContext<any>(null)
export type appProviderContextType = {
settings: any,
showMatamo: boolean
appManager: any
modal: any
layout: any
platform: appPlatformType
}
export type appPlatformType = 'web' | 'desktop'
export const AppContext = React.createContext<appProviderContextType>(null)
export interface dispatchModalInterface {
modal: (data: AppModal) => void

@ -80,7 +80,7 @@ export const ModalProvider = ({children = [], reducer = modalReducer, initialSta
)
}
export const AppProvider = ({children = [], value = {}} = {}) => {
export const AppProvider = ({children = [], value = {}} = null) => {
return (
<AppContext.Provider value={value}>
<ModalProvider>{children}</ModalProvider>

@ -7,10 +7,9 @@ import DragBar from './components/dragbar/dragbar'
import {AppProvider} from './context/provider'
import AppDialogs from './components/modals/dialogs'
import DialogViewPlugin from './components/modals/dialogViewPlugin'
import { AppContext } from './context/context'
import { AppContext, appProviderContextType } from './context/context'
import { FormattedMessage, IntlProvider } from 'react-intl'
import { CustomTooltip } from '@remix-ui/helper';
import { RemixUiXterminals } from '@remix-ui/xterm'
interface IRemixAppUi {
app: any
@ -74,12 +73,13 @@ const RemixApp = (props: IRemixAppUi) => {
})
}
const value = {
const value: appProviderContextType = {
settings: props.app.settings,
showMatamo: props.app.showMatamo,
appManager: props.app.appManager,
modal: props.app.notification,
layout: props.app.layout
layout: props.app.layout,
platform: props.app.platform,
}
return (

@ -1,7 +1,8 @@
import React from 'react'
import React, { useContext } from 'react'
import {CustomTooltip, CustomMenu, CustomIconsToggle} from '@remix-ui/helper'
import {Dropdown, NavDropdown} from 'react-bootstrap'
import {FormattedMessage} from 'react-intl'
import { AppContext, appPlatformType } from 'libs/remix-ui/app/src/lib/remix-app/context/context'
const _paq = (window._paq = window._paq || [])
@ -10,13 +11,16 @@ export interface HamburgerMenuItemProps {
kind: string
actionOnClick: () => void
fa: string
platforms: appPlatformType[]
}
export function HamburgerMenuItem(props: HamburgerMenuItemProps) {
const {hideOption} = props
const {platform} = useContext(AppContext)
const uid = 'workspace' + props.kind
return (
<>
{props.platforms.includes(platform)?(
<Dropdown.Item>
<CustomTooltip placement="right" tooltipId={uid + 'Tooltip'} tooltipClasses="text-nowrap" tooltipText={<FormattedMessage id={'filePanel.workspace.' + props.kind} />}>
<div
@ -33,7 +37,7 @@ export function HamburgerMenuItem(props: HamburgerMenuItemProps) {
</span>
</div>
</CustomTooltip>
</Dropdown.Item>
</Dropdown.Item>):null}
</>
)
}
@ -69,6 +73,7 @@ export interface HamburgerSubMenuItemProps {
id: string
title: string
subMenus: Array<HamburgerMenuItemProps>
platforms: appPlatformType[]
}
export function HamburgerSubMenuItem(props: HamburgerSubMenuItemProps) {
@ -76,7 +81,7 @@ export function HamburgerSubMenuItem(props: HamburgerSubMenuItemProps) {
<>
<NavDropdown title={props.title} as={CustomMenu} key={props.id} id={props.id} drop="right">
{props.subMenus.map((item) => (
<NavHamburgerMenuItem kind={item.kind} fa={item.fa} hideOption={item.hideOption} actionOnClick={item.actionOnClick} />
<NavHamburgerMenuItem platforms={props.platforms} kind={item.kind} fa={item.fa} hideOption={item.hideOption} actionOnClick={item.actionOnClick} />
))}
</NavDropdown>
</>

@ -33,6 +33,7 @@ export function HamburgerMenu(props: HamburgerMenuProps) {
props.createWorkspace()
props.hideIconsMenu(!showIconsMenu)
}}
platforms={['web', 'desktop']}
></HamburgerMenuItem>
<HamburgerMenuItem
kind="clone"
@ -42,6 +43,7 @@ export function HamburgerMenu(props: HamburgerMenuProps) {
props.cloneGitRepository()
props.hideIconsMenu(!showIconsMenu)
}}
platforms={['web', 'desktop']}
></HamburgerMenuItem>
<HamburgerMenuItem
kind="rename"
@ -51,6 +53,7 @@ export function HamburgerMenu(props: HamburgerMenuProps) {
props.renameCurrentWorkspace()
props.hideIconsMenu(!showIconsMenu)
}}
platforms={['web']}
></HamburgerMenuItem>
<HamburgerMenuItem
kind="download"
@ -60,6 +63,7 @@ export function HamburgerMenu(props: HamburgerMenuProps) {
props.downloadCurrentWorkspace()
props.hideIconsMenu(!showIconsMenu)
}}
platforms={['web']}
></HamburgerMenuItem>
<HamburgerMenuItem
kind="delete"
@ -69,6 +73,7 @@ export function HamburgerMenu(props: HamburgerMenuProps) {
props.deleteCurrentWorkspace()
props.hideIconsMenu(!showIconsMenu)
}}
platforms={['web']}
></HamburgerMenuItem>
<Dropdown.Divider className="border mb-0 mt-0 remixui_menuhr" style={{pointerEvents: 'none'}} />
<HamburgerMenuItem
@ -79,6 +84,7 @@ export function HamburgerMenu(props: HamburgerMenuProps) {
props.deleteAllWorkspaces()
props.hideIconsMenu(!showIconsMenu)
}}
platforms={['web']}
></HamburgerMenuItem>
<HamburgerMenuItem
kind="backup"
@ -88,6 +94,7 @@ export function HamburgerMenu(props: HamburgerMenuProps) {
props.downloadWorkspaces()
props.hideIconsMenu(!showIconsMenu)
}}
platforms={['web']}
></HamburgerMenuItem>
<HamburgerMenuItem
kind="restore"
@ -97,6 +104,7 @@ export function HamburgerMenu(props: HamburgerMenuProps) {
props.restoreBackup()
props.hideIconsMenu(!showIconsMenu)
}}
platforms={['web']}
></HamburgerMenuItem>
<Dropdown.Divider className="border mt-0 mb-0 remixui_menuhr" style={{pointerEvents: 'none'}} />
<HamburgerMenuItem
@ -107,6 +115,7 @@ export function HamburgerMenu(props: HamburgerMenuProps) {
props.addGithubAction()
props.hideIconsMenu(!showIconsMenu)
}}
platforms={['web', 'desktop']}
></HamburgerMenuItem>
<HamburgerMenuItem
kind="tssoltestghaction"
@ -116,6 +125,7 @@ export function HamburgerMenu(props: HamburgerMenuProps) {
props.addTsSolTestGithubAction()
props.hideIconsMenu(!showIconsMenu)
}}
platforms={['web', 'desktop']}
></HamburgerMenuItem>
<HamburgerMenuItem
kind="slitherghaction"
@ -125,6 +135,7 @@ export function HamburgerMenu(props: HamburgerMenuProps) {
props.addSlitherGithubAction()
props.hideIconsMenu(!showIconsMenu)
}}
platforms={['web', 'desktop']}
></HamburgerMenuItem>
<Dropdown.Divider className="border mb-0 mt-0 remixui_menuhr" style={{pointerEvents: 'none'}} />
<HamburgerMenuItem
@ -135,6 +146,7 @@ export function HamburgerMenu(props: HamburgerMenuProps) {
props.addHelperScripts('etherscan')
props.hideIconsMenu(!showIconsMenu)
}}
platforms={['web', 'desktop']}
></HamburgerMenuItem>
<HamburgerMenuItem
kind="addscriptdeployer"
@ -144,6 +156,7 @@ export function HamburgerMenu(props: HamburgerMenuProps) {
props.addHelperScripts('deployer')
props.hideIconsMenu(!showIconsMenu)
}}
platforms={['web', 'desktop']}
></HamburgerMenuItem>
</>
)

Loading…
Cancel
Save