Skip to content

Commit d0598e2

Browse files
committed
add props, make icons visible.
1 parent 2c28bbf commit d0598e2

File tree

6 files changed

+76
-64
lines changed

6 files changed

+76
-64
lines changed

libs/remix-ui/workspace/src/lib/components/file-explorer-hovericons.tsx

Lines changed: 50 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -17,82 +17,82 @@ export function FileHoverIcons(props: FileHoverIconsProps) {
1717

1818
return (
1919
<>
20-
{(props.hover && !props.isEditable) && <div className={`d-flex flex-row align-items-center`} style={{ marginLeft: '6rem' }}>
20+
{(!props.hover && !props.isEditable) && <div className="d-flex flex-row align-items-center" style={{ marginLeft: '6rem' }}>
2121
{
2222
props.file.isDirectory ? (
2323
<>
24-
<CustomTooltip
24+
{/* <CustomTooltip
2525
placement="right-start"
2626
delay={{show: 1000, hide: 0}}
2727
tooltipText={<FormattedMessage id="filePanel.edit" />}
2828
tooltipId={`filePanel.edit.${props.file.path}`}
2929
tooltipClasses="text-nowrap"
30-
>
31-
<span
32-
className="far fa-folder fa-1x remixui_icons_space remixui_icons"
33-
onClick={async (e) => {
34-
e.stopPropagation()
35-
console.log(props)
36-
await props.handleNewFolderOp(props.file.path)
37-
console.log('clicked on folder icon')
38-
}}
39-
></span>
40-
</CustomTooltip>
41-
<CustomTooltip
30+
> */}
31+
<span
32+
className="far fa-folder fa-1x remixui_icons_space remixui_icons"
33+
onClick={async (e) => {
34+
e.stopPropagation()
35+
console.log(props)
36+
await props.handleNewFolderOp(props.file.path)
37+
console.log('clicked on folder icon')
38+
}}
39+
></span>
40+
{/* </CustomTooltip> */}
41+
{/* <CustomTooltip
4242
placement="right-start"
4343
delay={{show: 1000, hide: 0}}
4444
tooltipText={<FormattedMessage id="fileExplorer.edit" />}
4545
tooltipId={`fileExplorer.edit.${props.file.path}`}
4646
tooltipClasses="text-nowrap"
47-
>
48-
<span
49-
className="far fa-file fa-1x remixui_icons remixui_icons_space"
50-
onClick={async (e) => {
51-
e.stopPropagation()
52-
await props.handleNewFileOp(props.file.path)
53-
console.log('clicked on file icon')
54-
}}
55-
></span>
56-
</CustomTooltip>
47+
> */}
48+
<span
49+
className="far fa-file fa-1x remixui_icons remixui_icons_space"
50+
onClick={async (e) => {
51+
e.stopPropagation()
52+
await props.handleNewFileOp(props.file.path)
53+
console.log('clicked on file icon')
54+
}}
55+
></span>
56+
{/* </CustomTooltip> */}
5757
</>
5858
) : null
5959
}
60-
<CustomTooltip
60+
{/* <CustomTooltip
6161
placement="right-start"
6262
delay={{show: 1000, hide: 0}}
6363
tooltipText={<FormattedMessage id="fileExplorer.edit" />}
6464
tooltipId={`fileExplorer.edit.${props.file.path}`}
6565
tooltipClasses="text-nowrap"
66-
>
67-
<span
68-
className="far fa-pen fa-1x remixui_icons remixui_icons_space"
69-
onClick={async (e) => {
70-
e.stopPropagation()
71-
console.log(props)
72-
console.log(e)
73-
await props.renamePathOp(props.file.path, props.file.type)
74-
console.log('clicked on edit icon')
75-
}}
76-
></span>
77-
</CustomTooltip>
78-
<CustomTooltip
66+
> */}
67+
<span
68+
className="far fa-pen fa-1x remixui_icons remixui_icons_space"
69+
onClick={async (e) => {
70+
e.stopPropagation()
71+
console.log(props)
72+
console.log(e)
73+
await props.renamePathOp(props.file.path, props.file.type)
74+
console.log('clicked on edit icon')
75+
}}
76+
></span>
77+
{/* </CustomTooltip> */}
78+
{/* <CustomTooltip
7979
placement="right-start"
8080
delay={{show: 1000, hide: 0}}
8181
tooltipText={<FormattedMessage id="fileExplorer.edit" />}
8282
tooltipId={`fileExplorer.edit.${props.file.path}`}
8383
tooltipClasses="text-nowrap"
84-
>
85-
<span
86-
className="far fa-trash fa-1x remixui_icons remixui_icons_space"
87-
onClick={async (e) => {
88-
e.stopPropagation()
89-
console.log(props)
90-
console.log(e)
91-
console.log('clicked on trash icon')
92-
await props.deletePathOp(props.file.path)
93-
}}
94-
></span>
95-
</CustomTooltip>
84+
> */}
85+
<span
86+
className="far fa-trash fa-1x remixui_icons remixui_icons_space"
87+
onClick={async (e) => {
88+
e.stopPropagation()
89+
console.log(props)
90+
console.log(e)
91+
console.log('clicked on trash icon')
92+
await props.deletePathOp(props.file.path)
93+
}}
94+
></span>
95+
{/* </CustomTooltip> */}
9696
</div>
9797
}
9898
</>

libs/remix-ui/workspace/src/lib/components/file-explorer.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useEffect, useState, useRef, SyntheticEvent, useTransition } from 'react' // eslint-disable-line
1+
import React, { useEffect, useState, useRef, SyntheticEvent } from 'react' // eslint-disable-line
22
import { useIntl } from 'react-intl'
33
import { TreeView } from '@remix-ui/tree-view' // eslint-disable-line
44
import { FileExplorerMenu } from './file-explorer-menu' // eslint-disable-line
@@ -27,12 +27,13 @@ export const FileExplorer = (props: FileExplorerProps) => {
2727
handleContextMenu,
2828
handleNewFileInput,
2929
handleNewFolderInput,
30+
deletePath,
3031
uploadFile,
3132
uploadFolder,
3233
fileState
3334
} = props
3435
const [state, setState] = useState<WorkSpaceState>(workspaceState)
35-
const [isPending, startTransition] = useTransition();
36+
// const [isPending, startTransition] = useTransition();
3637
const treeRef = useRef<HTMLDivElement>(null)
3738

3839
useEffect(() => {
@@ -404,6 +405,8 @@ export const FileExplorer = (props: FileExplorerProps) => {
404405
moveFile={handleFileMove}
405406
moveFolder={handleFolderMove}
406407
handleClickFolder={handleClickFolder}
408+
createNewFile={handleNewFileInput}
409+
createNewFolder={handleNewFolderInput}
407410
/>
408411
</div>
409412
</div>

libs/remix-ui/workspace/src/lib/components/flat-tree-drop.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { SyntheticEvent, startTransition, useEffect, useRef, useState } from 'react'
1+
import React, { SyntheticEvent, useEffect, useRef, useState } from 'react'
22
import { FileType } from '../types'
33
import { getEventTarget } from '../utils/getEventTarget'
44
import { extractParentFromKey } from '@remix-ui/helper'
@@ -36,7 +36,7 @@ export const FlatTreeDrop = (props: FlatTreeDropProps) => {
3636
setFolderToOpen(null)
3737
}
3838
if (dragDestination && dragDestination.isDirectory && !expandPath.includes(dragDestination.path) && folderToOpen !== dragDestination.path && props.handleClickFolder) {
39-
39+
4040
setFolderToOpen(dragDestination.path)
4141
timer && clearTimeout(timer)
4242
setTimer(
@@ -84,4 +84,4 @@ export const FlatTreeDrop = (props: FlatTreeDropProps) => {
8484
onDrop={onDrop} onDragOver={onDragOver}
8585
className="d-flex h-100"
8686
>{props.children}</div>)
87-
}
87+
}

libs/remix-ui/workspace/src/lib/components/flat-tree.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { FlatTreeDrop } from './flat-tree-drop';
88
import { getEventTarget } from '../utils/getEventTarget';
99
import { fileDecoration, FileDecorationIcons } from '@remix-ui/file-decorators';
1010
import { FileHoverIcons } from './file-explorer-hovericons';
11+
import { deletePath } from '../actions';
1112

1213
export default function useOnScreen(ref: RefObject<HTMLElement>) {
1314

@@ -37,6 +38,10 @@ interface FlatTreeProps {
3738
moveFile: (dest: string, src: string) => void
3839
moveFolder: (dest: string, src: string) => void
3940
fileState: fileDecoration[]
41+
createNewFile?: any
42+
createNewFolder?: any
43+
deletePath?: (path: string | string[]) => void | Promise<void>
44+
renamePath?: (path: string, newName: string) => void | Promise<void>
4045
}
4146

4247
let mouseTimer: any = {
@@ -45,7 +50,7 @@ let mouseTimer: any = {
4550
}
4651

4752
export const FlatTree = (props: FlatTreeProps) => {
48-
const { files, flatTree, expandPath, focusEdit, editModeOff, handleTreeClick, moveFile, moveFolder, fileState, focusElement, handleClickFolder } = props
53+
const { files, flatTree, expandPath, focusEdit, editModeOff, handleTreeClick, moveFile, moveFolder, fileState, focusElement, handleClickFolder, deletePath, renamePath } = props
4954
const [hover, setHover] = useState<string>('')
5055
const [mouseOverTarget, setMouseOverTarget] = useState<{
5156
path: string,
@@ -211,7 +216,9 @@ export const FlatTree = (props: FlatTreeProps) => {
211216

212217
</div>
213218
<div className="d-flex flex-row gap-1">
214-
<div><FileHoverIcons file={file} /></div>{getFileStateIcons(file)}
219+
<div>
220+
<FileHoverIcons file={file} />
221+
</div> {getFileStateIcons(file)}
215222
</div>
216223
</>
217224
}

libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -796,7 +796,7 @@ export function Workspace() {
796796
</option>
797797
<option style={{fontSize: 'small'}} value="breakthroughLabsUniswapv4Hooks">
798798
{intl.formatMessage({id: 'filePanel.breakthroughLabsUniswapv4Hooks'})}
799-
</option>
799+
</option>
800800

801801
<option style={{fontSize: 'small'}} value="uniswapV4HookBookMultiSigSwapHook">
802802
{intl.formatMessage({id: 'filePanel.uniswapV4HookBookMultiSigSwapHook'})}
@@ -988,7 +988,7 @@ export function Workspace() {
988988
>
989989
<i onClick={() => saveSampleCodeWorkspace()} className="far fa-exclamation-triangle text-warning ml-2 align-self-center" aria-hidden="true"></i>
990990
</CustomTooltip>}
991-
</span>
991+
</span>
992992
</div>
993993
<div className='mx-2'>
994994
{(platform !== appPlatformTypes.desktop) ? (
@@ -1063,7 +1063,7 @@ export function Workspace() {
10631063
</div>
10641064
</header>
10651065
</div>
1066-
<ElectronMenu></ElectronMenu>
1066+
<ElectronMenu></ElectronMenu>
10671067
<div
10681068
className="h-100 remixui_fileExplorerTree"
10691069
onFocus={() => {
@@ -1077,7 +1077,7 @@ export function Workspace() {
10771077
</div>
10781078
)}
10791079
{!(global.fs.browser.isRequestingWorkspace || global.fs.browser.isRequestingCloning) && global.fs.mode === 'browser' && currentWorkspace !== NO_WORKSPACE && (
1080-
1080+
10811081
<FileExplorer
10821082
fileState={global.fs.browser.fileState}
10831083
name={currentWorkspace}
@@ -1130,7 +1130,7 @@ export function Workspace() {
11301130
handleNewFolderInput={handleNewFolderInput}
11311131
dragStatus={dragStatus}
11321132
/>
1133-
1133+
11341134
)}
11351135
{global.fs.localhost.isRequestingLocalhost && (
11361136
<div className="text-center py-5">
@@ -1188,6 +1188,7 @@ export function Workspace() {
11881188
editModeOn={editModeOn}
11891189
handleNewFileInput={handleNewFileInput}
11901190
handleNewFolderInput={handleNewFolderInput}
1191+
deletePath={deletePath}
11911192
dragStatus={dragStatus}
11921193
/>
11931194
)}
@@ -1199,11 +1200,11 @@ export function Workspace() {
11991200
<div className={`bg-light border-top ${selectedWorkspace.isGitRepo && currentBranch ? 'd-block' : 'd-none'}`} data-id="workspaceGitPanel">
12001201
<div className="d-flex justify-space-between p-1">
12011202
<div className="mr-auto text-uppercase text-dark pt-2 pl-2">GIT</div>
1202-
{selectedWorkspace.hasGitSubmodules?
1203+
{selectedWorkspace.hasGitSubmodules?
12031204
<div className="pt-1 mr-1">
12041205
{global.fs.browser.isRequestingCloning ? <div style={{ height: 30 }} className='btn btn-sm border text-muted small'><i className="fad fa-spinner fa-spin"></i> updating submodules</div> :
12051206
<div style={{ height: 30 }} onClick={updateSubModules} data-id='updatesubmodules' className='btn btn-sm border text-muted small'>update submodules</div>}
1206-
</div>
1207+
</div>
12071208
: null}
12081209
<div className="pt-1 mr-1" data-id="workspaceGitBranchesDropdown">
12091210
<Dropdown style={{height: 30, minWidth: 80}} onToggle={toggleBranches} show={showBranches} drop={'up'}>

libs/remix-ui/workspace/src/lib/types/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ export interface FileExplorerProps {
130130
toGist: (path?: string, type?: string) => void
131131
handleNewFileInput: (parentFolder?: string) => Promise<void>
132132
handleNewFolderInput: (parentFolder?: string) => Promise<void>
133+
deletePath?: (path: string[]) => Promise<void>
133134
dragStatus: (status: boolean) => void
134135
}
135136

0 commit comments

Comments
 (0)