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