From 51955744576e186da371a0b39c4312fca564fb4d Mon Sep 17 00:00:00 2001 From: KS Date: Tue, 5 Mar 2024 23:22:24 -0800 Subject: [PATCH 1/3] implement settings menu still missing change password and change email --- frontend/src/HomePage.jsx | 66 -------------- frontend/src/NavBar.jsx | 182 ++++++++++++++++++++++++++++++-------- 2 files changed, 144 insertions(+), 104 deletions(-) diff --git a/frontend/src/HomePage.jsx b/frontend/src/HomePage.jsx index d828613..6237f9f 100644 --- a/frontend/src/HomePage.jsx +++ b/frontend/src/HomePage.jsx @@ -15,7 +15,6 @@ import { import { decryptText } from "./encryption"; import { Edit, Delete } from "@mui/icons-material"; import ConfirmationDialog from "./DeleteConfirmation"; -import DeleteAccountConfirmationDialog from "./DeleteAccountConfirmation"; export default function HomePage() { const nav = useNavigate(); @@ -24,7 +23,6 @@ export default function HomePage() { const [currentTab, setCurrentTab] = useState("0"); const [importedData, setImportedData] = useState([]); const [confirmationDialogOpen, setConfirmationDialogOpen] = useState(false); - const [accountDeletionDialogOpen, setAccountDeletionDialogOpen] = useState(false); const [deletingData, setDeletingData] = useState(null); const [currentFolderId, setCurrentFolderId] = useState(null); @@ -322,32 +320,6 @@ export default function HomePage() { marginBottom: "1rem", }} > - - - - - - - - - - - setAccountDeletionDialogOpen(false)} - email={loggedInUser["email"]} - userID={loggedInUser["userID"]} - accessToken={accessToken} - /> - state.auth.user); + const accessToken = useSelector((state) => state.auth.accessToken); + + const [deleteDialogOpen, setDeleteDialogOpen] = React.useState(false); + const [anchorEl, setAnchorEl] = React.useState(null); + const buttonRef = React.useRef(null); - const [open, setOpen] = React.useState(false); - - const handleClickOpen = () => { - setOpen(true); + const handleClick = (event) => { + setAnchorEl(event.currentTarget); }; const handleClose = () => { - setOpen(false); + setAnchorEl(null); }; const handleSignOut = () => { @@ -29,39 +33,141 @@ export default function NavBar() { }; return ( - <> - - navigate("/")}> - Beaver Logo - Beaver Vault - - {loggedInUser ? ( - + navigate("/")}> + Beaver Logo + Beaver Vault + + {accessToken && ( + + {loggedInUser["email"]} + + - {loggedInUser["email"]} - - - ) : ( - <> - )} - - + + + setDeleteDialogOpen(false)} + email={loggedInUser["email"]} + userID={loggedInUser["userID"]} + accessToken={accessToken} + /> + + )} + ); } \ No newline at end of file From 82291b140963563de91908c630d2000977742fcc Mon Sep 17 00:00:00 2001 From: KS Date: Tue, 5 Mar 2024 23:25:52 -0800 Subject: [PATCH 2/3] less wordy on one of the settings --- frontend/src/NavBar.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/NavBar.jsx b/frontend/src/NavBar.jsx index d2e0ac4..f409ea3 100644 --- a/frontend/src/NavBar.jsx +++ b/frontend/src/NavBar.jsx @@ -116,7 +116,7 @@ export default function NavBar() { }} sx={{ minWidth: buttonRef.current ? buttonRef.current.offsetWidth : 0 }} > - Delete User Account + Delete Account Date: Mon, 11 Mar 2024 20:09:33 -0700 Subject: [PATCH 3/3] Add settings menu --- frontend/src/HomePage.jsx | 9 --------- frontend/src/NavBar.jsx | 10 ++++++++++ 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/frontend/src/HomePage.jsx b/frontend/src/HomePage.jsx index 40ba9dd..fea54f6 100644 --- a/frontend/src/HomePage.jsx +++ b/frontend/src/HomePage.jsx @@ -331,15 +331,6 @@ export default function HomePage() { marginBottom: "1rem", }} > - - -