Commit 4a22b161 authored by isstuev's avatar isstuev

validations folder

parent 5d61a842
export const EMAIL_REGEXP = /^[\w.%+-]+@[a-zA-Z\d-]+(?:\.[a-zA-Z\d-]+)+$/;
...@@ -14,7 +14,7 @@ import { useForm, Controller } from 'react-hook-form'; ...@@ -14,7 +14,7 @@ import { useForm, Controller } from 'react-hook-form';
import type { CustomAbi, CustomAbis } from 'types/api/account'; import type { CustomAbi, CustomAbis } from 'types/api/account';
import { ADDRESS_REGEXP } from 'lib/addressValidations'; import { ADDRESS_REGEXP } from 'lib/validations/address';
import AddressInput from 'ui/shared/AddressInput'; import AddressInput from 'ui/shared/AddressInput';
type Props = { type Props = {
......
...@@ -10,7 +10,7 @@ import { useForm, Controller } from 'react-hook-form'; ...@@ -10,7 +10,7 @@ import { useForm, Controller } from 'react-hook-form';
import type { AddressTag } from 'types/api/account'; import type { AddressTag } from 'types/api/account';
import { ADDRESS_REGEXP } from 'lib/addressValidations'; import { ADDRESS_REGEXP } from 'lib/validations/address';
import AddressInput from 'ui/shared/AddressInput'; import AddressInput from 'ui/shared/AddressInput';
import TagInput from 'ui/shared/TagInput'; import TagInput from 'ui/shared/TagInput';
......
...@@ -10,7 +10,7 @@ import { useForm, Controller } from 'react-hook-form'; ...@@ -10,7 +10,7 @@ import { useForm, Controller } from 'react-hook-form';
import type { TransactionTag } from 'types/api/account'; import type { TransactionTag } from 'types/api/account';
import { TRANSACTION_HASH_LENGTH, TRANSACTION_HASH_REGEXP } from 'lib/transactionValidations'; import { TRANSACTION_HASH_LENGTH, TRANSACTION_HASH_REGEXP } from 'lib/validations/transaction';
import TagInput from 'ui/shared/TagInput'; import TagInput from 'ui/shared/TagInput';
import TransactionInput from 'ui/shared/TransactionInput'; import TransactionInput from 'ui/shared/TransactionInput';
......
...@@ -5,7 +5,7 @@ import { Controller } from 'react-hook-form'; ...@@ -5,7 +5,7 @@ import { Controller } from 'react-hook-form';
import MinusIcon from 'icons/minus.svg'; import MinusIcon from 'icons/minus.svg';
import PlusIcon from 'icons/plus.svg'; import PlusIcon from 'icons/plus.svg';
import { ADDRESS_REGEXP } from 'lib/addressValidations'; import { ADDRESS_REGEXP } from 'lib/validations/address';
import AddressInput from 'ui/shared/AddressInput'; import AddressInput from 'ui/shared/AddressInput';
import type { Inputs } from './PublicTagsForm'; import type { Inputs } from './PublicTagsForm';
......
...@@ -11,6 +11,7 @@ import type { Path } from 'react-hook-form'; ...@@ -11,6 +11,7 @@ import type { Path } from 'react-hook-form';
import { useForm, useFieldArray } from 'react-hook-form'; import { useForm, useFieldArray } from 'react-hook-form';
import type { TPublicTagItem, TPublicTag, TPublicTagAddress } from 'data/publicTags'; import type { TPublicTagItem, TPublicTag, TPublicTagAddress } from 'data/publicTags';
import { EMAIL_REGEXP } from 'lib/validations/email';
import PublicTagFormAction from './PublicTagFormAction'; import PublicTagFormAction from './PublicTagFormAction';
import PublicTagFormAddressInput from './PublicTagFormAddressInput'; import PublicTagFormAddressInput from './PublicTagFormAddressInput';
...@@ -98,7 +99,7 @@ const PublicTagsForm = ({ changeToDataScreen, data }: Props) => { ...@@ -98,7 +99,7 @@ const PublicTagsForm = ({ changeToDataScreen, data }: Props) => {
fieldName="userEmail" fieldName="userEmail"
control={ control } control={ control }
label={ placeholders.userEmail } label={ placeholders.userEmail }
pattern={ /^[\w.%+-]+@[a-zA-Z\d-]+(?:\.[a-zA-Z\d-]+)+$/ } pattern={ EMAIL_REGEXP }
hasError={ Boolean(errors.userEmail) } hasError={ Boolean(errors.userEmail) }
required required
/> />
......
...@@ -6,7 +6,7 @@ import { ...@@ -6,7 +6,7 @@ import {
import React from 'react'; import React from 'react';
import type { ControllerRenderProps, FieldValues, Path } from 'react-hook-form'; import type { ControllerRenderProps, FieldValues, Path } from 'react-hook-form';
import { ADDRESS_LENGTH } from 'lib/addressValidations'; import { ADDRESS_LENGTH } from 'lib/validations/address';
type Props<TInputs extends FieldValues, TInputName extends Path<TInputs>> = { type Props<TInputs extends FieldValues, TInputName extends Path<TInputs>> = {
field: ControllerRenderProps<TInputs, TInputName>; field: ControllerRenderProps<TInputs, TInputName>;
......
...@@ -14,7 +14,7 @@ import { useForm, Controller } from 'react-hook-form'; ...@@ -14,7 +14,7 @@ import { useForm, Controller } from 'react-hook-form';
import type { TWatchlistItem } from 'types/client/account'; import type { TWatchlistItem } from 'types/client/account';
import { ADDRESS_REGEXP } from 'lib/addressValidations'; import { ADDRESS_REGEXP } from 'lib/validations/address';
import AddressInput from 'ui/shared/AddressInput'; import AddressInput from 'ui/shared/AddressInput';
import TagInput from 'ui/shared/TagInput'; import TagInput from 'ui/shared/TagInput';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment