diff --git a/Client/src/Components/TabPanels/ProfileSettings/PasswordPanel.jsx b/Client/src/Components/TabPanels/ProfileSettings/PasswordPanel.jsx new file mode 100644 index 000000000..8a7763fa2 --- /dev/null +++ b/Client/src/Components/TabPanels/ProfileSettings/PasswordPanel.jsx @@ -0,0 +1,182 @@ +import TabPanel from "@mui/lab/TabPanel"; +import React, { useState } from "react"; +import AnnouncementsDualButtonWithIcon from "../../Announcements/AnnouncementsDualButtonWithIcon/AnnouncementsDualButtonWithIcon"; +import { useTheme } from "@emotion/react"; +import { + Box, + Divider, + FormControl, + IconButton, + InputAdornment, + OutlinedInput, + Stack, + Typography, +} from "@mui/material"; +import VisibilityOff from "@mui/icons-material/VisibilityOff"; +import Visibility from "@mui/icons-material/Visibility"; +import InfoOutlinedIcon from "@mui/icons-material/InfoOutlined"; +import WarningAmberOutlinedIcon from "@mui/icons-material/WarningAmberOutlined"; +import ButtonSpinner from "../../ButtonSpinner"; + +/** + * PasswordPanel component manages the form for editing password. + * + * @returns {JSX.Element} + * + */ + +const PasswordPanel = () => { + const theme = useTheme(); + const [isLoading, setIsLoading] = useState(false); + const [showPassword, setShowPassword] = useState(false); + + //TODO - implement save password function + const handleSavePassword = () => { + setIsLoading(true); + setTimeout(() => { + setIsLoading(false); + setIsOpen(false); + }, 2000); + }; + return ( + +
+
+ } + subject="SSO login" + body="Since you logged in via SSO, you cannot reset or modify your password." + /> +
+
+ + + Current Password + + + + + setShowPassword((show) => !show)} + sx={{ + width: "30px", + height: "30px", + "&:focus": { + outline: "none", + }, + }} + > + {!showPassword ? ( + + ) : ( + + )} + + + } + > + +
+
+ + + Password + + + + + setShowPassword((show) => !show)} + sx={{ + width: "30px", + height: "30px", + "&:focus": { + outline: "none", + }, + }} + > + {!showPassword ? ( + + ) : ( + + )} + + + } + > + +
+
+ + + Confirm new password + + + + } + body="New password must contain at least 8 characters and must have at least one uppercase letter, one number and one symbol." + /> + +
+
+ ); +}; + +PasswordPanel.propTypes = { + // No props are being passed to this component, hence no specific PropTypes are defined. + }; + +export default PasswordPanel; diff --git a/Client/src/Pages/Settings/index.jsx b/Client/src/Pages/Settings/index.jsx index b1052f26c..465284e72 100644 --- a/Client/src/Pages/Settings/index.jsx +++ b/Client/src/Pages/Settings/index.jsx @@ -35,6 +35,7 @@ import Button from "../../Components/Button"; import "./index.css"; import AnnouncementsDualButtonWithIcon from "../../Components/Announcements/AnnouncementsDualButtonWithIcon/AnnouncementsDualButtonWithIcon"; import ProfilePanel from "../../Components/TabPanels/ProfileSettings/ProfilePanel"; +import PasswordPanel from "../../Components/TabPanels/ProfileSettings/PasswordPanel"; const tabList = ["Profile", "Password", "Team"]; const passwordConfig = { @@ -138,13 +139,7 @@ const Settings = () => { const [isLoading, setIsLoading] = useState(false); const [isOpen, setIsOpen] = useState(false); - const handleSaveProfile = () => { - setIsLoading(true); - setTimeout(() => { - setIsLoading(false); - setIsOpen(false); - }, 2000); - }; + const handleDeleteAccount = () => { setIsLoading(true); setTimeout(() => { @@ -266,101 +261,7 @@ const Settings = () => { - -
-
- } - subject="SSO login" - body="Since you logged in via SSO, you cannot reset or modify your password." - /> -
- {Object.entries(passwordConfig).map(([key, field]) => ( -
- - - {field.label} - - - {/* TODO - Refactor Password Input Component */} - {field.type === "input" ? ( - - - setShowPassword((show) => !show)} - sx={{ - width: "30px", - height: "30px", - "&:focus": { - outline: "none", - }, - }} - > - {!showPassword ? ( - - ) : ( - - )} - - - } - > - - ) : field.type === "notice" ? ( - - - } - body="New password must contain at least 8 characters and must have at least one uppercase letter, one number and one symbol." - /> - - ) : ( - "" - )} -
- ))} -
+