Skip to content

Commit bf25d1c

Browse files
committed
Fix delete and custom submit
1 parent 132cca6 commit bf25d1c

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jderobot-ide-interface",
3-
"version": "0.1.52",
3+
"version": "0.1.53",
44
"main": "dist/main.js",
55
"typings": "dist/index.d.ts",
66
"files": [

src/components/Explorer/Explorer.tsx

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ const Explorer = ({
5555
const [deleteEntry, setDeleteEntry] = useState<Entry | undefined>(undefined);
5656
const [renameEntry, setRenameEntry] = useState<Entry | undefined>(undefined);
5757
const [selectedEntry, setSelectedEntry] = useState<Entry | undefined>(
58-
undefined,
58+
undefined
5959
);
6060
const [selectedLocation, setSelectedLocation] = useState("");
6161

@@ -156,10 +156,10 @@ const Explorer = ({
156156

157157
///////////////// DELETE FILES AND FOLDERS ///////////////////////////////////
158158

159-
const handleDeleteModal = (file: Entry, is_dir: boolean) => {
159+
const handleDeleteModal = (file: Entry) => {
160160
if (file) {
161161
setDeleteEntry(file);
162-
setDeleteType(is_dir);
162+
setDeleteType(file.is_dir);
163163
setDeleteModalOpen(true);
164164
} else {
165165
warning("No file is currently selected.");
@@ -175,7 +175,7 @@ const Explorer = ({
175175
const handleSubmitDeleteModal = async () => {
176176
//currentFile === Absolute File path
177177
if (deleteEntry) {
178-
console.log(deleteEntry)
178+
console.log(deleteEntry);
179179
try {
180180
if (deleteType) {
181181
await api.folder.delete(project, deleteEntry.path);
@@ -207,7 +207,7 @@ const Explorer = ({
207207
//currentFile === Absolute File path
208208
if (currentFile) {
209209
if (inFileList(fileList, currentFile)) {
210-
handleDeleteModal(currentFile, false);
210+
handleDeleteModal(currentFile);
211211
}
212212
} else {
213213
warning("No file is currently selected.");
@@ -232,7 +232,7 @@ const Explorer = ({
232232

233233
const handleCreateFolderSubmit = async (
234234
location: string,
235-
folder_name: string,
235+
folder_name: string
236236
) => {
237237
if (folder_name !== "") {
238238
try {
@@ -434,7 +434,10 @@ const Explorer = ({
434434
{api.modals?.createFile ? (
435435
<api.modals.createFile.component
436436
isOpen={isNewFileModalOpen}
437-
onSubmit={api.modals.createFile.onCreate}
437+
onSubmit={(project: string, location: string, ...args: any[]) => {
438+
api.modals!.createFile!.onCreate(project, location, ...args);
439+
fetchFileList();
440+
}}
438441
onClose={handleCloseNewFileModal}
439442
fileList={fileList}
440443
location={selectedLocation}

src/components/Explorer/file_explorer/MoreActionsMenu.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ function MoreActionsMenu({
8080
<StyledExplorerExtraMenuEntry
8181
hoverColor={theme.palette.secondary}
8282
onClick={() => {
83-
onDelete(menuProps.file!.path, menuProps.file!.is_dir);
83+
onDelete(menuProps.file);
8484
closeMenu();
8585
}}
8686
>

0 commit comments

Comments
 (0)