diff --git a/src/components/Authentication/SignUpUserName.tsx b/src/components/Authentication/SignUpUserName.tsx index c91195775..94f814727 100644 --- a/src/components/Authentication/SignUpUserName.tsx +++ b/src/components/Authentication/SignUpUserName.tsx @@ -1,7 +1,5 @@ import 'react-toastify/dist/ReactToastify.css'; - import * as yup from 'yup'; - import { Button, Label } from 'flowbite-react'; import { Field, @@ -9,12 +7,11 @@ import { Formik } from 'formik'; import { useState } from 'react'; - -import React from 'react'; import SignUpUserPasskey from './SignUpUserPasskey.js'; import SignUpUser from './SignUpUser.js'; import NavBar from './NavBar.js'; import FooterBar from './FooterBar.js'; +import React from 'react'; interface nameValues { firstName: string; @@ -126,13 +123,13 @@ const SignUpUserName = () => { .string() .required('First name is required') .min(2, 'First name must be at least 2 characters') - .max(50, 'First name must be at most 255 characters') + .max(50, 'First name must be at most 50 characters') .trim(), lastName: yup .string() .required('Last name is required') .min(2, 'Last name must be at least 2 characters') - .max(50, 'Last name must be at most 255 characters') + .max(50, 'Last name must be at most 50 characters') .trim() })} validateOnBlur @@ -151,72 +148,134 @@ const SignUpUserName = () => { lastName: formikHandlers.values.lastName }) return ( -
- ) + ); }} diff --git a/src/components/CreateEcosystemOrgModal/index.tsx b/src/components/CreateEcosystemOrgModal/index.tsx index 264b49303..a7b1462e3 100644 --- a/src/components/CreateEcosystemOrgModal/index.tsx +++ b/src/components/CreateEcosystemOrgModal/index.tsx @@ -14,6 +14,7 @@ import { createOrganization } from "../../api/organization"; import { getFromLocalStorage } from "../../api/Auth"; import { createEcosystems } from "../../api/ecosystem"; import { getOrgDetails } from "../../config/ecosystem"; +import React from "react"; interface Values { name: string; @@ -340,7 +341,19 @@ const CreateEcosystemOrgModal = (props: IProps) => { name="name" value={formikHandlers.values.name} className="bg-gray-50 border border-gray-300 text-gray-900 sm:text-sm rounded-lg focus:ring-primary-500 focus:border-primary-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-primary-500 dark:focus:border-primary-500" - placeholder={`Enter ${popupName} Name`} /> + placeholder={`Enter ${popupName} Name`} + onChange={(e) => { + const value = e.target.value; + formikHandlers.setFieldValue('name', value); + formikHandlers.setFieldTouched('name', true); + + if (value.length > 50) { + formikHandlers.setFieldError('name', props.isorgModal ? 'Organization name must be at most 50 characters' : 'Ecosystem name must be at most 50 characters'); + } else { + formikHandlers.setFieldError('name', undefined); + } + }} + /> { (formikHandlers?.errors?.name && formikHandlers?.touched?.name) && {formikHandlers?.errors?.name} @@ -365,7 +378,19 @@ const CreateEcosystemOrgModal = (props: IProps) => { value={formikHandlers.values.description} as='textarea' className="bg-gray-50 border border-gray-300 text-gray-900 sm:text-sm rounded-lg focus:ring-primary-500 focus:border-primary-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-primary-500 dark:focus:border-primary-500" - placeholder={`Enter ${popupName} Description`} /> + placeholder={`Enter ${popupName} Description`} + onChange={(e) => { + const value = e.target.value; + formikHandlers.setFieldValue('description', value); + formikHandlers.setFieldTouched('description', true); + + if (value.length > 50) { + formikHandlers.setFieldError('description', 'Description must be at most 255 characters'); + } else { + formikHandlers.setFieldError('description', undefined); + } + }} + /> { (formikHandlers?.errors?.description && formikHandlers?.touched?.description) && {formikHandlers?.errors?.description} @@ -385,14 +410,11 @@ const CreateEcosystemOrgModal = (props: IProps) => { )} - - ) } - return ( <> {renderEcosystemModal()} diff --git a/src/components/EditEcosystemOrgModal/index.tsx b/src/components/EditEcosystemOrgModal/index.tsx index b2ec9e95c..986e5bba8 100644 --- a/src/components/EditEcosystemOrgModal/index.tsx +++ b/src/components/EditEcosystemOrgModal/index.tsx @@ -295,6 +295,18 @@ const EditPopupModal = (props: EditEntityModalProps) => { value={formikHandlers.values.name} className="bg-gray-50 border border-gray-300 text-gray-900 sm:text-sm rounded-lg focus:ring-primary-500 focus:border-primary-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-primary-500 dark:focus:border-primary-500" placeholder={`Enter ${props.isOrganization ? "Organization" : "Ecosystem"} Name`} + onChange={(e) => { + const value = e.target.value; + formikHandlers.setFieldValue('name', value); + formikHandlers.setFieldTouched('name', true); + + if (value.length > 50) { + formikHandlers.setFieldError('name', props.isOrganization ? 'Organization name must be at most 50 characters' : 'Ecosystem name must be at most 50 characters'); + } else { + formikHandlers.setFieldError('name', undefined); + } + }} + /> {formikHandlers?.errors?.name && formikHandlers?.touched?.name && ( {formikHandlers?.errors?.name} @@ -312,6 +324,18 @@ const EditPopupModal = (props: EditEntityModalProps) => { as='textarea' className="bg-gray-50 border border-gray-300 text-gray-900 sm:text-sm rounded-lg focus:ring-primary-500 focus:border-primary-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-primary-500 dark:focus:border-primary-500" placeholder={`Enter ${props.isOrganization ? "Organization" : "Ecosystem"} Description`} + onChange={(e) => { + const value = e.target.value; + formikHandlers.setFieldValue('description', value); + formikHandlers.setFieldTouched('description', true); + + if (value.length > 50) { + formikHandlers.setFieldError('description', 'Description must be at most 255 characters'); + } else { + formikHandlers.setFieldError('description', undefined); + } + }} + /> {formikHandlers?.errors?.description && formikHandlers?.touched?.description && ( {formikHandlers?.errors?.description} diff --git a/src/components/Issuance/IssuedCrdentials.tsx b/src/components/Issuance/IssuedCrdentials.tsx index 70c934289..4c8430b10 100644 --- a/src/components/Issuance/IssuedCrdentials.tsx +++ b/src/components/Issuance/IssuedCrdentials.tsx @@ -21,6 +21,7 @@ import { dateConversion } from '../../utils/DateConversion'; import { getIssuedCredentials } from '../../api/issuance'; import { pathRoutes } from '../../config/pathRoutes'; import { getFromLocalStorage } from '../../api/Auth'; +import { getOrgDetails } from '../../config/ecosystem' interface IssuedCredential { metadata: { [x: string]: { schemaId: string } }; @@ -34,11 +35,15 @@ const CredentialList = () => { const [error, setError] = useState- {proofReqSuccess || errMsg} -
- -+ {proofReqSuccess || errMsg} +
+ +