(FEAT): Mobile friendly and code cleanup!
Cleaned the formatting with Nvim and created mobile friendly styles.
This commit is contained in:
parent
79c438aa3a
commit
7a583ec1d6
@ -20,8 +20,8 @@ import Multer from "multer";
|
|||||||
const PORT = 5000;
|
const PORT = 5000;
|
||||||
const APP: Express = express();
|
const APP: Express = express();
|
||||||
// TODO: BACK TO NORMAL PATH
|
// TODO: BACK TO NORMAL PATH
|
||||||
const ROOT: string = "/media/vault";
|
// const ROOT: string = "/media/vault";
|
||||||
// const ROOT: string = "/home/azpect";
|
const ROOT: string = "/home/azpect";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configure the .env file, this is for testing only, should be ignored in production.
|
* Configure the .env file, this is for testing only, should be ignored in production.
|
||||||
|
|||||||
@ -6,12 +6,12 @@ import "../index.css"
|
|||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
export default function ChildrenLoading() {
|
export default function ChildrenLoading() {
|
||||||
return (
|
return <>
|
||||||
<div className="size-full flex items-center justify-center">
|
<div className="size-full flex items-center justify-center">
|
||||||
<div
|
<div
|
||||||
className="animate-spin rounded-full border-blue-500 border-3 border-t-transparent size-6 mx-2 ">
|
className="animate-spin rounded-full border-blue-500 border-3 border-t-transparent size-6 mx-2 ">
|
||||||
</div>
|
</div>
|
||||||
<p className="text-lg text-black opacity-90">Content loading...</p>
|
<p className="text-lg text-black opacity-90">Content loading...</p>
|
||||||
</div>
|
</div>
|
||||||
);
|
</>
|
||||||
};
|
};
|
||||||
@ -6,7 +6,7 @@ import "../index.css"
|
|||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
export default function ContentLoading() {
|
export default function ContentLoading() {
|
||||||
return (
|
return <>
|
||||||
<div className="h-9/10 w-full flex flex-col items-center justify-center">
|
<div className="h-9/10 w-full flex flex-col items-center justify-center">
|
||||||
<div className="flex">
|
<div className="flex">
|
||||||
<div
|
<div
|
||||||
@ -16,5 +16,5 @@ export default function ContentLoading() {
|
|||||||
</div>
|
</div>
|
||||||
<p className="text-xs text-gray-500 my-2">For large files, this may take a while.</p>
|
<p className="text-xs text-gray-500 my-2">For large files, this may take a while.</p>
|
||||||
</div>
|
</div>
|
||||||
);
|
</>
|
||||||
};
|
};
|
||||||
|
|||||||
@ -7,24 +7,23 @@ import {useState} from "react";
|
|||||||
export default function CreateDirectory({close, create}) {
|
export default function CreateDirectory({close, create}) {
|
||||||
const [dirName, setDirName] = useState("");
|
const [dirName, setDirName] = useState("");
|
||||||
|
|
||||||
const createDirectory = () => {
|
const createDirectory = () => create(dirName);
|
||||||
create(dirName);
|
const updateDirName = (e) => setDirName(e.target.value);
|
||||||
}
|
|
||||||
|
|
||||||
const updateDirName = (e) => {
|
|
||||||
setDirName(e.target.value);
|
|
||||||
}
|
|
||||||
|
|
||||||
const closeWithoutSaving = () => {
|
const closeWithoutSaving = () => {
|
||||||
setDirName("");
|
setDirName("");
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return <>
|
||||||
<div className="fixed inset-0 z-50 flex items-center justify-center">
|
<div className="fixed inset-0 z-50 flex items-center justify-center">
|
||||||
|
{/* Blured backdrop */}
|
||||||
<div className="fixed -inset-10 bg-black opacity-50 blur-lg"></div>
|
<div className="fixed -inset-10 bg-black opacity-50 blur-lg"></div>
|
||||||
<div className="relative z-50 bg-white p-8 rounded-lg shadow-lg w-2/5 border-1 border-gray-400">
|
|
||||||
<h2 className="text-2xl font-semibold mb-2 text-blue-400">Create a Directory</h2>
|
<div className="relative z-50 bg-white p-8 rounded-lg shadow-lg w-9/10 lg:w-2/5 border-1 border-gray-400">
|
||||||
|
<h2 className="text-2xl font-semibold mb-2 text-blue-400">
|
||||||
|
Create a Directory
|
||||||
|
</h2>
|
||||||
<p className="text-sm">
|
<p className="text-sm">
|
||||||
Create a file or directory in the current directory. To create a directory, include a <span
|
Create a file or directory in the current directory. To create a directory, include a <span
|
||||||
className="font-mono text-black bg-gray-300 p-1 rounded-md">/</span> at the end of the name.
|
className="font-mono text-black bg-gray-300 p-1 rounded-md">/</span> at the end of the name.
|
||||||
@ -51,5 +50,5 @@ export default function CreateDirectory({close, create}) {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
</>
|
||||||
}
|
}
|
||||||
@ -2,21 +2,25 @@ import "../index.css"
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
|
|
||||||
function FileIcon() {
|
function FileIcon() {
|
||||||
return <svg className="text-black h-5 mx-2" stroke="currentColor" viewBox="0 0 24 24" fill="none"
|
return <>
|
||||||
|
<svg className="text-black h-5 mx-2" stroke="currentColor" viewBox="0 0 24 24" fill="none"
|
||||||
xmlns="http://www.w3.org/2000/svg">
|
xmlns="http://www.w3.org/2000/svg">
|
||||||
<path
|
<path
|
||||||
d="M19 9V17.8C19 18.9201 19 19.4802 18.782 19.908C18.5903 20.2843 18.2843 20.5903 17.908 20.782C17.4802 21 16.9201 21 15.8 21H8.2C7.07989 21 6.51984 21 6.09202 20.782C5.71569 20.5903 5.40973 20.2843 5.21799 19.908C5 19.4802 5 18.9201 5 17.8V6.2C5 5.07989 5 4.51984 5.21799 4.09202C5.40973 3.71569 5.71569 3.40973 6.09202 3.21799C6.51984 3 7.0799 3 8.2 3H13M19 9L13 3M19 9H14C13.4477 9 13 8.55228 13 8V3"
|
d="M19 9V17.8C19 18.9201 19 19.4802 18.782 19.908C18.5903 20.2843 18.2843 20.5903 17.908 20.782C17.4802 21 16.9201 21 15.8 21H8.2C7.07989 21 6.51984 21 6.09202 20.782C5.71569 20.5903 5.40973 20.2843 5.21799 19.908C5 19.4802 5 18.9201 5 17.8V6.2C5 5.07989 5 4.51984 5.21799 4.09202C5.40973 3.71569 5.71569 3.40973 6.09202 3.21799C6.51984 3 7.0799 3 8.2 3H13M19 9L13 3M19 9H14C13.4477 9 13 8.55228 13 8V3"
|
||||||
strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" />
|
strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" />
|
||||||
</svg>
|
</svg>
|
||||||
|
</>
|
||||||
}
|
}
|
||||||
|
|
||||||
function DirectoryIcon() {
|
function DirectoryIcon() {
|
||||||
return <svg className="text-black h-5 mx-2" stroke="currentColor" viewBox="0 0 24 24" fill="none"
|
return <>
|
||||||
|
<svg className="text-black h-5 mx-2" stroke="currentColor" viewBox="0 0 24 24" fill="none"
|
||||||
xmlns="http://www.w3.org/2000/svg">
|
xmlns="http://www.w3.org/2000/svg">
|
||||||
<path
|
<path
|
||||||
d="M3 8.2C3 7.07989 3 6.51984 3.21799 6.09202C3.40973 5.71569 3.71569 5.40973 4.09202 5.21799C4.51984 5 5.0799 5 6.2 5H9.67452C10.1637 5 10.4083 5 10.6385 5.05526C10.8425 5.10425 11.0376 5.18506 11.2166 5.29472C11.4184 5.4184 11.5914 5.59135 11.9373 5.93726L12.0627 6.06274C12.4086 6.40865 12.5816 6.5816 12.7834 6.70528C12.9624 6.81494 13.1575 6.89575 13.3615 6.94474C13.5917 7 13.8363 7 14.3255 7H17.8C18.9201 7 19.4802 7 19.908 7.21799C20.2843 7.40973 20.5903 7.71569 20.782 8.09202C21 8.51984 21 9.0799 21 10.2V15.8C21 16.9201 21 17.4802 20.782 17.908C20.5903 18.2843 20.2843 18.5903 19.908 18.782C19.4802 19 18.9201 19 17.8 19H6.2C5.07989 19 4.51984 19 4.09202 18.782C3.71569 18.5903 3.40973 18.2843 3.21799 17.908C3 17.4802 3 16.9201 3 15.8V8.2Z"
|
d="M3 8.2C3 7.07989 3 6.51984 3.21799 6.09202C3.40973 5.71569 3.71569 5.40973 4.09202 5.21799C4.51984 5 5.0799 5 6.2 5H9.67452C10.1637 5 10.4083 5 10.6385 5.05526C10.8425 5.10425 11.0376 5.18506 11.2166 5.29472C11.4184 5.4184 11.5914 5.59135 11.9373 5.93726L12.0627 6.06274C12.4086 6.40865 12.5816 6.5816 12.7834 6.70528C12.9624 6.81494 13.1575 6.89575 13.3615 6.94474C13.5917 7 13.8363 7 14.3255 7H17.8C18.9201 7 19.4802 7 19.908 7.21799C20.2843 7.40973 20.5903 7.71569 20.782 8.09202C21 8.51984 21 9.0799 21 10.2V15.8C21 16.9201 21 17.4802 20.782 17.908C20.5903 18.2843 20.2843 18.5903 19.908 18.782C19.4802 19 18.9201 19 17.8 19H6.2C5.07989 19 4.51984 19 4.09202 18.782C3.71569 18.5903 3.40973 18.2843 3.21799 17.908C3 17.4802 3 16.9201 3 15.8V8.2Z"
|
||||||
strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" />
|
strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" />
|
||||||
</svg>
|
</svg>
|
||||||
|
</>
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -51,9 +55,12 @@ export default function Directory({entry, showHidden, appendPath, toggleSelected
|
|||||||
return <></>;
|
return <></>;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return <>
|
||||||
<label className={`w-full hover:bg-gray-300 flex ${selected ? "bg-blue-300" : "bg-gray-100"}`}>
|
<label className={`w-full hover:bg-gray-300 flex ${selected ? "bg-blue-300" : "bg-gray-100"}`}>
|
||||||
<input className="mx-2 peer checked:bg-blue-300" type="checkbox" checked={selected}
|
<input
|
||||||
|
className="mx-2 peer checked:bg-blue-300"
|
||||||
|
type="checkbox"
|
||||||
|
checked={selected}
|
||||||
onChange={handleCheck} />
|
onChange={handleCheck} />
|
||||||
<div className="w-full flex bg-gray-100 peer-checked:bg-blue-300 hover:bg-gray-300 peer-hover:bg-gray-300">
|
<div className="w-full flex bg-gray-100 peer-checked:bg-blue-300 hover:bg-gray-300 peer-hover:bg-gray-300">
|
||||||
<button className="flex items-center" onClick={handleClick}>
|
<button className="flex items-center" onClick={handleClick}>
|
||||||
@ -63,5 +70,5 @@ export default function Directory({entry, showHidden, appendPath, toggleSelected
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
</label>
|
</label>
|
||||||
);
|
</>
|
||||||
}
|
}
|
||||||
@ -9,12 +9,15 @@ import Directory from "./Directory.jsx";
|
|||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
export default function DirectoryList({ dirs, showHidden, appendPath, toggleSelected, toggleEditing }) {
|
export default function DirectoryList({ dirs, showHidden, appendPath, toggleSelected, toggleEditing }) {
|
||||||
return (
|
return <>
|
||||||
<>
|
{dirs.map((dir, idx) =>
|
||||||
{dirs.map((dir, idx) => <Directory key={idx} entry={dir} showHidden={showHidden} appendPath={appendPath}
|
<Directory
|
||||||
toggleSelected={toggleSelected} toggleEditing={toggleEditing}/>)}
|
key={idx}
|
||||||
|
entry={dir}
|
||||||
|
showHidden={showHidden}
|
||||||
|
appendPath={appendPath}
|
||||||
|
toggleSelected={toggleSelected}
|
||||||
|
toggleEditing={toggleEditing} />
|
||||||
|
)}
|
||||||
</>
|
</>
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -6,7 +6,7 @@ import "../index.css"
|
|||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
export default function DownloadLoading() {
|
export default function DownloadLoading() {
|
||||||
return (
|
return <>
|
||||||
<div className="absolute size-full flex items-center justify-center">
|
<div className="absolute size-full flex items-center justify-center">
|
||||||
<div className="fixed inset-0 bg-black opacity-25 blur-lg"></div>
|
<div className="fixed inset-0 bg-black opacity-25 blur-lg"></div>
|
||||||
<div
|
<div
|
||||||
@ -14,5 +14,5 @@ export default function DownloadLoading() {
|
|||||||
</div>
|
</div>
|
||||||
<p className="text-lg text-black opacity-90">Preparing files...</p>
|
<p className="text-lg text-black opacity-90">Preparing files...</p>
|
||||||
</div>
|
</div>
|
||||||
);
|
</>
|
||||||
};
|
};
|
||||||
|
|||||||
@ -9,9 +9,7 @@ export default function Editor({content, path, exit, saveExit, loading}) {
|
|||||||
*/
|
*/
|
||||||
const textareaRef = useRef(null);
|
const textareaRef = useRef(null);
|
||||||
|
|
||||||
const updateText = (event) => {
|
const updateText = (event) => setText(event.target.value);
|
||||||
setText(event.target.value);
|
|
||||||
};
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setText(content);
|
setText(content);
|
||||||
@ -45,16 +43,19 @@ export default function Editor({content, path, exit, saveExit, loading}) {
|
|||||||
* Call the parent function with the new content which is
|
* Call the parent function with the new content which is
|
||||||
* stored in the text state.
|
* stored in the text state.
|
||||||
*/
|
*/
|
||||||
const saveAndExit = () => {
|
const saveAndExit = () => saveExit(text);
|
||||||
saveExit(text);
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return <>
|
||||||
<div className="fixed inset-0 z-50 flex items-center justify-center">
|
<div className="fixed inset-0 z-50 flex items-center justify-center">
|
||||||
|
{/* Blured backdrop */}
|
||||||
<div className="fixed inset-0 bg-black opacity-50 blur-lg"></div>
|
<div className="fixed inset-0 bg-black opacity-50 blur-lg"></div>
|
||||||
<div className="relative z-10 bg-white p-8 rounded-lg shadow-lg w-3/4 h-5/6 border-1 border-gray-400">
|
|
||||||
<h2 className="text-lg font-semibold mb-4 text-blue-400">Editing File: <span
|
<div className="w-9/10 lg:w-3/4 h-5/6 relative z-10 bg-white p-4 lg:p-8 rounded-lg shadow-lg border-1 border-gray-400 flex flex-col">
|
||||||
className="font-mono text-black bg-gray-300 p-1 rounded-md">{path}</span></h2>
|
<h2 className="text-lg font-semibold mb-4 text-blue-400">
|
||||||
|
Editing File: <span className="font-mono text-black bg-gray-300 p-1 rounded-md">
|
||||||
|
{path}
|
||||||
|
</span>
|
||||||
|
</h2>
|
||||||
{loading && <ContentLoading />}
|
{loading && <ContentLoading />}
|
||||||
{loading ||
|
{loading ||
|
||||||
<textarea
|
<textarea
|
||||||
@ -63,10 +64,10 @@ export default function Editor({content, path, exit, saveExit, loading}) {
|
|||||||
ref={textareaRef}
|
ref={textareaRef}
|
||||||
onInput={updateText}
|
onInput={updateText}
|
||||||
value={text}
|
value={text}
|
||||||
className="border-1 border-gray-300 rounded-md w-full h-9/10 p-1 resize-none text-sm font-mono">
|
className="border-1 border-gray-300 rounded-md w-full flex-grow p-1 resize-none text-sm font-mono">
|
||||||
</textarea>
|
</textarea>
|
||||||
}
|
}
|
||||||
<div className="flex justify-end">
|
<div className="flex justify-end mt-4">
|
||||||
<button
|
<button
|
||||||
title="Exit without saving"
|
title="Exit without saving"
|
||||||
onClick={exit}
|
onClick={exit}
|
||||||
@ -82,5 +83,5 @@ export default function Editor({content, path, exit, saveExit, loading}) {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
</>
|
||||||
}
|
}
|
||||||
@ -8,7 +8,7 @@ import "../index.css";
|
|||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
export default function Error({error, clear}) {
|
export default function Error({error, clear}) {
|
||||||
return (
|
return <>
|
||||||
<div className="fixed inset-0 z-50 flex items-center justify-center">
|
<div className="fixed inset-0 z-50 flex items-center justify-center">
|
||||||
<div className="fixed inset-0 bg-black opacity-50 blur-lg"></div>
|
<div className="fixed inset-0 bg-black opacity-50 blur-lg"></div>
|
||||||
<div className="relative z-50 bg-white p-8 rounded-lg shadow-lg w-96 border-1 border-gray-400">
|
<div className="relative z-50 bg-white p-8 rounded-lg shadow-lg w-96 border-1 border-gray-400">
|
||||||
@ -24,5 +24,5 @@ export default function Error({error, clear}) {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
</>
|
||||||
}
|
}
|
||||||
@ -112,7 +112,8 @@ export default function LoginForm() {
|
|||||||
}, [loading]);
|
}, [loading]);
|
||||||
|
|
||||||
|
|
||||||
return <form onSubmit={handleSubmit} className="w-full flex flex-col items-center justify-center">
|
return <>
|
||||||
|
<form onSubmit={handleSubmit} className="w-full flex flex-col items-center justify-center">
|
||||||
<UserInput onChange={updateUsername} />
|
<UserInput onChange={updateUsername} />
|
||||||
<PasswordInput onChange={updatePassword} />
|
<PasswordInput onChange={updatePassword} />
|
||||||
<RememberMe onChange={updateRemember} />
|
<RememberMe onChange={updateRemember} />
|
||||||
@ -129,4 +130,5 @@ export default function LoginForm() {
|
|||||||
If you do not have an account, you're in the wrong place!
|
If you do not have an account, you're in the wrong place!
|
||||||
</p>
|
</p>
|
||||||
</form>
|
</form>
|
||||||
|
</>
|
||||||
};
|
};
|
||||||
@ -9,11 +9,13 @@ import {useNavigate} from "react-router-dom";
|
|||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
function MainIcon() {
|
function MainIcon() {
|
||||||
return <svg className="h-10" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
return <>
|
||||||
|
<svg className="h-8 lg:h-10" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
<path
|
<path
|
||||||
d="M12 9.5V15.5M12 9.5L10 11.5M12 9.5L14 11.5M8.4 19C5.41766 19 3 16.6044 3 13.6493C3 11.2001 4.8 8.9375 7.5 8.5C8.34694 6.48637 10.3514 5 12.6893 5C15.684 5 18.1317 7.32251 18.3 10.25C19.8893 10.9449 21 12.6503 21 14.4969C21 16.9839 18.9853 19 16.5 19L8.4 19Z"
|
d="M12 9.5V15.5M12 9.5L10 11.5M12 9.5L14 11.5M8.4 19C5.41766 19 3 16.6044 3 13.6493C3 11.2001 4.8 8.9375 7.5 8.5C8.34694 6.48637 10.3514 5 12.6893 5C15.684 5 18.1317 7.32251 18.3 10.25C19.8893 10.9449 21 12.6503 21 14.4969C21 16.9839 18.9853 19 16.5 19L8.4 19Z"
|
||||||
stroke="#000000" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" />
|
stroke="#000000" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" />
|
||||||
</svg>
|
</svg>
|
||||||
|
</>
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -23,7 +25,7 @@ function MainIcon() {
|
|||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
function DownloadButton({ downloadFiles }) {
|
function DownloadButton({ downloadFiles }) {
|
||||||
return (
|
return <>
|
||||||
<button className="text-black" title="Download files" onClick={downloadFiles}>
|
<button className="text-black" title="Download files" onClick={downloadFiles}>
|
||||||
<svg className="hover:bg-gray-300 mx-1 transition-colors duration-200 p-1.5 rounded-full h-8"
|
<svg className="hover:bg-gray-300 mx-1 transition-colors duration-200 p-1.5 rounded-full h-8"
|
||||||
viewBox="0 0 24 24" fill="currentColor"
|
viewBox="0 0 24 24" fill="currentColor"
|
||||||
@ -34,7 +36,7 @@ function DownloadButton({downloadFiles}) {
|
|||||||
d="M3.75 15C3.75 14.5858 3.41422 14.25 3 14.25C2.58579 14.25 2.25 14.5858 2.25 15V15.0549C2.24998 16.4225 2.24996 17.5248 2.36652 18.3918C2.48754 19.2919 2.74643 20.0497 3.34835 20.6516C3.95027 21.2536 4.70814 21.5125 5.60825 21.6335C6.47522 21.75 7.57754 21.75 8.94513 21.75H15.0549C16.4225 21.75 17.5248 21.75 18.3918 21.6335C19.2919 21.5125 20.0497 21.2536 20.6517 20.6516C21.2536 20.0497 21.5125 19.2919 21.6335 18.3918C21.75 17.5248 21.75 16.4225 21.75 15.0549V15C21.75 14.5858 21.4142 14.25 21 14.25C20.5858 14.25 20.25 14.5858 20.25 15C20.25 16.4354 20.2484 17.4365 20.1469 18.1919C20.0482 18.9257 19.8678 19.3142 19.591 19.591C19.3142 19.8678 18.9257 20.0482 18.1919 20.1469C17.4365 20.2484 16.4354 20.25 15 20.25H9C7.56459 20.25 6.56347 20.2484 5.80812 20.1469C5.07435 20.0482 4.68577 19.8678 4.40901 19.591C4.13225 19.3142 3.9518 18.9257 3.85315 18.1919C3.75159 17.4365 3.75 16.4354 3.75 15Z" />
|
d="M3.75 15C3.75 14.5858 3.41422 14.25 3 14.25C2.58579 14.25 2.25 14.5858 2.25 15V15.0549C2.24998 16.4225 2.24996 17.5248 2.36652 18.3918C2.48754 19.2919 2.74643 20.0497 3.34835 20.6516C3.95027 21.2536 4.70814 21.5125 5.60825 21.6335C6.47522 21.75 7.57754 21.75 8.94513 21.75H15.0549C16.4225 21.75 17.5248 21.75 18.3918 21.6335C19.2919 21.5125 20.0497 21.2536 20.6517 20.6516C21.2536 20.0497 21.5125 19.2919 21.6335 18.3918C21.75 17.5248 21.75 16.4225 21.75 15.0549V15C21.75 14.5858 21.4142 14.25 21 14.25C20.5858 14.25 20.25 14.5858 20.25 15C20.25 16.4354 20.2484 17.4365 20.1469 18.1919C20.0482 18.9257 19.8678 19.3142 19.591 19.591C19.3142 19.8678 18.9257 20.0482 18.1919 20.1469C17.4365 20.2484 16.4354 20.25 15 20.25H9C7.56459 20.25 6.56347 20.2484 5.80812 20.1469C5.07435 20.0482 4.68577 19.8678 4.40901 19.591C4.13225 19.3142 3.9518 18.9257 3.85315 18.1919C3.75159 17.4365 3.75 16.4354 3.75 15Z" />
|
||||||
</svg>
|
</svg>
|
||||||
</button>
|
</button>
|
||||||
)
|
</>
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -44,7 +46,7 @@ function DownloadButton({downloadFiles}) {
|
|||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
function UploadButton({ uploadFiles }) {
|
function UploadButton({ uploadFiles }) {
|
||||||
return (
|
return <>
|
||||||
<button className="text-black" title="Upload files" onClick={uploadFiles}>
|
<button className="text-black" title="Upload files" onClick={uploadFiles}>
|
||||||
<svg className="hover:bg-gray-300 mx-1 transition-colors duration-200 p-1.5 rounded-full font-semibold h-8"
|
<svg className="hover:bg-gray-300 mx-1 transition-colors duration-200 p-1.5 rounded-full font-semibold h-8"
|
||||||
viewBox="0 0 24 24" fill="currentColor"
|
viewBox="0 0 24 24" fill="currentColor"
|
||||||
@ -55,7 +57,7 @@ function UploadButton({uploadFiles}) {
|
|||||||
d="M3.75 15C3.75 14.5858 3.41422 14.25 3 14.25C2.58579 14.25 2.25 14.5858 2.25 15V15.0549C2.24998 16.4225 2.24996 17.5248 2.36652 18.3918C2.48754 19.2919 2.74643 20.0497 3.34835 20.6516C3.95027 21.2536 4.70814 21.5125 5.60825 21.6335C6.47522 21.75 7.57754 21.75 8.94513 21.75H15.0549C16.4225 21.75 17.5248 21.75 18.3918 21.6335C19.2919 21.5125 20.0497 21.2536 20.6517 20.6516C21.2536 20.0497 21.5125 19.2919 21.6335 18.3918C21.75 17.5248 21.75 16.4225 21.75 15.0549V15C21.75 14.5858 21.4142 14.25 21 14.25C20.5858 14.25 20.25 14.5858 20.25 15C20.25 16.4354 20.2484 17.4365 20.1469 18.1919C20.0482 18.9257 19.8678 19.3142 19.591 19.591C19.3142 19.8678 18.9257 20.0482 18.1919 20.1469C17.4365 20.2484 16.4354 20.25 15 20.25H9C7.56459 20.25 6.56347 20.2484 5.80812 20.1469C5.07435 20.0482 4.68577 19.8678 4.40901 19.591C4.13225 19.3142 3.9518 18.9257 3.85315 18.1919C3.75159 17.4365 3.75 16.4354 3.75 15Z" />
|
d="M3.75 15C3.75 14.5858 3.41422 14.25 3 14.25C2.58579 14.25 2.25 14.5858 2.25 15V15.0549C2.24998 16.4225 2.24996 17.5248 2.36652 18.3918C2.48754 19.2919 2.74643 20.0497 3.34835 20.6516C3.95027 21.2536 4.70814 21.5125 5.60825 21.6335C6.47522 21.75 7.57754 21.75 8.94513 21.75H15.0549C16.4225 21.75 17.5248 21.75 18.3918 21.6335C19.2919 21.5125 20.0497 21.2536 20.6517 20.6516C21.2536 20.0497 21.5125 19.2919 21.6335 18.3918C21.75 17.5248 21.75 16.4225 21.75 15.0549V15C21.75 14.5858 21.4142 14.25 21 14.25C20.5858 14.25 20.25 14.5858 20.25 15C20.25 16.4354 20.2484 17.4365 20.1469 18.1919C20.0482 18.9257 19.8678 19.3142 19.591 19.591C19.3142 19.8678 18.9257 20.0482 18.1919 20.1469C17.4365 20.2484 16.4354 20.25 15 20.25H9C7.56459 20.25 6.56347 20.2484 5.80812 20.1469C5.07435 20.0482 4.68577 19.8678 4.40901 19.591C4.13225 19.3142 3.9518 18.9257 3.85315 18.1919C3.75159 17.4365 3.75 16.4354 3.75 15Z" />
|
||||||
</svg>
|
</svg>
|
||||||
</button>
|
</button>
|
||||||
)
|
</>
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -64,7 +66,7 @@ function UploadButton({uploadFiles}) {
|
|||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
function InfoButton() {
|
function InfoButton() {
|
||||||
return (
|
return <>
|
||||||
<button className="text-black" title="Filesystem information">
|
<button className="text-black" title="Filesystem information">
|
||||||
<svg className="hover:bg-gray-300 mx-1 transition-colors duration-200 p-1.5 rounded-full font-semibold h-8"
|
<svg className="hover:bg-gray-300 mx-1 transition-colors duration-200 p-1.5 rounded-full font-semibold h-8"
|
||||||
viewBox="0 0 24 24" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
|
viewBox="0 0 24 24" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
|
||||||
@ -76,7 +78,7 @@ function InfoButton() {
|
|||||||
d="M1.25 12C1.25 6.06294 6.06294 1.25 12 1.25C17.9371 1.25 22.75 6.06294 22.75 12C22.75 17.9371 17.9371 22.75 12 22.75C6.06294 22.75 1.25 17.9371 1.25 12ZM12 2.75C6.89137 2.75 2.75 6.89137 2.75 12C2.75 17.1086 6.89137 21.25 12 21.25C17.1086 21.25 21.25 17.1086 21.25 12C21.25 6.89137 17.1086 2.75 12 2.75Z" />
|
d="M1.25 12C1.25 6.06294 6.06294 1.25 12 1.25C17.9371 1.25 22.75 6.06294 22.75 12C22.75 17.9371 17.9371 22.75 12 22.75C6.06294 22.75 1.25 17.9371 1.25 12ZM12 2.75C6.89137 2.75 2.75 6.89137 2.75 12C2.75 17.1086 6.89137 21.25 12 21.25C17.1086 21.25 21.25 17.1086 21.25 12C21.25 6.89137 17.1086 2.75 12 2.75Z" />
|
||||||
</svg>
|
</svg>
|
||||||
</button>
|
</button>
|
||||||
)
|
</>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -100,7 +102,7 @@ function LogoutButton() {
|
|||||||
navigate("/login");
|
navigate("/login");
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return <>
|
||||||
<button className="text-red-500" title="Logout" onClick={handleClick}>
|
<button className="text-red-500" title="Logout" onClick={handleClick}>
|
||||||
<svg
|
<svg
|
||||||
className="text-red-500 hover:bg-red-200 mx-1 transition-colors duration-200 p-1.5 rounded-full font-semibold h-8"
|
className="text-red-500 hover:bg-red-200 mx-1 transition-colors duration-200 p-1.5 rounded-full font-semibold h-8"
|
||||||
@ -110,7 +112,7 @@ function LogoutButton() {
|
|||||||
strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" />
|
strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" />
|
||||||
</svg>
|
</svg>
|
||||||
</button>
|
</button>
|
||||||
)
|
</>
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -125,12 +127,10 @@ function SearchBar() {
|
|||||||
* Update the controlled state.
|
* Update the controlled state.
|
||||||
* @param event {InputEvent}
|
* @param event {InputEvent}
|
||||||
*/
|
*/
|
||||||
const updateSearch = (event) => {
|
const updateSearch = (event) => setSearch(event.target.value);
|
||||||
setSearch(event.target.value);
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="mx-4 w-1/4">
|
<div className="mx-4 w-1/2 lg:w-1/4">
|
||||||
<input
|
<input
|
||||||
className="px-2 py-1 w-full text-sm focus:outline-none focus:shadow-sm shadow-blue-300 transition-shadow duration-200 rounded-sm border-1 border-gray-400"
|
className="px-2 py-1 w-full text-sm focus:outline-none focus:shadow-sm shadow-blue-300 transition-shadow duration-200 rounded-sm border-1 border-gray-400"
|
||||||
type="search"
|
type="search"
|
||||||
@ -142,10 +142,12 @@ function SearchBar() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function Navbar({ downloadFiles, uploadFiles }) {
|
export default function Navbar({ downloadFiles, uploadFiles }) {
|
||||||
return <nav className="absolute w-full p-2 flex items-center border-b-1 border-gray-400 bg-gray-100">
|
return <>
|
||||||
|
<nav className="absolute w-full p-2 flex items-center border-b-1 border-gray-400 bg-gray-100">
|
||||||
<MainIcon />
|
<MainIcon />
|
||||||
|
|
||||||
<h3 className="text-xl font-mono px-3">file.gophernest.net</h3>
|
<h3 className="hidden lg:block text-xl font-mono px-3">file.gophernest.net</h3>
|
||||||
|
|
||||||
<SearchBar />
|
<SearchBar />
|
||||||
|
|
||||||
<div className="min-h-fit ml-auto flex">
|
<div className="min-h-fit ml-auto flex">
|
||||||
@ -155,4 +157,5 @@ export default function Navbar({downloadFiles, uploadFiles}) {
|
|||||||
<LogoutButton />
|
<LogoutButton />
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
|
</>;
|
||||||
}
|
}
|
||||||
@ -18,9 +18,7 @@ export default function PasswordInput({onChange}) {
|
|||||||
/**
|
/**
|
||||||
* Toggle the hidden state which will determine the type of the input.
|
* Toggle the hidden state which will determine the type of the input.
|
||||||
*/
|
*/
|
||||||
const toggleHidden = () => {
|
const toggleHidden = () => setHidden(!hidden);
|
||||||
setHidden(!hidden);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the password
|
* Update the password
|
||||||
|
|||||||
@ -7,7 +7,7 @@
|
|||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
function HomeButton({onClick, enabled}) {
|
function HomeButton({onClick, enabled}) {
|
||||||
return (
|
return <>
|
||||||
<button
|
<button
|
||||||
onClick={onClick}
|
onClick={onClick}
|
||||||
disabled={!enabled}
|
disabled={!enabled}
|
||||||
@ -19,11 +19,11 @@ function HomeButton({onClick, enabled}) {
|
|||||||
<path d="M1 6V15H6V11C6 9.89543 6.89543 9 8 9C9.10457 9 10 9.89543 10 11V15H15V6L8 0L1 6Z"/>
|
<path d="M1 6V15H6V11C6 9.89543 6.89543 9 8 9C9.10457 9 10 9.89543 10 11V15H15V6L8 0L1 6Z"/>
|
||||||
</svg>
|
</svg>
|
||||||
</button>
|
</button>
|
||||||
)
|
</>
|
||||||
}
|
}
|
||||||
|
|
||||||
function BackButton({onClick, enabled}) {
|
function BackButton({onClick, enabled}) {
|
||||||
return (
|
return <>
|
||||||
<button onClick={onClick}
|
<button onClick={onClick}
|
||||||
disabled={!enabled}
|
disabled={!enabled}
|
||||||
className="hover:bg-gray-200 p-1.5 mr-1 rounded-full transition-colors duration-150 disabled:text-gray-500 disabled:hover:bg-red-300 disabled:cursor-not-allowed text-black">
|
className="hover:bg-gray-200 p-1.5 mr-1 rounded-full transition-colors duration-150 disabled:text-gray-500 disabled:hover:bg-red-300 disabled:cursor-not-allowed text-black">
|
||||||
@ -32,12 +32,12 @@ function BackButton({onClick, enabled}) {
|
|||||||
d="M4 10L3.29289 10.7071L2.58579 10L3.29289 9.29289L4 10ZM21 18C21 18.5523 20.5523 19 20 19C19.4477 19 19 18.5523 19 18L21 18ZM8.29289 15.7071L3.29289 10.7071L4.70711 9.29289L9.70711 14.2929L8.29289 15.7071ZM3.29289 9.29289L8.29289 4.29289L9.70711 5.70711L4.70711 10.7071L3.29289 9.29289ZM4 9L14 9L14 11L4 11L4 9ZM21 16L21 18L19 18L19 16L21 16ZM14 9C17.866 9 21 12.134 21 16L19 16C19 13.2386 16.7614 11 14 11L14 9Z"/>
|
d="M4 10L3.29289 10.7071L2.58579 10L3.29289 9.29289L4 10ZM21 18C21 18.5523 20.5523 19 20 19C19.4477 19 19 18.5523 19 18L21 18ZM8.29289 15.7071L3.29289 10.7071L4.70711 9.29289L9.70711 14.2929L8.29289 15.7071ZM3.29289 9.29289L8.29289 4.29289L9.70711 5.70711L4.70711 10.7071L3.29289 9.29289ZM4 9L14 9L14 11L4 11L4 9ZM21 16L21 18L19 18L19 16L21 16ZM14 9C17.866 9 21 12.134 21 16L19 16C19 13.2386 16.7614 11 14 11L14 9Z"/>
|
||||||
</svg>
|
</svg>
|
||||||
</button>
|
</button>
|
||||||
)
|
</>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function CreateButton({onClick}) {
|
function CreateButton({onClick}) {
|
||||||
return (
|
return <>
|
||||||
<button onClick={onClick}
|
<button onClick={onClick}
|
||||||
title="Create a file/directory"
|
title="Create a file/directory"
|
||||||
className="hover:bg-gray-200 p-1.5 mr-1 rounded-full transition-colors duration-150 disabled:text-gray-500 disabled:hover:bg-red-300 disabled:cursor-not-allowed text-black">
|
className="hover:bg-gray-200 p-1.5 mr-1 rounded-full transition-colors duration-150 disabled:text-gray-500 disabled:hover:bg-red-300 disabled:cursor-not-allowed text-black">
|
||||||
@ -48,11 +48,11 @@ function CreateButton({onClick}) {
|
|||||||
stroke="#000000" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
|
stroke="#000000" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
|
||||||
</svg>
|
</svg>
|
||||||
</button>
|
</button>
|
||||||
)
|
</>
|
||||||
}
|
}
|
||||||
|
|
||||||
function DeleteButton({onClick, enabled}) {
|
function DeleteButton({onClick, enabled}) {
|
||||||
return (
|
return <>
|
||||||
<button onClick={onClick}
|
<button onClick={onClick}
|
||||||
disabled={!enabled}
|
disabled={!enabled}
|
||||||
title="Delete selected files/directories"
|
title="Delete selected files/directories"
|
||||||
@ -63,7 +63,7 @@ function DeleteButton({onClick, enabled}) {
|
|||||||
stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
|
stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
|
||||||
</svg>
|
</svg>
|
||||||
</button>
|
</button>
|
||||||
);
|
</>
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -75,10 +75,14 @@ function DeleteButton({onClick, enabled}) {
|
|||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
function PathElement({name, index, onClick}) {
|
function PathElement({name, index, onClick}) {
|
||||||
const handleClick = () => {
|
const handleClick = () => onClick(index);
|
||||||
onClick(index);
|
return <>
|
||||||
};
|
<button onClick={handleClick}>
|
||||||
return <button onClick={handleClick}>/<span className="hover:underline cursor-pointer">{name}</span></button>
|
/<span className="hover:underline cursor-pointer">
|
||||||
|
{name}
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
|
</>
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -95,9 +99,8 @@ function PathElement({name, index, onClick}) {
|
|||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
export default function PathDisplay({path, updatePath, backHome, backArrow, enabled, create, remove, removeEnable}) {
|
export default function PathDisplay({path, updatePath, backHome, backArrow, enabled, create, remove, removeEnable}) {
|
||||||
return (
|
return <>
|
||||||
<div
|
<div className="w-9/10 lg:w-2/3 mt-8 border-b-1 border-gray-400 bg-white flex items-center truncate">
|
||||||
className="w-2/3 mt-8 border-b-1 border-gray-400 bg-white flex items-center truncate">
|
|
||||||
<HomeButton onClick={backHome} enabled={enabled}/>
|
<HomeButton onClick={backHome} enabled={enabled}/>
|
||||||
<BackButton onClick={backArrow} enabled={enabled}/>
|
<BackButton onClick={backArrow} enabled={enabled}/>
|
||||||
{path.map((seg, idx) => <PathElement name={seg} key={idx} index={idx} onClick={updatePath}/>)}
|
{path.map((seg, idx) => <PathElement name={seg} key={idx} index={idx} onClick={updatePath}/>)}
|
||||||
@ -108,5 +111,5 @@ export default function PathDisplay({path, updatePath, backHome, backArrow, enab
|
|||||||
<CreateButton onClick={create}/>
|
<CreateButton onClick={create}/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
</>
|
||||||
}
|
}
|
||||||
@ -20,8 +20,10 @@ export default function RememberMe({onChange}) {
|
|||||||
setRemember(!remember);
|
setRemember(!remember);
|
||||||
};
|
};
|
||||||
|
|
||||||
return <div className="w-full flex items-center my-2" onClick={toggleRemember}>
|
return <>
|
||||||
|
<div className="w-full flex items-center my-2" onClick={toggleRemember}>
|
||||||
<input name={rememberMeId} checked={remember} type="checkbox" className="mx-1"/>
|
<input name={rememberMeId} checked={remember} type="checkbox" className="mx-1"/>
|
||||||
<label htmlFor={rememberMeId} className="text-sm select-none cursor-pointer">Remember me for 30 days</label>
|
<label htmlFor={rememberMeId} className="text-sm select-none cursor-pointer">Remember me for 30 days</label>
|
||||||
</div>
|
</div>
|
||||||
|
</>
|
||||||
}
|
}
|
||||||
@ -46,9 +46,7 @@ export default function Uploader({close, upload}) {
|
|||||||
* Prevent the default drag behavior.
|
* Prevent the default drag behavior.
|
||||||
* @param e {object} Event object from the div wrapper.
|
* @param e {object} Event object from the div wrapper.
|
||||||
*/
|
*/
|
||||||
const dragOver = (e) => {
|
const dragOver = (e) => e.preventDefault();
|
||||||
e.preventDefault();
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When files are dropped into the div, this will be called, to append the files.
|
* When files are dropped into the div, this will be called, to append the files.
|
||||||
@ -64,26 +62,20 @@ export default function Uploader({close, upload}) {
|
|||||||
* Click event for the input element.
|
* Click event for the input element.
|
||||||
* Uses the ref hook to access the element.
|
* Uses the ref hook to access the element.
|
||||||
*/
|
*/
|
||||||
const click = () => {
|
const click = () => inputElement.current.click();
|
||||||
inputElement.current.click();
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When the input changes, append the new files.
|
* When the input changes, append the new files.
|
||||||
* @param e {object} Event object from the input.
|
* @param e {object} Event object from the input.
|
||||||
*/
|
*/
|
||||||
const inputChange = (e) => {
|
const inputChange = (e) => setFiles([...files, ...e.target.files]);
|
||||||
setFiles([...files, ...e.target.files]);
|
|
||||||
};
|
|
||||||
|
|
||||||
const uploadFiles = () => {
|
const uploadFiles = () => upload(files);
|
||||||
upload(files);
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return <>
|
||||||
<div className="fixed inset-0 z-50 flex items-center justify-center">
|
<div className="fixed inset-0 z-50 flex items-center justify-center">
|
||||||
<div className="fixed -inset-10 bg-black opacity-50 blur-lg"></div>
|
<div className="fixed -inset-10 bg-black opacity-50 blur-lg"></div>
|
||||||
<div className="relative z-50 bg-white p-8 rounded-lg shadow-lg w-2/5 border-1 border-gray-400">
|
<div className="relative z-50 bg-white p-8 rounded-lg shadow-lg w-9/10 lg:w-2/5 border-1 border-gray-400">
|
||||||
<h2 className="text-2xl font-semibold mb-2 text-blue-400">Upload Files</h2>
|
<h2 className="text-2xl font-semibold mb-2 text-blue-400">Upload Files</h2>
|
||||||
<p className="text-sm">
|
<p className="text-sm">
|
||||||
Files uploaded will be added to the current directory. Currently, directory
|
Files uploaded will be added to the current directory. Currently, directory
|
||||||
@ -94,7 +86,13 @@ export default function Uploader({close, upload}) {
|
|||||||
className="my-5 border-2 border-dashed p-8 rounded-md text-center cursor-pointer border-gray-400 hover:bg-blue-100 hover:border-blue-500 transition-all duration-100"
|
className="my-5 border-2 border-dashed p-8 rounded-md text-center cursor-pointer border-gray-400 hover:bg-blue-100 hover:border-blue-500 transition-all duration-100"
|
||||||
onDragEnter={dragEnter} onDragLeave={dragLeave} onDragOver={dragOver} onDrop={drop} onClick={click}
|
onDragEnter={dragEnter} onDragLeave={dragLeave} onDragOver={dragOver} onDrop={drop} onClick={click}
|
||||||
>
|
>
|
||||||
<input multiple type="file" className="hidden" ref={inputElement} onChange={inputChange}/>
|
<input
|
||||||
|
multiple
|
||||||
|
type="file"
|
||||||
|
className="hidden"
|
||||||
|
ref={inputElement}
|
||||||
|
onChange={inputChange}
|
||||||
|
/>
|
||||||
<p className="italic">Drag and drop files here or click to select</p>
|
<p className="italic">Drag and drop files here or click to select</p>
|
||||||
</div>
|
</div>
|
||||||
<FileList files={files}/>
|
<FileList files={files}/>
|
||||||
@ -114,5 +112,5 @@ export default function Uploader({close, upload}) {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
</>
|
||||||
}
|
}
|
||||||
@ -13,8 +13,8 @@ import CreateDirectory from "../components/CreateDirectory.jsx";
|
|||||||
export default function Dashboard() {
|
export default function Dashboard() {
|
||||||
// Store the default path
|
// Store the default path
|
||||||
// TODO: BACK TO NORMAL PATH
|
// TODO: BACK TO NORMAL PATH
|
||||||
const defaultPath = ["media", "vault"];
|
// const defaultPath = ["media", "vault"];
|
||||||
// const defaultPath = ["home", "azpect"];
|
const defaultPath = ["home", "azpect"];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* URL To the backend web server.
|
* URL To the backend web server.
|
||||||
@ -442,25 +442,46 @@ export default function Dashboard() {
|
|||||||
<div className="w-full min-h-screen h-screen pb-8">
|
<div className="w-full min-h-screen h-screen pb-8">
|
||||||
<Navbar downloadFiles={downloadFiles} uploadFiles={toggleUploading} />
|
<Navbar downloadFiles={downloadFiles} uploadFiles={toggleUploading} />
|
||||||
<div className="h-full w-full flex flex-col items-center justify-center pb-8">
|
<div className="h-full w-full flex flex-col items-center justify-center pb-8">
|
||||||
|
|
||||||
{downloadLoading && <DownloadLoading />}
|
{downloadLoading && <DownloadLoading />}
|
||||||
{creating && <CreateDirectory close={closeCreate} create={createDirectory} />}
|
{creating && <CreateDirectory close={closeCreate} create={createDirectory} />}
|
||||||
{uploading && <Uploader close={toggleUploading} upload={upload} />}
|
{uploading && <Uploader close={toggleUploading} upload={upload} />}
|
||||||
|
|
||||||
{error && <Error error={error} clear={clearError} />}
|
{error && <Error error={error} clear={clearError} />}
|
||||||
{(editing !== "" && !error) &&
|
{
|
||||||
<Editor content={editingFileContent} path={editing} exit={exitFile} saveExit={exitAndSaveFile}
|
(editing !== "" && !error) &&
|
||||||
loading={contentLoading} />}
|
<Editor
|
||||||
|
content={editingFileContent}
|
||||||
|
path={editing}
|
||||||
|
exit={exitFile}
|
||||||
|
saveExit={exitAndSaveFile}
|
||||||
|
loading={contentLoading}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
|
||||||
<PathDisplay path={path} updatePath={updatePath} backHome={backHome} backArrow={backArrow}
|
<PathDisplay
|
||||||
enabled={path.length > defaultPath.length} create={createDir} remove={removeSelected}
|
path={path}
|
||||||
removeEnable={selected.length > 0} />
|
updatePath={updatePath}
|
||||||
<div className="w-2/3 h-5/6 overflow-y-auto border-1 border-gray-300">
|
backHome={backHome}
|
||||||
|
backArrow={backArrow}
|
||||||
|
enabled={path.length > defaultPath.length}
|
||||||
|
create={createDir}
|
||||||
|
remove={removeSelected}
|
||||||
|
removeEnable={selected.length > 0}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<div className="w-9/10 lg:w-2/3 h-5/6 overflow-y-auto border-1 border-gray-300">
|
||||||
{childrenLoading && <ChildrenLoading />}
|
{childrenLoading && <ChildrenLoading />}
|
||||||
<DirectoryList dirs={files} showHidden={showHidden} appendPath={appendPath}
|
<DirectoryList
|
||||||
// TODO: Rework the toggleSelected functionality
|
dirs={files}
|
||||||
toggleSelected={toggleSelected} toggleEditing={toggleEditing} />
|
showHidden={showHidden}
|
||||||
|
appendPath={appendPath}
|
||||||
|
toggleSelected={toggleSelected} // TODO: Rework the toggleSelected functionality
|
||||||
|
toggleEditing={toggleEditing}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="w-2/3 flex justify-end items-center">
|
|
||||||
|
<div className="w-9/10 lg:w-2/3 flex justify-end items-center">
|
||||||
<label className="text-sm mx-2" htmlFor="showHiddenItems">Show Hidden Items</label>
|
<label className="text-sm mx-2" htmlFor="showHiddenItems">Show Hidden Items</label>
|
||||||
<input
|
<input
|
||||||
className="p-2"
|
className="p-2"
|
||||||
|
|||||||
@ -11,7 +11,8 @@ function Login() {
|
|||||||
return <>
|
return <>
|
||||||
<div className="min-h-screen h-screen w-full bg-gray-200 flex items-center justify-center">
|
<div className="min-h-screen h-screen w-full bg-gray-200 flex items-center justify-center">
|
||||||
<h2 className="absolute top-0 left-0 font-[550] font-mono italic text-xl m-6">{domain}</h2>
|
<h2 className="absolute top-0 left-0 font-[550] font-mono italic text-xl m-6">{domain}</h2>
|
||||||
<div className="w-2/7 h-fit bg-white border-1 rounded-sm border-gray-300 p-12">
|
|
||||||
|
<div className="w-9/10 lg:w-2/7 h-fit bg-white border rounded-sm border-gray-300 p-12">
|
||||||
<p className="text-gray-400">Please enter your details</p>
|
<p className="text-gray-400">Please enter your details</p>
|
||||||
<h1 className="text-3xl font-semibold mt-2 mb-12"> Welcome Back </h1>
|
<h1 className="text-3xl font-semibold mt-2 mb-12"> Welcome Back </h1>
|
||||||
<LoginForm />
|
<LoginForm />
|
||||||
|
|||||||
Reference in New Issue
Block a user