Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
frontend
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
vicotor
frontend
Commits
1695c797
Commit
1695c797
authored
Dec 06, 2022
by
isstuev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add error message for invalid input and change mode
parent
7c0e052c
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
23 additions
and
16 deletions
+23
-16
ApiKeyForm.tsx
ui/apiKey/ApiKeyModal/ApiKeyForm.tsx
+2
-2
CustomAbiForm.tsx
ui/customAbi/CustomAbiModal/CustomAbiForm.tsx
+3
-3
AddressForm.tsx
ui/privateTags/AddressModal/AddressForm.tsx
+1
-1
TransactionForm.tsx
ui/privateTags/TransactionModal/TransactionForm.tsx
+1
-1
PublicTagFormComment.tsx
ui/publicTags/PublicTagsForm/PublicTagFormComment.tsx
+1
-1
PublicTagsForm.tsx
ui/publicTags/PublicTagsForm/PublicTagsForm.tsx
+1
-1
PublicTagsFormInput.tsx
ui/publicTags/PublicTagsForm/PublicTagsFormInput.tsx
+1
-1
AddressInput.tsx
ui/shared/AddressInput.tsx
+1
-1
InputPlaceholder.tsx
ui/shared/InputPlaceholder.tsx
+9
-2
TagInput.tsx
ui/shared/TagInput.tsx
+1
-1
TransactionInput.tsx
ui/shared/TransactionInput.tsx
+1
-1
AddressForm.tsx
ui/watchlist/AddressModal/AddressForm.tsx
+1
-1
No files found.
ui/apiKey/ApiKeyModal/ApiKeyForm.tsx
View file @
1695c797
...
@@ -34,7 +34,7 @@ const NAME_MAX_LENGTH = 255;
...
@@ -34,7 +34,7 @@ const NAME_MAX_LENGTH = 255;
const
ApiKeyForm
:
React
.
FC
<
Props
>
=
({
data
,
onClose
,
setAlertVisible
})
=>
{
const
ApiKeyForm
:
React
.
FC
<
Props
>
=
({
data
,
onClose
,
setAlertVisible
})
=>
{
const
{
control
,
handleSubmit
,
formState
:
{
errors
,
isValid
,
isDirty
},
setError
}
=
useForm
<
Inputs
>
({
const
{
control
,
handleSubmit
,
formState
:
{
errors
,
isValid
,
isDirty
},
setError
}
=
useForm
<
Inputs
>
({
mode
:
'
all
'
,
mode
:
'
onTouched
'
,
defaultValues
:
{
defaultValues
:
{
token
:
data
?.
api_key
||
''
,
token
:
data
?.
api_key
||
''
,
name
:
data
?.
name
||
''
,
name
:
data
?.
name
||
''
,
...
@@ -113,7 +113,7 @@ const ApiKeyForm: React.FC<Props> = ({ data, onClose, setAlertVisible }) => {
...
@@ -113,7 +113,7 @@ const ApiKeyForm: React.FC<Props> = ({ data, onClose, setAlertVisible }) => {
maxLength=
{
NAME_MAX_LENGTH
}
maxLength=
{
NAME_MAX_LENGTH
}
/>
/>
<
FormLabel
>
<
FormLabel
>
<
InputPlaceholder
text=
"Application name for API key (e.g Web3 project)"
error=
{
errors
.
name
?.
message
}
/>
<
InputPlaceholder
text=
"Application name for API key (e.g Web3 project)"
error=
{
errors
.
name
}
/>
</
FormLabel
>
</
FormLabel
>
</
FormControl
>
</
FormControl
>
);
);
...
...
ui/customAbi/CustomAbiModal/CustomAbiForm.tsx
View file @
1695c797
...
@@ -42,7 +42,7 @@ const CustomAbiForm: React.FC<Props> = ({ data, onClose, setAlertVisible }) => {
...
@@ -42,7 +42,7 @@ const CustomAbiForm: React.FC<Props> = ({ data, onClose, setAlertVisible }) => {
name
:
data
?.
name
||
''
,
name
:
data
?.
name
||
''
,
abi
:
JSON
.
stringify
(
data
?.
abi
)
||
''
,
abi
:
JSON
.
stringify
(
data
?.
abi
)
||
''
,
},
},
mode
:
'
all
'
,
mode
:
'
onTouched
'
,
});
});
const
queryClient
=
useQueryClient
();
const
queryClient
=
useQueryClient
();
...
@@ -118,7 +118,7 @@ const CustomAbiForm: React.FC<Props> = ({ data, onClose, setAlertVisible }) => {
...
@@ -118,7 +118,7 @@ const CustomAbiForm: React.FC<Props> = ({ data, onClose, setAlertVisible }) => {
isInvalid=
{
Boolean
(
errors
.
name
)
}
isInvalid=
{
Boolean
(
errors
.
name
)
}
maxLength=
{
NAME_MAX_LENGTH
}
maxLength=
{
NAME_MAX_LENGTH
}
/>
/>
<
InputPlaceholder
text=
"Project name"
error=
{
errors
.
name
?.
message
}
/>
<
InputPlaceholder
text=
"Project name"
error=
{
errors
.
name
}
/>
</
FormControl
>
</
FormControl
>
);
);
}
, [ errors, formBackgroundColor ]);
}
, [ errors, formBackgroundColor ]);
...
@@ -132,7 +132,7 @@ const CustomAbiForm: React.FC<Props> = ({ data, onClose, setAlertVisible }) => {
...
@@ -132,7 +132,7 @@ const CustomAbiForm: React.FC<Props> = ({ data, onClose, setAlertVisible }) => {
minH=
"300px"
minH=
"300px"
isInvalid=
{
Boolean
(
errors
.
abi
)
}
isInvalid=
{
Boolean
(
errors
.
abi
)
}
/>
/>
<
InputPlaceholder
text=
"Custom ABI [
{
...
}
]
(
JSON
format
)"
error=
{
errors
.
abi
?.
message
}
/>
<
InputPlaceholder
text=
"Custom ABI [
{
...
}
]
(
JSON
format
)"
error=
{
errors
.
abi
}
/>
</
FormControl
>
</
FormControl
>
);
);
}
, [ errors, formBackgroundColor ]);
}
, [ errors, formBackgroundColor ]);
...
...
ui/privateTags/AddressModal/AddressForm.tsx
View file @
1695c797
...
@@ -35,7 +35,7 @@ const AddressForm: React.FC<Props> = ({ data, onClose, setAlertVisible }) => {
...
@@ -35,7 +35,7 @@ const AddressForm: React.FC<Props> = ({ data, onClose, setAlertVisible }) => {
const
fetch
=
useFetch
();
const
fetch
=
useFetch
();
const
[
pending
,
setPending
]
=
useState
(
false
);
const
[
pending
,
setPending
]
=
useState
(
false
);
const
{
control
,
handleSubmit
,
formState
:
{
errors
,
isValid
,
isDirty
},
setError
}
=
useForm
<
Inputs
>
({
const
{
control
,
handleSubmit
,
formState
:
{
errors
,
isValid
,
isDirty
},
setError
}
=
useForm
<
Inputs
>
({
mode
:
'
all
'
,
mode
:
'
onTouched
'
,
defaultValues
:
{
defaultValues
:
{
address
:
data
?.
address_hash
||
''
,
address
:
data
?.
address_hash
||
''
,
tag
:
data
?.
name
||
''
,
tag
:
data
?.
name
||
''
,
...
...
ui/privateTags/TransactionModal/TransactionForm.tsx
View file @
1695c797
...
@@ -36,7 +36,7 @@ const TransactionForm: React.FC<Props> = ({ data, onClose, setAlertVisible }) =>
...
@@ -36,7 +36,7 @@ const TransactionForm: React.FC<Props> = ({ data, onClose, setAlertVisible }) =>
const
formBackgroundColor
=
useColorModeValue
(
'
white
'
,
'
gray.900
'
);
const
formBackgroundColor
=
useColorModeValue
(
'
white
'
,
'
gray.900
'
);
const
{
control
,
handleSubmit
,
formState
:
{
errors
,
isValid
,
isDirty
},
setError
}
=
useForm
<
Inputs
>
({
const
{
control
,
handleSubmit
,
formState
:
{
errors
,
isValid
,
isDirty
},
setError
}
=
useForm
<
Inputs
>
({
mode
:
'
all
'
,
mode
:
'
onTouched
'
,
defaultValues
:
{
defaultValues
:
{
transaction
:
data
?.
transaction_hash
||
''
,
transaction
:
data
?.
transaction_hash
||
''
,
tag
:
data
?.
name
||
''
,
tag
:
data
?.
name
||
''
,
...
...
ui/publicTags/PublicTagsForm/PublicTagFormComment.tsx
View file @
1695c797
...
@@ -25,7 +25,7 @@ export default function PublicTagFormComment({ control, error, size }: Props) {
...
@@ -25,7 +25,7 @@ export default function PublicTagFormComment({ control, error, size }: Props) {
isInvalid=
{
Boolean
(
error
)
}
isInvalid=
{
Boolean
(
error
)
}
/>
/>
<
FormLabel
>
<
FormLabel
>
<
InputPlaceholder
text=
"Specify the reason for adding tags and color preference(s)"
error=
{
error
?.
message
}
/>
<
InputPlaceholder
text=
"Specify the reason for adding tags and color preference(s)"
error=
{
error
}
/>
</
FormLabel
>
</
FormLabel
>
</
FormControl
>
</
FormControl
>
);
);
...
...
ui/publicTags/PublicTagsForm/PublicTagsForm.tsx
View file @
1695c797
...
@@ -73,7 +73,7 @@ const PublicTagsForm = ({ changeToDataScreen, data }: Props) => {
...
@@ -73,7 +73,7 @@ const PublicTagsForm = ({ changeToDataScreen, data }: Props) => {
comment
:
data
?.
additional_comment
||
''
,
comment
:
data
?.
additional_comment
||
''
,
action
:
data
?.
is_owner
===
undefined
||
data
?.
is_owner
?
'
add
'
:
'
report
'
,
action
:
data
?.
is_owner
===
undefined
||
data
?.
is_owner
?
'
add
'
:
'
report
'
,
},
},
mode
:
'
all
'
,
mode
:
'
onTouched
'
,
});
});
const
{
fields
,
append
,
remove
}
=
useFieldArray
({
const
{
fields
,
append
,
remove
}
=
useFieldArray
({
...
...
ui/publicTags/PublicTagsForm/PublicTagsFormInput.tsx
View file @
1695c797
...
@@ -36,7 +36,7 @@ export default function PublicTagsFormInput<Inputs extends FieldValues>({
...
@@ -36,7 +36,7 @@ export default function PublicTagsFormInput<Inputs extends FieldValues>({
isInvalid=
{
Boolean
(
error
)
}
isInvalid=
{
Boolean
(
error
)
}
maxLength=
{
TEXT_INPUT_MAX_LENGTH
}
maxLength=
{
TEXT_INPUT_MAX_LENGTH
}
/>
/>
<
InputPlaceholder
text=
{
label
}
error=
{
error
?.
message
}
/>
<
InputPlaceholder
text=
{
label
}
error=
{
error
}
/>
</
FormControl
>
</
FormControl
>
);
);
},
[
label
,
required
,
error
,
size
]);
},
[
label
,
required
,
error
,
size
]);
...
...
ui/shared/AddressInput.tsx
View file @
1695c797
...
@@ -32,7 +32,7 @@ export default function AddressInput<Inputs extends FieldValues, Name extends Pa
...
@@ -32,7 +32,7 @@ export default function AddressInput<Inputs extends FieldValues, Name extends Pa
isInvalid=
{
Boolean
(
error
)
}
isInvalid=
{
Boolean
(
error
)
}
maxLength=
{
ADDRESS_LENGTH
}
maxLength=
{
ADDRESS_LENGTH
}
/>
/>
<
InputPlaceholder
text=
{
placeholder
}
error=
{
error
?.
message
}
/>
<
InputPlaceholder
text=
{
placeholder
}
error=
{
error
}
/>
</
FormControl
>
</
FormControl
>
);
);
}
}
ui/shared/InputPlaceholder.tsx
View file @
1695c797
import
{
FormLabel
,
chakra
}
from
'
@chakra-ui/react
'
;
import
{
FormLabel
,
chakra
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
type
{
FieldError
}
from
'
react-hook-form
'
;
interface
Props
{
interface
Props
{
text
:
string
;
text
:
string
;
error
?:
string
;
error
?:
FieldError
;
}
}
const
InputPlaceholder
=
({
text
,
error
}:
Props
)
=>
{
const
InputPlaceholder
=
({
text
,
error
}:
Props
)
=>
{
let
errorMessage
=
error
?.
message
;
if
(
!
errorMessage
&&
error
?.
type
===
'
pattern
'
)
{
errorMessage
=
'
Invalid format
'
;
}
return
(
return
(
<
FormLabel
>
<
FormLabel
>
<
chakra
.
span
>
{
text
}
</
chakra
.
span
>
<
chakra
.
span
>
{
text
}
</
chakra
.
span
>
{
error
&&
<
chakra
.
span
order=
{
3
}
whiteSpace=
"pre"
>
-
{
error
}
</
chakra
.
span
>
}
{
error
Message
&&
<
chakra
.
span
order=
{
3
}
whiteSpace=
"pre"
>
-
{
errorMessage
}
</
chakra
.
span
>
}
</
FormLabel
>
</
FormLabel
>
);
);
};
};
...
...
ui/shared/TagInput.tsx
View file @
1695c797
...
@@ -23,7 +23,7 @@ function TagInput<Inputs extends FieldValues, Name extends Path<Inputs>>({ field
...
@@ -23,7 +23,7 @@ function TagInput<Inputs extends FieldValues, Name extends Path<Inputs>>({ field
isInvalid=
{
Boolean
(
error
)
}
isInvalid=
{
Boolean
(
error
)
}
maxLength=
{
TAG_MAX_LENGTH
}
maxLength=
{
TAG_MAX_LENGTH
}
/>
/>
<
InputPlaceholder
text=
"Private tag (max 35 characters)"
error=
{
error
?.
message
}
/>
<
InputPlaceholder
text=
"Private tag (max 35 characters)"
error=
{
error
}
/>
</
FormControl
>
</
FormControl
>
);
);
}
}
...
...
ui/shared/TransactionInput.tsx
View file @
1695c797
...
@@ -22,7 +22,7 @@ function TransactionInput<Field extends Partial<ControllerRenderProps<FieldValue
...
@@ -22,7 +22,7 @@ function TransactionInput<Field extends Partial<ControllerRenderProps<FieldValue
isInvalid=
{
Boolean
(
error
)
}
isInvalid=
{
Boolean
(
error
)
}
maxLength=
{
TRANSACTION_HASH_LENGTH
}
maxLength=
{
TRANSACTION_HASH_LENGTH
}
/>
/>
<
InputPlaceholder
text=
"Transaction hash (0x...)"
error=
{
error
?.
message
}
/>
<
InputPlaceholder
text=
"Transaction hash (0x...)"
error=
{
error
}
/>
</
FormControl
>
</
FormControl
>
);
);
}
}
...
...
ui/watchlist/AddressModal/AddressForm.tsx
View file @
1695c797
...
@@ -80,7 +80,7 @@ const AddressForm: React.FC<Props> = ({ data, onClose, setAlertVisible }) => {
...
@@ -80,7 +80,7 @@ const AddressForm: React.FC<Props> = ({ data, onClose, setAlertVisible }) => {
notification
:
data
?
data
.
notification_methods
.
email
:
true
,
notification
:
data
?
data
.
notification_methods
.
email
:
true
,
notification_settings
:
notificationsDefault
,
notification_settings
:
notificationsDefault
,
},
},
mode
:
'
all
'
,
mode
:
'
onTouched
'
,
});
});
const
queryClient
=
useQueryClient
();
const
queryClient
=
useQueryClient
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment