import PropTypes from "prop-types"; import { useState } from "react"; import { Box, Typography, Tab, useTheme, TextField, Avatar, Stack, Divider, Modal, FormControl, OutlinedInput, InputAdornment, IconButton, } from "@mui/material"; import TabPanel from "@mui/lab/TabPanel"; import TabContext from "@mui/lab/TabContext"; import TabList from "@mui/lab/TabList"; import Visibility from "@mui/icons-material/Visibility"; import VisibilityOff from "@mui/icons-material/VisibilityOff"; import InfoOutlinedIcon from "@mui/icons-material/InfoOutlined"; import WarningAmberOutlinedIcon from "@mui/icons-material/WarningAmberOutlined"; import ButtonSpinner from "../../Components/ButtonSpinner"; import Button from "../../Components/Button"; import "./index.css"; import AnnouncementsDualButtonWithIcon from "../../Components/Announcements/AnnouncementsDualButtonWithIcon/AnnouncementsDualButtonWithIcon"; const tabList = ["Profile", "Password", "Team"]; const profileConfig = { firstName: { id: "edit-first-name", label: "First name", type: "input", }, lastName: { id: "edit-last-name", label: "Last name", type: "input", }, email: { id: "edit-email", label: "Email", description: "After updating, you'll receive a confirmation email.", type: "input", }, photo: { id: "edit-photo", label: "Your photo", description: "This photo will be displayed in your profile page.", type: "photo", }, }; const passwordConfig = { current_password: { id: "edit-current-password", label: "Current password", type: "input", }, password: { id: "edit-password", label: "Password", type: "input", }, confirm_password: { id: "notice-confirm-password", label: "Confirm new password", type: "notice", }, }; const Settings = () => { //(tab) 0 - Profile //(tab) 1 - Password //(tab) 2 - Team const [tab, setTab] = useState("0"); const handleTabChange = (event, newTab) => { setTab(newTab); }; const theme = useTheme(); const [isLoading, setIsLoading] = useState(false); //TODO - implement delete profile picture function const handleDeletePicture = () => { setIsLoading(true); setTimeout(() => { setIsLoading(false); }, 2000); }; //TODO - implement delete profile update function const handleUpdatePicture = () => {}; const [isOpen, setIsOpen] = useState(false); //TODO - implement delete account function const handleDeleteAccount = () => { setIsLoading(true); setTimeout(() => { setIsLoading(false); setIsOpen(false); }, 2000); }; const handleSaveProfile = () => { setIsLoading(true); setTimeout(() => { setIsLoading(false); setIsOpen(false); }, 2000); }; const [showPassword, setShowPassword] = useState(false); return ( {tabList.map((label, index) => ( ))}
{Object.entries(profileConfig).map(([key, field]) => (
{field.label} {field ? ( {field.description} ) : ( "" )} {field.type === "input" ? ( ) : field.type === "photo" ? ( {/* TODO - Use Avatar component instead of @mui */} {/* TODO - modal popup for update pfp? */}
))}
} 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." /> ) : ( "" )}
))}
Team
{/* TODO - Update ModalPopup Component with @mui for reusability */} {/* */} setIsOpen(false)} disablePortal > Really delete this account? If you delete your account, you will no longer be able to sign in, and all of your data will be deleted. Deleting your account is permanent and non-recoverable action.