File tree Expand file tree Collapse file tree 4 files changed +67
-86
lines changed
packages/app/src/app/pages/Sandbox/Editor/Workspace Expand file tree Collapse file tree 4 files changed +67
-86
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ import { getModulePath } from '@codesandbox/common/lib/sandbox/modules' ;
2+ import { useOvermind } from 'app/overmind' ;
3+ import React from 'react' ;
4+
5+ import EditIcons from './DirectoryEntry/Entry/EditIcons' ;
6+ import DirectoryEntry from './DirectoryEntry/index' ;
7+
8+ interface IFilesProps {
9+ setEditActions : React . Dispatch < any > ;
10+ }
11+
12+ export const Files : React . FC < IFilesProps > = ( { setEditActions } ) => {
13+ const {
14+ state : {
15+ editor : { currentSandbox : sandbox } ,
16+ isLoggedIn,
17+ } ,
18+ actions : {
19+ editor : {
20+ createZipClicked,
21+ }
22+ } ,
23+ } = useOvermind ( ) ;
24+
25+ const _getModulePath = moduleId => {
26+ try {
27+ return getModulePath ( sandbox . modules , sandbox . directories , moduleId ) ;
28+ } catch ( e ) {
29+ return '' ;
30+ }
31+ } ;
32+
33+ return (
34+ < DirectoryEntry
35+ root
36+ getModulePath = { _getModulePath }
37+ title = { sandbox . title || 'Project' }
38+ initializeProperties = { ( {
39+ onCreateModuleClick,
40+ onCreateDirectoryClick,
41+ onUploadFileClick,
42+ } ) => {
43+ if ( setEditActions ) {
44+ setEditActions (
45+ < EditIcons
46+ hovering
47+ forceShow = { window . __isTouch }
48+ onCreateFile = { onCreateModuleClick }
49+ onCreateDirectory = { onCreateDirectoryClick }
50+ onDownload = { createZipClicked }
51+ onUploadFile = {
52+ isLoggedIn && sandbox . privacy === 0
53+ ? onUploadFileClick
54+ : undefined
55+ }
56+ />
57+ ) ;
58+ }
59+ } }
60+ depth = { - 1 }
61+ id = { null }
62+ shortid = { null }
63+ />
64+ ) ;
65+ } ;
Original file line number Diff line number Diff line change 11import React , { useState } from 'react' ;
22
33import { useOvermind } from 'app/overmind' ;
4- import Files from '../../Files' ;
4+ import { Files } from '../../Files' ;
55import { Dependencies } from '../../Dependencies' ;
66import { WorkspaceItem } from '../../WorkspaceItem' ;
77import { ItemTitle } from '../../elements' ;
Original file line number Diff line number Diff line change 11import React , { useState } from 'react' ;
22import { useOvermind } from 'app/overmind' ;
33import { Dependencies } from '../../Dependencies' ;
4- import Files from '../../Files' ;
4+ import { Files } from '../../Files' ;
55import { Project } from '../../Project' ;
66import { WorkspaceItem } from '../../WorkspaceItem' ;
77
You can’t perform that action at this time.
0 commit comments