@ -1,13 +1,11 @@
import React from 'react'
import React from 'react'
import { CustomTooltip } from '@remix-ui/helper'
import { Dropdown } from 'react-bootstrap'
import { Dropdown } from 'react-bootstrap'
import { FormattedMessage } from 'react-intl'
import { HamburgerMenuItem } from './workspace-hamburger-item'
const _paq = window . _paq = window . _paq || [ ]
export interface HamburgerMenuProps {
export interface HamburgerMenuProps {
createWorkspace : ( ) = > void ,
createWorkspace : ( ) = > void ,
deleteCurrentWorkspace : ( ) = > void ,
deleteCurrentWorkspace : ( ) = > void ,
deleteAllWorkspaces : ( ) = > void ,
renameCurrentWorkspace : ( ) = > void ,
renameCurrentWorkspace : ( ) = > void ,
cloneGitRepository : ( ) = > void ,
cloneGitRepository : ( ) = > void ,
downloadWorkspaces : ( ) = > void ,
downloadWorkspaces : ( ) = > void ,
@ -23,294 +21,51 @@ export interface HamburgerMenuProps {
export function HamburgerMenu ( props : HamburgerMenuProps ) {
export function HamburgerMenu ( props : HamburgerMenuProps ) {
const { showIconsMenu , hideWorkspaceOptions , hideLocalhostOptions } = props
const { showIconsMenu , hideWorkspaceOptions , hideLocalhostOptions } = props
return (
return (
< >
< >
< Dropdown.Item >
< HamburgerMenuItem kind = 'create' fa = 'far fa-plus' hideOption = { hideWorkspaceOptions } actionOnClick = { ( ) = > {
< CustomTooltip
props . createWorkspace ( )
placement = "right"
props . hideIconsMenu ( ! showIconsMenu )
tooltipId = "createWorkspaceTooltip"
} } > < / HamburgerMenuItem >
tooltipClasses = "text-nowrap"
< HamburgerMenuItem kind = 'delete' fa = 'far fa-trash' hideOption = { hideWorkspaceOptions || hideLocalhostOptions } actionOnClick = { ( ) = > {
tooltipText = { < FormattedMessage id = 'filePanel.workspace.create' / > }
props . deleteCurrentWorkspace ( )
>
props . hideIconsMenu ( ! showIconsMenu )
< div
} } > < / HamburgerMenuItem >
data - id = 'workspaceCreate'
< HamburgerMenuItem kind = 'deleteAll' fa = 'far fa-trash-alt' hideOption = { hideWorkspaceOptions || hideLocalhostOptions } actionOnClick = { ( ) = > {
onClick = { ( ) = > {
props . deleteAllWorkspaces ( )
props . createWorkspace ( )
props . hideIconsMenu ( ! showIconsMenu )
_paq . push ( [ 'trackEvent' , 'fileExplorer' , 'workspaceMenu' , 'workspaceCreate' ] )
} } > < / HamburgerMenuItem >
props . hideIconsMenu ( ! showIconsMenu )
< HamburgerMenuItem kind = 'rename' fa = 'far fa-edit' hideOption = { hideWorkspaceOptions || hideLocalhostOptions } actionOnClick = { ( ) = > {
} }
props . renameCurrentWorkspace ( )
key = { ` workspacesCreate-fe-ws ` }
props . hideIconsMenu ( ! showIconsMenu )
>
} } > < / HamburgerMenuItem >
< span
< Dropdown.Divider className = "border mb-0 mt-0 remixui_menuhr" style = { { pointerEvents : 'none' } } / >
hidden = { hideWorkspaceOptions }
< HamburgerMenuItem kind = 'clone' fa = 'fab fa-github' hideOption = { hideWorkspaceOptions } actionOnClick = { ( ) = > {
id = 'workspaceCreate'
props . cloneGitRepository ( )
data - id = 'workspaceCreate'
props . hideIconsMenu ( ! showIconsMenu )
onClick = { ( ) = > {
} } > < / HamburgerMenuItem >
props . createWorkspace ( )
< Dropdown.Divider className = "border mt-0 mb-0 remixui_menuhr" style = { { pointerEvents : 'none' } } / >
_paq . push ( [ 'trackEvent' , 'fileExplorer' , 'workspaceMenu' , 'workspaceCreate' ] )
< HamburgerMenuItem kind = 'download' fa = 'far fa-download' hideOption = { hideWorkspaceOptions || hideLocalhostOptions } actionOnClick = { ( ) = > {
props . hideIconsMenu ( ! showIconsMenu )
props . downloadWorkspaces ( )
} }
props . hideIconsMenu ( ! showIconsMenu )
className = 'far fa-plus pl-2'
} } > < / HamburgerMenuItem >
>
< HamburgerMenuItem kind = 'restore' fa = 'far fa-upload' hideOption = { hideWorkspaceOptions } actionOnClick = { ( ) = > {
< / span >
props . restoreBackup ( )
< span className = "pl-3" > < FormattedMessage id = 'filePanel.create' / > < / span >
props . hideIconsMenu ( ! showIconsMenu )
< / div >
} } > < / HamburgerMenuItem >
< / CustomTooltip >
< Dropdown.Divider className = "border mt-0 mb-0 remixui_menuhr" style = { { pointerEvents : 'none' } } / >
< / Dropdown.Item >
< HamburgerMenuItem kind = 'solghaction' fa = 'fak fa-solidity-mono' hideOption = { hideWorkspaceOptions } actionOnClick = { ( ) = > {
< Dropdown.Item >
props . addGithubAction ( )
< CustomTooltip
props . hideIconsMenu ( ! showIconsMenu )
placement = "right-start"
} } > < / HamburgerMenuItem >
tooltipId = "createWorkspaceTooltip"
< HamburgerMenuItem kind = 'tssoltestghaction' fa = 'fab fa-js' hideOption = { hideWorkspaceOptions } actionOnClick = { ( ) = > {
tooltipClasses = "text-nowrap"
props . addTsSolTestGithubAction ( )
tooltipText = { < FormattedMessage id = 'filePanel.workspace.delete' / > }
props . hideIconsMenu ( ! showIconsMenu )
>
} } > < / HamburgerMenuItem >
< div
< HamburgerMenuItem kind = 'slitherghaction' fa = 'far fa-shield' hideOption = { hideWorkspaceOptions } actionOnClick = { ( ) = > {
data - id = 'workspaceDelete'
props . addSlitherGithubAction ( )
onClick = { ( ) = > {
props . hideIconsMenu ( ! showIconsMenu )
props . deleteCurrentWorkspace ( )
} } > < / HamburgerMenuItem >
_paq . push ( [ 'trackEvent' , 'fileExplorer' , 'workspaceMenu' , 'workspaceDelete' ] )
< / >
props . hideIconsMenu ( ! showIconsMenu )
)
} }
}
key = { ` workspacesDelete-fe-ws ` }
>
< span
hidden = { hideWorkspaceOptions || hideLocalhostOptions }
id = 'workspaceDelete'
data - id = 'workspaceDelete'
onClick = { ( ) = > {
props . deleteCurrentWorkspace ( )
_paq . push ( [ 'trackEvent' , 'fileExplorer' , 'workspaceMenu' , 'workspaceDelete' ] )
props . hideIconsMenu ( ! showIconsMenu )
} }
className = 'far fa-trash pl-2'
>
< / span >
< span className = "pl-3" > < FormattedMessage id = 'filePanel.delete' / > < / span >
< / div >
< / CustomTooltip >
< / Dropdown.Item >
< Dropdown.Item >
< CustomTooltip
placement = 'right-start'
tooltipClasses = "text-nowrap"
tooltipId = "workspaceRenametooltip"
tooltipText = { < FormattedMessage id = 'filePanel.workspace.rename' / > }
>
< div onClick = { ( ) = > {
props . renameCurrentWorkspace ( )
_paq . push ( [ 'trackEvent' , 'fileExplorer' , 'workspaceMenu' , 'workspaceRename' ] )
props . hideIconsMenu ( ! showIconsMenu )
} }
data - id = 'workspaceRename'
key = { ` workspacesRename-fe-ws ` }
>
< span
hidden = { hideWorkspaceOptions || hideLocalhostOptions }
id = 'workspaceRename'
data - id = 'workspaceRename'
onClick = { ( ) = > {
props . renameCurrentWorkspace ( )
_paq . push ( [ 'trackEvent' , 'fileExplorer' , 'workspaceMenu' , 'workspaceRename' ] )
props . hideIconsMenu ( ! showIconsMenu )
} }
className = 'far fa-edit pl-2' >
< / span >
< span className = "pl-3" > < FormattedMessage id = 'filePanel.rename' / > < / span >
< / div >
< / CustomTooltip >
< / Dropdown.Item >
< Dropdown.Item > < Dropdown.Divider className = "border mb-0 mt-0" / > < / Dropdown.Item >
< Dropdown.Item >
< CustomTooltip
placement = "right-start"
tooltipId = "cloneWorkspaceTooltip"
tooltipClasses = "text-nowrap"
tooltipText = { < FormattedMessage id = 'filePanel.workspace.clone' / > }
>
< div
data - id = 'cloneGitRepository'
onClick = { ( ) = > {
props . cloneGitRepository ( )
_paq . push ( [ 'trackEvent' , 'fileExplorer' , 'workspaceMenu' , 'cloneGitRepository' ] )
props . hideIconsMenu ( ! showIconsMenu )
} }
key = { ` cloneGitRepository-fe-ws ` }
>
< span
hidden = { hideWorkspaceOptions }
id = 'cloneGitRepository'
data - id = 'cloneGitRepository'
onClick = { ( ) = > {
props . cloneGitRepository ( )
_paq . push ( [ 'trackEvent' , 'fileExplorer' , 'workspaceMenu' , 'cloneGitRepository' ] )
props . hideIconsMenu ( ! showIconsMenu )
} }
className = 'fab fa-github pl-2'
>
< / span >
< span className = "pl-3" > < FormattedMessage id = 'filePanel.clone' / > < / span >
< / div >
< / CustomTooltip >
< / Dropdown.Item >
< Dropdown.Item > < Dropdown.Divider className = "border mt-0 mb-0 remixui_menuhr" style = { { pointerEvents : 'none' } } / > < / Dropdown.Item >
< Dropdown.Item >
< CustomTooltip
placement = "right-start"
tooltipId = "createWorkspaceTooltip"
tooltipClasses = "text-nowrap"
tooltipText = { < FormattedMessage id = 'filePanel.workspace.download' / > }
>
< div
data - id = 'workspacesDownload'
onClick = { ( ) = > {
props . downloadWorkspaces ( )
_paq . push ( [ 'trackEvent' , 'fileExplorer' , 'workspaceMenu' , 'workspacesDownload' ] )
props . hideIconsMenu ( ! showIconsMenu )
} }
key = { ` workspacesDownload-fe-ws ` }
>
< span
hidden = { hideWorkspaceOptions || hideLocalhostOptions }
id = 'workspacesDownload'
data - id = 'workspacesDownload'
onClick = { ( ) = > {
props . downloadWorkspaces ( )
_paq . push ( [ 'trackEvent' , 'fileExplorer' , 'workspaceMenu' , 'workspacesDownload' ] )
props . hideIconsMenu ( ! showIconsMenu )
} }
className = 'far fa-download pl-2 '
>
< / span >
< span className = "pl-3" > < FormattedMessage id = 'filePanel.download' / > < / span >
< / div >
< / CustomTooltip >
< / Dropdown.Item >
< Dropdown.Item >
< CustomTooltip
placement = "right-start"
tooltipId = "createWorkspaceTooltip"
tooltipClasses = "text-nowrap"
tooltipText = { < FormattedMessage id = 'filePanel.workspace.restore' / > }
>
< div
data - id = 'workspacesRestore'
onClick = { ( ) = > {
props . restoreBackup ( )
_paq . push ( [ 'trackEvent' , 'fileExplorer' , 'workspaceMenu' , 'workspacesRestore' ] )
props . hideIconsMenu ( ! showIconsMenu )
} }
key = { ` workspacesRestore-fe-ws ` }
>
< span
hidden = { hideWorkspaceOptions }
id = 'workspacesRestore'
data - id = 'workspacesRestore'
onClick = { ( ) = > {
props . restoreBackup ( )
_paq . push ( [ 'trackEvent' , 'fileExplorer' , 'workspaceMenu' , 'workspacesRestore' ] )
props . hideIconsMenu ( ! showIconsMenu )
} }
className = 'far fa-upload pl-2'
>
< / span >
< span className = "pl-3" > < FormattedMessage id = 'filePanel.restore' / > < / span >
< / div >
< / CustomTooltip >
< / Dropdown.Item >
< Dropdown.Item > < Dropdown.Divider className = "border mt-0 mb-0 remixui_menuhr" style = { { pointerEvents : 'none' } } / > < / Dropdown.Item >
< Dropdown.Item >
< CustomTooltip
placement = "right-start"
tooltipId = "createSolGHActionTooltip"
tooltipClasses = "text-nowrap"
tooltipText = { < FormattedMessage id = 'filePanel.workspace.solghaction' / > }
>
< div
data - id = 'soliditygithubaction'
onClick = { ( ) = > {
props . addGithubAction ( )
_paq . push ( [ 'trackEvent' , 'fileExplorer' , 'workspaceMenu' , 'addSolidityTesting' ] )
props . hideIconsMenu ( ! showIconsMenu )
} }
>
< span
hidden = { hideWorkspaceOptions }
id = 'soliditygithubaction'
data - id = 'soliditygithubaction'
onClick = { ( ) = > {
props . addGithubAction ( )
_paq . push ( [ 'trackEvent' , 'fileExplorer' , 'workspaceMenu' , 'addSolidityTesting' ] )
props . hideIconsMenu ( ! showIconsMenu )
} }
className = 'fak fa-solidity-mono pl-2'
>
< / span >
< span className = "pl-3" > { < FormattedMessage id = 'filePanel.solghaction' / > } < / span >
< / div >
< / CustomTooltip >
< / Dropdown.Item >
< Dropdown.Item >
< CustomTooltip
placement = "right-start"
tooltipId = "createTsSolTestGHActionTooltip"
tooltipClasses = "text-nowrap"
tooltipText = { < FormattedMessage id = 'filePanel.workspace.tssoltestghaction' / > }
>
< div
data - id = 'typescriptsoliditygithubtestaction'
onClick = { ( ) = > {
props . addTsSolTestGithubAction ( )
_paq . push ( [ 'trackEvent' , 'fileExplorer' , 'workspaceMenu' , 'addTsSolTestingAction' ] )
props . hideIconsMenu ( ! showIconsMenu )
} }
>
< span
hidden = { hideWorkspaceOptions }
id = 'tssoliditygithubaction'
data - id = 'tssoliditygithubaction'
onClick = { ( ) = > {
props . addTsSolTestGithubAction ( )
_paq . push ( [ 'trackEvent' , 'fileExplorer' , 'workspaceMenu' , 'addTsSolTestingAction' ] )
props . hideIconsMenu ( ! showIconsMenu )
} }
className = 'fab fa-js pl-2'
>
< / span >
< span className = "pl-3" > { < FormattedMessage id = 'filePanel.tssoltestghaction' / > } < / span >
< / div >
< / CustomTooltip >
< / Dropdown.Item >
< Dropdown.Item >
< CustomTooltip
placement = "right-start"
tooltipId = "createSlitherGHActionTooltip"
tooltipClasses = "text-nowrap"
tooltipText = { < FormattedMessage id = 'filePanel.workspace.slitherghaction' / > }
>
< div
data - id = 'slithergithubtestaction'
onClick = { ( ) = > {
props . addSlitherGithubAction ( )
_paq . push ( [ 'trackEvent' , 'fileExplorer' , 'workspaceMenu' , 'addSlitherAction' ] )
props . hideIconsMenu ( ! showIconsMenu )
} }
>
< span
hidden = { hideWorkspaceOptions }
id = 'slithergithubaction'
data - id = 'slithergithubaction'
onClick = { ( ) = > {
props . addSlitherGithubAction ( )
_paq . push ( [ 'trackEvent' , 'fileExplorer' , 'workspaceMenu' , 'addSlitherAction' ] )
props . hideIconsMenu ( ! showIconsMenu )
} }
className = 'far fa-shield pl-2'
>
< / span >
< span className = "pl-3" > { < FormattedMessage id = 'filePanel.slitherghaction' / > } < / span >
< / div >
< / CustomTooltip >
< / Dropdown.Item >
< / >
)
}