Merge pull request #4550 from ethereum/improve_gist

Improve gist
pull/4541/head
yann300 9 months ago committed by GitHub
commit 2af97d7f1f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 25
      apps/remix-ide-e2e/src/tests/gist.test.ts
  2. 7
      apps/remix-ide-e2e/src/tests/plugin_api.ts
  3. 15
      apps/remix-ide/src/app/panels/file-panel.js
  4. 6
      apps/remix-ide/src/app/tabs/locales/en/filePanel.json
  5. 12
      libs/remix-core-plugin/src/lib/gist-handler.ts
  6. 2
      libs/remix-ui/drag-n-drop/src/lib/types/index.ts
  7. 2
      libs/remix-ui/file-decorators/src/lib/types/index.ts
  8. 29
      libs/remix-ui/workspace/src/lib/actions/index.ts
  9. 17
      libs/remix-ui/workspace/src/lib/actions/workspace.ts
  10. 8
      libs/remix-ui/workspace/src/lib/components/file-explorer-context-menu.tsx
  11. 26
      libs/remix-ui/workspace/src/lib/components/file-explorer-menu.tsx
  12. 6
      libs/remix-ui/workspace/src/lib/components/file-explorer.tsx
  13. 16
      libs/remix-ui/workspace/src/lib/components/workspace-hamburger.tsx
  14. 4
      libs/remix-ui/workspace/src/lib/contexts/index.ts
  15. 8
      libs/remix-ui/workspace/src/lib/providers/FileSystemProvider.tsx
  16. 8
      libs/remix-ui/workspace/src/lib/reducers/workspace.ts
  17. 44
      libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx
  18. 30
      libs/remix-ui/workspace/src/lib/types/index.ts
  19. 2
      libs/remix-ui/workspace/src/lib/utils/constants.ts
  20. 29
      libs/remix-ui/workspace/src/lib/utils/index.ts
  21. 8
      libs/remix-ui/workspace/src/lib/utils/types.ts

@ -37,9 +37,9 @@ module.exports = {
.addFile('File.sol', { content: '' }) .addFile('File.sol', { content: '' })
.executeScriptInTerminal(`remix.loadgist('${gistid}')`) .executeScriptInTerminal(`remix.loadgist('${gistid}')`)
// .perform((done) => { if (runtimeBrowser === 'chrome') { browser.openFile('gists') } done() }) // .perform((done) => { if (runtimeBrowser === 'chrome') { browser.openFile('gists') } done() })
.waitForElementVisible(`[data-id="treeViewLitreeViewItemgist-${gistid}"]`) .waitForElementVisible(`[data-id="treeViewLitreeViewItemREADME.txt"]`)
.openFile(`gist-${gistid}/README.txt`) .openFile(`README.txt`)
// Remix publish to gist // Remix publish to gist
/* .click('*[data-id="fileExplorerNewFilepublishToGist"]') /* .click('*[data-id="fileExplorerNewFilepublishToGist"]')
.pause(2000) .pause(2000)
@ -110,8 +110,8 @@ module.exports = {
.waitForElementVisible('[data-id="settingsTabRemoveGistToken"]') .waitForElementVisible('[data-id="settingsTabRemoveGistToken"]')
.click('[data-id="settingsTabRemoveGistToken"]') .click('[data-id="settingsTabRemoveGistToken"]')
.clickLaunchIcon('filePanel') .clickLaunchIcon('filePanel')
.waitForElementVisible('*[data-id="fileExplorerNewFilepublishToGist"]') .click('*[data-id="workspacesMenuDropdown"]')
.click('*[data-id="fileExplorerNewFilepublishToGist"]') .click('*[data-id="workspacepublishToGist"]')
.waitForElementVisible('[data-id="fileSystemModalDialogModalFooter-react"] .modal-ok') .waitForElementVisible('[data-id="fileSystemModalDialogModalFooter-react"] .modal-ok')
.execute(function () { (document.querySelector('[data-id="fileSystemModalDialogModalFooter-react"] .modal-ok') as HTMLElement).click() }) .execute(function () { (document.querySelector('[data-id="fileSystemModalDialogModalFooter-react"] .modal-ok') as HTMLElement).click() })
.pause(10000) .pause(10000)
@ -142,9 +142,9 @@ module.exports = {
.setValue('*[data-id="gisthandlerModalDialogModalBody-react"] input[data-id="modalDialogCustomPromp"]', testData.validGistId) .setValue('*[data-id="gisthandlerModalDialogModalBody-react"] input[data-id="modalDialogCustomPromp"]', testData.validGistId)
.modalFooterOKClick('gisthandler') .modalFooterOKClick('gisthandler')
.pause(10000) .pause(10000)
.openFile(`gist-${testData.validGistId}/README.txt`) .openFile(`README.txt`)
.waitForElementVisible(`div[data-path='default_workspace/gist-${testData.validGistId}/README.txt']`) .waitForElementVisible(`div[data-path='gist ${testData.validGistId}/README.txt']`)
.assert.containsText(`div[data-path='default_workspace/gist-${testData.validGistId}/README.txt'] > span`, 'README.txt') .assert.containsText(`div[data-path='gist ${testData.validGistId}/README.txt'] > span`, 'README.txt')
}, },
'Load Gist from URL and verify truncated files are loaded #group3': function (browser: NightwatchBrowser) { 'Load Gist from URL and verify truncated files are loaded #group3': function (browser: NightwatchBrowser) {
@ -152,14 +152,15 @@ module.exports = {
browser browser
.url('http://127.0.0.1:8080/#gist=' + gistId) // loading the gist .url('http://127.0.0.1:8080/#gist=' + gistId) // loading the gist
.refreshPage() .refreshPage()
.currentWorkspaceIs('gist ' + gistId)
.waitForElementVisible('*[data-id="remixIdeIconPanel"]', 15000) .waitForElementVisible('*[data-id="remixIdeIconPanel"]', 15000)
.waitForElementVisible(`#fileExplorerView li[data-path='gist-${gistId}/README.txt']`, 30000) .waitForElementVisible(`#fileExplorerView li[data-path='contracts']`, 30000)
.openFile(`gist-${gistId}/scripts/deploy_with_ethers.ts`) .openFile(`contracts/2_Owner.sol`)
.getEditorValue((content) => { .getEditorValue((content) => {
browser.assert.ok(content !== '') browser.assert.ok(content.indexOf('contract Owner {') !== -1)
}) })
.rightClickCustom(`li[data-path='gist-${gistId}'] div`) // saving the gist .click('*[data-id="workspacesMenuDropdown"]')
.click('[data-id="contextMenuItempublishFolderToGist"]') .click('*[data-id="workspacepublishToGist"]')
.modalFooterOKClick('fileSystem') .modalFooterOKClick('fileSystem')
.waitForElementVisible('*[data-shared="tooltipPopup"]', 5000) .waitForElementVisible('*[data-shared="tooltipPopup"]', 5000)
.assert.containsText('*[data-shared="tooltipPopup"]', 'Saving gist (' + gistId + ') ...') .assert.containsText('*[data-shared="tooltipPopup"]', 'Saving gist (' + gistId + ') ...')

@ -128,6 +128,7 @@ const checkForAcceptAndRemember = async function (browser: NightwatchBrowser) {
*/ */
const clickAndCheckLog = async (browser: NightwatchBrowser, buttonText: string, methodResult: any, eventResult: any, payload: any, waitResult: boolean = true) => { // eslint-disable-line const clickAndCheckLog = async (browser: NightwatchBrowser, buttonText: string, methodResult: any, eventResult: any, payload: any, waitResult: boolean = true) => { // eslint-disable-line
console.log('clickAndCheckLog', buttonText, methodResult, eventResult, payload, waitResult)
if (payload) { if (payload) {
await setPayload(browser, payload) await setPayload(browser, payload)
} else { } else {
@ -295,7 +296,7 @@ module.exports = {
}, null, '/') }, null, '/')
}, },
'Should get all workspaces #group2': async function (browser: NightwatchBrowser) { 'Should get all workspaces #group2': async function (browser: NightwatchBrowser) {
await clickAndCheckLog(browser, 'filePanel:getWorkspaces', [{name:"default_workspace",isGitRepo:false,hasGitSubmodules:false}, {name:"emptyworkspace",isGitRepo:false,hasGitSubmodules:false}, {name:"testspace",isGitRepo:false,hasGitSubmodules:false}], null, null) await clickAndCheckLog(browser, 'filePanel:getWorkspaces', [{name:"default_workspace",isGitRepo:false,hasGitSubmodules:false,isGist:null}, {name:"emptyworkspace",isGitRepo:false,hasGitSubmodules:false,isGist:null}, {name:"testspace",isGitRepo:false,hasGitSubmodules:false,isGist:null}], null, null)
}, },
'Should have set workspace event #group2': async function (browser: NightwatchBrowser) { 'Should have set workspace event #group2': async function (browser: NightwatchBrowser) {
await clickAndCheckLog(browser, 'filePanel:createWorkspace', null, { event: 'setWorkspace', args: [{ name: 'newspace', isLocalhost: false }] }, 'newspace') await clickAndCheckLog(browser, 'filePanel:createWorkspace', null, { event: 'setWorkspace', args: [{ name: 'newspace', isLocalhost: false }] }, 'newspace')
@ -309,11 +310,11 @@ module.exports = {
'Should rename workspace #group2': async function (browser: NightwatchBrowser) { 'Should rename workspace #group2': async function (browser: NightwatchBrowser) {
await clickAndCheckLog(browser, 'filePanel:renameWorkspace', null, null, ['default_workspace', 'renamed']) await clickAndCheckLog(browser, 'filePanel:renameWorkspace', null, null, ['default_workspace', 'renamed'])
await clickAndCheckLog(browser, 'filePanel:getWorkspaces', [{name:"emptyworkspace",isGitRepo:false,hasGitSubmodules:false},{name:"testspace",isGitRepo:false,hasGitSubmodules:false},{name:"newspace",isGitRepo:false,hasGitSubmodules:false},{name:"renamed",isGitRepo:false,hasGitSubmodules:false}], null, null) await clickAndCheckLog(browser, 'filePanel:getWorkspaces', [{name:"emptyworkspace",isGitRepo:false,hasGitSubmodules:false,isGist:null},{name:"testspace",isGitRepo:false,hasGitSubmodules:false,isGist:null},{name:"newspace",isGitRepo:false,hasGitSubmodules:false,isGist:null},{name:"renamed",isGitRepo:false,hasGitSubmodules:false,isGist:null}], null, null)
}, },
'Should delete workspace #group2': async function (browser: NightwatchBrowser) { 'Should delete workspace #group2': async function (browser: NightwatchBrowser) {
await clickAndCheckLog(browser, 'filePanel:deleteWorkspace', null, null, ['testspace']) await clickAndCheckLog(browser, 'filePanel:deleteWorkspace', null, null, ['testspace'])
await clickAndCheckLog(browser, 'filePanel:getWorkspaces', [{name:"emptyworkspace",isGitRepo:false,hasGitSubmodules:false},{name:"newspace",isGitRepo:false,hasGitSubmodules:false},{name:"renamed",isGitRepo:false,hasGitSubmodules:false}], null, null) await clickAndCheckLog(browser, 'filePanel:getWorkspaces', [{name:"emptyworkspace",isGitRepo:false,hasGitSubmodules:false,isGist:null},{name:"newspace",isGitRepo:false,hasGitSubmodules:false,isGist:null},{name:"renamed",isGitRepo:false,hasGitSubmodules:false,isGist:null}], null, null)
}, },
// DGIT // DGIT
'Should have changes on new workspace #group3': async function (browser: NightwatchBrowser) { 'Should have changes on new workspace #group3': async function (browser: NightwatchBrowser) {

@ -46,6 +46,7 @@ const profile = {
'loadTemplate', 'loadTemplate',
'clone', 'clone',
'isExpanded', 'isExpanded',
'isGist'
], ],
events: ['setWorkspace', 'workspaceRenamed', 'workspaceDeleted', 'workspaceCreated'], events: ['setWorkspace', 'workspaceRenamed', 'workspaceDeleted', 'workspaceCreated'],
icon: 'assets/img/fileManager.webp', icon: 'assets/img/fileManager.webp',
@ -131,6 +132,20 @@ module.exports = class Filepanel extends ViewPlugin {
}) })
} }
/**
* return the gist id if the current workspace is a gist workspace, otherwise returns null
* @argument {String} workspaceName - the name of the workspace to check against. default to the current workspace.
* @returns {string} gist id or null
*/
isGist (workspaceName) {
workspaceName = workspaceName || this.currentWorkspaceMetadata && this.currentWorkspaceMetadata.name
const isGist = workspaceName.startsWith('gist')
if (isGist) {
return workspaceName.split(' ')[1]
}
return null
}
getCurrentWorkspace() { getCurrentWorkspace() {
return this.currentWorkspaceMetadata return this.currentWorkspaceMetadata
} }

@ -62,10 +62,12 @@
"filePanel.compileForNahmii": "Compile for Nahmii", "filePanel.compileForNahmii": "Compile for Nahmii",
"filePanel.createNewFile": "Create new file", "filePanel.createNewFile": "Create new file",
"filePanel.createNewFolder": "Create new folder", "filePanel.createNewFolder": "Create new folder",
"filePanel.publishToGist": "Publish all files to GitHub gist", "filePanel.publishToGist": "Publish to Gist",
"filePanel.workspace.publishToGist": "Publish workspace to GitHub gist",
"filePanel.uploadFile": "Upload files", "filePanel.uploadFile": "Upload files",
"filePanel.uploadFolder": "Upload folder", "filePanel.uploadFolder": "Upload folder",
"filePanel.updateGist": "Update the current [gist] explorer", "filePanel.updateGist": "Update Gist",
"filePanel.workspace.updateGist": "Publish Gist update",
"filePanel.viewAllBranches": "View all branches", "filePanel.viewAllBranches": "View all branches",
"filePanel.createBranch": "Create branch", "filePanel.createBranch": "Create branch",
"filePanel.switchBranches": "Switch branches", "filePanel.switchBranches": "Switch branches",

@ -114,10 +114,20 @@ export class GistHandler extends Plugin {
return return
} }
const gistIdWorkspace = 'gist ' + gistId
const workspaces = await this.call('filePanel', 'getWorkspaces')
const found = workspaces.find((workspace) => workspace.name === gistIdWorkspace)
if (found) {
await this.call('notification', 'alert', `workspace "${gistIdWorkspace}" already exist`)
return
}
await this.call('filePanel', 'createWorkspace', 'gist ' + gistId, '', true)
await this.call('filePanel', 'switchToWorkspace', { name: 'gist ' + gistId, isLocalHost: false })
const obj: StringByString = {} const obj: StringByString = {}
Object.keys(data.files).forEach((element) => { Object.keys(data.files).forEach((element) => {
const path = element.replace(/\.\.\./g, '/') const path = element.replace(/\.\.\./g, '/')
obj['/gist-' + gistId + '/' + path] = data.files[element] obj['/' + path] = data.files[element]
}) })
this.call('fileManager', 'setBatchFiles', obj, isElectron()? 'electron':'workspace', true, async (errorSavingFiles: any) => { this.call('fileManager', 'setBatchFiles', obj, isElectron()? 'electron':'workspace', true, async (errorSavingFiles: any) => {
if (errorSavingFiles) { if (errorSavingFiles) {

@ -4,7 +4,7 @@ export interface FileType {
path: string, path: string,
name: string, name: string,
isDirectory: boolean, isDirectory: boolean,
type: 'folder' | 'file' | 'gist', type: 'folder' | 'file',
child?: File[] child?: File[]
} }

@ -24,6 +24,6 @@ export interface FileType {
path: string, path: string,
name?: string, name?: string,
isDirectory?: boolean, isDirectory?: boolean,
type?: 'folder' | 'file' | 'gist', type?: 'folder' | 'file',
child?: File[] child?: File[]
} }

@ -72,9 +72,10 @@ export const initWorkspace = (filePanelPlugin) => async (reducerDispatch: React.
dispatch(setWorkspaces(workspaces)) dispatch(setWorkspaces(workspaces))
} }
if (params.gist) { if (params.gist) {
await createWorkspaceTemplate('code-sample', 'gist-template') const name = 'gist ' + params.gist
plugin.setWorkspace({ name: 'code-sample', isLocalhost: false }) await createWorkspaceTemplate(name, 'gist-template')
dispatch(setCurrentWorkspace({ name: 'code-sample', isGitRepo: false })) plugin.setWorkspace({ name, isLocalhost: false })
dispatch(setCurrentWorkspace({ name, isGitRepo: false }))
await loadWorkspacePreset('gist-template') await loadWorkspacePreset('gist-template')
} else if (params.code || params.url || params.shareCode) { } else if (params.code || params.url || params.shareCode) {
await createWorkspaceTemplate('code-sample', 'code-template') await createWorkspaceTemplate('code-sample', 'code-template')
@ -224,14 +225,19 @@ export type SolidityConfiguration = {
runs: string runs: string
} }
export const publishToGist = async (path?: string, type?: string) => { export const publishToGist = async (path?: string) => {
// If 'id' is not defined, it is not a gist update but a creation so we have to take the files from the browser explorer. // If 'id' is not defined, it is not a gist update but a creation so we have to take the files from the browser explorer.
const folder = path || '/' const folder = path || '/'
try { try {
const name = extractNameFromKey(path) let id
const id = name && name.startsWith('gist-') ? name.split('-')[1] : null if (path) {
// check if the current folder is a gist folder
id = await plugin.call('filePanel', 'isGist', extractNameFromKey(path))
} else {
// check if the current workspace is a gist workspace
id = await plugin.call('filePanel', 'isGist')
}
const packaged = await packageGistFiles(folder) const packaged = await packageGistFiles(folder)
// check for token // check for token
const config = plugin.registry.get('config').api const config = plugin.registry.get('config').api
@ -314,7 +320,7 @@ export const createNewFile = async (path: string, rootDir: string) => {
} }
} }
export const setFocusElement = async (elements: { key: string, type: 'file' | 'folder' | 'gist' }[]) => { export const setFocusElement = async (elements: { key: string, type: 'file' | 'folder' }[]) => {
dispatch(focusElement(elements)) dispatch(focusElement(elements))
} }
@ -429,7 +435,7 @@ export const emitContextMenuEvent = async (cmd: customAction) => {
await plugin.call(cmd.id, cmd.name, cmd) await plugin.call(cmd.id, cmd.name, cmd)
} }
export const handleClickFile = async (path: string, type: 'file' | 'folder' | 'gist') => { export const handleClickFile = async (path: string, type: 'file' | 'folder' ) => {
if (type === 'file' && path.endsWith('.md')) { if (type === 'file' && path.endsWith('.md')) {
// just opening the preview // just opening the preview
await plugin.call('doc-viewer' as any, 'viewDocs', [path]) await plugin.call('doc-viewer' as any, 'viewDocs', [path])
@ -520,11 +526,6 @@ const packageGistFiles = async (directory) => {
if (/^\s+$/.test(content) || !content.length) { if (/^\s+$/.test(content) || !content.length) {
content = '// this line is added to create a gist. Empty file is not allowed.' content = '// this line is added to create a gist. Empty file is not allowed.'
} }
if (path.indexOf('gist-') === 0) {
path = path.split('/')
path.shift()
path = path.join('/')
}
path = path.replace(/\//g, '...') path = path.replace(/\//g, '...')
ret[path] = { content } ret[path] = { content }
}) })

@ -2,7 +2,7 @@ import React from 'react'
import { bufferToHex } from '@ethereumjs/util' import { bufferToHex } from '@ethereumjs/util'
import { hash } from '@remix-project/remix-lib' import { hash } from '@remix-project/remix-lib'
import { TEMPLATE_METADATA, TEMPLATE_NAMES } from '../utils/constants' import { TEMPLATE_METADATA, TEMPLATE_NAMES } from '../utils/constants'
import { TemplateType } from '../utils/types' import { TemplateType } from '../types'
import IpfsHttpClient from 'ipfs-http-client' import IpfsHttpClient from 'ipfs-http-client'
import axios, { AxiosResponse } from 'axios' import axios, { AxiosResponse } from 'axios'
import { import {
@ -345,9 +345,9 @@ export const loadWorkspacePreset = async (template: WorkspaceTemplate = 'remixDe
} }
if (data.files[element].type === 'application/json') { if (data.files[element].type === 'application/json') {
obj['/' + 'gist-' + gistId + '/' + path] = { content: JSON.stringify(value.content, null, '\t') } obj['/' + path] = { content: JSON.stringify(value.content, null, '\t') }
} else } else
obj['/' + 'gist-' + gistId + '/' + path] = value obj['/' + path] = value
} }
plugin.fileManager.setBatchFiles(obj, 'workspace', true, (errorLoadingFile) => { plugin.fileManager.setBatchFiles(obj, 'workspace', true, (errorLoadingFile) => {
if (errorLoadingFile) { if (errorLoadingFile) {
@ -609,6 +609,7 @@ export const getWorkspaces = async (): Promise<{ name: string; isGitRepo: boolea
Object.keys(items) Object.keys(items)
.filter((item) => items[item].isDirectory) .filter((item) => items[item].isDirectory)
.map(async (folder) => { .map(async (folder) => {
const name = folder.replace(workspacesPath + '/', '')
const isGitRepo: boolean = await plugin.fileProviders.browser.exists('/' + folder + '/.git') const isGitRepo: boolean = await plugin.fileProviders.browser.exists('/' + folder + '/.git')
const hasGitSubmodules: boolean = await plugin.fileProviders.browser.exists('/' + folder + '/.gitmodules') const hasGitSubmodules: boolean = await plugin.fileProviders.browser.exists('/' + folder + '/.gitmodules')
if (isGitRepo) { if (isGitRepo) {
@ -618,17 +619,19 @@ export const getWorkspaces = async (): Promise<{ name: string; isGitRepo: boolea
branches = await getGitRepoBranches(folder) branches = await getGitRepoBranches(folder)
currentBranch = await getGitRepoCurrentBranch(folder) currentBranch = await getGitRepoCurrentBranch(folder)
return { return {
name: folder.replace(workspacesPath + '/', ''), name,
isGitRepo, isGitRepo,
branches, branches,
currentBranch, currentBranch,
hasGitSubmodules hasGitSubmodules,
isGist: null
} }
} else { } else {
return { return {
name: folder.replace(workspacesPath + '/', ''), name,
isGitRepo, isGitRepo,
hasGitSubmodules hasGitSubmodules,
isGist: plugin.isGist(name) // plugin is filePanel
} }
} }
}) })

@ -187,15 +187,15 @@ export const FileExplorerContextMenu = (props: FileExplorerContextMenuProps) =>
break break
case 'Push changes to gist': case 'Push changes to gist':
_paq.push(['trackEvent', 'fileExplorer', 'contextMenu', 'pushToChangesoGist']) _paq.push(['trackEvent', 'fileExplorer', 'contextMenu', 'pushToChangesoGist'])
pushChangesToGist(path, type) pushChangesToGist(path)
break break
case 'Publish folder to gist': case 'Publish folder to gist':
_paq.push(['trackEvent', 'fileExplorer', 'contextMenu', 'publishFolderToGist']) _paq.push(['trackEvent', 'fileExplorer', 'contextMenu', 'publishFolderToGist'])
publishFolderToGist(path, type) publishFolderToGist(path)
break break
case 'Publish file to gist': case 'Publish file to gist':
_paq.push(['trackEvent', 'fileExplorer', 'contextMenu', 'publishFileToGist']) _paq.push(['trackEvent', 'fileExplorer', 'contextMenu', 'publishFileToGist'])
publishFileToGist(path, type) publishFileToGist(path)
break break
case 'Run': case 'Run':
_paq.push(['trackEvent', 'fileExplorer', 'contextMenu', 'runScript']) _paq.push(['trackEvent', 'fileExplorer', 'contextMenu', 'runScript'])
@ -227,7 +227,7 @@ export const FileExplorerContextMenu = (props: FileExplorerContextMenuProps) =>
break break
case 'Publish Workspace to Gist': case 'Publish Workspace to Gist':
_paq.push(['trackEvent', 'fileExplorer', 'contextMenu', 'publishWorkspace']) _paq.push(['trackEvent', 'fileExplorer', 'contextMenu', 'publishWorkspace'])
publishFolderToGist(path, type) publishFolderToGist(path)
break break
default: default:
_paq.push(['trackEvent', 'fileExplorer', 'contextMenu', `${item.id}/${item.name}`]) _paq.push(['trackEvent', 'fileExplorer', 'contextMenu', `${item.id}/${item.name}`])

@ -26,13 +26,6 @@ export const FileExplorerMenu = (props: FileExplorerMenuProps) => {
placement: 'top', placement: 'top',
platforms:[appPlatformTypes.web, appPlatformTypes.desktop] platforms:[appPlatformTypes.web, appPlatformTypes.desktop]
}, },
{
action: 'publishToGist',
title: 'Publish current workspace to GitHub gist',
icon: 'fab fa-github',
placement: 'top',
platforms:[appPlatformTypes.web]
},
{ {
action: 'uploadFile', action: 'uploadFile',
title: 'Upload files into current workspace', title: 'Upload files into current workspace',
@ -46,13 +39,6 @@ export const FileExplorerMenu = (props: FileExplorerMenuProps) => {
icon: 'far fa-folder-upload', icon: 'far fa-folder-upload',
placement: 'top', placement: 'top',
platforms:[appPlatformTypes.web] platforms:[appPlatformTypes.web]
},
{
action: 'updateGist',
title: 'Update the current [gist] explorer',
icon: 'fab fa-github',
placement: 'bottom-start',
platforms:[appPlatformTypes.web]
} }
].filter( ].filter(
(item) => (item) =>
@ -65,16 +51,6 @@ export const FileExplorerMenu = (props: FileExplorerMenuProps) => {
}) })
const enableDirUpload = {directory: '', webkitdirectory: ''} const enableDirUpload = {directory: '', webkitdirectory: ''}
useEffect(() => {
const actions = {
updateGist: () => {}
}
setState((prevState) => {
return {...prevState, actions}
})
}, [])
return ( return (
(!global.fs.browser.isSuccessfulWorkspace ? null : (!global.fs.browser.isSuccessfulWorkspace ? null :
<> <>
@ -165,7 +141,7 @@ export const FileExplorerMenu = (props: FileExplorerMenuProps) => {
props.createNewFile() props.createNewFile()
} else if (action === 'createNewFolder') { } else if (action === 'createNewFolder') {
props.createNewFolder() props.createNewFolder()
} else if (action === 'publishToGist') { } else if (action === 'publishToGist' || action == 'updateGist') {
props.publishToGist() props.publishToGist()
} else { } else {
state.actions[action]() state.actions[action]()

@ -143,12 +143,12 @@ export const FileExplorer = (props: FileExplorerProps) => {
} }
} }
const publishToGist = (path?: string, type?: string) => { const publishToGist = (path?: string) => {
props.modal( props.modal(
intl.formatMessage({ id: 'filePanel.createPublicGist' }), intl.formatMessage({ id: 'filePanel.createPublicGist' }),
intl.formatMessage({ id: 'filePanel.createPublicGistMsg4' }, { name }), intl.formatMessage({ id: 'filePanel.createPublicGistMsg4' }, { name }),
intl.formatMessage({ id: 'filePanel.ok' }), intl.formatMessage({ id: 'filePanel.ok' }),
() => toGist(path, type), () => toGist(path),
intl.formatMessage({ id: 'filePanel.cancel' }), intl.formatMessage({ id: 'filePanel.cancel' }),
() => { } () => { }
) )
@ -173,7 +173,7 @@ export const FileExplorer = (props: FileExplorerProps) => {
} }
} }
const handleClickFolder = async (path: string, type: 'folder' | 'file' | 'gist') => { const handleClickFolder = async (path: string, type: 'folder' | 'file' ) => {
if (state.ctrlKey) { if (state.ctrlKey) {
if (props.focusElement.findIndex((item) => item.key === path) !== -1) { if (props.focusElement.findIndex((item) => item.key === path) !== -1) {
const focusElement = props.focusElement.filter((item) => item.key !== path) const focusElement = props.focusElement.filter((item) => item.key !== path)

@ -2,13 +2,16 @@ import { appPlatformTypes } from '@remix-ui/app'
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'
import { WorkspaceMetadata } from '../types'
export interface HamburgerMenuProps { export interface HamburgerMenuProps {
selectedWorkspace: WorkspaceMetadata
createWorkspace: () => void createWorkspace: () => void
renameCurrentWorkspace: () => void renameCurrentWorkspace: () => void
downloadCurrentWorkspace: () => void downloadCurrentWorkspace: () => void
deleteCurrentWorkspace: () => void deleteCurrentWorkspace: () => void
deleteAllWorkspaces: () => void deleteAllWorkspaces: () => void
pushChangesToGist: () => void
cloneGitRepository: () => void cloneGitRepository: () => void
downloadWorkspaces: () => void downloadWorkspaces: () => void
restoreBackup: () => void restoreBackup: () => void
@ -24,7 +27,7 @@ export interface HamburgerMenuProps {
} }
export function HamburgerMenu(props: HamburgerMenuProps) { export function HamburgerMenu(props: HamburgerMenuProps) {
const {showIconsMenu, hideWorkspaceOptions, hideLocalhostOptions, hideFileOperations} = props const {showIconsMenu, hideWorkspaceOptions, hideLocalhostOptions, hideFileOperations, selectedWorkspace} = props
return ( return (
<> <>
<HamburgerMenuItem <HamburgerMenuItem
@ -88,6 +91,17 @@ export function HamburgerMenu(props: HamburgerMenuProps) {
platforms={[appPlatformTypes.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
kind={selectedWorkspace.isGist ? "updateGist" : "publishToGist"}
fa="fab fa-github"
hideOption={hideWorkspaceOptions || hideLocalhostOptions}
actionOnClick={() => {
props.pushChangesToGist()
props.hideIconsMenu(!showIconsMenu)
}}
platforms={[appPlatformTypes.web]}
></HamburgerMenuItem>
<Dropdown.Divider className="border mb-0 mt-0 remixui_menuhr" style={{pointerEvents: 'none'}} />
<HamburgerMenuItem <HamburgerMenuItem
kind="deleteAll" kind="deleteAll"
fa="far fa-trash-alt" fa="far fa-trash-alt"

@ -21,7 +21,7 @@ export const FileSystemContext = createContext<{
dispatchUploadFile: (target?: SyntheticEvent, targetFolder?: string) => Promise<void>, dispatchUploadFile: (target?: SyntheticEvent, targetFolder?: string) => Promise<void>,
dispatchUploadFolder: (target?: SyntheticEvent, targetFolder?: string) => Promise<void>, dispatchUploadFolder: (target?: SyntheticEvent, targetFolder?: string) => Promise<void>,
dispatchCreateNewFile: (path: string, rootDir: string) => Promise<void>, dispatchCreateNewFile: (path: string, rootDir: string) => Promise<void>,
dispatchSetFocusElement: (elements: { key: string, type: 'file' | 'folder' | 'gist' }[]) => Promise<void>, dispatchSetFocusElement: (elements: { key: string, type: 'file' | 'folder' }[]) => Promise<void>,
dispatchCreateNewFolder: (path: string, rootDir: string) => Promise<void>, dispatchCreateNewFolder: (path: string, rootDir: string) => Promise<void>,
dispatchDeletePath: (path: string[]) => Promise<void>, dispatchDeletePath: (path: string[]) => Promise<void>,
dispatchRenamePath: (oldPath: string, newPath: string) => Promise<void>, dispatchRenamePath: (oldPath: string, newPath: string) => Promise<void>,
@ -31,7 +31,7 @@ export const FileSystemContext = createContext<{
dispatchCopyFolder: (src: string, dest: string) => Promise<void>, dispatchCopyFolder: (src: string, dest: string) => Promise<void>,
dispatchRunScript: (path: string) => Promise<void>, dispatchRunScript: (path: string) => Promise<void>,
dispatchEmitContextMenuEvent: (cmd: customAction) => Promise<void>, dispatchEmitContextMenuEvent: (cmd: customAction) => Promise<void>,
dispatchHandleClickFile: (path: string, type: 'file' | 'folder' | 'gist') => Promise<void> dispatchHandleClickFile: (path: string, type: 'file' | 'folder' ) => Promise<void>
dispatchHandleExpandPath: (paths: string[]) => Promise<void>, dispatchHandleExpandPath: (paths: string[]) => Promise<void>,
dispatchHandleDownloadFiles: () => Promise<void>, dispatchHandleDownloadFiles: () => Promise<void>,
dispatchHandleDownloadWorkspace: () => Promise<void>, dispatchHandleDownloadWorkspace: () => Promise<void>,

@ -117,8 +117,8 @@ export const FileSystemProvider = (props: WorkspaceProps) => {
await deleteAllWorkspaces() await deleteAllWorkspaces()
} }
const dispatchPublishToGist = async (path?: string, type?: string) => { const dispatchPublishToGist = async (path?: string) => {
await publishToGist(path, type) await publishToGist(path)
} }
const dispatchUploadFile = async (target?: SyntheticEvent, targetFolder?: string) => { const dispatchUploadFile = async (target?: SyntheticEvent, targetFolder?: string) => {
@ -133,7 +133,7 @@ export const FileSystemProvider = (props: WorkspaceProps) => {
await createNewFile(path, rootDir) await createNewFile(path, rootDir)
} }
const dispatchSetFocusElement = async (elements: {key: string; type: 'file' | 'folder' | 'gist'}[]) => { const dispatchSetFocusElement = async (elements: {key: string; type: 'file' | 'folder' }[]) => {
await setFocusElement(elements) await setFocusElement(elements)
} }
@ -173,7 +173,7 @@ export const FileSystemProvider = (props: WorkspaceProps) => {
await emitContextMenuEvent(cmd) await emitContextMenuEvent(cmd)
} }
const dispatchHandleClickFile = async (path: string, type: 'file' | 'folder' | 'gist') => { const dispatchHandleClickFile = async (path: string, type: 'file' | 'folder' ) => {
await handleClickFile(path, type) await handleClickFile(path, type)
} }

@ -17,6 +17,7 @@ export interface BrowserState {
name: string name: string
}[] }[]
currentBranch?: string currentBranch?: string
isGist: string
}[] }[]
files: {[x: string]: Record<string, FileType>} files: {[x: string]: Record<string, FileType>}
flatTree: FileType[] flatTree: FileType[]
@ -150,7 +151,6 @@ export const browserReducer = (state = browserInitialState, action: Actions) =>
case 'SET_WORKSPACES': { case 'SET_WORKSPACES': {
const payload = action.payload const payload = action.payload
return { return {
...state, ...state,
browser: { browser: {
@ -986,8 +986,7 @@ const removeInputField = (
isDirectory: true, isDirectory: true,
path, path,
name: extractNameFromKey(path), name: extractNameFromKey(path),
type: type: 'folder',
extractNameFromKey(path).indexOf('gist-') === 0 ? 'gist' : 'folder',
child: prevFiles ? prevFiles.child : {} child: prevFiles ? prevFiles.child : {}
}, },
Object Object
@ -1117,8 +1116,7 @@ const normalize = (
path, path,
name: extractNameFromKey(path), name: extractNameFromKey(path),
isDirectory: filesList[key].isDirectory, isDirectory: filesList[key].isDirectory,
type: type: 'folder'
extractNameFromKey(path).indexOf('gist-') === 0 ? 'gist' : 'folder'
} }
} else { } else {
files[extractNameFromKey(key)] = { files[extractNameFromKey(key)] = {

@ -2,13 +2,14 @@ import React, {useState, useEffect, useRef, useContext, ChangeEvent} from 'react
import {FormattedMessage, useIntl} from 'react-intl' import {FormattedMessage, useIntl} from 'react-intl'
import {Dropdown} from 'react-bootstrap' import {Dropdown} from 'react-bootstrap'
import {CustomIconsToggle, CustomMenu, CustomToggle, CustomTooltip, extractNameFromKey, extractParentFromKey} from '@remix-ui/helper' import {CustomIconsToggle, CustomMenu, CustomToggle, CustomTooltip, extractNameFromKey, extractParentFromKey} from '@remix-ui/helper'
import {CopyToClipboard} from '@remix-ui/clipboard'
import {FileExplorer} from './components/file-explorer' // eslint-disable-line import {FileExplorer} from './components/file-explorer' // eslint-disable-line
import {FileSystemContext} from './contexts' import {FileSystemContext} from './contexts'
import './css/remix-ui-workspace.css' import './css/remix-ui-workspace.css'
import {ROOT_PATH, TEMPLATE_NAMES} from './utils/constants' import {ROOT_PATH, TEMPLATE_NAMES} from './utils/constants'
import {HamburgerMenu} from './components/workspace-hamburger' import {HamburgerMenu} from './components/workspace-hamburger'
import {MenuItems, WorkSpaceState} from './types' import {MenuItems, WorkSpaceState, WorkspaceMetadata} 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'
@ -26,13 +27,7 @@ export function Workspace() {
const LOCALHOST = ' - connect to localhost - ' const LOCALHOST = ' - connect to localhost - '
const NO_WORKSPACE = ' - none - ' const NO_WORKSPACE = ' - none - '
const [currentWorkspace, setCurrentWorkspace] = useState<string>(NO_WORKSPACE) const [currentWorkspace, setCurrentWorkspace] = useState<string>(NO_WORKSPACE)
const [selectedWorkspace, setSelectedWorkspace] = useState<{ const [selectedWorkspace, setSelectedWorkspace] = useState<WorkspaceMetadata>(null)
name: string
isGitRepo: boolean
hasGitSubmodules?: boolean
branches?: {remote: any; name: string}[]
currentBranch?: string
}>(null)
const [showDropdown, setShowDropdown] = useState<boolean>(false) const [showDropdown, setShowDropdown] = useState<boolean>(false)
const [showIconsMenu, hideIconsMenu] = useState<boolean>(false) const [showIconsMenu, hideIconsMenu] = useState<boolean>(false)
const [showBranches, setShowBranches] = useState<boolean>(false) const [showBranches, setShowBranches] = useState<boolean>(false)
@ -73,7 +68,7 @@ export function Workspace() {
}, },
mouseOverElement: null, mouseOverElement: null,
showContextMenu: false, showContextMenu: false,
reservedKeywords: [ROOT_PATH, 'gist-'], reservedKeywords: [ROOT_PATH],
copyElement: [], copyElement: [],
dragStatus: false dragStatus: false
}) })
@ -437,7 +432,7 @@ export function Workspace() {
} }
} }
const handleCopyClick = (path: string, type: 'folder' | 'gist' | 'file' | 'workspace') => { const handleCopyClick = (path: string, type: 'folder' | 'file' | 'workspace') => {
setState((prevState) => { setState((prevState) => {
return {...prevState, copyElement: [{key: path, type}]} return {...prevState, copyElement: [{key: path, type}]}
}) })
@ -506,7 +501,6 @@ export function Workspace() {
const focusElement = global.fs.focusElement const focusElement = global.fs.focusElement
if (focusElement[0]) { if (focusElement[0]) {
if (focusElement[0].type === 'folder' && focusElement[0].key) return focusElement[0].key if (focusElement[0].type === 'folder' && focusElement[0].key) return focusElement[0].key
else if (focusElement[0].type === 'gist' && focusElement[0].key) return focusElement[0].key
else if (focusElement[0].type === 'file' && focusElement[0].key) return extractParentFromKey(focusElement[0].key) ? extractParentFromKey(focusElement[0].key) : ROOT_PATH else if (focusElement[0].type === 'file' && focusElement[0].key) return extractParentFromKey(focusElement[0].key) ? extractParentFromKey(focusElement[0].key) : ROOT_PATH
else return ROOT_PATH else return ROOT_PATH
} }
@ -570,34 +564,34 @@ export function Workspace() {
} }
} }
const pushChangesToGist = (path?: string, type?: string) => { const pushChangesToGist = (path?: string) => {
global.modal( global.modal(
intl.formatMessage({id: 'filePanel.createPublicGist'}), intl.formatMessage({id: 'filePanel.createPublicGist'}),
intl.formatMessage({id: 'filePanel.createPublicGistMsg1'}), intl.formatMessage({id: 'filePanel.createPublicGistMsg1'}),
intl.formatMessage({id: 'filePanel.ok'}), intl.formatMessage({id: 'filePanel.ok'}),
() => toGist(path, type), () => toGist(path),
intl.formatMessage({id: 'filePanel.cancel'}), intl.formatMessage({id: 'filePanel.cancel'}),
() => {} () => {}
) )
} }
const publishFolderToGist = (path?: string, type?: string) => { const publishFolderToGist = (path?: string) => {
global.modal( global.modal(
intl.formatMessage({id: 'filePanel.createPublicGist'}), intl.formatMessage({id: 'filePanel.createPublicGist'}),
intl.formatMessage({id: 'filePanel.createPublicGistMsg2'}, {path}), intl.formatMessage({id: 'filePanel.createPublicGistMsg2'}, {path}),
intl.formatMessage({id: 'filePanel.ok'}), intl.formatMessage({id: 'filePanel.ok'}),
() => toGist(path, type), () => toGist(path),
intl.formatMessage({id: 'filePanel.cancel'}), intl.formatMessage({id: 'filePanel.cancel'}),
() => {} () => {}
) )
} }
const publishFileToGist = (path?: string, type?: string) => { const publishFileToGist = (path?: string) => {
global.modal( global.modal(
intl.formatMessage({id: 'filePanel.createPublicGist'}), intl.formatMessage({id: 'filePanel.createPublicGist'}),
intl.formatMessage({id: 'filePanel.createPublicGistMsg3'}, {path}), intl.formatMessage({id: 'filePanel.createPublicGistMsg3'}, {path}),
intl.formatMessage({id: 'filePanel.ok'}), intl.formatMessage({id: 'filePanel.ok'}),
() => toGist(path, type), () => toGist(path),
intl.formatMessage({id: 'filePanel.cancel'}), intl.formatMessage({id: 'filePanel.cancel'}),
() => {} () => {}
) )
@ -632,8 +626,8 @@ export function Workspace() {
) )
} }
const toGist = (path?: string, type?: string) => { const toGist = (path?: string) => {
global.dispatchPublishToGist(path, type) global.dispatchPublishToGist(path)
} }
const editModeOn = (path: string, type: string, isNew = false) => { const editModeOn = (path: string, type: string, isNew = false) => {
@ -922,7 +916,6 @@ export function Workspace() {
</> </>
) )
} }
return ( return (
<div className="d-flex flex-column justify-content-between h-100"> <div className="d-flex flex-column justify-content-between h-100">
<div <div
@ -952,11 +945,13 @@ export function Workspace() {
></Dropdown.Toggle> ></Dropdown.Toggle>
<Dropdown.Menu as={CustomMenu} data-id="wsdropdownMenu" className="custom-dropdown-items remixui_menuwidth" rootCloseEvent="click"> <Dropdown.Menu as={CustomMenu} data-id="wsdropdownMenu" className="custom-dropdown-items remixui_menuwidth" rootCloseEvent="click">
<HamburgerMenu <HamburgerMenu
selectedWorkspace={selectedWorkspace}
createWorkspace={createWorkspace} createWorkspace={createWorkspace}
renameCurrentWorkspace={renameCurrentWorkspace} renameCurrentWorkspace={renameCurrentWorkspace}
downloadCurrentWorkspace={downloadCurrentWorkspace} downloadCurrentWorkspace={downloadCurrentWorkspace}
deleteCurrentWorkspace={deleteCurrentWorkspace} deleteCurrentWorkspace={deleteCurrentWorkspace}
deleteAllWorkspaces={deleteAllWorkspaces} deleteAllWorkspaces={deleteAllWorkspaces}
pushChangesToGist={pushChangesToGist}
cloneGitRepository={cloneGitRepository} cloneGitRepository={cloneGitRepository}
downloadWorkspaces={downloadWorkspaces} downloadWorkspaces={downloadWorkspaces}
restoreBackup={restoreBackup} restoreBackup={restoreBackup}
@ -988,6 +983,12 @@ export function Workspace() {
> >
<i onClick={() => saveSampleCodeWorkspace()} className="far fa-exclamation-triangle text-warning ml-2 align-self-center" aria-hidden="true"></i> <i onClick={() => saveSampleCodeWorkspace()} className="far fa-exclamation-triangle text-warning ml-2 align-self-center" aria-hidden="true"></i>
</CustomTooltip>} </CustomTooltip>}
{selectedWorkspace && selectedWorkspace.isGist && <CopyToClipboard tip={'Copy Gist ID to clipboard'} getContent={() => selectedWorkspace.isGist} direction="bottom" icon="far fa-copy">
<i className="remixui_copyIcon ml-2 fab fa-github text-info" aria-hidden="true" style={{fontSize: '1.1rem', cursor: 'pointer'}} ></i>
</CopyToClipboard>
}
</span> </span>
</div> </div>
<div className='mx-2'> <div className='mx-2'>
@ -1077,11 +1078,10 @@ export function Workspace() {
</div> </div>
)} )}
{!(global.fs.browser.isRequestingWorkspace || global.fs.browser.isRequestingCloning) && global.fs.mode === 'browser' && currentWorkspace !== NO_WORKSPACE && ( {!(global.fs.browser.isRequestingWorkspace || global.fs.browser.isRequestingCloning) && global.fs.mode === 'browser' && currentWorkspace !== NO_WORKSPACE && (
<FileExplorer <FileExplorer
fileState={global.fs.browser.fileState} fileState={global.fs.browser.fileState}
name={currentWorkspace} name={currentWorkspace}
menuItems={['createNewFile', 'createNewFolder', 'publishToGist', canUpload ? 'uploadFile' : '', canUpload ? 'uploadFolder' : '']} menuItems={['createNewFile', 'createNewFolder', selectedWorkspace && selectedWorkspace.isGist ? 'updateGist' : 'publishToGist', canUpload ? 'uploadFile' : '', canUpload ? 'uploadFolder' : '']}
contextMenuItems={global.fs.browser.contextMenu.registeredMenuItems} contextMenuItems={global.fs.browser.contextMenu.registeredMenuItems}
removedContextMenuItems={global.fs.browser.contextMenu.removedMenuItems} removedContextMenuItems={global.fs.browser.contextMenu.removedMenuItems}
files={global.fs.browser.files} files={global.fs.browser.files}

@ -43,10 +43,28 @@ export interface FileType {
path: string path: string
name: string name: string
isDirectory: boolean isDirectory: boolean
type: 'folder' | 'file' | 'gist' type: 'folder' | 'file'
child?: File[] child?: File[]
} }
export type WorkspaceMetadata = {
name: string
isGitRepo: boolean
hasGitSubmodules?: boolean
branches?: {remote: any; name: string}[]
currentBranch?: string
isGist: string
}
export type TemplateType = {
type: 'git' | 'plugin'
url?: string
branch?: string
name?: string
endpoint?: string
params?: any[]
}
export interface FilePanelType extends ViewPlugin { export interface FilePanelType extends ViewPlugin {
setWorkspace: ({ name, isLocalhost }, setEvent: boolean) => void setWorkspace: ({ name, isLocalhost }, setEvent: boolean) => void
createWorkspace: (name: string, workspaceTemplateName: string) => void createWorkspace: (name: string, workspaceTemplateName: string) => void
@ -155,10 +173,10 @@ export interface FileExplorerContextMenuProps {
renamePath: (path: string, type: string) => void renamePath: (path: string, type: string) => void
downloadPath: (path: string) => void downloadPath: (path: string) => void
hideContextMenu: () => void hideContextMenu: () => void
publishToGist?: (path?: string, type?: string) => void publishToGist?: (path?: string) => void
pushChangesToGist?: (path?: string, type?: string) => void pushChangesToGist?: (path?: string) => void
publishFolderToGist?: (path?: string, type?: string) => void publishFolderToGist?: (path?: string) => void
publishFileToGist?: (path?: string, type?: string) => void publishFileToGist?: (path?: string) => void
runScript?: (path: string) => void runScript?: (path: string) => void
emit?: (cmd: customAction) => void emit?: (cmd: customAction) => void
pageX: number pageX: number
@ -319,4 +337,4 @@ export interface Action<T extends keyof ActionPayloadTypes> {
export type Actions = {[A in keyof ActionPayloadTypes]: Action<A>}[keyof ActionPayloadTypes] export type Actions = {[A in keyof ActionPayloadTypes]: Action<A>}[keyof ActionPayloadTypes]
export type WorkspaceElement = 'folder' | 'gist' | 'file' | 'workspace' export type WorkspaceElement = 'folder' | 'file' | 'workspace'

@ -1,4 +1,4 @@
import { TemplateType } from './types' import { TemplateType } from '../types'
export const ROOT_PATH = '/' export const ROOT_PATH = '/'
export const solTestYml = ` export const solTestYml = `
name: Running Solidity Unit Tests name: Running Solidity Unit Tests

@ -1,18 +1,18 @@
import { appPlatformTypes } from '@remix-ui/app' 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 { MenuItems } from '../types'
export const contextMenuActions: MenuItems = [{ export const contextMenuActions: MenuItems = [{
id: 'newFile', id: 'newFile',
name: 'New File', name: 'New File',
type: ['folder', 'gist', 'workspace'], type: ['folder', 'workspace'],
multiselect: false, multiselect: false,
label: '', label: '',
group: 0 group: 0
}, { }, {
id: 'newFolder', id: 'newFolder',
name: 'New Folder', name: 'New Folder',
type: ['folder', 'gist', 'workspace'], type: ['folder', 'workspace'],
multiselect: false, multiselect: false,
label: '', label: '',
group: 0 group: 0
@ -26,7 +26,7 @@ export const contextMenuActions: MenuItems = [{
}, { }, {
id: 'delete', id: 'delete',
name: 'Delete', name: 'Delete',
type: ['file', 'folder', 'gist'], type: ['file', 'folder'],
multiselect: false, multiselect: false,
label: '', label: '',
group: 0 group: 0
@ -80,14 +80,6 @@ export const contextMenuActions: MenuItems = [{
multiselect: false, multiselect: false,
label: '', label: '',
group: 3 group: 3
}, {
id: 'pushChangesToGist',
name: 'Push changes to gist',
type: ['gist'],
multiselect: false,
label: '',
group: 4,
platform: appPlatformTypes.web
}, { }, {
id: 'publishFolderToGist', id: 'publishFolderToGist',
name: 'Publish folder to gist', name: 'Publish folder to gist',
@ -107,21 +99,12 @@ export const contextMenuActions: MenuItems = [{
}, { }, {
id: 'uploadFile', id: 'uploadFile',
name: 'Load a Local File', name: 'Load a Local File',
type: ['folder', 'gist', 'workspace'], type: ['folder', 'workspace'],
multiselect: false, multiselect: false,
label: 'Load a Local File', label: 'Load a Local File',
group: 4, group: 4,
platform: appPlatformTypes.web platform: appPlatformTypes.web
}, { },{
id: 'publishToGist',
name: 'Push changes to gist',
type: ['folder', 'gist'],
multiselect: false,
label: 'Publish all to Gist',
group: 4,
platform: appPlatformTypes.web
},
{
id: 'publishWorkspace', id: 'publishWorkspace',
name: 'Publish Workspace to Gist', name: 'Publish Workspace to Gist',
type: ['workspace'], type: ['workspace'],

@ -1,8 +0,0 @@
export type TemplateType = {
type: 'git' | 'plugin'
url?: string
branch?: string
name?: string
endpoint?: string
params?: any[]
}
Loading…
Cancel
Save