diff --git a/web/src/App.js b/web/src/App.js index a51c6d0..89fe287 100644 --- a/web/src/App.js +++ b/web/src/App.js @@ -6,6 +6,7 @@ import SearchFiles from "./component/SearchFiles"; import SearchFolders from "./component/SearchFolders"; import FilesInFolder from "./component/FilesInFolder"; import Manage from "./component/Manage"; +import FileInfo from "./component/FileInfo"; import Share from "./component/Share"; import Login from "./component/Login"; import Register from "./component/Register"; @@ -81,6 +82,10 @@ function App() { path="/manage/tags/:id" element={} /> + } + /> } diff --git a/web/src/component/FileDialog.js b/web/src/component/FileDialog.js index d167fb5..c19838e 100644 --- a/web/src/component/FileDialog.js +++ b/web/src/component/FileDialog.js @@ -33,11 +33,11 @@ function FileDialog(props) { diff --git a/web/src/component/FileInfo.js b/web/src/component/FileInfo.js new file mode 100644 index 0000000..31c73cf --- /dev/null +++ b/web/src/component/FileInfo.js @@ -0,0 +1,75 @@ +import { useNavigate, useParams } from "react-router"; +import { useEffect, useState } from "react"; + +function FileInfo(props) { + let navigate = useNavigate(); + let params = useParams(); + const [file, setFile] = useState({ + id: "", + folder_id: "", + foldername: "", + filename: "", + filesize: "", + }); + + function refresh() { + fetch(`/api/v1/get_file_info`, { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify({ + id: parseInt(params.id), + }), + }) + .then((res) => res.json()) + .then((data) => { + if (data.error) { + alert(data.error); + } else { + setFile(data); + } + }); + } + + useEffect(() => { + refresh(); + }, []); + + return ( +
+

File Details

+
+ + + +
+
+ + { + navigate(`/folders/${file.folder_id}`); + }} + readOnly + /> + + + + +
+
+ ); +} + +export default FileInfo;