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
8b8f3c34
Commit
8b8f3c34
authored
Apr 06, 2023
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor
parent
0c8a5b7c
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
76 additions
and
98 deletions
+76
-98
TokenInfoForm.tsx
ui/tokenInfo/TokenInfoForm.tsx
+10
-2
TokenInfoFieldDocs.tsx
ui/tokenInfo/fields/TokenInfoFieldDocs.tsx
+6
-9
TokenInfoFieldPriceTicker.tsx
ui/tokenInfo/fields/TokenInfoFieldPriceTicker.tsx
+6
-9
TokenInfoFieldProjectDescription.tsx
ui/tokenInfo/fields/TokenInfoFieldProjectDescription.tsx
+7
-10
TokenInfoFieldProjectEmail.tsx
ui/tokenInfo/fields/TokenInfoFieldProjectEmail.tsx
+6
-9
TokenInfoFieldProjectName.tsx
ui/tokenInfo/fields/TokenInfoFieldProjectName.tsx
+6
-8
TokenInfoFieldProjectSector.tsx
ui/tokenInfo/fields/TokenInfoFieldProjectSector.tsx
+5
-7
TokenInfoFieldProjectWebsite.tsx
ui/tokenInfo/fields/TokenInfoFieldProjectWebsite.tsx
+6
-9
TokenInfoFieldRequesterEmail.tsx
ui/tokenInfo/fields/TokenInfoFieldRequesterEmail.tsx
+6
-9
TokenInfoFieldRequesterName.tsx
ui/tokenInfo/fields/TokenInfoFieldRequesterName.tsx
+6
-9
TokenInfoFieldSocialLink.tsx
ui/tokenInfo/fields/TokenInfoFieldSocialLink.tsx
+6
-9
TokenInfoFieldSupport.tsx
ui/tokenInfo/fields/TokenInfoFieldSupport.tsx
+6
-8
No files found.
ui/tokenInfo/TokenInfoForm.tsx
View file @
8b8f3c34
...
@@ -58,7 +58,7 @@ const TokenInfoForm = ({ id }: Props) => {
...
@@ -58,7 +58,7 @@ const TokenInfoForm = ({ id }: Props) => {
return
<
ContentLoader
/>;
return
<
ContentLoader
/>;
}
}
const
fieldProps
=
{
control
,
formState
};
const
fieldProps
=
{
control
};
return
(
return
(
<
form
noValidate
onSubmit=
{
onSubmit
}
>
<
form
noValidate
onSubmit=
{
onSubmit
}
>
...
@@ -104,7 +104,15 @@ const TokenInfoForm = ({ id }: Props) => {
...
@@ -104,7 +104,15 @@ const TokenInfoForm = ({ id }: Props) => {
<
TokenInfoFieldPriceTicker
{
...
fieldProps
}
name=
"ticker_defi_llama"
label=
"DefiLlama URL "
/>
<
TokenInfoFieldPriceTicker
{
...
fieldProps
}
name=
"ticker_defi_llama"
label=
"DefiLlama URL "
/>
</
GridItem
>
</
GridItem
>
</
Grid
>
</
Grid
>
<
Button
type=
"submit"
size=
"lg"
mt=
{
8
}
>
Send request
</
Button
>
<
Button
type=
"submit"
size=
"lg"
mt=
{
8
}
isLoading=
{
formState
.
isSubmitting
}
loadingText=
"Send request"
>
Send request
</
Button
>
</
form
>
</
form
>
);
);
};
};
...
...
ui/tokenInfo/fields/TokenInfoFieldDocs.tsx
View file @
8b8f3c34
import
{
FormControl
,
Input
}
from
'
@chakra-ui/react
'
;
import
{
FormControl
,
Input
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
type
{
Control
,
Controller
RenderProps
,
FormState
}
from
'
react-hook-form
'
;
import
type
{
Control
,
Controller
Props
}
from
'
react-hook-form
'
;
import
{
Controller
}
from
'
react-hook-form
'
;
import
{
Controller
}
from
'
react-hook-form
'
;
import
type
{
Fields
}
from
'
../types
'
;
import
type
{
Fields
}
from
'
../types
'
;
...
@@ -9,27 +9,24 @@ import { validator } from 'lib/validations/url';
...
@@ -9,27 +9,24 @@ import { validator } from 'lib/validations/url';
import
InputPlaceholder
from
'
ui/shared/InputPlaceholder
'
;
import
InputPlaceholder
from
'
ui/shared/InputPlaceholder
'
;
interface
Props
{
interface
Props
{
formState
:
FormState
<
Fields
>
;
control
:
Control
<
Fields
>
;
control
:
Control
<
Fields
>
;
isReadOnly
?:
boolean
;
isReadOnly
?:
boolean
;
}
}
const
TokenInfoFieldDocs
=
({
formState
,
control
,
isReadOnly
}:
Props
)
=>
{
const
TokenInfoFieldDocs
=
({
control
,
isReadOnly
}:
Props
)
=>
{
const
renderControl
=
React
.
useCallback
(({
field
}:
{
field
:
ControllerRenderProps
<
Fields
,
'
docs
'
>
})
=>
{
const
renderControl
:
ControllerProps
<
Fields
,
'
docs
'
>
[
'
render
'
]
=
React
.
useCallback
(({
field
,
fieldState
,
formState
})
=>
{
const
error
=
'
docs
'
in
formState
.
errors
?
formState
.
errors
.
docs
:
undefined
;
return
(
return
(
<
FormControl
variant=
"floating"
id=
{
field
.
name
}
size=
"lg"
>
<
FormControl
variant=
"floating"
id=
{
field
.
name
}
size=
"lg"
>
<
Input
<
Input
{
...
field
}
{
...
field
}
isInvalid=
{
Boolean
(
error
)
}
isInvalid=
{
Boolean
(
fieldState
.
error
)
}
isDisabled=
{
formState
.
isSubmitting
||
isReadOnly
}
isDisabled=
{
formState
.
isSubmitting
||
isReadOnly
}
autoComplete=
"off"
autoComplete=
"off"
/>
/>
<
InputPlaceholder
text=
"Docs"
error=
{
error
}
/>
<
InputPlaceholder
text=
"Docs"
error=
{
fieldState
.
error
}
/>
</
FormControl
>
</
FormControl
>
);
);
},
[
formState
.
errors
,
formState
.
isSubmitting
,
isReadOnly
]);
},
[
isReadOnly
]);
return
(
return
(
<
Controller
<
Controller
...
...
ui/tokenInfo/fields/TokenInfoFieldPriceTicker.tsx
View file @
8b8f3c34
import
{
FormControl
,
Input
}
from
'
@chakra-ui/react
'
;
import
{
FormControl
,
Input
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
type
{
Control
,
Controller
RenderProps
,
FormState
}
from
'
react-hook-form
'
;
import
type
{
Control
,
Controller
Props
}
from
'
react-hook-form
'
;
import
{
Controller
}
from
'
react-hook-form
'
;
import
{
Controller
}
from
'
react-hook-form
'
;
import
type
{
Fields
,
TickerUrlFields
}
from
'
../types
'
;
import
type
{
Fields
,
TickerUrlFields
}
from
'
../types
'
;
...
@@ -9,29 +9,26 @@ import { validator } from 'lib/validations/url';
...
@@ -9,29 +9,26 @@ import { validator } from 'lib/validations/url';
import
InputPlaceholder
from
'
ui/shared/InputPlaceholder
'
;
import
InputPlaceholder
from
'
ui/shared/InputPlaceholder
'
;
interface
Props
{
interface
Props
{
formState
:
FormState
<
Fields
>
;
control
:
Control
<
Fields
>
;
control
:
Control
<
Fields
>
;
isReadOnly
?:
boolean
;
isReadOnly
?:
boolean
;
name
:
keyof
TickerUrlFields
;
name
:
keyof
TickerUrlFields
;
label
:
string
;
label
:
string
;
}
}
const
TokenInfoFieldPriceTicker
=
({
formState
,
control
,
isReadOnly
,
name
,
label
}:
Props
)
=>
{
const
TokenInfoFieldPriceTicker
=
({
control
,
isReadOnly
,
name
,
label
}:
Props
)
=>
{
const
renderControl
=
React
.
useCallback
(({
field
}:
{
field
:
ControllerRenderProps
<
Fields
,
typeof
name
>
})
=>
{
const
renderControl
:
ControllerProps
<
Fields
,
typeof
name
>
[
'
render
'
]
=
React
.
useCallback
(({
field
,
fieldState
,
formState
})
=>
{
const
error
=
name
in
formState
.
errors
?
formState
.
errors
[
name
]
:
undefined
;
return
(
return
(
<
FormControl
variant=
"floating"
id=
{
field
.
name
}
size=
"lg"
>
<
FormControl
variant=
"floating"
id=
{
field
.
name
}
size=
"lg"
>
<
Input
<
Input
{
...
field
}
{
...
field
}
isInvalid=
{
Boolean
(
error
)
}
isInvalid=
{
Boolean
(
fieldState
.
error
)
}
isDisabled=
{
formState
.
isSubmitting
||
isReadOnly
}
isDisabled=
{
formState
.
isSubmitting
||
isReadOnly
}
autoComplete=
"off"
autoComplete=
"off"
/>
/>
<
InputPlaceholder
text=
{
label
}
error=
{
error
}
/>
<
InputPlaceholder
text=
{
label
}
error=
{
fieldState
.
error
}
/>
</
FormControl
>
</
FormControl
>
);
);
},
[
formState
.
errors
,
formState
.
isSubmitting
,
isReadOnly
,
name
,
label
]);
},
[
isReadOnly
,
label
]);
return
(
return
(
<
Controller
<
Controller
...
...
ui/tokenInfo/fields/TokenInfoFieldProjectDescription.tsx
View file @
8b8f3c34
import
{
FormControl
,
Text
,
Textarea
}
from
'
@chakra-ui/react
'
;
import
{
FormControl
,
Text
,
Textarea
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
type
{
Control
,
Controller
RenderProps
,
FormState
}
from
'
react-hook-form
'
;
import
type
{
Control
,
Controller
Props
}
from
'
react-hook-form
'
;
import
{
Controller
}
from
'
react-hook-form
'
;
import
{
Controller
}
from
'
react-hook-form
'
;
import
type
{
Fields
}
from
'
../types
'
;
import
type
{
Fields
}
from
'
../types
'
;
...
@@ -8,34 +8,31 @@ import type { Fields } from '../types';
...
@@ -8,34 +8,31 @@ import type { Fields } from '../types';
import
InputPlaceholder
from
'
ui/shared/InputPlaceholder
'
;
import
InputPlaceholder
from
'
ui/shared/InputPlaceholder
'
;
interface
Props
{
interface
Props
{
formState
:
FormState
<
Fields
>
;
control
:
Control
<
Fields
>
;
control
:
Control
<
Fields
>
;
isReadOnly
?:
boolean
;
isReadOnly
?:
boolean
;
}
}
const
TokenInfoFieldProjectDescription
=
({
formState
,
control
,
isReadOnly
}:
Props
)
=>
{
const
TokenInfoFieldProjectDescription
=
({
control
,
isReadOnly
}:
Props
)
=>
{
const
renderControl
=
React
.
useCallback
(({
field
}:
{
field
:
ControllerRenderProps
<
Fields
,
'
project_description
'
>
})
=>
{
const
renderControl
:
ControllerProps
<
Fields
,
'
project_description
'
>
[
'
render
'
]
=
React
.
useCallback
(({
field
,
fieldState
,
formState
})
=>
{
const
error
=
'
project_description
'
in
formState
.
errors
?
formState
.
errors
.
project_description
:
undefined
;
return
(
return
(
<
FormControl
variant=
"floating"
id=
{
field
.
name
}
size=
"lg"
isRequired
>
<
FormControl
variant=
"floating"
id=
{
field
.
name
}
size=
"lg"
isRequired
>
<
Textarea
<
Textarea
{
...
field
}
{
...
field
}
required
required
isInvalid=
{
Boolean
(
error
)
}
isInvalid=
{
Boolean
(
fieldState
.
error
)
}
isDisabled=
{
formState
.
isSubmitting
||
isReadOnly
}
isDisabled=
{
formState
.
isSubmitting
||
isReadOnly
}
autoComplete=
"off"
autoComplete=
"off"
maxH=
"160px"
maxH=
"160px"
maxLength=
{
300
}
maxLength=
{
300
}
/>
/>
<
InputPlaceholder
text=
"Project description"
error=
{
error
}
/>
<
InputPlaceholder
text=
"Project description"
error=
{
fieldState
.
error
}
/>
<
Text
variant=
"secondary"
fontSize=
"sm"
mt=
{
1
}
>
<
Text
variant=
"secondary"
fontSize=
"sm"
mt=
{
1
}
>
Introduce or summari
s
e the project’s operation/goals in a maximum of 300 characters.
Introduce or summari
z
e the project’s operation/goals in a maximum of 300 characters.
The description should be written in a neutral point of view and must exclude unsubstantiated claims unless proven otherwise.
The description should be written in a neutral point of view and must exclude unsubstantiated claims unless proven otherwise.
</
Text
>
</
Text
>
</
FormControl
>
</
FormControl
>
);
);
},
[
formState
.
errors
,
formState
.
isSubmitting
,
isReadOnly
]);
},
[
isReadOnly
]);
return
(
return
(
<
Controller
<
Controller
...
...
ui/tokenInfo/fields/TokenInfoFieldProjectEmail.tsx
View file @
8b8f3c34
import
{
FormControl
,
Input
}
from
'
@chakra-ui/react
'
;
import
{
FormControl
,
Input
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
type
{
Control
,
Controller
RenderProps
,
FormState
}
from
'
react-hook-form
'
;
import
type
{
Control
,
Controller
Props
}
from
'
react-hook-form
'
;
import
{
Controller
}
from
'
react-hook-form
'
;
import
{
Controller
}
from
'
react-hook-form
'
;
import
type
{
Fields
}
from
'
../types
'
;
import
type
{
Fields
}
from
'
../types
'
;
...
@@ -9,28 +9,25 @@ import { EMAIL_REGEXP } from 'lib/validations/email';
...
@@ -9,28 +9,25 @@ import { EMAIL_REGEXP } from 'lib/validations/email';
import
InputPlaceholder
from
'
ui/shared/InputPlaceholder
'
;
import
InputPlaceholder
from
'
ui/shared/InputPlaceholder
'
;
interface
Props
{
interface
Props
{
formState
:
FormState
<
Fields
>
;
control
:
Control
<
Fields
>
;
control
:
Control
<
Fields
>
;
isReadOnly
?:
boolean
;
isReadOnly
?:
boolean
;
}
}
const
TokenInfoFieldProjectEmail
=
({
formState
,
control
,
isReadOnly
}:
Props
)
=>
{
const
TokenInfoFieldProjectEmail
=
({
control
,
isReadOnly
}:
Props
)
=>
{
const
renderControl
=
React
.
useCallback
(({
field
}:
{
field
:
ControllerRenderProps
<
Fields
,
'
project_email
'
>
})
=>
{
const
renderControl
:
ControllerProps
<
Fields
,
'
project_email
'
>
[
'
render
'
]
=
React
.
useCallback
(({
field
,
fieldState
,
formState
})
=>
{
const
error
=
'
project_email
'
in
formState
.
errors
?
formState
.
errors
.
project_email
:
undefined
;
return
(
return
(
<
FormControl
variant=
"floating"
id=
{
field
.
name
}
isRequired
size=
"lg"
>
<
FormControl
variant=
"floating"
id=
{
field
.
name
}
isRequired
size=
"lg"
>
<
Input
<
Input
{
...
field
}
{
...
field
}
required
required
isInvalid=
{
Boolean
(
error
)
}
isInvalid=
{
Boolean
(
fieldState
.
error
)
}
isDisabled=
{
formState
.
isSubmitting
||
isReadOnly
}
isDisabled=
{
formState
.
isSubmitting
||
isReadOnly
}
autoComplete=
"off"
autoComplete=
"off"
/>
/>
<
InputPlaceholder
text=
"Official project email address"
error=
{
error
}
/>
<
InputPlaceholder
text=
"Official project email address"
error=
{
fieldState
.
error
}
/>
</
FormControl
>
</
FormControl
>
);
);
},
[
formState
.
errors
,
formState
.
isSubmitting
,
isReadOnly
]);
},
[
isReadOnly
]);
return
(
return
(
<
Controller
<
Controller
...
...
ui/tokenInfo/fields/TokenInfoFieldProjectName.tsx
View file @
8b8f3c34
import
{
FormControl
,
Input
}
from
'
@chakra-ui/react
'
;
import
{
FormControl
,
Input
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
type
{
Control
,
Controller
RenderProps
,
FormState
}
from
'
react-hook-form
'
;
import
type
{
Control
,
Controller
Props
}
from
'
react-hook-form
'
;
import
{
Controller
}
from
'
react-hook-form
'
;
import
{
Controller
}
from
'
react-hook-form
'
;
import
type
{
Fields
}
from
'
../types
'
;
import
type
{
Fields
}
from
'
../types
'
;
...
@@ -8,27 +8,25 @@ import type { Fields } from '../types';
...
@@ -8,27 +8,25 @@ import type { Fields } from '../types';
import
InputPlaceholder
from
'
ui/shared/InputPlaceholder
'
;
import
InputPlaceholder
from
'
ui/shared/InputPlaceholder
'
;
interface
Props
{
interface
Props
{
formState
:
FormState
<
Fields
>
;
control
:
Control
<
Fields
>
;
control
:
Control
<
Fields
>
;
isReadOnly
?:
boolean
;
isReadOnly
?:
boolean
;
}
}
const
TokenInfoFieldProjectName
=
({
formState
,
control
,
isReadOnly
}:
Props
)
=>
{
const
TokenInfoFieldProjectName
=
({
control
,
isReadOnly
}:
Props
)
=>
{
const
renderControl
=
React
.
useCallback
(({
field
}:
{
field
:
ControllerRenderProps
<
Fields
,
'
project_name
'
>
})
=>
{
const
renderControl
:
ControllerProps
<
Fields
,
'
project_name
'
>
[
'
render
'
]
=
React
.
useCallback
(({
field
,
fieldState
,
formState
})
=>
{
const
error
=
'
project_name
'
in
formState
.
errors
?
formState
.
errors
.
project_name
:
undefined
;
return
(
return
(
<
FormControl
variant=
"floating"
id=
{
field
.
name
}
size=
"lg"
>
<
FormControl
variant=
"floating"
id=
{
field
.
name
}
size=
"lg"
>
<
Input
<
Input
{
...
field
}
{
...
field
}
isInvalid=
{
Boolean
(
error
)
}
isInvalid=
{
Boolean
(
fieldState
.
error
)
}
isDisabled=
{
formState
.
isSubmitting
||
isReadOnly
}
isDisabled=
{
formState
.
isSubmitting
||
isReadOnly
}
autoComplete=
"off"
autoComplete=
"off"
/>
/>
<
InputPlaceholder
text=
"Project name"
error=
{
error
}
/>
<
InputPlaceholder
text=
"Project name"
error=
{
fieldState
.
error
}
/>
</
FormControl
>
</
FormControl
>
);
);
},
[
formState
.
errors
,
formState
.
isSubmitting
,
isReadOnly
]);
},
[
isReadOnly
]);
return
(
return
(
<
Controller
<
Controller
...
...
ui/tokenInfo/fields/TokenInfoFieldProjectSector.tsx
View file @
8b8f3c34
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
type
{
Control
,
Controller
RenderProps
,
FormState
}
from
'
react-hook-form
'
;
import
type
{
Control
,
Controller
Props
}
from
'
react-hook-form
'
;
import
{
Controller
}
from
'
react-hook-form
'
;
import
{
Controller
}
from
'
react-hook-form
'
;
import
type
{
Fields
}
from
'
../types
'
;
import
type
{
Fields
}
from
'
../types
'
;
...
@@ -8,19 +8,17 @@ import type { TokenInfoApplicationConfig } from 'types/api/account';
...
@@ -8,19 +8,17 @@ import type { TokenInfoApplicationConfig } from 'types/api/account';
import
FancySelect
from
'
ui/shared/FancySelect/FancySelect
'
;
import
FancySelect
from
'
ui/shared/FancySelect/FancySelect
'
;
interface
Props
{
interface
Props
{
formState
:
FormState
<
Fields
>
;
control
:
Control
<
Fields
>
;
control
:
Control
<
Fields
>
;
isReadOnly
?:
boolean
;
isReadOnly
?:
boolean
;
config
:
TokenInfoApplicationConfig
[
'
projectSectors
'
];
config
:
TokenInfoApplicationConfig
[
'
projectSectors
'
];
}
}
const
TokenInfoFieldProjectSector
=
({
formState
,
control
,
isReadOnly
,
config
}:
Props
)
=>
{
const
TokenInfoFieldProjectSector
=
({
control
,
isReadOnly
,
config
}:
Props
)
=>
{
const
options
=
React
.
useMemo
(()
=>
{
const
options
=
React
.
useMemo
(()
=>
{
return
config
.
map
((
option
)
=>
({
label
:
option
,
value
:
option
}));
return
config
.
map
((
option
)
=>
({
label
:
option
,
value
:
option
}));
},
[
config
]);
},
[
config
]);
const
renderControl
=
React
.
useCallback
(({
field
}:
{
field
:
ControllerRenderProps
<
Fields
,
'
project_sector
'
>
})
=>
{
const
renderControl
:
ControllerProps
<
Fields
,
'
project_sector
'
>
[
'
render
'
]
=
React
.
useCallback
(({
field
,
fieldState
,
formState
})
=>
{
const
error
=
'
project_sector
'
in
formState
.
errors
?
formState
.
errors
.
project_sector
:
undefined
;
return
(
return
(
<
FancySelect
<
FancySelect
...
@@ -29,10 +27,10 @@ const TokenInfoFieldProjectSector = ({ formState, control, isReadOnly, config }:
...
@@ -29,10 +27,10 @@ const TokenInfoFieldProjectSector = ({ formState, control, isReadOnly, config }:
size=
"lg"
size=
"lg"
placeholder=
"Project industry"
placeholder=
"Project industry"
isDisabled=
{
formState
.
isSubmitting
||
isReadOnly
}
isDisabled=
{
formState
.
isSubmitting
||
isReadOnly
}
error=
{
error
}
error=
{
fieldState
.
error
}
/>
/>
);
);
},
[
formState
.
errors
,
formState
.
isSubmitting
,
isReadOnly
,
options
]);
},
[
isReadOnly
,
options
]);
return
(
return
(
<
Controller
<
Controller
...
...
ui/tokenInfo/fields/TokenInfoFieldProjectWebsite.tsx
View file @
8b8f3c34
import
{
FormControl
,
Input
}
from
'
@chakra-ui/react
'
;
import
{
FormControl
,
Input
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
type
{
Control
,
Controller
RenderProps
,
FormState
}
from
'
react-hook-form
'
;
import
type
{
Control
,
Controller
Props
}
from
'
react-hook-form
'
;
import
{
Controller
}
from
'
react-hook-form
'
;
import
{
Controller
}
from
'
react-hook-form
'
;
import
type
{
Fields
}
from
'
../types
'
;
import
type
{
Fields
}
from
'
../types
'
;
...
@@ -9,28 +9,25 @@ import { validator } from 'lib/validations/url';
...
@@ -9,28 +9,25 @@ import { validator } from 'lib/validations/url';
import
InputPlaceholder
from
'
ui/shared/InputPlaceholder
'
;
import
InputPlaceholder
from
'
ui/shared/InputPlaceholder
'
;
interface
Props
{
interface
Props
{
formState
:
FormState
<
Fields
>
;
control
:
Control
<
Fields
>
;
control
:
Control
<
Fields
>
;
isReadOnly
?:
boolean
;
isReadOnly
?:
boolean
;
}
}
const
TokenInfoFieldProjectWebsite
=
({
formState
,
control
,
isReadOnly
}:
Props
)
=>
{
const
TokenInfoFieldProjectWebsite
=
({
control
,
isReadOnly
}:
Props
)
=>
{
const
renderControl
=
React
.
useCallback
(({
field
}:
{
field
:
ControllerRenderProps
<
Fields
,
'
project_website
'
>
})
=>
{
const
renderControl
:
ControllerProps
<
Fields
,
'
project_website
'
>
[
'
render
'
]
=
React
.
useCallback
(({
field
,
fieldState
,
formState
})
=>
{
const
error
=
'
project_website
'
in
formState
.
errors
?
formState
.
errors
.
project_website
:
undefined
;
return
(
return
(
<
FormControl
variant=
"floating"
id=
{
field
.
name
}
size=
"lg"
isRequired
>
<
FormControl
variant=
"floating"
id=
{
field
.
name
}
size=
"lg"
isRequired
>
<
Input
<
Input
{
...
field
}
{
...
field
}
isInvalid=
{
Boolean
(
error
)
}
isInvalid=
{
Boolean
(
fieldState
.
error
)
}
isDisabled=
{
formState
.
isSubmitting
||
isReadOnly
}
isDisabled=
{
formState
.
isSubmitting
||
isReadOnly
}
autoComplete=
"off"
autoComplete=
"off"
required
required
/>
/>
<
InputPlaceholder
text=
"Official project website"
error=
{
error
}
/>
<
InputPlaceholder
text=
"Official project website"
error=
{
fieldState
.
error
}
/>
</
FormControl
>
</
FormControl
>
);
);
},
[
formState
.
errors
,
formState
.
isSubmitting
,
isReadOnly
]);
},
[
isReadOnly
]);
return
(
return
(
<
Controller
<
Controller
...
...
ui/tokenInfo/fields/TokenInfoFieldRequesterEmail.tsx
View file @
8b8f3c34
import
{
FormControl
,
Input
}
from
'
@chakra-ui/react
'
;
import
{
FormControl
,
Input
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
type
{
Control
,
Controller
RenderProps
,
FormState
}
from
'
react-hook-form
'
;
import
type
{
Control
,
Controller
Props
}
from
'
react-hook-form
'
;
import
{
Controller
}
from
'
react-hook-form
'
;
import
{
Controller
}
from
'
react-hook-form
'
;
import
type
{
Fields
}
from
'
../types
'
;
import
type
{
Fields
}
from
'
../types
'
;
...
@@ -9,28 +9,25 @@ import { EMAIL_REGEXP } from 'lib/validations/email';
...
@@ -9,28 +9,25 @@ import { EMAIL_REGEXP } from 'lib/validations/email';
import
InputPlaceholder
from
'
ui/shared/InputPlaceholder
'
;
import
InputPlaceholder
from
'
ui/shared/InputPlaceholder
'
;
interface
Props
{
interface
Props
{
formState
:
FormState
<
Fields
>
;
control
:
Control
<
Fields
>
;
control
:
Control
<
Fields
>
;
isReadOnly
?:
boolean
;
isReadOnly
?:
boolean
;
}
}
const
TokenInfoFieldRequesterEmail
=
({
formState
,
control
,
isReadOnly
}:
Props
)
=>
{
const
TokenInfoFieldRequesterEmail
=
({
control
,
isReadOnly
}:
Props
)
=>
{
const
renderControl
=
React
.
useCallback
(({
field
}:
{
field
:
ControllerRenderProps
<
Fields
,
'
requester_email
'
>
})
=>
{
const
renderControl
:
ControllerProps
<
Fields
,
'
requester_email
'
>
[
'
render
'
]
=
React
.
useCallback
(({
field
,
fieldState
,
formState
})
=>
{
const
error
=
'
requester_email
'
in
formState
.
errors
?
formState
.
errors
.
requester_email
:
undefined
;
return
(
return
(
<
FormControl
variant=
"floating"
id=
{
field
.
name
}
isRequired
size=
"lg"
>
<
FormControl
variant=
"floating"
id=
{
field
.
name
}
isRequired
size=
"lg"
>
<
Input
<
Input
{
...
field
}
{
...
field
}
required
required
isInvalid=
{
Boolean
(
error
)
}
isInvalid=
{
Boolean
(
fieldState
.
error
)
}
isDisabled=
{
formState
.
isSubmitting
||
isReadOnly
}
isDisabled=
{
formState
.
isSubmitting
||
isReadOnly
}
autoComplete=
"off"
autoComplete=
"off"
/>
/>
<
InputPlaceholder
text=
"Requester email"
error=
{
error
}
/>
<
InputPlaceholder
text=
"Requester email"
error=
{
fieldState
.
error
}
/>
</
FormControl
>
</
FormControl
>
);
);
},
[
formState
.
errors
,
formState
.
isSubmitting
,
isReadOnly
]);
},
[
isReadOnly
]);
return
(
return
(
<
Controller
<
Controller
...
...
ui/tokenInfo/fields/TokenInfoFieldRequesterName.tsx
View file @
8b8f3c34
import
{
FormControl
,
Input
}
from
'
@chakra-ui/react
'
;
import
{
FormControl
,
Input
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
type
{
Control
,
Controller
RenderProps
,
FormState
}
from
'
react-hook-form
'
;
import
type
{
Control
,
Controller
Props
}
from
'
react-hook-form
'
;
import
{
Controller
}
from
'
react-hook-form
'
;
import
{
Controller
}
from
'
react-hook-form
'
;
import
type
{
Fields
}
from
'
../types
'
;
import
type
{
Fields
}
from
'
../types
'
;
...
@@ -8,28 +8,25 @@ import type { Fields } from '../types';
...
@@ -8,28 +8,25 @@ import type { Fields } from '../types';
import
InputPlaceholder
from
'
ui/shared/InputPlaceholder
'
;
import
InputPlaceholder
from
'
ui/shared/InputPlaceholder
'
;
interface
Props
{
interface
Props
{
formState
:
FormState
<
Fields
>
;
control
:
Control
<
Fields
>
;
control
:
Control
<
Fields
>
;
isReadOnly
?:
boolean
;
isReadOnly
?:
boolean
;
}
}
const
TokenInfoFieldRequesterName
=
({
formState
,
control
,
isReadOnly
}:
Props
)
=>
{
const
TokenInfoFieldRequesterName
=
({
control
,
isReadOnly
}:
Props
)
=>
{
const
renderControl
=
React
.
useCallback
(({
field
}:
{
field
:
ControllerRenderProps
<
Fields
,
'
requester_name
'
>
})
=>
{
const
renderControl
:
ControllerProps
<
Fields
,
'
requester_name
'
>
[
'
render
'
]
=
React
.
useCallback
(({
field
,
fieldState
,
formState
})
=>
{
const
error
=
'
requester_name
'
in
formState
.
errors
?
formState
.
errors
.
requester_name
:
undefined
;
return
(
return
(
<
FormControl
variant=
"floating"
id=
{
field
.
name
}
isRequired
size=
"lg"
>
<
FormControl
variant=
"floating"
id=
{
field
.
name
}
isRequired
size=
"lg"
>
<
Input
<
Input
{
...
field
}
{
...
field
}
required
required
isInvalid=
{
Boolean
(
error
)
}
isInvalid=
{
Boolean
(
fieldState
.
error
)
}
isDisabled=
{
formState
.
isSubmitting
||
isReadOnly
}
isDisabled=
{
formState
.
isSubmitting
||
isReadOnly
}
autoComplete=
"off"
autoComplete=
"off"
/>
/>
<
InputPlaceholder
text=
"Requester name"
error=
{
error
}
/>
<
InputPlaceholder
text=
"Requester name"
error=
{
fieldState
.
error
}
/>
</
FormControl
>
</
FormControl
>
);
);
},
[
formState
.
errors
,
formState
.
isSubmitting
,
isReadOnly
]);
},
[
isReadOnly
]);
return
(
return
(
<
Controller
<
Controller
...
...
ui/tokenInfo/fields/TokenInfoFieldSocialLink.tsx
View file @
8b8f3c34
import
{
FormControl
,
Icon
,
Input
,
InputRightElement
,
InputGroup
}
from
'
@chakra-ui/react
'
;
import
{
FormControl
,
Icon
,
Input
,
InputRightElement
,
InputGroup
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
type
{
Control
,
Controller
RenderProps
,
FormState
}
from
'
react-hook-form
'
;
import
type
{
Control
,
Controller
Props
}
from
'
react-hook-form
'
;
import
{
Controller
}
from
'
react-hook-form
'
;
import
{
Controller
}
from
'
react-hook-form
'
;
import
type
{
Fields
,
SocialLinkFields
}
from
'
../types
'
;
import
type
{
Fields
,
SocialLinkFields
}
from
'
../types
'
;
...
@@ -37,33 +37,30 @@ const SETTINGS: Record<keyof SocialLinkFields, Item> = {
...
@@ -37,33 +37,30 @@ const SETTINGS: Record<keyof SocialLinkFields, Item> = {
};
};
interface
Props
{
interface
Props
{
formState
:
FormState
<
Fields
>
;
control
:
Control
<
Fields
>
;
control
:
Control
<
Fields
>
;
isReadOnly
?:
boolean
;
isReadOnly
?:
boolean
;
name
:
keyof
SocialLinkFields
;
name
:
keyof
SocialLinkFields
;
}
}
const
TokenInfoFieldSocialLink
=
({
formState
,
control
,
isReadOnly
,
name
}:
Props
)
=>
{
const
TokenInfoFieldSocialLink
=
({
control
,
isReadOnly
,
name
}:
Props
)
=>
{
const
renderControl
=
React
.
useCallback
(({
field
}:
{
field
:
ControllerRenderProps
<
Fields
,
typeof
name
>
})
=>
{
const
renderControl
:
ControllerProps
<
Fields
,
typeof
name
>
[
'
render
'
]
=
React
.
useCallback
(({
field
,
fieldState
,
formState
})
=>
{
const
error
=
name
in
formState
.
errors
?
formState
.
errors
[
name
]
:
undefined
;
return
(
return
(
<
FormControl
variant=
"floating"
id=
{
field
.
name
}
size=
"lg"
sx=
{
{
'
.chakra-input__group input
'
:
{
pr
:
'
60px
'
}
}
}
>
<
FormControl
variant=
"floating"
id=
{
field
.
name
}
size=
"lg"
sx=
{
{
'
.chakra-input__group input
'
:
{
pr
:
'
60px
'
}
}
}
>
<
InputGroup
>
<
InputGroup
>
<
Input
<
Input
{
...
field
}
{
...
field
}
isInvalid=
{
Boolean
(
error
)
}
isInvalid=
{
Boolean
(
fieldState
.
error
)
}
isDisabled=
{
formState
.
isSubmitting
||
isReadOnly
}
isDisabled=
{
formState
.
isSubmitting
||
isReadOnly
}
autoComplete=
"off"
autoComplete=
"off"
/>
/>
<
InputPlaceholder
text=
{
SETTINGS
[
name
].
label
}
error=
{
error
}
/>
<
InputPlaceholder
text=
{
SETTINGS
[
name
].
label
}
error=
{
fieldState
.
error
}
/>
<
InputRightElement
h=
"100%"
>
<
InputRightElement
h=
"100%"
>
<
Icon
as=
{
SETTINGS
[
name
].
icon
}
boxSize=
{
6
}
color=
{
field
.
value
?
SETTINGS
[
name
].
color
:
'
#718096
'
}
/>
<
Icon
as=
{
SETTINGS
[
name
].
icon
}
boxSize=
{
6
}
color=
{
field
.
value
?
SETTINGS
[
name
].
color
:
'
#718096
'
}
/>
</
InputRightElement
>
</
InputRightElement
>
</
InputGroup
>
</
InputGroup
>
</
FormControl
>
</
FormControl
>
);
);
},
[
formState
.
errors
,
formState
.
isSubmitting
,
isReadOnly
,
name
]);
},
[
isReadOnly
,
name
]);
return
(
return
(
<
Controller
<
Controller
...
...
ui/tokenInfo/fields/TokenInfoFieldSupport.tsx
View file @
8b8f3c34
import
{
FormControl
,
Input
}
from
'
@chakra-ui/react
'
;
import
{
FormControl
,
Input
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
type
{
Control
,
Controller
RenderProps
,
FormState
}
from
'
react-hook-form
'
;
import
type
{
Control
,
Controller
Props
}
from
'
react-hook-form
'
;
import
{
Controller
}
from
'
react-hook-form
'
;
import
{
Controller
}
from
'
react-hook-form
'
;
import
type
{
Fields
}
from
'
../types
'
;
import
type
{
Fields
}
from
'
../types
'
;
...
@@ -9,27 +9,25 @@ import { validator } from 'lib/validations/url';
...
@@ -9,27 +9,25 @@ import { validator } from 'lib/validations/url';
import
InputPlaceholder
from
'
ui/shared/InputPlaceholder
'
;
import
InputPlaceholder
from
'
ui/shared/InputPlaceholder
'
;
interface
Props
{
interface
Props
{
formState
:
FormState
<
Fields
>
;
control
:
Control
<
Fields
>
;
control
:
Control
<
Fields
>
;
isReadOnly
?:
boolean
;
isReadOnly
?:
boolean
;
}
}
const
TokenInfoFieldSupport
=
({
formState
,
control
,
isReadOnly
}:
Props
)
=>
{
const
TokenInfoFieldSupport
=
({
control
,
isReadOnly
}:
Props
)
=>
{
const
renderControl
=
React
.
useCallback
(({
field
}:
{
field
:
ControllerRenderProps
<
Fields
,
'
support
'
>
})
=>
{
const
renderControl
:
ControllerProps
<
Fields
,
'
support
'
>
[
'
render
'
]
=
React
.
useCallback
(({
field
,
fieldState
,
formState
})
=>
{
const
error
=
'
support
'
in
formState
.
errors
?
formState
.
errors
.
support
:
undefined
;
return
(
return
(
<
FormControl
variant=
"floating"
id=
{
field
.
name
}
size=
"lg"
>
<
FormControl
variant=
"floating"
id=
{
field
.
name
}
size=
"lg"
>
<
Input
<
Input
{
...
field
}
{
...
field
}
isInvalid=
{
Boolean
(
error
)
}
isInvalid=
{
Boolean
(
fieldState
.
error
)
}
isDisabled=
{
formState
.
isSubmitting
||
isReadOnly
}
isDisabled=
{
formState
.
isSubmitting
||
isReadOnly
}
autoComplete=
"off"
autoComplete=
"off"
/>
/>
<
InputPlaceholder
text=
"Support"
error=
{
error
}
/>
<
InputPlaceholder
text=
"Support"
error=
{
fieldState
.
error
}
/>
</
FormControl
>
</
FormControl
>
);
);
},
[
formState
.
errors
,
formState
.
isSubmitting
,
isReadOnly
]);
},
[
isReadOnly
]);
return
(
return
(
<
Controller
<
Controller
...
...
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