diff --git a/frontend/src/app/credentials/add/page.jsx b/frontend/src/app/credentials/add/page.jsx index 5ab13b1..4aac044 100644 --- a/frontend/src/app/credentials/add/page.jsx +++ b/frontend/src/app/credentials/add/page.jsx @@ -5,22 +5,30 @@ import globalStyle from "../../globalStyle.module.css"; import createCredStyle from "./styles.module.css"; import TopToolTip from "@/app/components/topToolTip/TopToolTip"; import TextField from "@/app/components/fields/textfield"; +import Prompts from "@/app/components/prompts/Prompts"; const Page = () => { - const fileInputRef = useRef(null); - const [fileName, setFileName] = useState(""); - - const handleClick = () => { - fileInputRef.current.click(); - }; - + const [selectedFile, setSelectedFile] = useState(null); + // Click const handleFileChange = (e) => { const file = e.target.files[0]; if (file) { - setFileName(file.name); - console.log(file); // you can send this to backend later + setSelectedFile(file); + console.log(file); //send this to backend later } }; + // Drag/Drop + const handleDrop = (e) => { + e.preventDefault(); + + const file = e.dataTransfer.files[0]; + if (file) { + setSelectedFile(file); + } + }; + const handleDragOver = (e) => { + e.preventDefault(); + }; return (
Upload File
+ {/* Optional or Required */} + {/*(Optional)
*/}{" "}{fileName}
+ + {selectedFile ? ( ++ {/* Display file name only */} + {selectedFile.name} +
) : ( <>@@ -79,7 +89,7 @@ const Page = () => {
> )} -