From db66774ca681e0a7476e81a66a26dc044f8949d2 Mon Sep 17 00:00:00 2001 From: Daniel Cojocea Date: Tue, 25 Jun 2024 17:38:40 -0400 Subject: [PATCH] Initial design --- .../ProfileSettings/ProfilePanel.jsx | 104 +++++++++++++++--- .../src/Components/TextFields/Image/index.css | 15 +++ .../src/Components/TextFields/Image/index.jsx | 97 ++++++++++++++++ Client/src/Pages/Demo/Demo.jsx | 5 + Client/src/Utils/Theme.js | 6 +- 5 files changed, 211 insertions(+), 16 deletions(-) create mode 100644 Client/src/Components/TextFields/Image/index.css create mode 100644 Client/src/Components/TextFields/Image/index.jsx diff --git a/Client/src/Components/TabPanels/ProfileSettings/ProfilePanel.jsx b/Client/src/Components/TabPanels/ProfileSettings/ProfilePanel.jsx index 18b47e15b..5bf540775 100644 --- a/Client/src/Components/TabPanels/ProfileSettings/ProfilePanel.jsx +++ b/Client/src/Components/TabPanels/ProfileSettings/ProfilePanel.jsx @@ -1,7 +1,14 @@ import { useTheme } from "@emotion/react"; import { useState } from "react"; import TabPanel from "@mui/lab/TabPanel"; -import { Box, Divider, Modal, Stack, Typography } from "@mui/material"; +import { + Box, + Divider, + IconButton, + Modal, + Stack, + Typography, +} from "@mui/material"; import ButtonSpinner from "../../ButtonSpinner"; import Button from "../../Button"; import EmailTextField from "../../TextFields/Email/EmailTextField"; @@ -10,6 +17,9 @@ import Avatar from "../../Avatar"; import { editProfileValidation } from "../../../Validation/validation"; import { useDispatch, useSelector } from "react-redux"; import { update } from "../../../Features/Auth/authSlice"; +import ImageField from "../../TextFields/Image"; +import DoDisturbAltIcon from "@mui/icons-material/DoDisturbAlt"; +import CloseIcon from "@mui/icons-material/Close"; /** * ProfilePanel component displays a form for editing user profile information @@ -39,8 +49,9 @@ const ProfilePanel = () => { profilePicUrl: "placeholder", }); const [errors, setErrors] = useState({}); - const [isOpen, setIsOpen] = useState(false); - const [loadingPfp, setLoadingPfp] = useState(false); + const [isOpen, setIsOpen] = useState(""); + const isModalOpen = (name) => isOpen === name; + const [loading, setLoading] = useState(false); const handleChange = (event) => { const { value, id } = event.target; @@ -69,16 +80,13 @@ const ProfilePanel = () => { //TODO - implement delete profile picture function const handleDeletePicture = () => { - setLoadingPfp(true); + setLoading(true); setTimeout(() => { - setLoadingPfp(false); + setLoading(false); }, 2000); }; //TODO - implement update profile function - const handleUpdatePicture = () => { - setLocalData((prev) => ({ ...prev, profilePicUrl: file })); - console.log(localData); - }; + const handleUpdatePicture = () => {}; //TODO - implement delete account function const handleDeleteAccount = () => {}; //TODO - implement save profile function @@ -94,6 +102,7 @@ const ProfilePanel = () => { } dispatch(update({ authToken, localData })); + //TODO - add toast confirmation }; return ( @@ -204,13 +213,13 @@ const ProfilePanel = () => { level="tertiary" label="Delete" onClick={handleDeletePicture} - isLoading={loadingPfp} + isLoading={loading} /> {/* TODO - modal popup for update pfp? */}