Skip to content

Commit d665449

Browse files
committed
Revert "Open folder on drag over it / Ignore thumbnail cache files (codesandbox#2951)"
This reverts commit d7823e6.
1 parent 7b6385e commit d665449

File tree

11 files changed

+461
-517
lines changed

11 files changed

+461
-517
lines changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,5 +251,4 @@ Thanks goes to these wonderful people
251251

252252
<!-- markdownlint-enable -->
253253
<!-- prettier-ignore-end -->
254-
255254
<!-- ALL-CONTRIBUTORS-LIST:END -->

packages/app/src/app/overmind/namespaces/files/actions.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ export const deletedUploadedFile: AsyncAction<{
402402
});
403403

404404
export const filesUploaded: AsyncAction<{
405-
files: { [k: string]: { dataURI: string; type: string } };
405+
files: any[];
406406
directoryShortid: string;
407407
}> = withOwnedSandbox(
408408
async ({ state, effects, actions }, { files, directoryShortid }) => {
@@ -420,7 +420,7 @@ export const filesUploaded: AsyncAction<{
420420
}
421421
);
422422

423-
await actions.files.massCreateModules({
423+
actions.files.massCreateModules({
424424
modules,
425425
directories,
426426
directoryShortid,

packages/app/src/app/overmind/namespaces/files/internalActions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export const recoverFiles: Action = ({ effects, actions, state }) => {
6060

6161
export const uploadFiles: AsyncAction<
6262
{
63-
files: { [k: string]: { dataURI: string; type: string } };
63+
files: any[];
6464
directoryShortid: string;
6565
},
6666
{

packages/app/src/app/pages/Sandbox/Editor/Workspace/Files/DirectoryEntry/DirectoryChildren/ModuleEntry.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Directory, Module } from '@codesandbox/common/lib/types';
1+
import { Module, Directory } from '@codesandbox/common/lib/types';
22
import { useOvermind } from 'app/overmind';
33
// eslint-disable-next-line import/extensions
44
import getType from 'app/utils/get-type.ts';
@@ -8,18 +8,18 @@ import Entry from '../Entry';
88

99
interface IModuleEntryProps {
1010
module: Module;
11-
setCurrentModule?: (id: string) => void;
12-
markTabsNotDirty?: () => void;
13-
depth?: number;
14-
renameModule?: (title: string, moduleShortid: string) => void;
15-
deleteEntry?: (shortid: string, title: string) => void;
16-
discardModuleChanges?: (shortid: string, title: string) => void;
17-
getModulePath?: (
11+
setCurrentModule: (id: string) => void;
12+
markTabsNotDirty: () => void;
13+
depth: number;
14+
renameModule: (title: string, moduleShortid: string) => void;
15+
deleteEntry: (shortid: string, title: string) => void;
16+
discardModuleChanges: (shortid: string) => void;
17+
getModulePath: (
1818
modules: Module[],
1919
directories: Directory[],
2020
id: string
2121
) => string;
22-
renameValidator?: (id: string, title: string) => string | false | null;
22+
renameValidator: (id: string, title: string) => string | false | null;
2323
}
2424

2525
const ModuleEntry: React.FC<IModuleEntryProps> = ({

packages/app/src/app/pages/Sandbox/Editor/Workspace/Files/DirectoryEntry/DirectoryChildren/index.tsx

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,26 @@
11
import { HIDDEN_DIRECTORIES } from '@codesandbox/common/lib/templates/constants/files';
2-
import { Directory, Module } from '@codesandbox/common/lib/types';
2+
import { Module, Directory } from '@codesandbox/common/lib/types';
33
import { useOvermind } from 'app/overmind';
44
import { sortBy } from 'lodash-es';
55
import * as React from 'react';
6-
7-
import ModuleEntry from './ModuleEntry';
86
import DirectoryEntry from '..';
7+
import ModuleEntry from './ModuleEntry';
98

109
interface IDirectoryChildrenProps {
11-
depth?: number;
12-
renameModule?: (title: string, moduleShortid: string) => void;
13-
setCurrentModule?: (id: string) => void;
14-
parentShortid?: string;
15-
deleteEntry?: (shortid: string, title: string) => void;
16-
isInProjectView?: boolean;
17-
markTabsNotDirty?: () => void;
18-
discardModuleChanges: (moduleShortid: string, moduleName: string) => void;
19-
getModulePath?: (
10+
depth: number;
11+
renameModule: (title: string, moduleShortid: string) => void;
12+
setCurrentModule: (id: string) => void;
13+
parentShortid: string;
14+
deleteEntry: (shortid: string, title: string) => void;
15+
isInProjectView: boolean;
16+
markTabsNotDirty: () => void;
17+
discardModuleChanges: (shortid: string) => void;
18+
getModulePath: (
2019
modules: Module[],
2120
directories: Directory[],
2221
id: string
2322
) => string;
24-
renameValidator?: (id: string, title: string) => string | false | null;
23+
renameValidator: (id: string, title: string) => string | false | null;
2524
}
2625

2726
const DirectoryChildren: React.FC<IDirectoryChildrenProps> = ({
@@ -37,10 +36,10 @@ const DirectoryChildren: React.FC<IDirectoryChildrenProps> = ({
3736
renameValidator,
3837
}) => {
3938
const {
40-
state: {
41-
editor: { currentSandbox, mainModule, currentModuleShortid },
42-
},
39+
state: { isLoggedIn, editor: editorState },
40+
actions: { files, editor },
4341
} = useOvermind();
42+
const { currentSandbox, mainModule, currentModuleShortid } = editorState;
4443

4544
const {
4645
id: sandboxId,
@@ -64,6 +63,8 @@ const DirectoryChildren: React.FC<IDirectoryChildrenProps> = ({
6463
key={dir.id}
6564
siblings={[...directories, ...modules]}
6665
depth={depth + 1}
66+
signals={{ files, editor }}
67+
store={{ editor: editorState, isLoggedIn }}
6768
id={dir.id}
6869
shortid={dir.shortid}
6970
title={dir.title}

packages/app/src/app/pages/Sandbox/Editor/Workspace/Files/DirectoryEntry/Entry/index.tsx

Lines changed: 21 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import theme from '@codesandbox/common/lib/theme';
2-
import { Directory, Module } from '@codesandbox/common/lib/types';
32
import { ContextMenu, Item } from 'app/components/ContextMenu';
3+
import { Module, Directory } from '@codesandbox/common/lib/types';
44
import React, { useState } from 'react';
55
import { DragSource } from 'react-dnd';
66
import EditIcon from 'react-icons/lib/go/pencil';
@@ -18,37 +18,33 @@ import EntryTitle from './EntryTitle';
1818
import { EntryTitleInput } from './EntryTitleInput';
1919

2020
interface IEntryProps {
21-
renameValidator?: (id: string, title: string) => string | false | null;
22-
shortid?: string;
21+
renameValidator: (id: string, title: string) => string | false | null;
22+
shortid: string;
2323
id: string;
24-
title?: string;
24+
title: string;
2525
rename?: (shortid: string, title: string) => void;
26-
deleteEntry?: (shortid: string, title: string) => void;
27-
depth?: number;
28-
root?: boolean;
29-
isOpen?: boolean;
30-
hasChildren?: boolean;
31-
closeTree?: () => void;
32-
type?: string;
33-
active?: boolean;
34-
discardModuleChanges?: (shortid: string, title: string) => void;
35-
setCurrentModule?: (id: string) => void;
36-
connectDragSource?: (node: JSX.Element) => JSX.Element;
37-
onCreateDirectoryClick?: () => boolean | void;
38-
onCreateModuleClick?: () => boolean | void;
39-
onUploadFileClick?: () => boolean | void;
40-
onClick?: () => void;
41-
markTabsNotDirty?: () => void;
26+
deleteEntry: (shortid: string, title: string) => void;
27+
depth: number;
28+
type: string;
29+
active: boolean;
30+
discardModuleChanges: (shortid: string, title: string) => void;
31+
setCurrentModule: (id: string) => void;
32+
connectDragSource: (node: JSX.Element) => JSX.Element;
33+
onCreateDirectoryClick: () => boolean | void;
34+
onCreateModuleClick: () => boolean | void;
35+
onUploadFileClick: () => boolean | void;
36+
onClick: () => void;
37+
markTabsNotDirty: () => void;
4238
onRenameCancel?: () => void;
43-
getModulePath?: (
39+
getModulePath: (
4440
modules: Module[],
4541
directories: Directory[],
4642
id: string
4743
) => string;
48-
isNotSynced?: boolean;
49-
isMainModule?: boolean;
50-
moduleHasError?: boolean;
51-
rightColors?: string[];
44+
isNotSynced: boolean;
45+
isMainModule: boolean;
46+
moduleHasError: boolean;
47+
rightColors: string[];
5248
state?: string;
5349
}
5450

packages/app/src/app/pages/Sandbox/Editor/Workspace/Files/DirectoryEntry/elements.tsx renamed to packages/app/src/app/pages/Sandbox/Editor/Workspace/Files/DirectoryEntry/elements.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export const EntryContainer = styled.div`
44
position: relative;
55
`;
66

7-
export const Overlay = styled.div<{ isOver: boolean }>`
7+
export const Overlay = styled.div`
88
position: absolute;
99
top: 0;
1010
bottom: 0;
@@ -14,7 +14,7 @@ export const Overlay = styled.div<{ isOver: boolean }>`
1414
display: ${props => (props.isOver ? 'block' : 'none')};
1515
`;
1616

17-
export const Opener = styled.div<{ open: boolean }>`
17+
export const Opener = styled.div`
1818
height: ${props => (props.open ? '100%' : '0px')};
1919
overflow: hidden;
2020
`;

0 commit comments

Comments
 (0)