diff --git a/frontend/src/components/Navbar.jsx b/frontend/src/components/Navbar.jsx index 8a3b73f..352804e 100644 --- a/frontend/src/components/Navbar.jsx +++ b/frontend/src/components/Navbar.jsx @@ -39,12 +39,13 @@ function DownloadButton({downloadFiles}) { /** * Upload button + * @param uploadFiles {function} * @returns {JSX.Element} * @constructor */ -function UploadButton() { +function UploadButton({uploadFiles}) { return ( - + + + + + ); +} \ No newline at end of file diff --git a/frontend/src/pages/Dashboard.jsx b/frontend/src/pages/Dashboard.jsx index 1f6b902..9ac0a0a 100644 --- a/frontend/src/pages/Dashboard.jsx +++ b/frontend/src/pages/Dashboard.jsx @@ -7,6 +7,7 @@ import Error from "../components/Error.jsx"; import Editor from "../components/Editor.jsx"; import ChildrenLoading from "../components/ChildrenLoading.jsx"; import DownloadLoading from "../components/DownloadLoading.jsx"; +import Uploader from "../components/Uploader.jsx"; export default function Dashboard() { // Store the default path @@ -28,6 +29,7 @@ export default function Dashboard() { const [files, setFiles] = useState([]); const [error, setError] = useState(null); const [editing, setEditing] = useState(""); + const [uploading, setUploading] = useState(false); const [childrenLoading, setChildrenLoading] = useState(false); const [downloadLoading, setDownloadLoading] = useState(false); const [contentLoading, setContentLoading] = useState(false); @@ -207,6 +209,10 @@ export default function Dashboard() { setError(null); } + /** + * Toggle editing of a file. + * @param path {string} + */ const toggleEditing = (path) => { setEditing(path); }; @@ -238,7 +244,6 @@ export default function Dashboard() { }); }; - /** * Handle the state for the content being modified in the text editor. */ @@ -282,11 +287,29 @@ export default function Dashboard() { setShowHidden(e.target.checked); }; + /** + * Toggle the upload modal. + * This can be used in the navbar and the close button! + */ + const toggleUploading = () => { + setUploading(!uploading); + }; + + /** + * This will be where the magic happens, where the files are upload + * @param files {object[]} + * TODO: Actually do something here... + */ + const upload = (files) => { + console.log(files); + }; + return (
- +
{downloadLoading && } + {uploading && } {error && } {(editing !== "" && !error) &&