From d7ee1904a3f27cf2d9d7947e432e0d05c61f5aa1 Mon Sep 17 00:00:00 2001 From: iamsethsamuel Date: Tue, 12 Jul 2022 17:52:08 +0100 Subject: [PATCH 01/21] files can be dragged and drop --- apps/remix-ide/src/app/files/fileManager.ts | 29 ++++++ .../src/lib/tree-view-item/tree-view-item.tsx | 90 +++++++++++++++---- libs/remix-ui/tree-view/src/types/index.ts | 5 ++ .../workspace/src/lib/actions/index.ts | 10 +++ .../src/lib/components/file-explorer.tsx | 30 ++++++- .../src/lib/components/file-render.tsx | 6 ++ .../workspace/src/lib/contexts/index.ts | 5 +- .../src/lib/providers/FileSystemProvider.tsx | 11 ++- .../workspace/src/lib/remix-ui-workspace.tsx | 4 +- .../remix-ui/workspace/src/lib/types/index.ts | 4 +- 10 files changed, 168 insertions(+), 26 deletions(-) diff --git a/apps/remix-ide/src/app/files/fileManager.ts b/apps/remix-ide/src/app/files/fileManager.ts index 44b604b8d4..7366fc9589 100644 --- a/apps/remix-ide/src/app/files/fileManager.ts +++ b/apps/remix-ide/src/app/files/fileManager.ts @@ -817,6 +817,35 @@ class FileManager extends Plugin { return exists } + + /** + * Moves a file to a new folder + * @param {string} src path of the source file + * @param {string} dest path of the destrination file + * @returns {void} + */ + + async moveFile(src: string, dest: string) { + try { + src = this.normalize(src) + dest = this.normalize(dest) + src = this.limitPluginScope(src) + dest = this.limitPluginScope(dest) + await this._handleExists(src, `Cannot copy from ${src}. Path does not exist.`) + await this._handleExists(dest, `Cannot paste content into ${dest}. Path does not exist.`) + await this._handleIsDir(dest, `Cannot paste content into ${dest}. Path is not directory.`) + + const content = await this.readFile(src) + let movedFilePath = dest + ( '/' + `${helper.extractNameFromKey(src)}`) + movedFilePath = await helper.createNonClashingNameAsync(movedFilePath, this) + + await this.writeFile(movedFilePath, content) + await this.remove(src) + + } catch (e) { + throw new Error(e) + } + } } module.exports = FileManager diff --git a/libs/remix-ui/tree-view/src/lib/tree-view-item/tree-view-item.tsx b/libs/remix-ui/tree-view/src/lib/tree-view-item/tree-view-item.tsx index e03e624977..3352e44b43 100644 --- a/libs/remix-ui/tree-view/src/lib/tree-view-item/tree-view-item.tsx +++ b/libs/remix-ui/tree-view/src/lib/tree-view-item/tree-view-item.tsx @@ -1,27 +1,83 @@ -import React, { useState, useEffect } from 'react' // eslint-disable-line -import { TreeViewItemProps } from '../../types' +import React, { useState, useEffect, useRef, useMemo, useContext } from 'react'; // eslint-disable-line +import { TreeViewItemProps } from '../../types'; -import './tree-view-item.css' +import './tree-view-item.css'; +import { MoveContext } from '../../../../workspace/src/lib/components/file-explorer' export const TreeViewItem = (props: TreeViewItemProps) => { - const { id, children, label, labelClass, expand, iconX = 'fas fa-caret-right', iconY = 'fas fa-caret-down', icon, controlBehaviour = false, innerRef, showIcon = true, ...otherProps } = props - const [isExpanded, setIsExpanded] = useState(false) + const { id, children, label, labelClass, expand, iconX = 'fas fa-caret-right', iconY = 'fas fa-caret-down', icon, controlBehaviour = false, innerRef, file, showIcon = true, ...otherProps } = props; + const [isExpanded, setIsExpanded] = useState(false); + const dragRef = useRef(); + const moveContext = useContext(MoveContext) useEffect(() => { - setIsExpanded(expand) - }, [expand]) + setIsExpanded(expand); + }, [expand]); + const handleDrop = (event: React.DragEvent, isDirectory: boolean,path: string) => { + event.preventDefault() + + if (isDirectory) { + moveContext.moveFile( path); + } + }; + + const handleDragover = ( + event: React.DragEvent, + isDirectory: boolean, + path: string, + type: string + ) => { + //Checks if the folder is opened + event.preventDefault(); + if (isDirectory !== null && !props.expandedPaths.includes(path)) { + props.handleClickFolder(path, type); + } + }; + + + const handleDrag = (event: React.DragEvent, path: string) => { + if (moveContext.dragged !== path) { + moveContext.currentlyMoved(path); + } + }; + return ( -
  • -
    !controlBehaviour && setIsExpanded(!isExpanded)}> - { children && showIcon ?
    : icon ?
    : null } - - { label } - +
  • { + if (file && file.isDirectory) { + handleDragover(event, file.isDirectory, file.path, file.type); + }}} + onDrop={(event) => {handleDrop(event, file ? file.isDirectory : false ,file ? file.path : null)}} + onDragStart={event => { + if (file) { + handleDrag(event, file.path); + } + }} + > +
    !controlBehaviour && setIsExpanded(!isExpanded)} + > + {children && showIcon ? ( +
    + ) : icon ? ( +
    + ) : null} + {label}
    - { isExpanded ? children : null } + {isExpanded ? children : null}
  • - ) -} + ); +}; -export default TreeViewItem +export default TreeViewItem; diff --git a/libs/remix-ui/tree-view/src/types/index.ts b/libs/remix-ui/tree-view/src/types/index.ts index 4f6bfc9e02..8f20c1b8a2 100644 --- a/libs/remix-ui/tree-view/src/types/index.ts +++ b/libs/remix-ui/tree-view/src/types/index.ts @@ -1,4 +1,6 @@ /* eslint-disable no-undef */ +import { FileType } from 'libs/remix-ui/workspace/src/lib/types/index' + export interface TreeViewProps { children?: React.ReactNode, id?: string @@ -23,4 +25,7 @@ export interface TreeViewItemProps { onContextMenu?: (...args: any) => void, onBlur?: (...args: any) => void, showIcon?: boolean + expandedPaths?: string[]; + handleClickFolder?: (path: string, type: string) => void; + file?: FileType } diff --git a/libs/remix-ui/workspace/src/lib/actions/index.ts b/libs/remix-ui/workspace/src/lib/actions/index.ts index 31fe71a453..eaf65dba08 100644 --- a/libs/remix-ui/workspace/src/lib/actions/index.ts +++ b/libs/remix-ui/workspace/src/lib/actions/index.ts @@ -462,3 +462,13 @@ const saveAs = (blob, name) => { } }, 0) // 40s } + +export const moveFile = async (src: string, dest: string) => { + const fileManager = plugin.fileManager + + try { + await fileManager.moveFile(src, dest) + } catch (error) { + dispatch(displayPopUp('Oops! An error ocurred while performing moveFile operation.' + error)) + } +} \ No newline at end of file diff --git a/libs/remix-ui/workspace/src/lib/components/file-explorer.tsx b/libs/remix-ui/workspace/src/lib/components/file-explorer.tsx index 3ccefdb2db..528589afc1 100644 --- a/libs/remix-ui/workspace/src/lib/components/file-explorer.tsx +++ b/libs/remix-ui/workspace/src/lib/components/file-explorer.tsx @@ -11,6 +11,18 @@ import { checkSpecialChars, extractNameFromKey, extractParentFromKey, joinPath } // eslint-disable-next-line @typescript-eslint/no-unused-vars import { FileRender } from './file-render' +interface MoveContextType{ + dragged: string, + moveFile: (dest: string) => void + currentlyMoved: (path: string) => void +} + +export const MoveContext = React.createContext({ + dragged:"", + moveFile:( )=> {}, + currentlyMoved: () => {} +}) + export const FileExplorer = (props: FileExplorerProps) => { const { name, contextMenuItems, removedContextMenuItems, files, fileState } = props const [state, setState] = useState({ @@ -36,6 +48,7 @@ export const FileExplorer = (props: FileExplorerProps) => { }) const [canPaste, setCanPaste] = useState(false) const treeRef = useRef(null) + const [dragged, setDragged] = useState("") useEffect(() => { if (contextMenuItems) { @@ -409,7 +422,21 @@ export const FileExplorer = (props: FileExplorerProps) => { props.dispatchHandleExpandPath(expandPath) } + return ( + { + try { + props.dispatchMoveFile(dragged, dest) + } catch (error) { + props.modal('Moving File Failed', 'Unexpected error while moving file: ' + dragged, 'Close', async () => {}) + } + }, + currentlyMoved:(path)=>{ + setDragged(path) + } + }}>
    { handleClickFolder={handleClickFolder} handleContextMenu={handleContextMenu} key={index} + />) } @@ -473,7 +501,7 @@ export const FileExplorer = (props: FileExplorerProps) => { /> }
    - ) +
    ) } export default FileExplorer diff --git a/libs/remix-ui/workspace/src/lib/components/file-render.tsx b/libs/remix-ui/workspace/src/lib/components/file-render.tsx index 164689899b..5a9f3652b7 100644 --- a/libs/remix-ui/workspace/src/lib/components/file-render.tsx +++ b/libs/remix-ui/workspace/src/lib/components/file-render.tsx @@ -90,6 +90,9 @@ export const FileRender = (props: RenderFileProps) => { expand={props.expandPath.includes(file.path)} onMouseOver={handleMouseOver} onMouseOut={handleMouseOut} + file={file} + handleClickFolder={props.handleClickFolder} + expandedPaths={props.expandPath} > { file.child ? { @@ -132,6 +135,9 @@ export const FileRender = (props: RenderFileProps) => { labelClass={labelClass} onMouseOver={handleMouseOver} onMouseOut={handleMouseOut} + file={file} + handleClickFolder={props.handleClickFolder} + expandedPaths={props.expandPath} /> ) } diff --git a/libs/remix-ui/workspace/src/lib/contexts/index.ts b/libs/remix-ui/workspace/src/lib/contexts/index.ts index b71dc9e373..56bba8e036 100644 --- a/libs/remix-ui/workspace/src/lib/contexts/index.ts +++ b/libs/remix-ui/workspace/src/lib/contexts/index.ts @@ -4,7 +4,7 @@ import { BrowserState } from '../reducers/workspace' export const FileSystemContext = createContext<{ fs: BrowserState, - modal:(title: string | JSX.Element, message: string | JSX.Element, okLabel: string, okFn: () => void, cancelLabel?: string, cancelFn?: () => void) => void, + modal:(title: string, message: string | JSX.Element, okLabel: string, okFn: () => void, cancelLabel?: string, cancelFn?: () => void) => void, dispatchInitWorkspace:() => Promise, dispatchFetchDirectory:(path: string) => Promise, dispatchAddInputField:(path: string, type: 'file' | 'folder') => Promise, @@ -29,6 +29,7 @@ export const FileSystemContext = createContext<{ dispatchHandleClickFile: (path: string, type: 'file' | 'folder' | 'gist') => Promise dispatchHandleExpandPath: (paths: string[]) => Promise, dispatchHandleDownloadFiles: () => Promise, - dispatchHandleRestoreBackup: () => Promise, + dispatchHandleRestoreBackup: () => Promise + dispatchMoveFile: (src: string, dest: string) => Promise, dispatchCloneRepository: (url: string) => Promise }>(null) diff --git a/libs/remix-ui/workspace/src/lib/providers/FileSystemProvider.tsx b/libs/remix-ui/workspace/src/lib/providers/FileSystemProvider.tsx index f754869931..fbf1af48dc 100644 --- a/libs/remix-ui/workspace/src/lib/providers/FileSystemProvider.tsx +++ b/libs/remix-ui/workspace/src/lib/providers/FileSystemProvider.tsx @@ -5,9 +5,7 @@ import { Toaster } from '@remix-ui/toaster' // eslint-disable-line // eslint-disable-next-line @typescript-eslint/no-unused-vars import { FileSystemContext } from '../contexts' import { browserReducer, browserInitialState } from '../reducers/workspace' -import { initWorkspace, fetchDirectory, removeInputField, deleteWorkspace, clearPopUp, publishToGist, createNewFile, setFocusElement, createNewFolder, - deletePath, renamePath, copyFile, copyFolder, runScript, emitContextMenuEvent, handleClickFile, handleExpandPath, addInputField, createWorkspace, - fetchWorkspaceDirectory, renameWorkspace, switchToWorkspace, uploadFile, handleDownloadFiles, restoreBackupZip, cloneRepository } from '../actions' +import { initWorkspace, fetchDirectory, removeInputField, deleteWorkspace, clearPopUp, publishToGist, createNewFile, setFocusElement, createNewFolder, deletePath, renamePath, copyFile, copyFolder, runScript, emitContextMenuEvent, handleClickFile, handleExpandPath, addInputField, createWorkspace, fetchWorkspaceDirectory, renameWorkspace, switchToWorkspace, uploadFile, handleDownloadFiles, restoreBackupZip, moveFile, cloneRepository } from '../actions' import { Modal, WorkspaceProps, WorkspaceTemplate } from '../types' // eslint-disable-next-line @typescript-eslint/no-unused-vars import { Workspace } from '../remix-ui-workspace' @@ -129,6 +127,10 @@ export const FileSystemProvider = (props: WorkspaceProps) => { await cloneRepository(url) } + const dispatchMoveFile = async (src: string, dest: string) => { + await moveFile(src, dest) + } + useEffect(() => { dispatchInitWorkspace() }, []) @@ -231,7 +233,8 @@ export const FileSystemProvider = (props: WorkspaceProps) => { dispatchHandleExpandPath, dispatchHandleDownloadFiles, dispatchHandleRestoreBackup, - dispatchCloneRepository + dispatchCloneRepository, + dispatchMoveFile } return ( diff --git a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx index b56c83b5de..f96a252c26 100644 --- a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx +++ b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx @@ -330,6 +330,7 @@ export function Workspace () { dispatchRemoveInputField={global.dispatchRemoveInputField} dispatchAddInputField={global.dispatchAddInputField} dispatchHandleExpandPath={global.dispatchHandleExpandPath} + dispatchMoveFile={global.dispatchMoveFile} /> } @@ -367,6 +368,7 @@ export function Workspace () { dispatchRemoveInputField={global.dispatchRemoveInputField} dispatchAddInputField={global.dispatchAddInputField} dispatchHandleExpandPath={global.dispatchHandleExpandPath} + dispatchMoveFile={global.dispatchMoveFile} /> } @@ -378,4 +380,4 @@ export function Workspace () { ) } -export default Workspace +export default Workspace \ No newline at end of file diff --git a/libs/remix-ui/workspace/src/lib/types/index.ts b/libs/remix-ui/workspace/src/lib/types/index.ts index 93b6d9f8c9..cc78ca6a14 100644 --- a/libs/remix-ui/workspace/src/lib/types/index.ts +++ b/libs/remix-ui/workspace/src/lib/types/index.ts @@ -14,7 +14,7 @@ export interface JSONStandardInput { }; } export type MenuItems = action[] -export type WorkspaceTemplate = 'gist-template' | 'code-template' | 'remixDefault' | 'blank' | 'ozerc20' | 'zeroxErc20' | 'ozerc721' +export type WorkspaceTemplate = 'gist-template' | 'code-template' | 'remixDefault' | 'blank' | 'erc20' export interface WorkspaceProps { plugin: { setWorkspace: ({ name: string, isLocalhost: boolean }, setEvent: boolean) => void, @@ -98,6 +98,8 @@ export interface FileExplorerProps { dispatchRemoveInputField:(path: string) => Promise, dispatchAddInputField:(path: string, type: 'file' | 'folder') => Promise, dispatchHandleExpandPath: (paths: string[]) => Promise + dispatchMoveFile: (src: string, dest: string) => Promise, + } export interface FileExplorerMenuProps { From 286fec066378bb23b3502e0c699c149406df981b Mon Sep 17 00:00:00 2001 From: iamsethsamuel Date: Mon, 1 Aug 2022 13:48:32 +0100 Subject: [PATCH 02/21] drag and drop working --- .../src/lib/tree-view-item/tree-view-item.tsx | 8 ++++---- libs/remix-ui/tree-view/src/types/index.ts | 4 +--- .../workspace/src/lib/components/file-explorer.tsx | 13 +------------ libs/remix-ui/workspace/src/lib/contexts/index.ts | 13 +++++++++++++ 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/libs/remix-ui/tree-view/src/lib/tree-view-item/tree-view-item.tsx b/libs/remix-ui/tree-view/src/lib/tree-view-item/tree-view-item.tsx index 3352e44b43..ead7268c0a 100644 --- a/libs/remix-ui/tree-view/src/lib/tree-view-item/tree-view-item.tsx +++ b/libs/remix-ui/tree-view/src/lib/tree-view-item/tree-view-item.tsx @@ -1,11 +1,11 @@ -import React, { useState, useEffect, useRef, useMemo, useContext } from 'react'; // eslint-disable-line +import React, { useState, useEffect, useRef, useContext } from 'react'; // eslint-disable-line import { TreeViewItemProps } from '../../types'; import './tree-view-item.css'; -import { MoveContext } from '../../../../workspace/src/lib/components/file-explorer' - +import { MoveContext } from '@remix-ui/workspace' + export const TreeViewItem = (props: TreeViewItemProps) => { - const { id, children, label, labelClass, expand, iconX = 'fas fa-caret-right', iconY = 'fas fa-caret-down', icon, controlBehaviour = false, innerRef, file, showIcon = true, ...otherProps } = props; + const { id, children, label, labelClass, expand, iconX = 'fas fa-caret-right', iconY = 'fas fa-caret-down', icon, controlBehaviour = false, file, showIcon = true, ...otherProps } = props; const [isExpanded, setIsExpanded] = useState(false); const dragRef = useRef(); const moveContext = useContext(MoveContext) diff --git a/libs/remix-ui/tree-view/src/types/index.ts b/libs/remix-ui/tree-view/src/types/index.ts index 8f20c1b8a2..1248e7ad5a 100644 --- a/libs/remix-ui/tree-view/src/types/index.ts +++ b/libs/remix-ui/tree-view/src/types/index.ts @@ -1,6 +1,4 @@ /* eslint-disable no-undef */ -import { FileType } from 'libs/remix-ui/workspace/src/lib/types/index' - export interface TreeViewProps { children?: React.ReactNode, id?: string @@ -27,5 +25,5 @@ export interface TreeViewItemProps { showIcon?: boolean expandedPaths?: string[]; handleClickFolder?: (path: string, type: string) => void; - file?: FileType + file?: any } diff --git a/libs/remix-ui/workspace/src/lib/components/file-explorer.tsx b/libs/remix-ui/workspace/src/lib/components/file-explorer.tsx index 528589afc1..523a7d3943 100644 --- a/libs/remix-ui/workspace/src/lib/components/file-explorer.tsx +++ b/libs/remix-ui/workspace/src/lib/components/file-explorer.tsx @@ -10,18 +10,7 @@ import '../css/file-explorer.css' import { checkSpecialChars, extractNameFromKey, extractParentFromKey, joinPath } from '@remix-ui/helper' // eslint-disable-next-line @typescript-eslint/no-unused-vars import { FileRender } from './file-render' - -interface MoveContextType{ - dragged: string, - moveFile: (dest: string) => void - currentlyMoved: (path: string) => void -} - -export const MoveContext = React.createContext({ - dragged:"", - moveFile:( )=> {}, - currentlyMoved: () => {} -}) +import { MoveContext } from '../contexts' export const FileExplorer = (props: FileExplorerProps) => { const { name, contextMenuItems, removedContextMenuItems, files, fileState } = props diff --git a/libs/remix-ui/workspace/src/lib/contexts/index.ts b/libs/remix-ui/workspace/src/lib/contexts/index.ts index 56bba8e036..c0bcb7c59f 100644 --- a/libs/remix-ui/workspace/src/lib/contexts/index.ts +++ b/libs/remix-ui/workspace/src/lib/contexts/index.ts @@ -33,3 +33,16 @@ export const FileSystemContext = createContext<{ dispatchMoveFile: (src: string, dest: string) => Promise, dispatchCloneRepository: (url: string) => Promise }>(null) + +interface MoveContextType{ + dragged: string, + moveFile: (dest: string) => void + currentlyMoved: (path: string) => void +} + +export const MoveContext = createContext({ + dragged:"", + moveFile:( )=> {}, + currentlyMoved: () => {} +}) + \ No newline at end of file From 29c7887959a2b34fd06b7941e2408e27b1ef6767 Mon Sep 17 00:00:00 2001 From: iamsethsamuel Date: Wed, 3 Aug 2022 13:17:45 +0100 Subject: [PATCH 03/21] drag and drop is now a library --- jest.config.js | 2 +- jest.preset.js | 4 + libs/remix-ui/draggable/.babelrc | 3 + libs/remix-ui/draggable/.eslintrc.json | 33 +++++ libs/remix-ui/draggable/README.md | 10 ++ libs/remix-ui/draggable/jest.config.js | 14 ++ libs/remix-ui/draggable/src/index.ts | 1 + .../src/lib/remix-ui-draggable.spec.ts | 7 + .../draggable/src/lib/remix-ui-draggable.tsx | 104 ++++++++++++++ libs/remix-ui/draggable/tsconfig.json | 19 +++ libs/remix-ui/draggable/tsconfig.lib.json | 11 ++ libs/remix-ui/draggable/tsconfig.spec.json | 15 ++ .../src/lib/components/file-explorer.tsx | 26 ++-- .../workspace/src/lib/contexts/index.ts | 2 + .../src/lib/providers/FileSystemProvider.tsx | 7 +- .../remix-ui/workspace/src/lib/types/index.ts | 1 - package.json | 2 +- tsconfig.base.json | 133 +++++++++++++----- 18 files changed, 340 insertions(+), 54 deletions(-) create mode 100644 jest.preset.js create mode 100644 libs/remix-ui/draggable/.babelrc create mode 100644 libs/remix-ui/draggable/.eslintrc.json create mode 100644 libs/remix-ui/draggable/README.md create mode 100644 libs/remix-ui/draggable/jest.config.js create mode 100644 libs/remix-ui/draggable/src/index.ts create mode 100644 libs/remix-ui/draggable/src/lib/remix-ui-draggable.spec.ts create mode 100644 libs/remix-ui/draggable/src/lib/remix-ui-draggable.tsx create mode 100644 libs/remix-ui/draggable/tsconfig.json create mode 100644 libs/remix-ui/draggable/tsconfig.lib.json create mode 100644 libs/remix-ui/draggable/tsconfig.spec.json diff --git a/jest.config.js b/jest.config.js index b2722cad44..117de1bcd1 100644 --- a/jest.config.js +++ b/jest.config.js @@ -21,5 +21,5 @@ module.exports = { "/../../dist/libs/remix-ws-templates/src/index.js" , "@remix-project/remixd": "/../../dist/libs/remixd/index.js" - } + },"projects": "/libs/remix-ui/draggable" }; diff --git a/jest.preset.js b/jest.preset.js new file mode 100644 index 0000000000..a7ccccd3f1 --- /dev/null +++ b/jest.preset.js @@ -0,0 +1,4 @@ + + const nxPreset = require('@nrwl/jest/preset'); + + module.exports = { ...nxPreset } \ No newline at end of file diff --git a/libs/remix-ui/draggable/.babelrc b/libs/remix-ui/draggable/.babelrc new file mode 100644 index 0000000000..cf7ddd99c6 --- /dev/null +++ b/libs/remix-ui/draggable/.babelrc @@ -0,0 +1,3 @@ +{ + "presets": [["@nrwl/web/babel", { "useBuiltIns": "usage" }]] +} diff --git a/libs/remix-ui/draggable/.eslintrc.json b/libs/remix-ui/draggable/.eslintrc.json new file mode 100644 index 0000000000..7cd4bf646b --- /dev/null +++ b/libs/remix-ui/draggable/.eslintrc.json @@ -0,0 +1,33 @@ +{ + "extends": [ + "../../../.eslintrc.json" + ], + "ignorePatterns": [ + "!**/*" + ], + "overrides": [ + { + "files": [ + "*.ts", + "*.tsx", + "*.js", + "*.jsx" + ], + "rules": {} + }, + { + "files": [ + "*.ts", + "*.tsx" + ], + "rules": {} + }, + { + "files": [ + "*.js", + "*.jsx" + ], + "rules": {} + } + ] +} \ No newline at end of file diff --git a/libs/remix-ui/draggable/README.md b/libs/remix-ui/draggable/README.md new file mode 100644 index 0000000000..5c429edbde --- /dev/null +++ b/libs/remix-ui/draggable/README.md @@ -0,0 +1,10 @@ +# remix-ui-draggable + +This library was generated with [Nx](https://nx.dev). + + +## Running unit tests + +Run `nx test remix-ui-draggable` to execute the unit tests via [Jest](https://jestjs.io). + + diff --git a/libs/remix-ui/draggable/jest.config.js b/libs/remix-ui/draggable/jest.config.js new file mode 100644 index 0000000000..1798c08a91 --- /dev/null +++ b/libs/remix-ui/draggable/jest.config.js @@ -0,0 +1,14 @@ +module.exports = { + displayName: 'remix-ui-draggable', + preset: '../../../jest.preset.js', + globals: { + 'ts-jest': { + tsconfig: '/tsconfig.spec.json', + } + }, + transform: { + '^.+\\.[tj]sx?$': 'ts-jest' + }, + moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], + coverageDirectory: '../../../coverage/libs/remix-ui/draggable' +}; diff --git a/libs/remix-ui/draggable/src/index.ts b/libs/remix-ui/draggable/src/index.ts new file mode 100644 index 0000000000..9a4142a6fc --- /dev/null +++ b/libs/remix-ui/draggable/src/index.ts @@ -0,0 +1 @@ +export * from './lib/remix-ui-draggable'; diff --git a/libs/remix-ui/draggable/src/lib/remix-ui-draggable.spec.ts b/libs/remix-ui/draggable/src/lib/remix-ui-draggable.spec.ts new file mode 100644 index 0000000000..26a3488b47 --- /dev/null +++ b/libs/remix-ui/draggable/src/lib/remix-ui-draggable.spec.ts @@ -0,0 +1,7 @@ +import { remixUiDraggable } from './remix-ui-draggable'; + +describe('remixUiDraggable', () => { + it('should work', () => { + expect(remixUiDraggable()).toEqual('remix-ui-draggable'); + }) +}) \ No newline at end of file diff --git a/libs/remix-ui/draggable/src/lib/remix-ui-draggable.tsx b/libs/remix-ui/draggable/src/lib/remix-ui-draggable.tsx new file mode 100644 index 0000000000..222eca1ddd --- /dev/null +++ b/libs/remix-ui/draggable/src/lib/remix-ui-draggable.tsx @@ -0,0 +1,104 @@ +import { FileType } from "libs/remix-ui/workspace/src/lib/types"; +import React, { + createContext, + ReactNode, + useContext, + useRef, + useState, +} from "react"; + +interface MoveContextType { + dragged: string; + isDraggable?: boolean; + moveFile: (dest: string, dragged: string) => void; + currentlyMoved: (path: string) => void; +} +interface DraggableType { + children: ReactNode; + file: FileType; + isDraggable?: boolean; + expandedPath: string[]; + handleClickFolder: (path: string, type: string) => void; +} + +interface DragType { + children: ReactNode; + onFileMoved: (dest: string, dragged: string) => void; +} + +export const MoveContext = createContext({ + dragged: "", + moveFile: () => {}, + currentlyMoved: () => {}, +}); + +export const Drag = (props: DragType) => { + const [dragged, setDragged] = useState(""); + + return ( + { + setDragged(() => path); + }, + }} + > + {props.children} + + ); +}; + +export const Draggable = (props: DraggableType) => { + const dragRef = useRef(), + file = props.file, + context = useContext(MoveContext); + + const handleDrop = (event: React.DragEvent) => { + event.preventDefault(); + + if (file.isDirectory) { + context.moveFile(file.path, context.dragged); + } + }; + + const handleDragover = (event: React.DragEvent) => { + //Checks if the folder is opened + event.preventDefault(); + if (file.isDirectory && !props.expandedPath.includes(file.path)) { + props.handleClickFolder(file.path, file.type); + } + }; + const handleDrag = () => { + if (context.dragged !== file.path) { + context.currentlyMoved(file.path); + } + }; + + if (props.isDraggable) { + return <>{props.children}; + } + + return ( + { + handleDrop(event); + }} + onDragStart={(event) => { + if (file) { + handleDrag(); + } + }} + onDragOver={(event) => { + if (file && file.isDirectory) { + handleDragover(event); + } + }} + > + {props.children} + + ); +}; diff --git a/libs/remix-ui/draggable/tsconfig.json b/libs/remix-ui/draggable/tsconfig.json new file mode 100644 index 0000000000..58b5a738e8 --- /dev/null +++ b/libs/remix-ui/draggable/tsconfig.json @@ -0,0 +1,19 @@ +{ + "extends": "../../../tsconfig.base.json", + "files": [], + "include": [], + "compilerOptions": { + "jsx": "react", + "allowJs": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true + }, + "references": [ + { + "path": "./tsconfig.lib.json" + }, + { + "path": "./tsconfig.spec.json" + } + ] +} \ No newline at end of file diff --git a/libs/remix-ui/draggable/tsconfig.lib.json b/libs/remix-ui/draggable/tsconfig.lib.json new file mode 100644 index 0000000000..a2268f1709 --- /dev/null +++ b/libs/remix-ui/draggable/tsconfig.lib.json @@ -0,0 +1,11 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "module": "commonjs", + "outDir": "../../../dist/out-tsc", + "declaration": true, + "types": ["node"] + }, + "exclude": ["**/*.spec.ts"], + "include": ["**/*.ts", "src/lib/remix-ui-draggable.tsx"] +} diff --git a/libs/remix-ui/draggable/tsconfig.spec.json b/libs/remix-ui/draggable/tsconfig.spec.json new file mode 100644 index 0000000000..1798b378a9 --- /dev/null +++ b/libs/remix-ui/draggable/tsconfig.spec.json @@ -0,0 +1,15 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../../dist/out-tsc", + "module": "commonjs", + "types": ["jest", "node"] + }, + "include": [ + "**/*.spec.ts", + "**/*.spec.tsx", + "**/*.spec.js", + "**/*.spec.jsx", + "**/*.d.ts" + ] +} diff --git a/libs/remix-ui/workspace/src/lib/components/file-explorer.tsx b/libs/remix-ui/workspace/src/lib/components/file-explorer.tsx index 523a7d3943..09e29bdd3e 100644 --- a/libs/remix-ui/workspace/src/lib/components/file-explorer.tsx +++ b/libs/remix-ui/workspace/src/lib/components/file-explorer.tsx @@ -10,7 +10,7 @@ import '../css/file-explorer.css' import { checkSpecialChars, extractNameFromKey, extractParentFromKey, joinPath } from '@remix-ui/helper' // eslint-disable-next-line @typescript-eslint/no-unused-vars import { FileRender } from './file-render' -import { MoveContext } from '../contexts' +import { Drag } from '@remix-project/remix-ui/draggable' export const FileExplorer = (props: FileExplorerProps) => { const { name, contextMenuItems, removedContextMenuItems, files, fileState } = props @@ -411,21 +411,16 @@ export const FileExplorer = (props: FileExplorerProps) => { props.dispatchHandleExpandPath(expandPath) } + const handleFileMove = (dest: string, dragged:string)=>{ + try { + props.dispatchMoveFile(dragged, dest) + } catch (error) { + props.modal('Moving File Failed', 'Unexpected error while moving file: ' + dragged, 'Close', async () => {}) + } +} return ( - { - try { - props.dispatchMoveFile(dragged, dest) - } catch (error) { - props.modal('Moving File Failed', 'Unexpected error while moving file: ' + dragged, 'Close', async () => {}) - } - }, - currentlyMoved:(path)=>{ - setDragged(path) - } - }}> +
    { /> }
    -
    ) + + ) } export default FileExplorer diff --git a/libs/remix-ui/workspace/src/lib/contexts/index.ts b/libs/remix-ui/workspace/src/lib/contexts/index.ts index c0bcb7c59f..8a94a1aba1 100644 --- a/libs/remix-ui/workspace/src/lib/contexts/index.ts +++ b/libs/remix-ui/workspace/src/lib/contexts/index.ts @@ -32,6 +32,8 @@ export const FileSystemContext = createContext<{ dispatchHandleRestoreBackup: () => Promise dispatchMoveFile: (src: string, dest: string) => Promise, dispatchCloneRepository: (url: string) => Promise + dispatchMoveFile: (src: string, dest: string) => Promise, + }>(null) interface MoveContextType{ diff --git a/libs/remix-ui/workspace/src/lib/providers/FileSystemProvider.tsx b/libs/remix-ui/workspace/src/lib/providers/FileSystemProvider.tsx index fbf1af48dc..985f531e9a 100644 --- a/libs/remix-ui/workspace/src/lib/providers/FileSystemProvider.tsx +++ b/libs/remix-ui/workspace/src/lib/providers/FileSystemProvider.tsx @@ -5,7 +5,9 @@ import { Toaster } from '@remix-ui/toaster' // eslint-disable-line // eslint-disable-next-line @typescript-eslint/no-unused-vars import { FileSystemContext } from '../contexts' import { browserReducer, browserInitialState } from '../reducers/workspace' -import { initWorkspace, fetchDirectory, removeInputField, deleteWorkspace, clearPopUp, publishToGist, createNewFile, setFocusElement, createNewFolder, deletePath, renamePath, copyFile, copyFolder, runScript, emitContextMenuEvent, handleClickFile, handleExpandPath, addInputField, createWorkspace, fetchWorkspaceDirectory, renameWorkspace, switchToWorkspace, uploadFile, handleDownloadFiles, restoreBackupZip, moveFile, cloneRepository } from '../actions' +import { initWorkspace, fetchDirectory, removeInputField, deleteWorkspace, clearPopUp, publishToGist, createNewFile, setFocusElement, createNewFolder, + deletePath, renamePath, copyFile, copyFolder, runScript, emitContextMenuEvent, handleClickFile, handleExpandPath, addInputField, createWorkspace, + fetchWorkspaceDirectory, renameWorkspace, switchToWorkspace, uploadFile, handleDownloadFiles, restoreBackupZip, cloneRepository, moveFile } from '../actions' import { Modal, WorkspaceProps, WorkspaceTemplate } from '../types' // eslint-disable-next-line @typescript-eslint/no-unused-vars import { Workspace } from '../remix-ui-workspace' @@ -126,11 +128,9 @@ export const FileSystemProvider = (props: WorkspaceProps) => { const dispatchCloneRepository = async (url: string) => { await cloneRepository(url) } - const dispatchMoveFile = async (src: string, dest: string) => { await moveFile(src, dest) } - useEffect(() => { dispatchInitWorkspace() }, []) @@ -247,3 +247,4 @@ export const FileSystemProvider = (props: WorkspaceProps) => { } export default FileSystemProvider + diff --git a/libs/remix-ui/workspace/src/lib/types/index.ts b/libs/remix-ui/workspace/src/lib/types/index.ts index cc78ca6a14..b709dc5e58 100644 --- a/libs/remix-ui/workspace/src/lib/types/index.ts +++ b/libs/remix-ui/workspace/src/lib/types/index.ts @@ -99,7 +99,6 @@ export interface FileExplorerProps { dispatchAddInputField:(path: string, type: 'file' | 'folder') => Promise, dispatchHandleExpandPath: (paths: string[]) => Promise dispatchMoveFile: (src: string, dest: string) => Promise, - } export interface FileExplorerMenuProps { diff --git a/package.json b/package.json index 11c4897478..c6aee5ac69 100644 --- a/package.json +++ b/package.json @@ -338,4 +338,4 @@ "yo-yo": "github:ioedeveloper/yo-yo", "yo-yoify": "^3.7.3" } -} +} \ No newline at end of file diff --git a/tsconfig.base.json b/tsconfig.base.json index 9174b23427..fa35b7d64a 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -10,8 +10,14 @@ "importHelpers": true, "target": "es2015", "module": "commonjs", - "typeRoots": ["node_modules/@types"], - "lib": ["es2017", "es2019", "dom"], + "typeRoots": [ + "node_modules/@types" + ], + "lib": [ + "es2017", + "es2019", + "dom" + ], "skipLibCheck": true, "skipDefaultLibCheck": true, "baseUrl": ".", @@ -22,62 +28,120 @@ "@remix-project/remix-astwalker": [ "dist/libs/remix-astwalker/src/index.js" ], - "@remix-project/remix-debug": ["dist/libs/remix-debug/src/index.js"], - "@remix-project/remix-lib": ["dist/libs/remix-lib/src/index.js"], + "@remix-project/remix-debug": [ + "dist/libs/remix-debug/src/index.js" + ], + "@remix-project/remix-lib": [ + "dist/libs/remix-lib/src/index.js" + ], "@remix-project/remix-simulator": [ "dist/libs/remix-simulator/src/index.js" ], "@remix-project/remix-solidity": [ "dist/libs/remix-solidity/src/index.js" ], - "@remix-project/remix-tests": ["dist/libs/remix-tests/src/index.js"], + "@remix-project/remix-tests": [ + "dist/libs/remix-tests/src/index.js" + ], "@remix-project/remix-url-resolver": [ "dist/libs/remix-url-resolver/src/index.js" ], "@remix-project/remix-ws-templates": [ "dist/libs/remix-ws-templates/src/index.js" ], - "@remixproject/debugger-plugin": ["apps/debugger/src/index.ts"], + "@remixproject/debugger-plugin": [ + "apps/debugger/src/index.ts" + ], "@remixproject/solidity-compiler-plugin": [ "apps/solidity-compiler/src/index.ts" ], - "@remix-project/remixd": ["dist/libs/remixd/index.js"], - "@remix-ui/tree-view": ["libs/remix-ui/tree-view/src/index.ts"], - "@remix-ui/search": ["libs/remix-ui/search/src/index.ts"], - "@remix-ui/debugger-ui": ["libs/remix-ui/debugger-ui/src/index.ts"], - "@remix-ui/utils": ["libs/remix-ui/utils/src/index.ts"], - "@remix-ui/clipboard": ["libs/remix-ui/clipboard/src/index.ts"], - "@remix-project/remix-solidity-ts": ["libs/remix-solidity/src/index.ts"], - "@remix-project/remix-lib-ts": ["libs/remix-lib/src/index.ts"], - "@remix-ui/modal-dialog": ["libs/remix-ui/modal-dialog/src/index.ts"], - "@remix-ui/toaster": ["libs/remix-ui/toaster/src/index.ts"], - "@remix-ui/file-explorer": ["libs/remix-ui/file-explorer/src/index.ts"], - "@remix-ui/workspace": ["libs/remix-ui/workspace/src/index.ts"], + "@remix-project/remixd": [ + "dist/libs/remixd/index.js" + ], + "@remix-ui/tree-view": [ + "libs/remix-ui/tree-view/src/index.ts" + ], + "@remix-ui/search": [ + "libs/remix-ui/search/src/index.ts" + ], + "@remix-ui/debugger-ui": [ + "libs/remix-ui/debugger-ui/src/index.ts" + ], + "@remix-ui/utils": [ + "libs/remix-ui/utils/src/index.ts" + ], + "@remix-ui/clipboard": [ + "libs/remix-ui/clipboard/src/index.ts" + ], + "@remix-project/remix-solidity-ts": [ + "libs/remix-solidity/src/index.ts" + ], + "@remix-project/remix-lib-ts": [ + "libs/remix-lib/src/index.ts" + ], + "@remix-ui/modal-dialog": [ + "libs/remix-ui/modal-dialog/src/index.ts" + ], + "@remix-ui/toaster": [ + "libs/remix-ui/toaster/src/index.ts" + ], + "@remix-ui/file-explorer": [ + "libs/remix-ui/file-explorer/src/index.ts" + ], + "@remix-ui/workspace": [ + "libs/remix-ui/workspace/src/index.ts" + ], "@remix-ui/static-analyser": [ "libs/remix-ui/static-analyser/src/index.ts" ], - "@remix-ui/checkbox": ["libs/remix-ui/checkbox/src/index.ts"], - "@remix-ui/settings": ["libs/remix-ui/settings/src/index.ts"], - "@remix-project/core-plugin": ["libs/remix-core-plugin/src/index.ts"], + "@remix-ui/checkbox": [ + "libs/remix-ui/checkbox/src/index.ts" + ], + "@remix-ui/settings": [ + "libs/remix-ui/settings/src/index.ts" + ], + "@remix-project/core-plugin": [ + "libs/remix-core-plugin/src/index.ts" + ], "@remix-ui/solidity-compiler": [ "libs/remix-ui/solidity-compiler/src/index.ts" ], "@remix-ui/publish-to-storage": [ "libs/remix-ui/publish-to-storage/src/index.ts" ], - "@remix-ui/renderer": ["libs/remix-ui/renderer/src/index.ts"], - "@remix-ui/terminal": ["libs/remix-ui/terminal/src/index.ts"], - "@remix-ui/plugin-manager": ["libs/remix-ui/plugin-manager/src/index.ts"], - "@remix-ui/home-tab": ["libs/remix-ui/home-tab/src/index.ts"], - "@remix-ui/editor": ["libs/remix-ui/editor/src/index.ts"], - "@remix-ui/tabs": ["libs/remix-ui/tabs/src/index.ts"], - "@remix-ui/helper": ["libs/remix-ui/helper/src/index.ts"], - "@remix-ui/app": ["libs/remix-ui/app/src/index.ts"], + "@remix-ui/renderer": [ + "libs/remix-ui/renderer/src/index.ts" + ], + "@remix-ui/terminal": [ + "libs/remix-ui/terminal/src/index.ts" + ], + "@remix-ui/plugin-manager": [ + "libs/remix-ui/plugin-manager/src/index.ts" + ], + "@remix-ui/home-tab": [ + "libs/remix-ui/home-tab/src/index.ts" + ], + "@remix-ui/editor": [ + "libs/remix-ui/editor/src/index.ts" + ], + "@remix-ui/tabs": [ + "libs/remix-ui/tabs/src/index.ts" + ], + "@remix-ui/helper": [ + "libs/remix-ui/helper/src/index.ts" + ], + "@remix-ui/app": [ + "libs/remix-ui/app/src/index.ts" + ], "@remix-ui/vertical-icons-panel": [ "libs/remix-ui/vertical-icons-panel/src/index.ts" ], - "@remix-ui/theme-module": ["libs/remix-ui/theme-module/src/index.ts"], - "@remix-ui/panel": ["libs/remix-ui/panel/src/index.ts"], + "@remix-ui/theme-module": [ + "libs/remix-ui/theme-module/src/index.ts" + ], + "@remix-ui/panel": [ + "libs/remix-ui/panel/src/index.ts" + ], "@remix-ui/editor-context-view": [ "libs/remix-ui/editor-context-view/src/index.ts" ], @@ -92,5 +156,8 @@ "@remix-ui/tooltip-popup": ["libs/remix-ui/tooltip-popup/src/index.ts"] } }, - "exclude": ["node_modules", "tmp"] -} + "exclude": [ + "node_modules", + "tmp" + ] +} \ No newline at end of file From fdb26a29055515246153fbd6a7ea0477a9733363 Mon Sep 17 00:00:00 2001 From: yann300 Date: Sun, 10 Jul 2022 13:32:45 +0200 Subject: [PATCH 04/21] add vyper --- apps/vyper/src/app/app.tsx | 4 ++-- apps/vyper/src/app/components/CompilerButton.tsx | 2 +- apps/vyper/src/app/components/VyperResult.tsx | 6 +++--- nx.json | 1 + 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/apps/vyper/src/app/app.tsx b/apps/vyper/src/app/app.tsx index 18b0fd0a80..eeb573138e 100644 --- a/apps/vyper/src/app/app.tsx +++ b/apps/vyper/src/app/app.tsx @@ -88,10 +88,10 @@ const App: React.FC = () => { type="radio" value={state.environment} > - + Remote Compiler - + Local Compiler diff --git a/apps/vyper/src/app/components/CompilerButton.tsx b/apps/vyper/src/app/components/CompilerButton.tsx index c7fe318f0d..cb2732c185 100644 --- a/apps/vyper/src/app/components/CompilerButton.tsx +++ b/apps/vyper/src/app/components/CompilerButton.tsx @@ -103,7 +103,7 @@ function CompilerButton({ contract, setOutput, compilerUrl }: Props) { } return ( - ) diff --git a/apps/vyper/src/app/components/VyperResult.tsx b/apps/vyper/src/app/components/VyperResult.tsx index e58f901fea..dd178fec0c 100644 --- a/apps/vyper/src/app/components/VyperResult.tsx +++ b/apps/vyper/src/app/components/VyperResult.tsx @@ -28,8 +28,8 @@ function VyperResult({ output }: VyperResultProps) {

    No contract compiled yet.

    -
    ) @@ -38,7 +38,7 @@ function VyperResult({ output }: VyperResultProps) { return (
    -
    {output.message}
    +

    {output.message}

    ) } diff --git a/nx.json b/nx.json index aeaf1074ad..542208dba8 100644 --- a/nx.json +++ b/nx.json @@ -204,6 +204,7 @@ }, "etherscan": { "tags": [] + } }, "targetDependencies": { From 51cf7f6d3cbd4a4e610d712047ad4f2f4d9f64f4 Mon Sep 17 00:00:00 2001 From: yann300 Date: Tue, 2 Aug 2022 12:21:44 +0200 Subject: [PATCH 05/21] add e2e test --- apps/vyper/src/app/app.tsx | 4 ++-- apps/vyper/src/app/components/CompilerButton.tsx | 2 +- apps/vyper/src/app/components/VyperResult.tsx | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/vyper/src/app/app.tsx b/apps/vyper/src/app/app.tsx index eeb573138e..18b0fd0a80 100644 --- a/apps/vyper/src/app/app.tsx +++ b/apps/vyper/src/app/app.tsx @@ -88,10 +88,10 @@ const App: React.FC = () => { type="radio" value={state.environment} > - + Remote Compiler - + Local Compiler diff --git a/apps/vyper/src/app/components/CompilerButton.tsx b/apps/vyper/src/app/components/CompilerButton.tsx index cb2732c185..c7fe318f0d 100644 --- a/apps/vyper/src/app/components/CompilerButton.tsx +++ b/apps/vyper/src/app/components/CompilerButton.tsx @@ -103,7 +103,7 @@ function CompilerButton({ contract, setOutput, compilerUrl }: Props) { } return ( - ) diff --git a/apps/vyper/src/app/components/VyperResult.tsx b/apps/vyper/src/app/components/VyperResult.tsx index dd178fec0c..f4d263b391 100644 --- a/apps/vyper/src/app/components/VyperResult.tsx +++ b/apps/vyper/src/app/components/VyperResult.tsx @@ -28,7 +28,7 @@ function VyperResult({ output }: VyperResultProps) {

    No contract compiled yet.

    -
    @@ -38,7 +38,7 @@ function VyperResult({ output }: VyperResultProps) { return (
    -

    {output.message}

    +

    {output.message}

    ) } From c4f2310059a280726944ae824d1794f34c92feaf Mon Sep 17 00:00:00 2001 From: iamsethsamuel Date: Wed, 3 Aug 2022 13:17:45 +0100 Subject: [PATCH 06/21] drag and drop is now a library --- nx.json | 1 - 1 file changed, 1 deletion(-) diff --git a/nx.json b/nx.json index 542208dba8..aeaf1074ad 100644 --- a/nx.json +++ b/nx.json @@ -204,7 +204,6 @@ }, "etherscan": { "tags": [] - } }, "targetDependencies": { From 874a7fef3cd9e7bbcd964e997d5d20d907f48101 Mon Sep 17 00:00:00 2001 From: iamsethsamuel Date: Wed, 3 Aug 2022 14:22:04 +0100 Subject: [PATCH 07/21] rebased --- libs/remix-ui/workspace/src/lib/contexts/index.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/libs/remix-ui/workspace/src/lib/contexts/index.ts b/libs/remix-ui/workspace/src/lib/contexts/index.ts index 8a94a1aba1..5d1aac73ed 100644 --- a/libs/remix-ui/workspace/src/lib/contexts/index.ts +++ b/libs/remix-ui/workspace/src/lib/contexts/index.ts @@ -30,7 +30,6 @@ export const FileSystemContext = createContext<{ dispatchHandleExpandPath: (paths: string[]) => Promise, dispatchHandleDownloadFiles: () => Promise, dispatchHandleRestoreBackup: () => Promise - dispatchMoveFile: (src: string, dest: string) => Promise, dispatchCloneRepository: (url: string) => Promise dispatchMoveFile: (src: string, dest: string) => Promise, From 21bc7e6e7e3315ae3a4489e514a3b1898d727508 Mon Sep 17 00:00:00 2001 From: iamsethsamuel Date: Wed, 3 Aug 2022 14:57:55 +0100 Subject: [PATCH 08/21] linting fixed --- .../src/lib/tree-view-item/tree-view-item.tsx | 92 ++++--------------- libs/remix-ui/tree-view/src/types/index.ts | 2 - .../src/lib/components/file-render.tsx | 4 - 3 files changed, 18 insertions(+), 80 deletions(-) diff --git a/libs/remix-ui/tree-view/src/lib/tree-view-item/tree-view-item.tsx b/libs/remix-ui/tree-view/src/lib/tree-view-item/tree-view-item.tsx index ead7268c0a..bf60d4cd4f 100644 --- a/libs/remix-ui/tree-view/src/lib/tree-view-item/tree-view-item.tsx +++ b/libs/remix-ui/tree-view/src/lib/tree-view-item/tree-view-item.tsx @@ -1,83 +1,27 @@ -import React, { useState, useEffect, useRef, useContext } from 'react'; // eslint-disable-line -import { TreeViewItemProps } from '../../types'; +import React, { useState, useEffect } from 'react' // eslint-disable-line +import { TreeViewItemProps } from '../../types' + +import './tree-view-item.css' -import './tree-view-item.css'; -import { MoveContext } from '@remix-ui/workspace' - export const TreeViewItem = (props: TreeViewItemProps) => { - const { id, children, label, labelClass, expand, iconX = 'fas fa-caret-right', iconY = 'fas fa-caret-down', icon, controlBehaviour = false, file, showIcon = true, ...otherProps } = props; - const [isExpanded, setIsExpanded] = useState(false); - const dragRef = useRef(); - const moveContext = useContext(MoveContext) + const { id, children, label, labelClass, expand, iconX = 'fas fa-caret-right', iconY = 'fas fa-caret-down', icon, controlBehaviour = false, innerRef, showIcon = true, ...otherProps } = props + const [isExpanded, setIsExpanded] = useState(false) useEffect(() => { - setIsExpanded(expand); - }, [expand]); - - const handleDrop = (event: React.DragEvent, isDirectory: boolean,path: string) => { - event.preventDefault() - - if (isDirectory) { - moveContext.moveFile( path); - } - }; - - const handleDragover = ( - event: React.DragEvent, - isDirectory: boolean, - path: string, - type: string - ) => { - //Checks if the folder is opened - event.preventDefault(); - if (isDirectory !== null && !props.expandedPaths.includes(path)) { - props.handleClickFolder(path, type); - } - }; - + setIsExpanded(expand) + }, [expand]) - const handleDrag = (event: React.DragEvent, path: string) => { - if (moveContext.dragged !== path) { - moveContext.currentlyMoved(path); - } - }; - return ( -
  • { - if (file && file.isDirectory) { - handleDragover(event, file.isDirectory, file.path, file.type); - }}} - onDrop={(event) => {handleDrop(event, file ? file.isDirectory : false ,file ? file.path : null)}} - onDragStart={event => { - if (file) { - handleDrag(event, file.path); - } - }} - > -
    !controlBehaviour && setIsExpanded(!isExpanded)} - > - {children && showIcon ? ( -
    - ) : icon ? ( -
    - ) : null} - {label} +
  • +
    !controlBehaviour && setIsExpanded(!isExpanded)}> + { children && showIcon ?
    : icon ?
    : null } + + { label } +
    - {isExpanded ? children : null} + { isExpanded ? children : null }
  • - ); -}; + ) +} -export default TreeViewItem; +export default TreeViewItem \ No newline at end of file diff --git a/libs/remix-ui/tree-view/src/types/index.ts b/libs/remix-ui/tree-view/src/types/index.ts index 1248e7ad5a..9827b7f2d4 100644 --- a/libs/remix-ui/tree-view/src/types/index.ts +++ b/libs/remix-ui/tree-view/src/types/index.ts @@ -24,6 +24,4 @@ export interface TreeViewItemProps { onBlur?: (...args: any) => void, showIcon?: boolean expandedPaths?: string[]; - handleClickFolder?: (path: string, type: string) => void; - file?: any } diff --git a/libs/remix-ui/workspace/src/lib/components/file-render.tsx b/libs/remix-ui/workspace/src/lib/components/file-render.tsx index 5a9f3652b7..ef1e2329fa 100644 --- a/libs/remix-ui/workspace/src/lib/components/file-render.tsx +++ b/libs/remix-ui/workspace/src/lib/components/file-render.tsx @@ -90,8 +90,6 @@ export const FileRender = (props: RenderFileProps) => { expand={props.expandPath.includes(file.path)} onMouseOver={handleMouseOver} onMouseOut={handleMouseOut} - file={file} - handleClickFolder={props.handleClickFolder} expandedPaths={props.expandPath} > { @@ -135,8 +133,6 @@ export const FileRender = (props: RenderFileProps) => { labelClass={labelClass} onMouseOver={handleMouseOver} onMouseOut={handleMouseOut} - file={file} - handleClickFolder={props.handleClickFolder} expandedPaths={props.expandPath} /> ) From e1973240a6d25511c07a9fcea822033076e6603b Mon Sep 17 00:00:00 2001 From: iamsethsamuel Date: Wed, 3 Aug 2022 16:38:02 +0100 Subject: [PATCH 09/21] renamed draggable to drag-n-drop --- jest.config.js | 2 +- libs/remix-ui/drag-n-drop/.babelrc | 16 +++++++++++++++ .../{draggable => drag-n-drop}/.eslintrc.json | 1 + libs/remix-ui/drag-n-drop/README.md | 7 +++++++ libs/remix-ui/drag-n-drop/jest.config.js | 9 +++++++++ libs/remix-ui/drag-n-drop/package.json | 4 ++++ libs/remix-ui/drag-n-drop/src/index.ts | 2 ++ .../src/lib/remix-ui-drag-n-drop.module.css | 0 .../src/lib/remix-ui-drag-n-drop.spec.tsx | 10 ++++++++++ .../src/lib/remix-ui-drag-n-drop.tsx} | 2 +- .../{draggable => drag-n-drop}/tsconfig.json | 12 +++++++---- libs/remix-ui/drag-n-drop/tsconfig.lib.json | 13 ++++++++++++ .../tsconfig.spec.json | 0 libs/remix-ui/draggable/.babelrc | 3 --- libs/remix-ui/draggable/README.md | 10 ---------- libs/remix-ui/draggable/jest.config.js | 14 ------------- libs/remix-ui/draggable/src/index.ts | 1 - .../src/lib/remix-ui-draggable.spec.ts | 7 ------- libs/remix-ui/draggable/tsconfig.lib.json | 11 ---------- .../src/lib/components/file-explorer.tsx | 2 +- .../src/lib/components/file-render.tsx | 6 ++++-- nx.json | 11 +++------- tsconfig.base.json | 5 ++++- workspace.json | 20 +++++++++++++++++++ 24 files changed, 104 insertions(+), 64 deletions(-) create mode 100644 libs/remix-ui/drag-n-drop/.babelrc rename libs/remix-ui/{draggable => drag-n-drop}/.eslintrc.json (93%) create mode 100644 libs/remix-ui/drag-n-drop/README.md create mode 100644 libs/remix-ui/drag-n-drop/jest.config.js create mode 100644 libs/remix-ui/drag-n-drop/package.json create mode 100644 libs/remix-ui/drag-n-drop/src/index.ts create mode 100644 libs/remix-ui/drag-n-drop/src/lib/remix-ui-drag-n-drop.module.css create mode 100644 libs/remix-ui/drag-n-drop/src/lib/remix-ui-drag-n-drop.spec.tsx rename libs/remix-ui/{draggable/src/lib/remix-ui-draggable.tsx => drag-n-drop/src/lib/remix-ui-drag-n-drop.tsx} (97%) rename libs/remix-ui/{draggable => drag-n-drop}/tsconfig.json (57%) create mode 100644 libs/remix-ui/drag-n-drop/tsconfig.lib.json rename libs/remix-ui/{draggable => drag-n-drop}/tsconfig.spec.json (100%) delete mode 100644 libs/remix-ui/draggable/.babelrc delete mode 100644 libs/remix-ui/draggable/README.md delete mode 100644 libs/remix-ui/draggable/jest.config.js delete mode 100644 libs/remix-ui/draggable/src/index.ts delete mode 100644 libs/remix-ui/draggable/src/lib/remix-ui-draggable.spec.ts delete mode 100644 libs/remix-ui/draggable/tsconfig.lib.json diff --git a/jest.config.js b/jest.config.js index 117de1bcd1..d82629178b 100644 --- a/jest.config.js +++ b/jest.config.js @@ -21,5 +21,5 @@ module.exports = { "/../../dist/libs/remix-ws-templates/src/index.js" , "@remix-project/remixd": "/../../dist/libs/remixd/index.js" - },"projects": "/libs/remix-ui/draggable" + },"projects":"/libs/remix-ui/drag-n-drop" }; diff --git a/libs/remix-ui/drag-n-drop/.babelrc b/libs/remix-ui/drag-n-drop/.babelrc new file mode 100644 index 0000000000..938d07c327 --- /dev/null +++ b/libs/remix-ui/drag-n-drop/.babelrc @@ -0,0 +1,16 @@ +{ + "presets": [ + [ + "@nrwl/react/babel", { + "runtime": "automatic", + "useBuiltIns": "usage" + + } + ] + ], + "plugins": [ + + + + ] +} diff --git a/libs/remix-ui/draggable/.eslintrc.json b/libs/remix-ui/drag-n-drop/.eslintrc.json similarity index 93% rename from libs/remix-ui/draggable/.eslintrc.json rename to libs/remix-ui/drag-n-drop/.eslintrc.json index 7cd4bf646b..ac865be105 100644 --- a/libs/remix-ui/draggable/.eslintrc.json +++ b/libs/remix-ui/drag-n-drop/.eslintrc.json @@ -1,5 +1,6 @@ { "extends": [ + "plugin:@nrwl/nx/react", "../../../.eslintrc.json" ], "ignorePatterns": [ diff --git a/libs/remix-ui/drag-n-drop/README.md b/libs/remix-ui/drag-n-drop/README.md new file mode 100644 index 0000000000..cbe7a6ff0e --- /dev/null +++ b/libs/remix-ui/drag-n-drop/README.md @@ -0,0 +1,7 @@ +# remix-ui-drag-n-drop + +This library was generated with [Nx](https://nx.dev). + +## Running unit tests + +Run `nx test remix-ui-drag-n-drop` to execute the unit tests via [Jest](https://jestjs.io). diff --git a/libs/remix-ui/drag-n-drop/jest.config.js b/libs/remix-ui/drag-n-drop/jest.config.js new file mode 100644 index 0000000000..1a5729e026 --- /dev/null +++ b/libs/remix-ui/drag-n-drop/jest.config.js @@ -0,0 +1,9 @@ +module.exports = { + displayName: 'remix-ui-drag-n-drop', + preset: '../../../jest.preset.js', + transform: { + '^.+\\.[tj]sx?$': 'babel-jest' + }, + moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], + coverageDirectory: '../../../coverage/libs/remix-ui/drag-n-drop' +}; diff --git a/libs/remix-ui/drag-n-drop/package.json b/libs/remix-ui/drag-n-drop/package.json new file mode 100644 index 0000000000..8813962570 --- /dev/null +++ b/libs/remix-ui/drag-n-drop/package.json @@ -0,0 +1,4 @@ +{ + "name": "@remix-ui/drag-n-drop", + "version": "0.0.1" +} \ No newline at end of file diff --git a/libs/remix-ui/drag-n-drop/src/index.ts b/libs/remix-ui/drag-n-drop/src/index.ts new file mode 100644 index 0000000000..40aad7289f --- /dev/null +++ b/libs/remix-ui/drag-n-drop/src/index.ts @@ -0,0 +1,2 @@ + +export * from './lib/remix-ui-drag-n-drop'; diff --git a/libs/remix-ui/drag-n-drop/src/lib/remix-ui-drag-n-drop.module.css b/libs/remix-ui/drag-n-drop/src/lib/remix-ui-drag-n-drop.module.css new file mode 100644 index 0000000000..e69de29bb2 diff --git a/libs/remix-ui/drag-n-drop/src/lib/remix-ui-drag-n-drop.spec.tsx b/libs/remix-ui/drag-n-drop/src/lib/remix-ui-drag-n-drop.spec.tsx new file mode 100644 index 0000000000..04dc71fa14 --- /dev/null +++ b/libs/remix-ui/drag-n-drop/src/lib/remix-ui-drag-n-drop.spec.tsx @@ -0,0 +1,10 @@ +import { render } from '@testing-library/react'; + +import RemixUiDragNDrop from './remix-ui-drag-n-drop'; + +describe('RemixUiDragNDrop', () => { + it('should render successfully', () => { + const { baseElement } = render(< RemixUiDragNDrop />); + expect(baseElement).toBeTruthy(); + }); +}); diff --git a/libs/remix-ui/draggable/src/lib/remix-ui-draggable.tsx b/libs/remix-ui/drag-n-drop/src/lib/remix-ui-drag-n-drop.tsx similarity index 97% rename from libs/remix-ui/draggable/src/lib/remix-ui-draggable.tsx rename to libs/remix-ui/drag-n-drop/src/lib/remix-ui-drag-n-drop.tsx index 222eca1ddd..9e5d4a8152 100644 --- a/libs/remix-ui/draggable/src/lib/remix-ui-draggable.tsx +++ b/libs/remix-ui/drag-n-drop/src/lib/remix-ui-drag-n-drop.tsx @@ -51,7 +51,7 @@ export const Drag = (props: DragType) => { }; export const Draggable = (props: DraggableType) => { - const dragRef = useRef(), + const dragRef = useRef(null), file = props.file, context = useContext(MoveContext); diff --git a/libs/remix-ui/draggable/tsconfig.json b/libs/remix-ui/drag-n-drop/tsconfig.json similarity index 57% rename from libs/remix-ui/draggable/tsconfig.json rename to libs/remix-ui/drag-n-drop/tsconfig.json index 58b5a738e8..29741baf11 100644 --- a/libs/remix-ui/draggable/tsconfig.json +++ b/libs/remix-ui/drag-n-drop/tsconfig.json @@ -1,13 +1,17 @@ { "extends": "../../../tsconfig.base.json", - "files": [], - "include": [], "compilerOptions": { - "jsx": "react", + "jsx": "react-jsx", "allowJs": true, "esModuleInterop": true, - "allowSyntheticDefaultImports": true + "allowSyntheticDefaultImports": true, + "forceConsistentCasingInFileNames": true, + "strict": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true }, + "files": [], + "include": [], "references": [ { "path": "./tsconfig.lib.json" diff --git a/libs/remix-ui/drag-n-drop/tsconfig.lib.json b/libs/remix-ui/drag-n-drop/tsconfig.lib.json new file mode 100644 index 0000000000..b560bc4dec --- /dev/null +++ b/libs/remix-ui/drag-n-drop/tsconfig.lib.json @@ -0,0 +1,13 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../../dist/out-tsc", + "types": ["node"] + }, + "files": [ + "../../../node_modules/@nrwl/react/typings/cssmodule.d.ts", + "../../../node_modules/@nrwl/react/typings/image.d.ts" + ], + "exclude": ["**/*.spec.ts", "**/*.spec.tsx"], + "include": ["**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx"] +} diff --git a/libs/remix-ui/draggable/tsconfig.spec.json b/libs/remix-ui/drag-n-drop/tsconfig.spec.json similarity index 100% rename from libs/remix-ui/draggable/tsconfig.spec.json rename to libs/remix-ui/drag-n-drop/tsconfig.spec.json diff --git a/libs/remix-ui/draggable/.babelrc b/libs/remix-ui/draggable/.babelrc deleted file mode 100644 index cf7ddd99c6..0000000000 --- a/libs/remix-ui/draggable/.babelrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "presets": [["@nrwl/web/babel", { "useBuiltIns": "usage" }]] -} diff --git a/libs/remix-ui/draggable/README.md b/libs/remix-ui/draggable/README.md deleted file mode 100644 index 5c429edbde..0000000000 --- a/libs/remix-ui/draggable/README.md +++ /dev/null @@ -1,10 +0,0 @@ -# remix-ui-draggable - -This library was generated with [Nx](https://nx.dev). - - -## Running unit tests - -Run `nx test remix-ui-draggable` to execute the unit tests via [Jest](https://jestjs.io). - - diff --git a/libs/remix-ui/draggable/jest.config.js b/libs/remix-ui/draggable/jest.config.js deleted file mode 100644 index 1798c08a91..0000000000 --- a/libs/remix-ui/draggable/jest.config.js +++ /dev/null @@ -1,14 +0,0 @@ -module.exports = { - displayName: 'remix-ui-draggable', - preset: '../../../jest.preset.js', - globals: { - 'ts-jest': { - tsconfig: '/tsconfig.spec.json', - } - }, - transform: { - '^.+\\.[tj]sx?$': 'ts-jest' - }, - moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], - coverageDirectory: '../../../coverage/libs/remix-ui/draggable' -}; diff --git a/libs/remix-ui/draggable/src/index.ts b/libs/remix-ui/draggable/src/index.ts deleted file mode 100644 index 9a4142a6fc..0000000000 --- a/libs/remix-ui/draggable/src/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './lib/remix-ui-draggable'; diff --git a/libs/remix-ui/draggable/src/lib/remix-ui-draggable.spec.ts b/libs/remix-ui/draggable/src/lib/remix-ui-draggable.spec.ts deleted file mode 100644 index 26a3488b47..0000000000 --- a/libs/remix-ui/draggable/src/lib/remix-ui-draggable.spec.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { remixUiDraggable } from './remix-ui-draggable'; - -describe('remixUiDraggable', () => { - it('should work', () => { - expect(remixUiDraggable()).toEqual('remix-ui-draggable'); - }) -}) \ No newline at end of file diff --git a/libs/remix-ui/draggable/tsconfig.lib.json b/libs/remix-ui/draggable/tsconfig.lib.json deleted file mode 100644 index a2268f1709..0000000000 --- a/libs/remix-ui/draggable/tsconfig.lib.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "module": "commonjs", - "outDir": "../../../dist/out-tsc", - "declaration": true, - "types": ["node"] - }, - "exclude": ["**/*.spec.ts"], - "include": ["**/*.ts", "src/lib/remix-ui-draggable.tsx"] -} diff --git a/libs/remix-ui/workspace/src/lib/components/file-explorer.tsx b/libs/remix-ui/workspace/src/lib/components/file-explorer.tsx index 09e29bdd3e..40d81e1252 100644 --- a/libs/remix-ui/workspace/src/lib/components/file-explorer.tsx +++ b/libs/remix-ui/workspace/src/lib/components/file-explorer.tsx @@ -10,7 +10,7 @@ import '../css/file-explorer.css' import { checkSpecialChars, extractNameFromKey, extractParentFromKey, joinPath } from '@remix-ui/helper' // eslint-disable-next-line @typescript-eslint/no-unused-vars import { FileRender } from './file-render' -import { Drag } from '@remix-project/remix-ui/draggable' +import {Drag} from "@remix-ui/drag-n-drop" export const FileExplorer = (props: FileExplorerProps) => { const { name, contextMenuItems, removedContextMenuItems, files, fileState } = props diff --git a/libs/remix-ui/workspace/src/lib/components/file-render.tsx b/libs/remix-ui/workspace/src/lib/components/file-render.tsx index ef1e2329fa..8b601582eb 100644 --- a/libs/remix-ui/workspace/src/lib/components/file-render.tsx +++ b/libs/remix-ui/workspace/src/lib/components/file-render.tsx @@ -7,7 +7,7 @@ import { getPathIcon } from '@remix-ui/helper' // eslint-disable-next-line @typescript-eslint/no-unused-vars import { FileLabel } from './file-label' import { fileDecoration, FileDecorationIcons } from '@remix-ui/file-decorators' - +import {Draggable} from "@remix-ui/drag-n-drop" @@ -122,7 +122,9 @@ export const FileRender = (props: RenderFileProps) => { label={ <>
    - + + +
    diff --git a/nx.json b/nx.json index aeaf1074ad..db4114c205 100644 --- a/nx.json +++ b/nx.json @@ -204,14 +204,9 @@ }, "etherscan": { "tags": [] + }, + "remix-ui-drag-n-drop": { + "tags": [] } - }, - "targetDependencies": { - "build": [ - { - "target": "build", - "projects": "dependencies" - } - ] } } \ No newline at end of file diff --git a/tsconfig.base.json b/tsconfig.base.json index fa35b7d64a..0639979e32 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -153,7 +153,10 @@ "libs/remix-ui/permission-handler/src/index.ts" ], "@remix-ui/file-decorators": ["libs/remix-ui/file-decorators/src/index.ts"], - "@remix-ui/tooltip-popup": ["libs/remix-ui/tooltip-popup/src/index.ts"] + "@remix-ui/tooltip-popup": ["libs/remix-ui/tooltip-popup/src/index.ts"], + "@remix-ui/drag-n-drop": [ + "libs/remix-ui/drag-n-drop/src/index.ts" + ] } }, "exclude": [ diff --git a/workspace.json b/workspace.json index f14281de0d..8c0a1168db 100644 --- a/workspace.json +++ b/workspace.json @@ -1516,6 +1516,26 @@ } } }, + "remix-ui-drag-n-drop": { + "root": "libs/remix-ui/drag-n-drop", + "sourceRoot": "libs/remix-ui/drag-n-drop/src", + "projectType": "library", + "architect": { + "lint": { + "builder": "@nrwl/linter:lint", + "options": { + "linter": "eslint", + "config": "libs/remix-ui/drag-n-drop/.eslintrc.json", + "tsConfig": [ + "libs/remix-ui/drag-n-drop/tsconfig.lib.json" + ], + "exclude": [ + "**/node_modules/**" + ] + } + } + } + }, "vyper": { "root": "apps/vyper", "sourceRoot": "apps/vyper/src", From b60451e1bf901d52a1cce822dc60fb93253739f0 Mon Sep 17 00:00:00 2001 From: iamsethsamuel Date: Thu, 4 Aug 2022 02:09:40 +0100 Subject: [PATCH 10/21] circular dependency fixed --- .../drag-n-drop/src/lib/remix-ui-drag-n-drop.tsx | 10 +++++++++- .../workspace/src/lib/components/file-explorer.tsx | 3 +-- .../workspace/src/lib/components/file-render.tsx | 4 +++- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/libs/remix-ui/drag-n-drop/src/lib/remix-ui-drag-n-drop.tsx b/libs/remix-ui/drag-n-drop/src/lib/remix-ui-drag-n-drop.tsx index 9e5d4a8152..8046c1358c 100644 --- a/libs/remix-ui/drag-n-drop/src/lib/remix-ui-drag-n-drop.tsx +++ b/libs/remix-ui/drag-n-drop/src/lib/remix-ui-drag-n-drop.tsx @@ -1,4 +1,3 @@ -import { FileType } from "libs/remix-ui/workspace/src/lib/types"; import React, { createContext, ReactNode, @@ -7,6 +6,15 @@ import React, { useState, } from "react"; + +export interface FileType { + path: string, + name: string, + isDirectory: boolean, + type: 'folder' | 'file' | 'gist', + child?: File[] +} + interface MoveContextType { dragged: string; isDraggable?: boolean; diff --git a/libs/remix-ui/workspace/src/lib/components/file-explorer.tsx b/libs/remix-ui/workspace/src/lib/components/file-explorer.tsx index 40d81e1252..bd11d75fb5 100644 --- a/libs/remix-ui/workspace/src/lib/components/file-explorer.tsx +++ b/libs/remix-ui/workspace/src/lib/components/file-explorer.tsx @@ -10,7 +10,7 @@ import '../css/file-explorer.css' import { checkSpecialChars, extractNameFromKey, extractParentFromKey, joinPath } from '@remix-ui/helper' // eslint-disable-next-line @typescript-eslint/no-unused-vars import { FileRender } from './file-render' -import {Drag} from "@remix-ui/drag-n-drop" +import { Drag } from "@remix-ui/drag-n-drop" export const FileExplorer = (props: FileExplorerProps) => { const { name, contextMenuItems, removedContextMenuItems, files, fileState } = props @@ -37,7 +37,6 @@ export const FileExplorer = (props: FileExplorerProps) => { }) const [canPaste, setCanPaste] = useState(false) const treeRef = useRef(null) - const [dragged, setDragged] = useState("") useEffect(() => { if (contextMenuItems) { diff --git a/libs/remix-ui/workspace/src/lib/components/file-render.tsx b/libs/remix-ui/workspace/src/lib/components/file-render.tsx index 8b601582eb..814715ee42 100644 --- a/libs/remix-ui/workspace/src/lib/components/file-render.tsx +++ b/libs/remix-ui/workspace/src/lib/components/file-render.tsx @@ -82,7 +82,9 @@ export const FileRender = (props: RenderFileProps) => { iconX='pr-3 fa fa-folder' iconY='pr-3 fa fa-folder-open' key={`${file.path + props.index}`} - label={} + label={ + + } onClick={handleFolderClick} onContextMenu={handleContextMenu} labelClass={labelClass} From 8735b554d4f070a0491a89d14200b68f77d9ba81 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Mon, 8 Aug 2022 15:21:27 +0200 Subject: [PATCH 11/21] Update global-variables.tsx --- .../debugger-ui/src/lib/vm-debugger/global-variables.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/global-variables.tsx b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/global-variables.tsx index cf34760ae2..413ef52b35 100644 --- a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/global-variables.tsx +++ b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/global-variables.tsx @@ -18,7 +18,7 @@ export const GlobalVariables = ({ block, receipt, tx }) => { 'tx.origin': tx.from } if (block.baseFeePerGas) { - globals['block.basefee'] = Web3.utils.toBN(block.baseFeePerGas).toString(10) + ` Wei (${block.baseFeePerGas})` + globals['block.basefee'] = (Web3.utils.toBN(block.baseFeePerGas)) + ` Wei (${block.baseFeePerGas})` } return ( From d3e26161f1cc76d806d842994363dec78211a24c Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 3 Aug 2022 12:24:20 +0200 Subject: [PATCH 12/21] add etherscan plugin --- apps/etherscan/src/app/app.tsx | 13 +++++++++++++ .../src/app/components/HeaderWithSettings.tsx | 3 +++ apps/etherscan/src/app/components/SubmitButton.tsx | 13 +++++++++++++ apps/etherscan/src/app/hooks/useLocalStorage.tsx | 8 ++++++++ apps/etherscan/src/app/routes.tsx | 4 ++++ apps/etherscan/src/app/utils/utilities.ts | 10 ++++++++++ apps/etherscan/src/app/views/CaptureKeyView.tsx | 4 ++++ apps/etherscan/src/app/views/ErrorView.tsx | 4 ++++ apps/etherscan/src/app/views/VerifyView.tsx | 12 ++++++++++++ 9 files changed, 71 insertions(+) diff --git a/apps/etherscan/src/app/app.tsx b/apps/etherscan/src/app/app.tsx index 653d90bfb1..212e195e42 100644 --- a/apps/etherscan/src/app/app.tsx +++ b/apps/etherscan/src/app/app.tsx @@ -43,11 +43,20 @@ const App = () => { contractsRef.current = contracts useEffect(() => { +<<<<<<< HEAD +======= + console.log("Remix Etherscan loading...") +>>>>>>> e02014ca4 (add etherscan plugin) const client = new PluginClient() createClient(client) const loadClient = async () => { await client.onload() setClientInstance(client) +<<<<<<< HEAD +======= + console.log("Remix Etherscan Plugin has been loaded") + +>>>>>>> e02014ca4 (add etherscan plugin) client.on("solidity", "compilationFinished", ( @@ -56,6 +65,10 @@ const App = () => { languageVersion: string, data: CompilationResult ) => { +<<<<<<< HEAD +======= + console.log("New compilation received") +>>>>>>> e02014ca4 (add etherscan plugin) const newContractsNames = getNewContractNames(data) const newContractsToSave: string[] = [ diff --git a/apps/etherscan/src/app/components/HeaderWithSettings.tsx b/apps/etherscan/src/app/components/HeaderWithSettings.tsx index 14e048d6cd..bd9c18430a 100644 --- a/apps/etherscan/src/app/components/HeaderWithSettings.tsx +++ b/apps/etherscan/src/app/components/HeaderWithSettings.tsx @@ -18,7 +18,10 @@ interface IconProps { const HomeIcon: React.FC = ({ from, themeType }: IconProps) => { return ( >>>>>> e02014ca4 (add etherscan plugin) data-toggle="tooltip" data-placement="top" title="Home" diff --git a/apps/etherscan/src/app/components/SubmitButton.tsx b/apps/etherscan/src/app/components/SubmitButton.tsx index c89f12bf02..a0c18d8e8f 100644 --- a/apps/etherscan/src/app/components/SubmitButton.tsx +++ b/apps/etherscan/src/app/components/SubmitButton.tsx @@ -3,17 +3,26 @@ import React from "react" interface Props { text: string isSubmitting?: boolean +<<<<<<< HEAD dataId?: string +======= +>>>>>>> e02014ca4 (add etherscan plugin) } export const SubmitButton: React.FC = ({ text, +<<<<<<< HEAD dataId, +======= +>>>>>>> e02014ca4 (add etherscan plugin) isSubmitting = false, }) => { return ( diff --git a/apps/etherscan/src/app/hooks/useLocalStorage.tsx b/apps/etherscan/src/app/hooks/useLocalStorage.tsx index dbef5378a8..e442ea5a8e 100644 --- a/apps/etherscan/src/app/hooks/useLocalStorage.tsx +++ b/apps/etherscan/src/app/hooks/useLocalStorage.tsx @@ -11,7 +11,11 @@ export function useLocalStorage(key: string, initialValue: any) { return item ? JSON.parse(item) : initialValue } catch (error) { // If error also return initialValue +<<<<<<< HEAD console.error(error) +======= + console.log(error) +>>>>>>> e02014ca4 (add etherscan plugin) return initialValue } }) @@ -29,7 +33,11 @@ export function useLocalStorage(key: string, initialValue: any) { window.localStorage.setItem(key, JSON.stringify(valueToStore)) } catch (error) { // A more advanced implementation would handle the error case +<<<<<<< HEAD console.error(error) +======= + console.log(error) +>>>>>>> e02014ca4 (add etherscan plugin) } } diff --git a/apps/etherscan/src/app/routes.tsx b/apps/etherscan/src/app/routes.tsx index 1400a601df..ba6e7b1998 100644 --- a/apps/etherscan/src/app/routes.tsx +++ b/apps/etherscan/src/app/routes.tsx @@ -1,6 +1,10 @@ import React from "react" import { +<<<<<<< HEAD HashRouter as Router, +======= + BrowserRouter as Router, +>>>>>>> e02014ca4 (add etherscan plugin) Route, Routes, RouteProps, diff --git a/apps/etherscan/src/app/utils/utilities.ts b/apps/etherscan/src/app/utils/utilities.ts index d7300806a3..85ffc482e0 100644 --- a/apps/etherscan/src/app/utils/utilities.ts +++ b/apps/etherscan/src/app/utils/utilities.ts @@ -13,7 +13,13 @@ export const getNetworkName = async (client: RemixClient) => { if (!network) { throw new Error("no known network to verify against") } +<<<<<<< HEAD return network.name!.toLowerCase() +======= + const name = network.name!.toLowerCase() + // TODO : remove that when https://github.com/ethereum/remix-ide/issues/2017 is fixe + return name === "görli" ? "goerli" : name +>>>>>>> e02014ca4 (add etherscan plugin) } export const getReceiptStatus = async ( @@ -27,6 +33,10 @@ export const getReceiptStatus = async ( const { result } = response.data return result } catch (error) { +<<<<<<< HEAD console.error(error) +======= + console.log("Error", error) +>>>>>>> e02014ca4 (add etherscan plugin) } } diff --git a/apps/etherscan/src/app/views/CaptureKeyView.tsx b/apps/etherscan/src/app/views/CaptureKeyView.tsx index 9703ec10ff..2350614c1b 100644 --- a/apps/etherscan/src/app/views/CaptureKeyView.tsx +++ b/apps/etherscan/src/app/views/CaptureKeyView.tsx @@ -48,7 +48,11 @@ export const CaptureKeyView: React.FC = () => {
    +<<<<<<< HEAD +======= + +>>>>>>> e02014ca4 (add etherscan plugin)
    )} diff --git a/apps/etherscan/src/app/views/ErrorView.tsx b/apps/etherscan/src/app/views/ErrorView.tsx index 69e022e47c..66a4ea0ebb 100644 --- a/apps/etherscan/src/app/views/ErrorView.tsx +++ b/apps/etherscan/src/app/views/ErrorView.tsx @@ -21,7 +21,11 @@ export const ErrorView: React.FC = () => { Please raise an issue:{" "} >>>>>> e02014ca4 (add etherscan plugin) > Here diff --git a/apps/etherscan/src/app/views/VerifyView.tsx b/apps/etherscan/src/app/views/VerifyView.tsx index 3e85d471b7..bcdd0930e2 100644 --- a/apps/etherscan/src/app/views/VerifyView.tsx +++ b/apps/etherscan/src/app/views/VerifyView.tsx @@ -170,7 +170,11 @@ export const VerifyView: React.FC = ({ } return result } catch (error) { +<<<<<<< HEAD console.error(error) +======= + console.log("Error, something wrong happened", error) +>>>>>>> e02014ca4 (add etherscan plugin) setResults("Something wrong happened, try again") } } @@ -284,12 +288,20 @@ export const VerifyView: React.FC = ({ /> +<<<<<<< HEAD +======= + +>>>>>>> e02014ca4 (add etherscan plugin) )} +<<<<<<< HEAD
    >>>>>> e02014ca4 (add etherscan plugin) style={{ marginTop: "2em", fontSize: "0.8em", textAlign: "center" }} dangerouslySetInnerHTML={{ __html: results }} /> From 44f0433061fb865774ee4eaf191429561b28ad53 Mon Sep 17 00:00:00 2001 From: filip mertens Date: Thu, 21 Jul 2022 15:39:04 +0200 Subject: [PATCH 13/21] add test --- .../src/app/plugins/file-decorator.ts | 39 +++++++++++++++++++ .../file-decoration-custom-icon.tsx | 4 ++ .../file-decoration-error-icon.tsx | 4 ++ .../file-decoration-tooltip.tsx | 6 +++ .../file-decoration-warning-icon.tsx | 4 ++ .../file-decorators/src/lib/helper/index.tsx | 6 +++ .../file-decorators/src/lib/types/index.ts | 7 ++++ 7 files changed, 70 insertions(+) diff --git a/apps/remix-ide/src/app/plugins/file-decorator.ts b/apps/remix-ide/src/app/plugins/file-decorator.ts index c81c1894ff..9b6d304b02 100644 --- a/apps/remix-ide/src/app/plugins/file-decorator.ts +++ b/apps/remix-ide/src/app/plugins/file-decorator.ts @@ -8,7 +8,11 @@ import { fileDecoration } from '@remix-ui/file-decorators' const profile = { name: 'fileDecorator', desciption: 'Keeps decorators of the files', +<<<<<<< HEAD methods: ['setFileDecorators', 'clearFileDecorators', 'clearAllFileDecorators'], +======= + methods: ['setFileDecorators', 'clearFileDecorators'], +>>>>>>> 43bc1038a (add test) events: ['fileDecoratorsChanged'], version: '0.0.1' } @@ -18,6 +22,7 @@ export class FileDecorator extends Plugin { constructor() { super(profile) } +<<<<<<< HEAD onActivation(): void { this.on('filePanel', 'setWorkspace', async () => { @@ -25,33 +30,61 @@ export class FileDecorator extends Plugin { }) } +======= +>>>>>>> 43bc1038a (add test) /** * * @param fileStates Array of file states */ async setFileDecorators(fileStates: fileDecoration[] | fileDecoration) { +<<<<<<< HEAD const { from } = this.currentRequest const workspace = await this.call('filePanel', 'getCurrentWorkspace') +======= + const workspace = await this.call('filePanel', 'getCurrentWorkspace') + function sortByPath( a: fileDecoration, b: fileDecoration ) { + if ( a.path < b.path ){ + return -1; + } + if ( a.path > b.path ){ + return 1; + } + return 0; + } + +>>>>>>> 43bc1038a (add test) const fileStatesPayload = Array.isArray(fileStates) ? fileStates : [fileStates] // clear all file states in the previous state of this owner on the files called fileStatesPayload.forEach((state) => { state.workspace = workspace +<<<<<<< HEAD state.owner = from }) const filteredState = this._fileStates.filter((state) => { const index = fileStatesPayload.findIndex((payloadFileState: fileDecoration) => { return from == state.owner && payloadFileState.path == state.path +======= + }) + const filteredState = this._fileStates.filter((state) => { + const index = fileStatesPayload.findIndex((payloadFileState: fileDecoration) => { + return payloadFileState.owner == state.owner && payloadFileState.path == state.path +>>>>>>> 43bc1038a (add test) }) return index == -1 }) const newState = [...filteredState, ...fileStatesPayload].sort(sortByPath) +<<<<<<< HEAD +======= + +>>>>>>> 43bc1038a (add test) if (!deepequal(newState, this._fileStates)) { this._fileStates = newState this.emit('fileDecoratorsChanged', this._fileStates) } } +<<<<<<< HEAD async clearFileDecorators(path?: string) { const { from } = this.currentRequest if (!from) return @@ -83,4 +116,10 @@ const sortByPath = (a: fileDecoration, b: fileDecoration) => { return 1; } return 0; +======= + async clearFileDecorators() { + this._fileStates = [] + this.emit('fileDecoratorsChanged', []) + } +>>>>>>> 43bc1038a (add test) } \ No newline at end of file diff --git a/libs/remix-ui/file-decorators/src/lib/components/filedecorationicons/file-decoration-custom-icon.tsx b/libs/remix-ui/file-decorators/src/lib/components/filedecorationicons/file-decoration-custom-icon.tsx index 2cfec2ac97..807331e0b9 100644 --- a/libs/remix-ui/file-decorators/src/lib/components/filedecorationicons/file-decoration-custom-icon.tsx +++ b/libs/remix-ui/file-decorators/src/lib/components/filedecorationicons/file-decoration-custom-icon.tsx @@ -5,7 +5,11 @@ import { fileDecoration } from '../../types' const FileDecorationCustomIcon = (props: { fileDecoration: fileDecoration }) => { +<<<<<<< HEAD return <> +======= + return <> +>>>>>>> 43bc1038a (add test) {props.fileDecoration.fileStateIcon} } diff --git a/libs/remix-ui/file-decorators/src/lib/components/filedecorationicons/file-decoration-error-icon.tsx b/libs/remix-ui/file-decorators/src/lib/components/filedecorationicons/file-decoration-error-icon.tsx index 5a9c48b555..07b7db6b5f 100644 --- a/libs/remix-ui/file-decorators/src/lib/components/filedecorationicons/file-decoration-error-icon.tsx +++ b/libs/remix-ui/file-decorators/src/lib/components/filedecorationicons/file-decoration-error-icon.tsx @@ -7,7 +7,11 @@ const FileDecorationErrorIcon = (props: { fileDecoration: fileDecoration }) => { return <> +<<<<<<< HEAD {props.fileDecoration.text} +======= + {props.fileDecoration.text} +>>>>>>> 43bc1038a (add test) } diff --git a/libs/remix-ui/file-decorators/src/lib/components/filedecorationicons/file-decoration-tooltip.tsx b/libs/remix-ui/file-decorators/src/lib/components/filedecorationicons/file-decoration-tooltip.tsx index 1d87846192..1a84263965 100644 --- a/libs/remix-ui/file-decorators/src/lib/components/filedecorationicons/file-decoration-tooltip.tsx +++ b/libs/remix-ui/file-decorators/src/lib/components/filedecorationicons/file-decoration-tooltip.tsx @@ -9,9 +9,15 @@ const FileDecorationTooltip = (props: { }, ) => { const getComments = function (fileDecoration: fileDecoration) { +<<<<<<< HEAD if (fileDecoration.comment) { const comments = Array.isArray(fileDecoration.comment) ? fileDecoration.comment : [fileDecoration.comment] return comments.map((comment, index) => { +======= + if (fileDecoration.commment) { + const commments = Array.isArray(fileDecoration.commment) ? fileDecoration.commment : [fileDecoration.commment] + return commments.map((comment, index) => { +>>>>>>> 43bc1038a (add test) return
    {comment}

    }) } diff --git a/libs/remix-ui/file-decorators/src/lib/components/filedecorationicons/file-decoration-warning-icon.tsx b/libs/remix-ui/file-decorators/src/lib/components/filedecorationicons/file-decoration-warning-icon.tsx index 9bfd368506..d7bddff75e 100644 --- a/libs/remix-ui/file-decorators/src/lib/components/filedecorationicons/file-decoration-warning-icon.tsx +++ b/libs/remix-ui/file-decorators/src/lib/components/filedecorationicons/file-decoration-warning-icon.tsx @@ -5,7 +5,11 @@ import { fileDecoration } from '../../types' const FileDecorationWarningIcon = (props: { fileDecoration: fileDecoration }) => { +<<<<<<< HEAD return <>{props.fileDecoration.text} +======= + return <>{props.fileDecoration.text} +>>>>>>> 43bc1038a (add test) } export default FileDecorationWarningIcon \ No newline at end of file diff --git a/libs/remix-ui/file-decorators/src/lib/helper/index.tsx b/libs/remix-ui/file-decorators/src/lib/helper/index.tsx index 10bad7d3fc..2812124bd9 100644 --- a/libs/remix-ui/file-decorators/src/lib/helper/index.tsx +++ b/libs/remix-ui/file-decorators/src/lib/helper/index.tsx @@ -2,9 +2,15 @@ import React from "react" import { fileDecoration } from "../types" export const getComments = function (fileDecoration: fileDecoration) { +<<<<<<< HEAD if(fileDecoration.comment){ const comments = Array.isArray(fileDecoration.comment) ? fileDecoration.comment : [fileDecoration.comment] return comments.map((comment, index) => { +======= + if(fileDecoration.commment){ + const commments = Array.isArray(fileDecoration.commment) ? fileDecoration.commment : [fileDecoration.commment] + return commments.map((comment, index) => { +>>>>>>> 43bc1038a (add test) return
    {comment}

    }) } diff --git a/libs/remix-ui/file-decorators/src/lib/types/index.ts b/libs/remix-ui/file-decorators/src/lib/types/index.ts index fa783ec6e5..a734c2fd4a 100644 --- a/libs/remix-ui/file-decorators/src/lib/types/index.ts +++ b/libs/remix-ui/file-decorators/src/lib/types/index.ts @@ -14,10 +14,17 @@ export enum fileDecorationType { fileStateIcon: string | HTMLDivElement | JSX.Element, bubble: boolean, text?: string, +<<<<<<< HEAD owner?: string, workspace?: any tooltip?: string comment?: string[] | string +======= + owner: string, + workspace?: any + tooltip?: string + commment?: string[] | string +>>>>>>> 43bc1038a (add test) } export interface FileType { From 4bff17e989a97ca9d92d2eccd82676701275fcbb Mon Sep 17 00:00:00 2001 From: filip mertens Date: Thu, 21 Jul 2022 15:39:23 +0200 Subject: [PATCH 14/21] add tests --- .../src/tests/file_decorator.test.ts | 125 ------------------ .../src/app/plugins/file-decorator.ts | 63 --------- .../file-decoration-custom-icon.tsx | 4 - .../file-decoration-error-icon.tsx | 4 - .../file-decoration-warning-icon.tsx | 4 - 5 files changed, 200 deletions(-) diff --git a/apps/remix-ide-e2e/src/tests/file_decorator.test.ts b/apps/remix-ide-e2e/src/tests/file_decorator.test.ts index 3483853cad..e69de29bb2 100644 --- a/apps/remix-ide-e2e/src/tests/file_decorator.test.ts +++ b/apps/remix-ide-e2e/src/tests/file_decorator.test.ts @@ -1,125 +0,0 @@ - -'use strict' -import { NightwatchBrowser } from 'nightwatch' -import init from '../helpers/init' - -module.exports = { - - before: function (browser: NightwatchBrowser, done: VoidFunction) { - init(browser, done) - }, - - 'Test decorators with script': function (browser: NightwatchBrowser) { - browser - .openFile('contracts') - .openFile('contracts/2_Owner.sol') - .openFile('contracts/1_Storage.sol') - .openFile('contracts/3_Ballot.sol') - .addFile('scripts/decorators.ts', { content: testScriptSet }) - .pause(2000) - .executeScriptInTerminal('remix.exeCurrent()') - .pause(4000) - .useXpath() - .waitForElementContainsText('//*[@id="fileExplorerView"]//*[@data-id="file-decoration-error-contracts/2_Owner.sol"]', '2') - .waitForElementContainsText('//*[@class="mainview"]//*[@data-id="file-decoration-error-contracts/2_Owner.sol"]', '2') - .waitForElementContainsText('//*[@id="fileExplorerView"]//*[@data-id="file-decoration-custom-contracts/2_Owner.sol"]', 'U') - .waitForElementContainsText('//*[@class="mainview"]//*[@data-id="file-decoration-custom-contracts/2_Owner.sol"]', 'U') - .waitForElementContainsText('//*[@id="fileExplorerView"]//*[@data-id="file-decoration-warning-contracts/1_Storage.sol"]', '2') - .waitForElementContainsText('//*[@class="mainview"]//*[@data-id="file-decoration-warning-contracts/1_Storage.sol"]', '2') - .waitForElementContainsText('//*[@id="fileExplorerView"]//*[@data-id="file-decoration-custom-contracts/3_Ballot.sol"]', 'customtext') - .waitForElementContainsText('//*[@class="mainview"]//*[@data-id="file-decoration-custom-contracts/3_Ballot.sol"]', 'customtext') - .moveToElement('//*[@id="fileExplorerView"]//*[@data-id="file-decoration-error-contracts/2_Owner.sol"]', 0, 0) - .waitForElementVisible('//*[@id="error-tooltip-contracts/2_Owner.sol"]') - .waitForElementContainsText('//*[@id="error-tooltip-contracts/2_Owner.sol"]', 'error on owner') - }, - - 'clear ballot decorator': function (browser: NightwatchBrowser) { - browser - .useCss() - .addFile('scripts/clearballot.ts', { content: testScriptClearBallot }) - .pause(2000) - .executeScriptInTerminal('remix.exeCurrent()') - .pause(4000) - .waitForElementNotPresent('[data-id="file-decoration-custom-contracts/3_Ballot.sol"]', 10000) - }, - 'clear all decorators': function (browser: NightwatchBrowser) { - browser - .addFile('scripts/clearall.ts', { content: testScriptClear }) - .pause(2000) - .executeScriptInTerminal('remix.exeCurrent()') - .pause(4000) - .waitForElementNotPresent('[data-id="file-decoration-error-contracts/2_Owner.sol"]', 10000) - .waitForElementNotPresent('[data-id="file-decoration-warning-contracts/1_Storage.sol"]', 10000) - } - - -} -const testScriptSet = ` -(async () => { - remix.call('fileDecorator' as any, 'clearFileDecorators') - let decorator: any = { - path: 'contracts/2_Owner.sol', - isDirectory: false, - fileStateType: 'ERROR', - fileStateLabelClass: 'text-danger', - fileStateIconClass: '', - fileStateIcon: '', - text: '2', - bubble: true, - comment: 'error on owner', - } - let decorator2: any = { - path: 'contracts/2_Owner.sol', - isDirectory: false, - fileStateType: 'CUSTOM', - fileStateLabelClass: 'text-success', - fileStateIconClass: 'text-success', - fileStateIcon: 'U', - text: '', - bubble: true, - comment: 'modified', - } - await remix.call('fileDecorator' as any, 'setFileDecorators', [decorator, decorator2]) - - decorator = { - path: 'contracts/1_Storage.sol', - isDirectory: false, - fileStateType: 'WARNING', - fileStateLabelClass: 'text-warning', - fileStateIconClass: '', - fileStateIcon: '', - text: '2', - bubble: true, - comment: 'warning on storage', - } - await remix.call('fileDecorator' as any, 'setFileDecorators', decorator) - - decorator = { - path: 'contracts/3_Ballot.sol', - isDirectory: false, - fileStateType: 'CUSTOM', - fileStateLabelClass: '', - fileStateIconClass: '', - fileStateIcon: 'customtext', - text: 'with text', - bubble: true, - comment: 'custom comment', - } - await remix.call('fileDecorator' as any, 'setFileDecorators', decorator) - - })()` - - -const testScriptClearBallot = ` - (async () => { - - await remix.call('fileDecorator' as any, 'clearFileDecorators', 'contracts/3_Ballot.sol') - - })()` - -const testScriptClear = ` - (async () => { - await remix.call('fileDecorator' as any, 'clearAllFileDecorators') - - - })()` \ No newline at end of file diff --git a/apps/remix-ide/src/app/plugins/file-decorator.ts b/apps/remix-ide/src/app/plugins/file-decorator.ts index 9b6d304b02..85ad3a4f8f 100644 --- a/apps/remix-ide/src/app/plugins/file-decorator.ts +++ b/apps/remix-ide/src/app/plugins/file-decorator.ts @@ -8,11 +8,7 @@ import { fileDecoration } from '@remix-ui/file-decorators' const profile = { name: 'fileDecorator', desciption: 'Keeps decorators of the files', -<<<<<<< HEAD methods: ['setFileDecorators', 'clearFileDecorators', 'clearAllFileDecorators'], -======= - methods: ['setFileDecorators', 'clearFileDecorators'], ->>>>>>> 43bc1038a (add test) events: ['fileDecoratorsChanged'], version: '0.0.1' } @@ -22,25 +18,11 @@ export class FileDecorator extends Plugin { constructor() { super(profile) } -<<<<<<< HEAD - - onActivation(): void { - this.on('filePanel', 'setWorkspace', async () => { - await this.clearAllFileDecorators() - }) - } - -======= ->>>>>>> 43bc1038a (add test) /** * * @param fileStates Array of file states */ async setFileDecorators(fileStates: fileDecoration[] | fileDecoration) { -<<<<<<< HEAD - const { from } = this.currentRequest - const workspace = await this.call('filePanel', 'getCurrentWorkspace') -======= const workspace = await this.call('filePanel', 'getCurrentWorkspace') function sortByPath( a: fileDecoration, b: fileDecoration ) { if ( a.path < b.path ){ @@ -52,49 +34,20 @@ export class FileDecorator extends Plugin { return 0; } ->>>>>>> 43bc1038a (add test) const fileStatesPayload = Array.isArray(fileStates) ? fileStates : [fileStates] // clear all file states in the previous state of this owner on the files called fileStatesPayload.forEach((state) => { state.workspace = workspace -<<<<<<< HEAD state.owner = from }) const filteredState = this._fileStates.filter((state) => { const index = fileStatesPayload.findIndex((payloadFileState: fileDecoration) => { return from == state.owner && payloadFileState.path == state.path -======= - }) - const filteredState = this._fileStates.filter((state) => { - const index = fileStatesPayload.findIndex((payloadFileState: fileDecoration) => { - return payloadFileState.owner == state.owner && payloadFileState.path == state.path ->>>>>>> 43bc1038a (add test) }) return index == -1 }) const newState = [...filteredState, ...fileStatesPayload].sort(sortByPath) -<<<<<<< HEAD - -======= ->>>>>>> 43bc1038a (add test) - if (!deepequal(newState, this._fileStates)) { - this._fileStates = newState - this.emit('fileDecoratorsChanged', this._fileStates) - } - } - -<<<<<<< HEAD - async clearFileDecorators(path?: string) { - const { from } = this.currentRequest - if (!from) return - - const filteredState = this._fileStates.filter((state) => { - if(state.owner != from) return true - if(path && state.path != path) return true - }) - const newState = [...filteredState].sort(sortByPath) - if (!deepequal(newState, this._fileStates)) { this._fileStates = newState this.emit('fileDecoratorsChanged', this._fileStates) @@ -102,24 +55,8 @@ export class FileDecorator extends Plugin { } - async clearAllFileDecorators() { - this._fileStates = [] - this.emit('fileDecoratorsChanged', []) - } -} - -const sortByPath = (a: fileDecoration, b: fileDecoration) => { - if (a.path < b.path) { - return -1; - } - if (a.path > b.path) { - return 1; - } - return 0; -======= async clearFileDecorators() { this._fileStates = [] this.emit('fileDecoratorsChanged', []) } ->>>>>>> 43bc1038a (add test) } \ No newline at end of file diff --git a/libs/remix-ui/file-decorators/src/lib/components/filedecorationicons/file-decoration-custom-icon.tsx b/libs/remix-ui/file-decorators/src/lib/components/filedecorationicons/file-decoration-custom-icon.tsx index 807331e0b9..c157bc66c0 100644 --- a/libs/remix-ui/file-decorators/src/lib/components/filedecorationicons/file-decoration-custom-icon.tsx +++ b/libs/remix-ui/file-decorators/src/lib/components/filedecorationicons/file-decoration-custom-icon.tsx @@ -5,11 +5,7 @@ import { fileDecoration } from '../../types' const FileDecorationCustomIcon = (props: { fileDecoration: fileDecoration }) => { -<<<<<<< HEAD - return <> -======= return <> ->>>>>>> 43bc1038a (add test) {props.fileDecoration.fileStateIcon} } diff --git a/libs/remix-ui/file-decorators/src/lib/components/filedecorationicons/file-decoration-error-icon.tsx b/libs/remix-ui/file-decorators/src/lib/components/filedecorationicons/file-decoration-error-icon.tsx index 07b7db6b5f..2bb61fd97f 100644 --- a/libs/remix-ui/file-decorators/src/lib/components/filedecorationicons/file-decoration-error-icon.tsx +++ b/libs/remix-ui/file-decorators/src/lib/components/filedecorationicons/file-decoration-error-icon.tsx @@ -7,11 +7,7 @@ const FileDecorationErrorIcon = (props: { fileDecoration: fileDecoration }) => { return <> -<<<<<<< HEAD - {props.fileDecoration.text} -======= {props.fileDecoration.text} ->>>>>>> 43bc1038a (add test) } diff --git a/libs/remix-ui/file-decorators/src/lib/components/filedecorationicons/file-decoration-warning-icon.tsx b/libs/remix-ui/file-decorators/src/lib/components/filedecorationicons/file-decoration-warning-icon.tsx index d7bddff75e..1c027c9854 100644 --- a/libs/remix-ui/file-decorators/src/lib/components/filedecorationicons/file-decoration-warning-icon.tsx +++ b/libs/remix-ui/file-decorators/src/lib/components/filedecorationicons/file-decoration-warning-icon.tsx @@ -5,11 +5,7 @@ import { fileDecoration } from '../../types' const FileDecorationWarningIcon = (props: { fileDecoration: fileDecoration }) => { -<<<<<<< HEAD - return <>{props.fileDecoration.text} -======= return <>{props.fileDecoration.text} ->>>>>>> 43bc1038a (add test) } export default FileDecorationWarningIcon \ No newline at end of file From 1d71d9f21bb19fc79b64f16edb0a48d0d6b857cf Mon Sep 17 00:00:00 2001 From: iamsethsamuel Date: Tue, 16 Aug 2022 14:15:20 +0100 Subject: [PATCH 15/21] merge conflict hopefully fixed --- .../editor/src/lib/remix-ui-editor.tsx | 2 +- .../src/lib/components/file-render.tsx | 25 +++++++++++-------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx b/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx index 2f7ba40384..716c289046 100644 --- a/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx +++ b/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx @@ -617,4 +617,4 @@ export const EditorUI = (props: EditorUIProps) => { ) } -export default EditorUI +export default EditorUI \ No newline at end of file diff --git a/libs/remix-ui/workspace/src/lib/components/file-render.tsx b/libs/remix-ui/workspace/src/lib/components/file-render.tsx index 814715ee42..d535a0ca89 100644 --- a/libs/remix-ui/workspace/src/lib/components/file-render.tsx +++ b/libs/remix-ui/workspace/src/lib/components/file-render.tsx @@ -82,9 +82,14 @@ export const FileRender = (props: RenderFileProps) => { iconX='pr-3 fa fa-folder' iconY='pr-3 fa fa-folder-open' key={`${file.path + props.index}`} - label={ - - } + label={<> +
    + + + + +
    + } onClick={handleFolderClick} onContextMenu={handleContextMenu} labelClass={labelClass} @@ -122,13 +127,13 @@ export const FileRender = (props: RenderFileProps) => { id={`treeViewItem${file.path}`} key={`treeView${file.path}`} label={ - <> -
    - - - - -
    + <> +
    + + + + +
    } onClick={handleFileClick} From a73313758ba5d78144e4904b4c6db4d6099e5922 Mon Sep 17 00:00:00 2001 From: iamsethsamuel Date: Tue, 16 Aug 2022 16:27:27 +0100 Subject: [PATCH 16/21] app building locally --- .../src/app/plugins/file-decorator.ts | 48 ++++++++++++++----- .../file-decoration-tooltip.tsx | 6 --- .../file-decorators/src/lib/types/index.ts | 6 --- 3 files changed, 36 insertions(+), 24 deletions(-) diff --git a/apps/remix-ide/src/app/plugins/file-decorator.ts b/apps/remix-ide/src/app/plugins/file-decorator.ts index 85ad3a4f8f..c81c1894ff 100644 --- a/apps/remix-ide/src/app/plugins/file-decorator.ts +++ b/apps/remix-ide/src/app/plugins/file-decorator.ts @@ -18,22 +18,20 @@ export class FileDecorator extends Plugin { constructor() { super(profile) } + + onActivation(): void { + this.on('filePanel', 'setWorkspace', async () => { + await this.clearAllFileDecorators() + }) + } + /** * * @param fileStates Array of file states */ async setFileDecorators(fileStates: fileDecoration[] | fileDecoration) { + const { from } = this.currentRequest const workspace = await this.call('filePanel', 'getCurrentWorkspace') - function sortByPath( a: fileDecoration, b: fileDecoration ) { - if ( a.path < b.path ){ - return -1; - } - if ( a.path > b.path ){ - return 1; - } - return 0; - } - const fileStatesPayload = Array.isArray(fileStates) ? fileStates : [fileStates] // clear all file states in the previous state of this owner on the files called fileStatesPayload.forEach((state) => { @@ -47,7 +45,23 @@ export class FileDecorator extends Plugin { return index == -1 }) const newState = [...filteredState, ...fileStatesPayload].sort(sortByPath) - + + if (!deepequal(newState, this._fileStates)) { + this._fileStates = newState + this.emit('fileDecoratorsChanged', this._fileStates) + } + } + + async clearFileDecorators(path?: string) { + const { from } = this.currentRequest + if (!from) return + + const filteredState = this._fileStates.filter((state) => { + if(state.owner != from) return true + if(path && state.path != path) return true + }) + const newState = [...filteredState].sort(sortByPath) + if (!deepequal(newState, this._fileStates)) { this._fileStates = newState this.emit('fileDecoratorsChanged', this._fileStates) @@ -55,8 +69,18 @@ export class FileDecorator extends Plugin { } - async clearFileDecorators() { + async clearAllFileDecorators() { this._fileStates = [] this.emit('fileDecoratorsChanged', []) } +} + +const sortByPath = (a: fileDecoration, b: fileDecoration) => { + if (a.path < b.path) { + return -1; + } + if (a.path > b.path) { + return 1; + } + return 0; } \ No newline at end of file diff --git a/libs/remix-ui/file-decorators/src/lib/components/filedecorationicons/file-decoration-tooltip.tsx b/libs/remix-ui/file-decorators/src/lib/components/filedecorationicons/file-decoration-tooltip.tsx index 1a84263965..7c9149c14d 100644 --- a/libs/remix-ui/file-decorators/src/lib/components/filedecorationicons/file-decoration-tooltip.tsx +++ b/libs/remix-ui/file-decorators/src/lib/components/filedecorationicons/file-decoration-tooltip.tsx @@ -9,15 +9,9 @@ const FileDecorationTooltip = (props: { }, ) => { const getComments = function (fileDecoration: fileDecoration) { -<<<<<<< HEAD - if (fileDecoration.comment) { - const comments = Array.isArray(fileDecoration.comment) ? fileDecoration.comment : [fileDecoration.comment] - return comments.map((comment, index) => { -======= if (fileDecoration.commment) { const commments = Array.isArray(fileDecoration.commment) ? fileDecoration.commment : [fileDecoration.commment] return commments.map((comment, index) => { ->>>>>>> 43bc1038a (add test) return
    {comment}

    }) } diff --git a/libs/remix-ui/file-decorators/src/lib/types/index.ts b/libs/remix-ui/file-decorators/src/lib/types/index.ts index a734c2fd4a..932cd3c326 100644 --- a/libs/remix-ui/file-decorators/src/lib/types/index.ts +++ b/libs/remix-ui/file-decorators/src/lib/types/index.ts @@ -14,17 +14,11 @@ export enum fileDecorationType { fileStateIcon: string | HTMLDivElement | JSX.Element, bubble: boolean, text?: string, -<<<<<<< HEAD - owner?: string, - workspace?: any - tooltip?: string comment?: string[] | string -======= owner: string, workspace?: any tooltip?: string commment?: string[] | string ->>>>>>> 43bc1038a (add test) } export interface FileType { From 673ce001e560650d7f83b4123358457bf351f52e Mon Sep 17 00:00:00 2001 From: iamsethsamuel Date: Wed, 17 Aug 2022 15:58:31 +0100 Subject: [PATCH 17/21] unwanted changes removed --- apps/etherscan/src/app/app.tsx | 13 -- .../src/app/components/HeaderWithSettings.tsx | 3 - .../src/app/components/SubmitButton.tsx | 13 -- .../src/app/hooks/useLocalStorage.tsx | 8 - apps/etherscan/src/app/routes.tsx | 4 - apps/etherscan/src/app/utils/utilities.ts | 10 -- .../src/app/views/CaptureKeyView.tsx | 4 - apps/etherscan/src/app/views/ErrorView.tsx | 4 - apps/etherscan/src/app/views/VerifyView.tsx | 12 -- .../src/tests/file_decorator.test.ts | 125 ++++++++++++++++ jest.config.js | 2 +- .../src/lib/vm-debugger/global-variables.tsx | 2 +- .../editor/src/lib/remix-ui-editor.tsx | 2 +- .../file-decoration-custom-icon.tsx | 2 +- .../file-decoration-error-icon.tsx | 2 +- .../file-decoration-tooltip.tsx | 6 +- .../file-decorators/src/lib/helper/index.tsx | 6 - .../file-decorators/src/lib/types/index.ts | 5 +- .../src/lib/tree-view-item/tree-view-item.tsx | 2 +- package.json | 2 +- tsconfig.base.json | 138 +++++------------- 21 files changed, 171 insertions(+), 194 deletions(-) diff --git a/apps/etherscan/src/app/app.tsx b/apps/etherscan/src/app/app.tsx index 212e195e42..653d90bfb1 100644 --- a/apps/etherscan/src/app/app.tsx +++ b/apps/etherscan/src/app/app.tsx @@ -43,20 +43,11 @@ const App = () => { contractsRef.current = contracts useEffect(() => { -<<<<<<< HEAD -======= - console.log("Remix Etherscan loading...") ->>>>>>> e02014ca4 (add etherscan plugin) const client = new PluginClient() createClient(client) const loadClient = async () => { await client.onload() setClientInstance(client) -<<<<<<< HEAD -======= - console.log("Remix Etherscan Plugin has been loaded") - ->>>>>>> e02014ca4 (add etherscan plugin) client.on("solidity", "compilationFinished", ( @@ -65,10 +56,6 @@ const App = () => { languageVersion: string, data: CompilationResult ) => { -<<<<<<< HEAD -======= - console.log("New compilation received") ->>>>>>> e02014ca4 (add etherscan plugin) const newContractsNames = getNewContractNames(data) const newContractsToSave: string[] = [ diff --git a/apps/etherscan/src/app/components/HeaderWithSettings.tsx b/apps/etherscan/src/app/components/HeaderWithSettings.tsx index bd9c18430a..14e048d6cd 100644 --- a/apps/etherscan/src/app/components/HeaderWithSettings.tsx +++ b/apps/etherscan/src/app/components/HeaderWithSettings.tsx @@ -18,10 +18,7 @@ interface IconProps { const HomeIcon: React.FC = ({ from, themeType }: IconProps) => { return ( >>>>>> e02014ca4 (add etherscan plugin) data-toggle="tooltip" data-placement="top" title="Home" diff --git a/apps/etherscan/src/app/components/SubmitButton.tsx b/apps/etherscan/src/app/components/SubmitButton.tsx index a0c18d8e8f..c89f12bf02 100644 --- a/apps/etherscan/src/app/components/SubmitButton.tsx +++ b/apps/etherscan/src/app/components/SubmitButton.tsx @@ -3,26 +3,17 @@ import React from "react" interface Props { text: string isSubmitting?: boolean -<<<<<<< HEAD dataId?: string -======= ->>>>>>> e02014ca4 (add etherscan plugin) } export const SubmitButton: React.FC = ({ text, -<<<<<<< HEAD dataId, -======= ->>>>>>> e02014ca4 (add etherscan plugin) isSubmitting = false, }) => { return (
    )} diff --git a/apps/etherscan/src/app/hooks/useLocalStorage.tsx b/apps/etherscan/src/app/hooks/useLocalStorage.tsx index e442ea5a8e..dbef5378a8 100644 --- a/apps/etherscan/src/app/hooks/useLocalStorage.tsx +++ b/apps/etherscan/src/app/hooks/useLocalStorage.tsx @@ -11,11 +11,7 @@ export function useLocalStorage(key: string, initialValue: any) { return item ? JSON.parse(item) : initialValue } catch (error) { // If error also return initialValue -<<<<<<< HEAD console.error(error) -======= - console.log(error) ->>>>>>> e02014ca4 (add etherscan plugin) return initialValue } }) @@ -33,11 +29,7 @@ export function useLocalStorage(key: string, initialValue: any) { window.localStorage.setItem(key, JSON.stringify(valueToStore)) } catch (error) { // A more advanced implementation would handle the error case -<<<<<<< HEAD console.error(error) -======= - console.log(error) ->>>>>>> e02014ca4 (add etherscan plugin) } } diff --git a/apps/etherscan/src/app/routes.tsx b/apps/etherscan/src/app/routes.tsx index ba6e7b1998..1400a601df 100644 --- a/apps/etherscan/src/app/routes.tsx +++ b/apps/etherscan/src/app/routes.tsx @@ -1,10 +1,6 @@ import React from "react" import { -<<<<<<< HEAD HashRouter as Router, -======= - BrowserRouter as Router, ->>>>>>> e02014ca4 (add etherscan plugin) Route, Routes, RouteProps, diff --git a/apps/etherscan/src/app/utils/utilities.ts b/apps/etherscan/src/app/utils/utilities.ts index 85ffc482e0..d7300806a3 100644 --- a/apps/etherscan/src/app/utils/utilities.ts +++ b/apps/etherscan/src/app/utils/utilities.ts @@ -13,13 +13,7 @@ export const getNetworkName = async (client: RemixClient) => { if (!network) { throw new Error("no known network to verify against") } -<<<<<<< HEAD return network.name!.toLowerCase() -======= - const name = network.name!.toLowerCase() - // TODO : remove that when https://github.com/ethereum/remix-ide/issues/2017 is fixe - return name === "görli" ? "goerli" : name ->>>>>>> e02014ca4 (add etherscan plugin) } export const getReceiptStatus = async ( @@ -33,10 +27,6 @@ export const getReceiptStatus = async ( const { result } = response.data return result } catch (error) { -<<<<<<< HEAD console.error(error) -======= - console.log("Error", error) ->>>>>>> e02014ca4 (add etherscan plugin) } } diff --git a/apps/etherscan/src/app/views/CaptureKeyView.tsx b/apps/etherscan/src/app/views/CaptureKeyView.tsx index 2350614c1b..9703ec10ff 100644 --- a/apps/etherscan/src/app/views/CaptureKeyView.tsx +++ b/apps/etherscan/src/app/views/CaptureKeyView.tsx @@ -48,11 +48,7 @@ export const CaptureKeyView: React.FC = () => {
    -<<<<<<< HEAD -======= - ->>>>>>> e02014ca4 (add etherscan plugin)
    )} diff --git a/apps/etherscan/src/app/views/ErrorView.tsx b/apps/etherscan/src/app/views/ErrorView.tsx index 66a4ea0ebb..69e022e47c 100644 --- a/apps/etherscan/src/app/views/ErrorView.tsx +++ b/apps/etherscan/src/app/views/ErrorView.tsx @@ -21,11 +21,7 @@ export const ErrorView: React.FC = () => { Please raise an issue:{" "} >>>>>> e02014ca4 (add etherscan plugin) > Here diff --git a/apps/etherscan/src/app/views/VerifyView.tsx b/apps/etherscan/src/app/views/VerifyView.tsx index bcdd0930e2..3e85d471b7 100644 --- a/apps/etherscan/src/app/views/VerifyView.tsx +++ b/apps/etherscan/src/app/views/VerifyView.tsx @@ -170,11 +170,7 @@ export const VerifyView: React.FC = ({ } return result } catch (error) { -<<<<<<< HEAD console.error(error) -======= - console.log("Error, something wrong happened", error) ->>>>>>> e02014ca4 (add etherscan plugin) setResults("Something wrong happened, try again") } } @@ -288,20 +284,12 @@ export const VerifyView: React.FC = ({ /> -<<<<<<< HEAD -======= - ->>>>>>> e02014ca4 (add etherscan plugin) )} -<<<<<<< HEAD
    >>>>>> e02014ca4 (add etherscan plugin) style={{ marginTop: "2em", fontSize: "0.8em", textAlign: "center" }} dangerouslySetInnerHTML={{ __html: results }} /> diff --git a/apps/remix-ide-e2e/src/tests/file_decorator.test.ts b/apps/remix-ide-e2e/src/tests/file_decorator.test.ts index e69de29bb2..3483853cad 100644 --- a/apps/remix-ide-e2e/src/tests/file_decorator.test.ts +++ b/apps/remix-ide-e2e/src/tests/file_decorator.test.ts @@ -0,0 +1,125 @@ + +'use strict' +import { NightwatchBrowser } from 'nightwatch' +import init from '../helpers/init' + +module.exports = { + + before: function (browser: NightwatchBrowser, done: VoidFunction) { + init(browser, done) + }, + + 'Test decorators with script': function (browser: NightwatchBrowser) { + browser + .openFile('contracts') + .openFile('contracts/2_Owner.sol') + .openFile('contracts/1_Storage.sol') + .openFile('contracts/3_Ballot.sol') + .addFile('scripts/decorators.ts', { content: testScriptSet }) + .pause(2000) + .executeScriptInTerminal('remix.exeCurrent()') + .pause(4000) + .useXpath() + .waitForElementContainsText('//*[@id="fileExplorerView"]//*[@data-id="file-decoration-error-contracts/2_Owner.sol"]', '2') + .waitForElementContainsText('//*[@class="mainview"]//*[@data-id="file-decoration-error-contracts/2_Owner.sol"]', '2') + .waitForElementContainsText('//*[@id="fileExplorerView"]//*[@data-id="file-decoration-custom-contracts/2_Owner.sol"]', 'U') + .waitForElementContainsText('//*[@class="mainview"]//*[@data-id="file-decoration-custom-contracts/2_Owner.sol"]', 'U') + .waitForElementContainsText('//*[@id="fileExplorerView"]//*[@data-id="file-decoration-warning-contracts/1_Storage.sol"]', '2') + .waitForElementContainsText('//*[@class="mainview"]//*[@data-id="file-decoration-warning-contracts/1_Storage.sol"]', '2') + .waitForElementContainsText('//*[@id="fileExplorerView"]//*[@data-id="file-decoration-custom-contracts/3_Ballot.sol"]', 'customtext') + .waitForElementContainsText('//*[@class="mainview"]//*[@data-id="file-decoration-custom-contracts/3_Ballot.sol"]', 'customtext') + .moveToElement('//*[@id="fileExplorerView"]//*[@data-id="file-decoration-error-contracts/2_Owner.sol"]', 0, 0) + .waitForElementVisible('//*[@id="error-tooltip-contracts/2_Owner.sol"]') + .waitForElementContainsText('//*[@id="error-tooltip-contracts/2_Owner.sol"]', 'error on owner') + }, + + 'clear ballot decorator': function (browser: NightwatchBrowser) { + browser + .useCss() + .addFile('scripts/clearballot.ts', { content: testScriptClearBallot }) + .pause(2000) + .executeScriptInTerminal('remix.exeCurrent()') + .pause(4000) + .waitForElementNotPresent('[data-id="file-decoration-custom-contracts/3_Ballot.sol"]', 10000) + }, + 'clear all decorators': function (browser: NightwatchBrowser) { + browser + .addFile('scripts/clearall.ts', { content: testScriptClear }) + .pause(2000) + .executeScriptInTerminal('remix.exeCurrent()') + .pause(4000) + .waitForElementNotPresent('[data-id="file-decoration-error-contracts/2_Owner.sol"]', 10000) + .waitForElementNotPresent('[data-id="file-decoration-warning-contracts/1_Storage.sol"]', 10000) + } + + +} +const testScriptSet = ` +(async () => { + remix.call('fileDecorator' as any, 'clearFileDecorators') + let decorator: any = { + path: 'contracts/2_Owner.sol', + isDirectory: false, + fileStateType: 'ERROR', + fileStateLabelClass: 'text-danger', + fileStateIconClass: '', + fileStateIcon: '', + text: '2', + bubble: true, + comment: 'error on owner', + } + let decorator2: any = { + path: 'contracts/2_Owner.sol', + isDirectory: false, + fileStateType: 'CUSTOM', + fileStateLabelClass: 'text-success', + fileStateIconClass: 'text-success', + fileStateIcon: 'U', + text: '', + bubble: true, + comment: 'modified', + } + await remix.call('fileDecorator' as any, 'setFileDecorators', [decorator, decorator2]) + + decorator = { + path: 'contracts/1_Storage.sol', + isDirectory: false, + fileStateType: 'WARNING', + fileStateLabelClass: 'text-warning', + fileStateIconClass: '', + fileStateIcon: '', + text: '2', + bubble: true, + comment: 'warning on storage', + } + await remix.call('fileDecorator' as any, 'setFileDecorators', decorator) + + decorator = { + path: 'contracts/3_Ballot.sol', + isDirectory: false, + fileStateType: 'CUSTOM', + fileStateLabelClass: '', + fileStateIconClass: '', + fileStateIcon: 'customtext', + text: 'with text', + bubble: true, + comment: 'custom comment', + } + await remix.call('fileDecorator' as any, 'setFileDecorators', decorator) + + })()` + + +const testScriptClearBallot = ` + (async () => { + + await remix.call('fileDecorator' as any, 'clearFileDecorators', 'contracts/3_Ballot.sol') + + })()` + +const testScriptClear = ` + (async () => { + await remix.call('fileDecorator' as any, 'clearAllFileDecorators') + + + })()` \ No newline at end of file diff --git a/jest.config.js b/jest.config.js index d82629178b..b2722cad44 100644 --- a/jest.config.js +++ b/jest.config.js @@ -21,5 +21,5 @@ module.exports = { "/../../dist/libs/remix-ws-templates/src/index.js" , "@remix-project/remixd": "/../../dist/libs/remixd/index.js" - },"projects":"/libs/remix-ui/drag-n-drop" + } }; diff --git a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/global-variables.tsx b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/global-variables.tsx index 413ef52b35..cf34760ae2 100644 --- a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/global-variables.tsx +++ b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/global-variables.tsx @@ -18,7 +18,7 @@ export const GlobalVariables = ({ block, receipt, tx }) => { 'tx.origin': tx.from } if (block.baseFeePerGas) { - globals['block.basefee'] = (Web3.utils.toBN(block.baseFeePerGas)) + ` Wei (${block.baseFeePerGas})` + globals['block.basefee'] = Web3.utils.toBN(block.baseFeePerGas).toString(10) + ` Wei (${block.baseFeePerGas})` } return ( diff --git a/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx b/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx index 716c289046..2f7ba40384 100644 --- a/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx +++ b/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx @@ -617,4 +617,4 @@ export const EditorUI = (props: EditorUIProps) => { ) } -export default EditorUI \ No newline at end of file +export default EditorUI diff --git a/libs/remix-ui/file-decorators/src/lib/components/filedecorationicons/file-decoration-custom-icon.tsx b/libs/remix-ui/file-decorators/src/lib/components/filedecorationicons/file-decoration-custom-icon.tsx index c157bc66c0..2cfec2ac97 100644 --- a/libs/remix-ui/file-decorators/src/lib/components/filedecorationicons/file-decoration-custom-icon.tsx +++ b/libs/remix-ui/file-decorators/src/lib/components/filedecorationicons/file-decoration-custom-icon.tsx @@ -5,7 +5,7 @@ import { fileDecoration } from '../../types' const FileDecorationCustomIcon = (props: { fileDecoration: fileDecoration }) => { - return <> + return <> {props.fileDecoration.fileStateIcon} } diff --git a/libs/remix-ui/file-decorators/src/lib/components/filedecorationicons/file-decoration-error-icon.tsx b/libs/remix-ui/file-decorators/src/lib/components/filedecorationicons/file-decoration-error-icon.tsx index 2bb61fd97f..5a9c48b555 100644 --- a/libs/remix-ui/file-decorators/src/lib/components/filedecorationicons/file-decoration-error-icon.tsx +++ b/libs/remix-ui/file-decorators/src/lib/components/filedecorationicons/file-decoration-error-icon.tsx @@ -7,7 +7,7 @@ const FileDecorationErrorIcon = (props: { fileDecoration: fileDecoration }) => { return <> - {props.fileDecoration.text} + {props.fileDecoration.text} } diff --git a/libs/remix-ui/file-decorators/src/lib/components/filedecorationicons/file-decoration-tooltip.tsx b/libs/remix-ui/file-decorators/src/lib/components/filedecorationicons/file-decoration-tooltip.tsx index 7c9149c14d..1d87846192 100644 --- a/libs/remix-ui/file-decorators/src/lib/components/filedecorationicons/file-decoration-tooltip.tsx +++ b/libs/remix-ui/file-decorators/src/lib/components/filedecorationicons/file-decoration-tooltip.tsx @@ -9,9 +9,9 @@ const FileDecorationTooltip = (props: { }, ) => { const getComments = function (fileDecoration: fileDecoration) { - if (fileDecoration.commment) { - const commments = Array.isArray(fileDecoration.commment) ? fileDecoration.commment : [fileDecoration.commment] - return commments.map((comment, index) => { + if (fileDecoration.comment) { + const comments = Array.isArray(fileDecoration.comment) ? fileDecoration.comment : [fileDecoration.comment] + return comments.map((comment, index) => { return
    {comment}

    }) } diff --git a/libs/remix-ui/file-decorators/src/lib/helper/index.tsx b/libs/remix-ui/file-decorators/src/lib/helper/index.tsx index 2812124bd9..10bad7d3fc 100644 --- a/libs/remix-ui/file-decorators/src/lib/helper/index.tsx +++ b/libs/remix-ui/file-decorators/src/lib/helper/index.tsx @@ -2,15 +2,9 @@ import React from "react" import { fileDecoration } from "../types" export const getComments = function (fileDecoration: fileDecoration) { -<<<<<<< HEAD if(fileDecoration.comment){ const comments = Array.isArray(fileDecoration.comment) ? fileDecoration.comment : [fileDecoration.comment] return comments.map((comment, index) => { -======= - if(fileDecoration.commment){ - const commments = Array.isArray(fileDecoration.commment) ? fileDecoration.commment : [fileDecoration.commment] - return commments.map((comment, index) => { ->>>>>>> 43bc1038a (add test) return
    {comment}

    }) } diff --git a/libs/remix-ui/file-decorators/src/lib/types/index.ts b/libs/remix-ui/file-decorators/src/lib/types/index.ts index 932cd3c326..fa783ec6e5 100644 --- a/libs/remix-ui/file-decorators/src/lib/types/index.ts +++ b/libs/remix-ui/file-decorators/src/lib/types/index.ts @@ -14,11 +14,10 @@ export enum fileDecorationType { fileStateIcon: string | HTMLDivElement | JSX.Element, bubble: boolean, text?: string, - comment?: string[] | string - owner: string, + owner?: string, workspace?: any tooltip?: string - commment?: string[] | string + comment?: string[] | string } export interface FileType { diff --git a/libs/remix-ui/tree-view/src/lib/tree-view-item/tree-view-item.tsx b/libs/remix-ui/tree-view/src/lib/tree-view-item/tree-view-item.tsx index bf60d4cd4f..e03e624977 100644 --- a/libs/remix-ui/tree-view/src/lib/tree-view-item/tree-view-item.tsx +++ b/libs/remix-ui/tree-view/src/lib/tree-view-item/tree-view-item.tsx @@ -24,4 +24,4 @@ export const TreeViewItem = (props: TreeViewItemProps) => { ) } -export default TreeViewItem \ No newline at end of file +export default TreeViewItem diff --git a/package.json b/package.json index c6aee5ac69..11c4897478 100644 --- a/package.json +++ b/package.json @@ -338,4 +338,4 @@ "yo-yo": "github:ioedeveloper/yo-yo", "yo-yoify": "^3.7.3" } -} \ No newline at end of file +} diff --git a/tsconfig.base.json b/tsconfig.base.json index 0639979e32..9174b23427 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -10,14 +10,8 @@ "importHelpers": true, "target": "es2015", "module": "commonjs", - "typeRoots": [ - "node_modules/@types" - ], - "lib": [ - "es2017", - "es2019", - "dom" - ], + "typeRoots": ["node_modules/@types"], + "lib": ["es2017", "es2019", "dom"], "skipLibCheck": true, "skipDefaultLibCheck": true, "baseUrl": ".", @@ -28,120 +22,62 @@ "@remix-project/remix-astwalker": [ "dist/libs/remix-astwalker/src/index.js" ], - "@remix-project/remix-debug": [ - "dist/libs/remix-debug/src/index.js" - ], - "@remix-project/remix-lib": [ - "dist/libs/remix-lib/src/index.js" - ], + "@remix-project/remix-debug": ["dist/libs/remix-debug/src/index.js"], + "@remix-project/remix-lib": ["dist/libs/remix-lib/src/index.js"], "@remix-project/remix-simulator": [ "dist/libs/remix-simulator/src/index.js" ], "@remix-project/remix-solidity": [ "dist/libs/remix-solidity/src/index.js" ], - "@remix-project/remix-tests": [ - "dist/libs/remix-tests/src/index.js" - ], + "@remix-project/remix-tests": ["dist/libs/remix-tests/src/index.js"], "@remix-project/remix-url-resolver": [ "dist/libs/remix-url-resolver/src/index.js" ], "@remix-project/remix-ws-templates": [ "dist/libs/remix-ws-templates/src/index.js" ], - "@remixproject/debugger-plugin": [ - "apps/debugger/src/index.ts" - ], + "@remixproject/debugger-plugin": ["apps/debugger/src/index.ts"], "@remixproject/solidity-compiler-plugin": [ "apps/solidity-compiler/src/index.ts" ], - "@remix-project/remixd": [ - "dist/libs/remixd/index.js" - ], - "@remix-ui/tree-view": [ - "libs/remix-ui/tree-view/src/index.ts" - ], - "@remix-ui/search": [ - "libs/remix-ui/search/src/index.ts" - ], - "@remix-ui/debugger-ui": [ - "libs/remix-ui/debugger-ui/src/index.ts" - ], - "@remix-ui/utils": [ - "libs/remix-ui/utils/src/index.ts" - ], - "@remix-ui/clipboard": [ - "libs/remix-ui/clipboard/src/index.ts" - ], - "@remix-project/remix-solidity-ts": [ - "libs/remix-solidity/src/index.ts" - ], - "@remix-project/remix-lib-ts": [ - "libs/remix-lib/src/index.ts" - ], - "@remix-ui/modal-dialog": [ - "libs/remix-ui/modal-dialog/src/index.ts" - ], - "@remix-ui/toaster": [ - "libs/remix-ui/toaster/src/index.ts" - ], - "@remix-ui/file-explorer": [ - "libs/remix-ui/file-explorer/src/index.ts" - ], - "@remix-ui/workspace": [ - "libs/remix-ui/workspace/src/index.ts" - ], + "@remix-project/remixd": ["dist/libs/remixd/index.js"], + "@remix-ui/tree-view": ["libs/remix-ui/tree-view/src/index.ts"], + "@remix-ui/search": ["libs/remix-ui/search/src/index.ts"], + "@remix-ui/debugger-ui": ["libs/remix-ui/debugger-ui/src/index.ts"], + "@remix-ui/utils": ["libs/remix-ui/utils/src/index.ts"], + "@remix-ui/clipboard": ["libs/remix-ui/clipboard/src/index.ts"], + "@remix-project/remix-solidity-ts": ["libs/remix-solidity/src/index.ts"], + "@remix-project/remix-lib-ts": ["libs/remix-lib/src/index.ts"], + "@remix-ui/modal-dialog": ["libs/remix-ui/modal-dialog/src/index.ts"], + "@remix-ui/toaster": ["libs/remix-ui/toaster/src/index.ts"], + "@remix-ui/file-explorer": ["libs/remix-ui/file-explorer/src/index.ts"], + "@remix-ui/workspace": ["libs/remix-ui/workspace/src/index.ts"], "@remix-ui/static-analyser": [ "libs/remix-ui/static-analyser/src/index.ts" ], - "@remix-ui/checkbox": [ - "libs/remix-ui/checkbox/src/index.ts" - ], - "@remix-ui/settings": [ - "libs/remix-ui/settings/src/index.ts" - ], - "@remix-project/core-plugin": [ - "libs/remix-core-plugin/src/index.ts" - ], + "@remix-ui/checkbox": ["libs/remix-ui/checkbox/src/index.ts"], + "@remix-ui/settings": ["libs/remix-ui/settings/src/index.ts"], + "@remix-project/core-plugin": ["libs/remix-core-plugin/src/index.ts"], "@remix-ui/solidity-compiler": [ "libs/remix-ui/solidity-compiler/src/index.ts" ], "@remix-ui/publish-to-storage": [ "libs/remix-ui/publish-to-storage/src/index.ts" ], - "@remix-ui/renderer": [ - "libs/remix-ui/renderer/src/index.ts" - ], - "@remix-ui/terminal": [ - "libs/remix-ui/terminal/src/index.ts" - ], - "@remix-ui/plugin-manager": [ - "libs/remix-ui/plugin-manager/src/index.ts" - ], - "@remix-ui/home-tab": [ - "libs/remix-ui/home-tab/src/index.ts" - ], - "@remix-ui/editor": [ - "libs/remix-ui/editor/src/index.ts" - ], - "@remix-ui/tabs": [ - "libs/remix-ui/tabs/src/index.ts" - ], - "@remix-ui/helper": [ - "libs/remix-ui/helper/src/index.ts" - ], - "@remix-ui/app": [ - "libs/remix-ui/app/src/index.ts" - ], + "@remix-ui/renderer": ["libs/remix-ui/renderer/src/index.ts"], + "@remix-ui/terminal": ["libs/remix-ui/terminal/src/index.ts"], + "@remix-ui/plugin-manager": ["libs/remix-ui/plugin-manager/src/index.ts"], + "@remix-ui/home-tab": ["libs/remix-ui/home-tab/src/index.ts"], + "@remix-ui/editor": ["libs/remix-ui/editor/src/index.ts"], + "@remix-ui/tabs": ["libs/remix-ui/tabs/src/index.ts"], + "@remix-ui/helper": ["libs/remix-ui/helper/src/index.ts"], + "@remix-ui/app": ["libs/remix-ui/app/src/index.ts"], "@remix-ui/vertical-icons-panel": [ "libs/remix-ui/vertical-icons-panel/src/index.ts" ], - "@remix-ui/theme-module": [ - "libs/remix-ui/theme-module/src/index.ts" - ], - "@remix-ui/panel": [ - "libs/remix-ui/panel/src/index.ts" - ], + "@remix-ui/theme-module": ["libs/remix-ui/theme-module/src/index.ts"], + "@remix-ui/panel": ["libs/remix-ui/panel/src/index.ts"], "@remix-ui/editor-context-view": [ "libs/remix-ui/editor-context-view/src/index.ts" ], @@ -153,14 +89,8 @@ "libs/remix-ui/permission-handler/src/index.ts" ], "@remix-ui/file-decorators": ["libs/remix-ui/file-decorators/src/index.ts"], - "@remix-ui/tooltip-popup": ["libs/remix-ui/tooltip-popup/src/index.ts"], - "@remix-ui/drag-n-drop": [ - "libs/remix-ui/drag-n-drop/src/index.ts" - ] + "@remix-ui/tooltip-popup": ["libs/remix-ui/tooltip-popup/src/index.ts"] } }, - "exclude": [ - "node_modules", - "tmp" - ] -} \ No newline at end of file + "exclude": ["node_modules", "tmp"] +} From 64cd1fa99c1082702edcd8375c26c7b494a828b7 Mon Sep 17 00:00:00 2001 From: iamsethsamuel Date: Wed, 17 Aug 2022 15:59:35 +0100 Subject: [PATCH 18/21] unwanted files removed --- libs/remix-ui/drag-n-drop/.babelrc | 16 +----- libs/remix-ui/drag-n-drop/.eslintrc.json | 51 +++++++------------ libs/remix-ui/drag-n-drop/package.json | 4 -- .../src/lib/remix-ui-drag-n-drop.module.css | 0 .../src/lib/remix-ui-drag-n-drop.spec.tsx | 10 ---- .../remix-ui/workspace/src/lib/types/index.ts | 2 +- nx.json | 9 ++++ tsconfig.base.json | 3 +- 8 files changed, 32 insertions(+), 63 deletions(-) delete mode 100644 libs/remix-ui/drag-n-drop/package.json delete mode 100644 libs/remix-ui/drag-n-drop/src/lib/remix-ui-drag-n-drop.module.css delete mode 100644 libs/remix-ui/drag-n-drop/src/lib/remix-ui-drag-n-drop.spec.tsx diff --git a/libs/remix-ui/drag-n-drop/.babelrc b/libs/remix-ui/drag-n-drop/.babelrc index 938d07c327..09d67939cc 100644 --- a/libs/remix-ui/drag-n-drop/.babelrc +++ b/libs/remix-ui/drag-n-drop/.babelrc @@ -1,16 +1,4 @@ { - "presets": [ - [ - "@nrwl/react/babel", { - "runtime": "automatic", - "useBuiltIns": "usage" - - } - ] - ], - "plugins": [ - - - - ] + "presets": ["@nrwl/react/babel"], + "plugins": [] } diff --git a/libs/remix-ui/drag-n-drop/.eslintrc.json b/libs/remix-ui/drag-n-drop/.eslintrc.json index ac865be105..0d43d424e3 100644 --- a/libs/remix-ui/drag-n-drop/.eslintrc.json +++ b/libs/remix-ui/drag-n-drop/.eslintrc.json @@ -1,34 +1,19 @@ { - "extends": [ - "plugin:@nrwl/nx/react", - "../../../.eslintrc.json" - ], - "ignorePatterns": [ - "!**/*" - ], - "overrides": [ - { - "files": [ - "*.ts", - "*.tsx", - "*.js", - "*.jsx" - ], - "rules": {} - }, - { - "files": [ - "*.ts", - "*.tsx" - ], - "rules": {} - }, - { - "files": [ - "*.js", - "*.jsx" - ], - "rules": {} - } - ] -} \ No newline at end of file + "env": { + "browser": true, + "es6": true + }, + "extends": "../../../.eslintrc.json", + "globals": { + "Atomics": "readonly", + "SharedArrayBuffer": "readonly" + }, + "parserOptions": { + "ecmaVersion": 11, + "sourceType": "module" + }, + "rules": { + "no-unused-vars": "off", + "@typescript-eslint/no-unused-vars": "error" + } +} diff --git a/libs/remix-ui/drag-n-drop/package.json b/libs/remix-ui/drag-n-drop/package.json deleted file mode 100644 index 8813962570..0000000000 --- a/libs/remix-ui/drag-n-drop/package.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "name": "@remix-ui/drag-n-drop", - "version": "0.0.1" -} \ No newline at end of file diff --git a/libs/remix-ui/drag-n-drop/src/lib/remix-ui-drag-n-drop.module.css b/libs/remix-ui/drag-n-drop/src/lib/remix-ui-drag-n-drop.module.css deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/libs/remix-ui/drag-n-drop/src/lib/remix-ui-drag-n-drop.spec.tsx b/libs/remix-ui/drag-n-drop/src/lib/remix-ui-drag-n-drop.spec.tsx deleted file mode 100644 index 04dc71fa14..0000000000 --- a/libs/remix-ui/drag-n-drop/src/lib/remix-ui-drag-n-drop.spec.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import { render } from '@testing-library/react'; - -import RemixUiDragNDrop from './remix-ui-drag-n-drop'; - -describe('RemixUiDragNDrop', () => { - it('should render successfully', () => { - const { baseElement } = render(< RemixUiDragNDrop />); - expect(baseElement).toBeTruthy(); - }); -}); diff --git a/libs/remix-ui/workspace/src/lib/types/index.ts b/libs/remix-ui/workspace/src/lib/types/index.ts index b709dc5e58..bdb308587b 100644 --- a/libs/remix-ui/workspace/src/lib/types/index.ts +++ b/libs/remix-ui/workspace/src/lib/types/index.ts @@ -14,7 +14,7 @@ export interface JSONStandardInput { }; } export type MenuItems = action[] -export type WorkspaceTemplate = 'gist-template' | 'code-template' | 'remixDefault' | 'blank' | 'erc20' +export type WorkspaceTemplate = 'gist-template' | 'code-template' | 'remixDefault' | 'blank' | 'ozerc20' | 'zeroxErc20' | 'ozerc721' export interface WorkspaceProps { plugin: { setWorkspace: ({ name: string, isLocalhost: boolean }, setEvent: boolean) => void, diff --git a/nx.json b/nx.json index db4114c205..c38fc5aad7 100644 --- a/nx.json +++ b/nx.json @@ -208,5 +208,14 @@ "remix-ui-drag-n-drop": { "tags": [] } + }, + "targetDependencies": { + "build": [ + { + "target": "build", + "projects": "dependencies" + } + ] } + } \ No newline at end of file diff --git a/tsconfig.base.json b/tsconfig.base.json index 9174b23427..63f825d949 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -89,7 +89,8 @@ "libs/remix-ui/permission-handler/src/index.ts" ], "@remix-ui/file-decorators": ["libs/remix-ui/file-decorators/src/index.ts"], - "@remix-ui/tooltip-popup": ["libs/remix-ui/tooltip-popup/src/index.ts"] + "@remix-ui/tooltip-popup": ["libs/remix-ui/tooltip-popup/src/index.ts"], + "@remix-ui/drag-n-drop": ["libs/remix-ui/drag-n-drop/src/index.ts"] } }, "exclude": ["node_modules", "tmp"] From 2017db5736444ebe145b8bba2c680f75469d2e64 Mon Sep 17 00:00:00 2001 From: iamsethsamuel Date: Wed, 17 Aug 2022 16:02:28 +0100 Subject: [PATCH 19/21] | JSX.Element added --- libs/remix-ui/workspace/src/lib/contexts/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/remix-ui/workspace/src/lib/contexts/index.ts b/libs/remix-ui/workspace/src/lib/contexts/index.ts index 5d1aac73ed..2ba8b7394b 100644 --- a/libs/remix-ui/workspace/src/lib/contexts/index.ts +++ b/libs/remix-ui/workspace/src/lib/contexts/index.ts @@ -4,7 +4,7 @@ import { BrowserState } from '../reducers/workspace' export const FileSystemContext = createContext<{ fs: BrowserState, - modal:(title: string, message: string | JSX.Element, okLabel: string, okFn: () => void, cancelLabel?: string, cancelFn?: () => void) => void, + modal:(title: string | JSX.Element, message: string | JSX.Element, okLabel: string, okFn: () => void, cancelLabel?: string, cancelFn?: () => void) => void, dispatchInitWorkspace:() => Promise, dispatchFetchDirectory:(path: string) => Promise, dispatchAddInputField:(path: string, type: 'file' | 'folder') => Promise, From eb7848aab1fb1ea1eab9c56960f565ebab62595e Mon Sep 17 00:00:00 2001 From: iamsethsamuel Date: Fri, 19 Aug 2022 14:43:22 +0100 Subject: [PATCH 20/21] event removed --- libs/remix-ui/drag-n-drop/src/lib/remix-ui-drag-n-drop.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/remix-ui/drag-n-drop/src/lib/remix-ui-drag-n-drop.tsx b/libs/remix-ui/drag-n-drop/src/lib/remix-ui-drag-n-drop.tsx index 8046c1358c..39433bbe51 100644 --- a/libs/remix-ui/drag-n-drop/src/lib/remix-ui-drag-n-drop.tsx +++ b/libs/remix-ui/drag-n-drop/src/lib/remix-ui-drag-n-drop.tsx @@ -95,7 +95,7 @@ export const Draggable = (props: DraggableType) => { onDrop={(event) => { handleDrop(event); }} - onDragStart={(event) => { + onDragStart={() => { if (file) { handleDrag(); } From b0c45612ea9f18d47220026ee494ecd7f752f162 Mon Sep 17 00:00:00 2001 From: iamsethsamuel Date: Fri, 19 Aug 2022 15:05:19 +0100 Subject: [PATCH 21/21] add vyper --- apps/vyper/src/app/components/VyperResult.tsx | 6 +++--- .../filedecorationicons/file-decoration-warning-icon.tsx | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/vyper/src/app/components/VyperResult.tsx b/apps/vyper/src/app/components/VyperResult.tsx index f4d263b391..e58f901fea 100644 --- a/apps/vyper/src/app/components/VyperResult.tsx +++ b/apps/vyper/src/app/components/VyperResult.tsx @@ -28,8 +28,8 @@ function VyperResult({ output }: VyperResultProps) {

    No contract compiled yet.

    -
    ) @@ -38,7 +38,7 @@ function VyperResult({ output }: VyperResultProps) { return (
    -

    {output.message}

    +
    {output.message}
    ) } diff --git a/libs/remix-ui/file-decorators/src/lib/components/filedecorationicons/file-decoration-warning-icon.tsx b/libs/remix-ui/file-decorators/src/lib/components/filedecorationicons/file-decoration-warning-icon.tsx index 1c027c9854..9bfd368506 100644 --- a/libs/remix-ui/file-decorators/src/lib/components/filedecorationicons/file-decoration-warning-icon.tsx +++ b/libs/remix-ui/file-decorators/src/lib/components/filedecorationicons/file-decoration-warning-icon.tsx @@ -5,7 +5,7 @@ import { fileDecoration } from '../../types' const FileDecorationWarningIcon = (props: { fileDecoration: fileDecoration }) => { - return <>{props.fileDecoration.text} + return <>{props.fileDecoration.text} } export default FileDecorationWarningIcon \ No newline at end of file