From 6e48ba550751f53568894ac34693233ef463b94a Mon Sep 17 00:00:00 2001 From: Daniel Cojocea Date: Tue, 18 Jun 2024 19:59:23 -0400 Subject: [PATCH] Refactored Profile Tab Panel --- .../ProfileSettings/ProfilePanel.jsx | 295 ++++++++++++++++++ Client/src/Pages/Settings/index.jsx | 247 +-------------- Client/src/index.css | 4 +- 3 files changed, 306 insertions(+), 240 deletions(-) create mode 100644 Client/src/Components/TabPanels/ProfileSettings/ProfilePanel.jsx diff --git a/Client/src/Components/TabPanels/ProfileSettings/ProfilePanel.jsx b/Client/src/Components/TabPanels/ProfileSettings/ProfilePanel.jsx new file mode 100644 index 000000000..5b51a0f2b --- /dev/null +++ b/Client/src/Components/TabPanels/ProfileSettings/ProfilePanel.jsx @@ -0,0 +1,295 @@ +import { useTheme } from "@emotion/react"; +import { useState } from "react"; +import TabPanel from "@mui/lab/TabPanel"; +import { + Avatar, + Box, + Divider, + Modal, + Stack, + TextField, + Typography, +} from "@mui/material"; +import ButtonSpinner from "../../ButtonSpinner"; +import Button from "../../Button"; + +/** + * ProfilePanel component displays a form for editing user profile information + * and allows for actions like updating profile picture, credentials, + * and deleting account. + * + * @returns {JSX.Element} + * + */ + +const ProfilePanel = () => { + const theme = useTheme(); + //TODO - use redux loading state + //!! - currently all loading buttons are tied to the same state + const [isLoading, setIsLoading] = useState(false); + //TODO - implement delete profile picture function + const handleDeletePicture = () => { + setIsLoading(true); + setTimeout(() => { + setIsLoading(false); + }, 2000); + }; + //TODO - implement update profile function + const handleUpdatePicture = () => {}; + const [isOpen, setIsOpen] = useState(false); + //TODO - implement delete account function + const handleDeleteAccount = () => { + setIsLoading(true); + setTimeout(() => { + setIsLoading(false); + setIsOpen(false); + }, 2000); + }; + //TODO - implement save profile function + const handleSaveProfile = () => { + setIsLoading(true); + setTimeout(() => { + setIsLoading(false); + setIsOpen(false); + }, 2000); + }; + + return ( + +
+
+ + + First Name + + + {/* TODO - use existing textfield components */} + +
+
+ + + Last Name + + + {/* TODO - use existing textfield components */} + +
+
+ + + Email + + + After updating, you'll receive a confirmation email. + + + {/* TODO - use existing textfield components */} + +
+
+ + + Your Photo + + + This photo will be displayed in your profile page. + + + + {/* TODO - Use Avatar component instead of @mui */} + + + {/* TODO - modal popup for update pfp? */} +
+
+