|
|
@ -4,47 +4,55 @@ import {FormattedMessage} from 'react-intl' |
|
|
|
import {Placement} from 'react-bootstrap/esm/Overlay' |
|
|
|
import {Placement} from 'react-bootstrap/esm/Overlay' |
|
|
|
import {FileExplorerMenuProps} from '../types' |
|
|
|
import {FileExplorerMenuProps} from '../types' |
|
|
|
import { FileSystemContext } from '../contexts' |
|
|
|
import { FileSystemContext } from '../contexts' |
|
|
|
|
|
|
|
import { appPlatformTypes, platformContext } from '@remix-ui/app' |
|
|
|
const _paq = (window._paq = window._paq || []) |
|
|
|
const _paq = (window._paq = window._paq || []) |
|
|
|
|
|
|
|
|
|
|
|
export const FileExplorerMenu = (props: FileExplorerMenuProps) => { |
|
|
|
export const FileExplorerMenu = (props: FileExplorerMenuProps) => { |
|
|
|
const global = useContext(FileSystemContext) |
|
|
|
const global = useContext(FileSystemContext) |
|
|
|
|
|
|
|
const platform = useContext(platformContext) |
|
|
|
const [state, setState] = useState({ |
|
|
|
const [state, setState] = useState({ |
|
|
|
menuItems: [ |
|
|
|
menuItems: [ |
|
|
|
{ |
|
|
|
{ |
|
|
|
action: 'createNewFile', |
|
|
|
action: 'createNewFile', |
|
|
|
title: 'Create new file', |
|
|
|
title: 'Create new file', |
|
|
|
icon: 'far fa-file', |
|
|
|
icon: 'far fa-file', |
|
|
|
placement: 'top' |
|
|
|
placement: 'top', |
|
|
|
|
|
|
|
platforms:[appPlatformTypes.web, appPlatformTypes.desktop] |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
action: 'createNewFolder', |
|
|
|
action: 'createNewFolder', |
|
|
|
title: 'Create new folder', |
|
|
|
title: 'Create new folder', |
|
|
|
icon: 'far fa-folder', |
|
|
|
icon: 'far fa-folder', |
|
|
|
placement: 'top' |
|
|
|
placement: 'top', |
|
|
|
|
|
|
|
platforms:[appPlatformTypes.web, appPlatformTypes.desktop] |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
action: 'publishToGist', |
|
|
|
action: 'publishToGist', |
|
|
|
title: 'Publish current workspace to GitHub gist', |
|
|
|
title: 'Publish current workspace to GitHub gist', |
|
|
|
icon: 'fab fa-github', |
|
|
|
icon: 'fab fa-github', |
|
|
|
placement: 'top' |
|
|
|
placement: 'top', |
|
|
|
|
|
|
|
platforms:[appPlatformTypes.web] |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
action: 'uploadFile', |
|
|
|
action: 'uploadFile', |
|
|
|
title: 'Upload files into current workspace', |
|
|
|
title: 'Upload files into current workspace', |
|
|
|
icon: 'far fa-upload', |
|
|
|
icon: 'far fa-upload', |
|
|
|
placement: 'top' |
|
|
|
placement: 'top', |
|
|
|
|
|
|
|
platforms:[appPlatformTypes.web] |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
action: 'uploadFolder', |
|
|
|
action: 'uploadFolder', |
|
|
|
title: 'Upload folder into current workspace', |
|
|
|
title: 'Upload folder into current workspace', |
|
|
|
icon: 'far fa-folder-upload', |
|
|
|
icon: 'far fa-folder-upload', |
|
|
|
placement: 'top' |
|
|
|
placement: 'top', |
|
|
|
|
|
|
|
platforms:[appPlatformTypes.web] |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
action: 'updateGist', |
|
|
|
action: 'updateGist', |
|
|
|
title: 'Update the current [gist] explorer', |
|
|
|
title: 'Update the current [gist] explorer', |
|
|
|
icon: 'fab fa-github', |
|
|
|
icon: 'fab fa-github', |
|
|
|
placement: 'bottom-start' |
|
|
|
placement: 'bottom-start', |
|
|
|
|
|
|
|
platforms:[appPlatformTypes.web] |
|
|
|
} |
|
|
|
} |
|
|
|
].filter( |
|
|
|
].filter( |
|
|
|
(item) => |
|
|
|
(item) => |
|
|
@ -72,7 +80,8 @@ export const FileExplorerMenu = (props: FileExplorerMenuProps) => { |
|
|
|
<> |
|
|
|
<> |
|
|
|
|
|
|
|
|
|
|
|
<span data-id="spanContaining" className="pl-0 pb-1 w-50"> |
|
|
|
<span data-id="spanContaining" className="pl-0 pb-1 w-50"> |
|
|
|
{state.menuItems.map(({action, title, icon, placement}, index) => { |
|
|
|
{state.menuItems.map(({ action, title, icon, placement, platforms }, index) => { |
|
|
|
|
|
|
|
if (platforms && !platforms.includes(platform)) return null |
|
|
|
if (action === 'uploadFile') { |
|
|
|
if (action === 'uploadFile') { |
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<CustomTooltip |
|
|
|
<CustomTooltip |
|
|
|