diff --git a/packages/uiweb/src/lib/components/chat/CreateGroup/CreateGroupModal.tsx b/packages/uiweb/src/lib/components/chat/CreateGroup/CreateGroupModal.tsx index 9b2ad7045..dc9b94e75 100644 --- a/packages/uiweb/src/lib/components/chat/CreateGroup/CreateGroupModal.tsx +++ b/packages/uiweb/src/lib/components/chat/CreateGroup/CreateGroupModal.tsx @@ -26,6 +26,7 @@ import { import { Image } from '../../../config/styles'; import { ProfilePicture, device } from '../../../config'; +import { CriteriaValidationErrorType } from '../types'; export const CREATE_GROUP_STEP_KEYS = { INPUT_DETAILS: 1, @@ -162,7 +163,8 @@ const CreateGroupDetail = ({ const groupInfoToast = useToast(); const { groupName, groupDescription, groupImage } = groupInputDetails; const theme = useContext(ThemeContext); - + const [validationErrors, setValidationErrors] = + useState({}); const fileUploadInputRef = useRef(null); const isMobile = useMediaQuery(device.mobileL); @@ -205,21 +207,20 @@ const CreateGroupDetail = ({ if (!skipVerify) { // verify name if (groupName.trim().length === 0) { - showError('Group Name is empty'); + setValidationErrors({ + groupName: 'Group name cannot be empty', + }); return; } // verify description if (groupDescription.trim().length === 0) { - showError('Group Description is empty'); + setValidationErrors({ + groupDescription: 'Group Description is empty', + }); return; } - // verify description - // if (!groupImage) { - // showError("Group image can't be empty"); - // return; - // } } if (handleNext) { @@ -268,31 +269,42 @@ const CreateGroupDetail = ({ onChange={(e) => handleChange(e as unknown as Event)} /> - - setGroupInputDetails({ - groupDescription, - groupName: e.target.value, - groupImage, - }) - } - /> - -