diff --git a/Client/src/Components/Button/index.jsx b/Client/src/Components/Button/index.jsx index fcf157f5e..c53ece09e 100644 --- a/Client/src/Components/Button/index.jsx +++ b/Client/src/Components/Button/index.jsx @@ -58,15 +58,12 @@ const Button = ({ id, type, level, label, disabled, img, onClick, sx }) => { color={color} disabled={disabled} onClick={onClick} + disableRipple sx={{ textTransform: "none", "&:focus": { outline: "none", }, - "& .MuiTouchRipple-root": { - pointerEvents: "none", - display: "none", - }, ...sx, }} > diff --git a/Client/src/Components/ButtonSpinner/index.jsx b/Client/src/Components/ButtonSpinner/index.jsx index 7f89f1ab9..2d940c539 100644 --- a/Client/src/Components/ButtonSpinner/index.jsx +++ b/Client/src/Components/ButtonSpinner/index.jsx @@ -70,6 +70,7 @@ const ButtonSpinner = ({ endIcon={position === "end" && img} onClick={onClick} loading={isLoading} + disableRipple sx={{ textTransform: "none", "&:focus": { diff --git a/Client/src/Components/TabPanels/Account/ProfilePanel.jsx b/Client/src/Components/TabPanels/Account/ProfilePanel.jsx index d5a286ec5..69a997a77 100644 --- a/Client/src/Components/TabPanels/Account/ProfilePanel.jsx +++ b/Client/src/Components/TabPanels/Account/ProfilePanel.jsx @@ -255,7 +255,8 @@ const ProfilePanel = () => { value={user.email} placeholder="Enter your email" autoComplete="email" - // onChange={handleChange} + // TODO - add onChange + onChange={() => console.log("Disabled.")} // error={errors[idToName["edit-email"]]} disabled={true} /> diff --git a/Client/src/Components/TabPanels/Account/TeamPanel.jsx b/Client/src/Components/TabPanels/Account/TeamPanel.jsx index 471752dfa..5ef356f9c 100644 --- a/Client/src/Components/TabPanels/Account/TeamPanel.jsx +++ b/Client/src/Components/TabPanels/Account/TeamPanel.jsx @@ -21,6 +21,8 @@ import ButtonSpinner from "../../ButtonSpinner"; import Button from "../../Button"; import { useState } from "react"; import EditSvg from "../../../assets/icons/edit.svg?react"; +import Field from "../../Inputs/Field"; +import { credentials } from "../../../Validation/validation"; /** * TeamPanel component manages the organization and team members, @@ -106,19 +108,11 @@ const TeamPanel = () => { name: "Bluewave Labs", isLoading: false, isEdit: false, - newName: "", }); const toggleEdit = () => { setOrgStates((prev) => ({ ...prev, isEdit: !prev.isEdit })); }; - const handleChange = (event) => { - const { value } = event.target; - setOrgStates((prev) => ({ - ...prev, - name: value, - })); - }; const handleRename = () => {}; const [teamStates, setTeamStates] = useState({ @@ -163,8 +157,44 @@ const TeamPanel = () => { setIsLoading(false); }, 2000); }; + + const [toInvite, setToInvite] = useState({ + email: "", + role: "", + }); + const [errors, setErrors] = useState({}); + + const handleChange = (event) => { + const { value } = event.target; + setToInvite((prev) => ({ + ...prev, + email: value, + })); + + const validation = credentials.validate( + { email: value }, + { abortEarly: false } + ); + + setErrors((prev) => { + const updatedErrors = { ...prev }; + + if (validation.error) { + updatedErrors.email = validation.error.details[0].message; + } else { + delete updatedErrors.email; + } + return updatedErrors; + }); + }; const [isOpen, setIsOpen] = useState(false); const handleInviteMember = () => {}; + const closeInviteModal = () => { + setIsOpen(false); + setToInvite({ email: "", role: "" }); + setErrors({}); + }; + const handleMembersQuery = (type) => { let count = 0; teamStates.members.forEach((member) => { @@ -188,7 +218,12 @@ const TeamPanel = () => { > + setOrgStates((prev) => ({ + ...prev, + name: event.target.value, + })) + } disabled={!orgStates.isEdit} sx={{ color: theme.palette.otherColors.bluishGray, @@ -409,7 +444,7 @@ const TeamPanel = () => { aria-labelledby="modal-invite-member" aria-describedby="invite-member-to-team" open={isOpen} - onClose={() => setIsOpen(false)} + onClose={closeInviteModal} disablePortal > { Invite new team member - + When you add a new team member, they will get access to all monitors. - - // setOrgStates((prev) => ({ - // ...prev, - // newName: event.target.value, - // })) - // } - > - + placeholder="Email" + value={toInvite.email} + onChange={handleChange} + error={errors.email} + /> + +