[FEATURE] Drag & Drop Implimented
This commit is contained in:
parent
c9361e6771
commit
15aae89e6d
3 changed files with 308 additions and 718 deletions
954
package-lock.json
generated
954
package-lock.json
generated
File diff suppressed because it is too large
Load diff
11
package.json
11
package.json
|
@ -24,9 +24,9 @@
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@emotion/react": "^11.11.3",
|
"@emotion/react": "^11.11.3",
|
||||||
"@emotion/styled": "^11.11.0",
|
"@emotion/styled": "^11.11.0",
|
||||||
"@mui/icons-material": "^5.15.7",
|
"@mui/icons-material": "^5.15.9",
|
||||||
"@mui/material": "^5.15.7",
|
"@mui/material": "^5.15.9",
|
||||||
"@tanstack/react-query": "^5.18.1",
|
"@tanstack/react-query": "^5.20.1",
|
||||||
"@vitejs/plugin-react": "^4.2.1",
|
"@vitejs/plugin-react": "^4.2.1",
|
||||||
"chonky": "^2.3.2",
|
"chonky": "^2.3.2",
|
||||||
"chonky-icon-fontawesome": "^2.3.2",
|
"chonky-icon-fontawesome": "^2.3.2",
|
||||||
|
@ -39,11 +39,11 @@
|
||||||
"react-router-dom": "^6.22.0",
|
"react-router-dom": "^6.22.0",
|
||||||
"react-toastify": "^10.0.4",
|
"react-toastify": "^10.0.4",
|
||||||
"socket.io-client": "^4.7.4",
|
"socket.io-client": "^4.7.4",
|
||||||
"vite": "^5.0.12"
|
"vite": "^5.1.1"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@kubernetes/client-node": "^0.20.0",
|
"@kubernetes/client-node": "^0.20.0",
|
||||||
"aws-sdk": "^2.1550.0",
|
"aws-sdk": "^2.1555.0",
|
||||||
"basic-ftp": "^5.0.4",
|
"basic-ftp": "^5.0.4",
|
||||||
"bcrypt": "^5.1.1",
|
"bcrypt": "^5.1.1",
|
||||||
"chalk": "^5.3.0",
|
"chalk": "^5.3.0",
|
||||||
|
@ -57,6 +57,7 @@
|
||||||
"pg-promise": "^11.5.4",
|
"pg-promise": "^11.5.4",
|
||||||
"postgres-migrations": "^5.3.0",
|
"postgres-migrations": "^5.3.0",
|
||||||
"rcon-client": "^4.2.4",
|
"rcon-client": "^4.2.4",
|
||||||
|
"react-dropzone": "^14.2.3",
|
||||||
"socket.io": "^4.7.4",
|
"socket.io": "^4.7.4",
|
||||||
"uuid": "^9.0.1"
|
"uuid": "^9.0.1"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import { useState, useEffect, useMemo, useRef } from "react";
|
import { useState, useEffect, useMemo, useRef } from "react";
|
||||||
import Box from "@mui/material/Box";
|
import Box from "@mui/material/Box";
|
||||||
import { DndProvider } from "react-dnd";
|
import Dropzone from "react-dropzone";
|
||||||
import { HTML5Backend } from "react-dnd-html5-backend";
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
FileBrowser,
|
FileBrowser,
|
||||||
|
@ -101,6 +100,10 @@ export default function MineclusterFiles(props) {
|
||||||
function uploadFileSelection(e) {
|
function uploadFileSelection(e) {
|
||||||
if (!e.target.files || e.target.files.length === 0) return;
|
if (!e.target.files || e.target.files.length === 0) return;
|
||||||
const { files } = e.target;
|
const { files } = e.target;
|
||||||
|
uploadMultipleFiles(files);
|
||||||
|
}
|
||||||
|
|
||||||
|
function uploadMultipleFiles(files) {
|
||||||
Promise.all([...files].map((f) => uploadFile(f)))
|
Promise.all([...files].map((f) => uploadFile(f)))
|
||||||
.catch((e) => console.log("Error uploading a file", e))
|
.catch((e) => console.log("Error uploading a file", e))
|
||||||
.then(updateFiles);
|
.then(updateFiles);
|
||||||
|
@ -158,29 +161,37 @@ export default function MineclusterFiles(props) {
|
||||||
if (clickEvent !== "open_files") return; // console.log(clickEvent);
|
if (clickEvent !== "open_files") return; // console.log(clickEvent);
|
||||||
openItem(payload);
|
openItem(payload);
|
||||||
}
|
}
|
||||||
return (
|
|
||||||
<Box className="minecluster-files" sx={{ height: "calc(100vh - 6rem)" }}>
|
|
||||||
<input
|
|
||||||
type="file"
|
|
||||||
id="file"
|
|
||||||
ref={inputRef}
|
|
||||||
style={{ display: "none" }}
|
|
||||||
onChange={uploadFileSelection}
|
|
||||||
multiple
|
|
||||||
/>
|
|
||||||
<FileBrowser
|
|
||||||
files={files}
|
|
||||||
folderChain={getFolderChain()}
|
|
||||||
onFileAction={fileClick}
|
|
||||||
fileActions={fileActions}
|
|
||||||
darkMode={true}
|
|
||||||
>
|
|
||||||
<FileNavbar />
|
|
||||||
<FileToolbar />
|
|
||||||
|
|
||||||
<FileList />
|
return (
|
||||||
<FileContextMenu />
|
<Dropzone onDrop={uploadMultipleFiles}>
|
||||||
</FileBrowser>
|
{({ getRootProps }) => (
|
||||||
</Box>
|
<Box
|
||||||
|
className="minecluster-files"
|
||||||
|
sx={{ height: "calc(100vh - 6rem)" }}
|
||||||
|
onDrop={getRootProps().onDrop}
|
||||||
|
>
|
||||||
|
<input
|
||||||
|
type="file"
|
||||||
|
id="file"
|
||||||
|
ref={inputRef}
|
||||||
|
style={{ display: "none" }}
|
||||||
|
onChange={uploadFileSelection}
|
||||||
|
multiple
|
||||||
|
/>
|
||||||
|
<FileBrowser
|
||||||
|
files={files}
|
||||||
|
folderChain={getFolderChain()}
|
||||||
|
onFileAction={fileClick}
|
||||||
|
fileActions={fileActions}
|
||||||
|
darkMode={true}
|
||||||
|
>
|
||||||
|
<FileNavbar />
|
||||||
|
<FileToolbar />
|
||||||
|
<FileList />
|
||||||
|
<FileContextMenu />
|
||||||
|
</FileBrowser>
|
||||||
|
</Box>
|
||||||
|
)}
|
||||||
|
</Dropzone>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue