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
eb298eca
Commit
eb298eca
authored
Apr 19, 2023
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add token name field
parent
c2b3d2c1
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
50 additions
and
7 deletions
+50
-7
VerifiedAddresses.tsx
ui/pages/VerifiedAddresses.tsx
+3
-0
TokenInfoForm.tsx
ui/tokenInfo/TokenInfoForm.tsx
+6
-5
TokenInfoFieldTokenName.tsx
ui/tokenInfo/fields/TokenInfoFieldTokenName.tsx
+37
-0
types.ts
ui/tokenInfo/types.ts
+1
-0
utils.ts
ui/tokenInfo/utils.ts
+3
-2
No files found.
ui/pages/VerifiedAddresses.tsx
View file @
eb298eca
...
...
@@ -126,11 +126,14 @@ const VerifiedAddresses = () => {
},
[
handleGoBack
,
selectedAddress
]);
if
(
selectedAddress
)
{
const
addressInfo
=
addressesQuery
.
data
?.
verifiedAddresses
.
find
(({
contractAddress
})
=>
contractAddress
.
toLowerCase
()
===
selectedAddress
.
toLowerCase
());
const
tokenName
=
addressInfo
?
`
${
addressInfo
.
metadata
.
tokenName
}
(
${
addressInfo
.
metadata
.
tokenSymbol
}
)`
:
''
;
return
(
<>
<
PageTitle
text=
"Token info application form"
backLink=
{
backLink
}
/>
<
TokenInfoForm
address=
{
selectedAddress
}
tokenName=
{
tokenName
}
application=
{
applicationsQuery
.
data
?.
submissions
.
find
(({
tokenAddress
})
=>
tokenAddress
.
toLowerCase
()
===
selectedAddress
.
toLowerCase
())
}
onSubmit=
{
handleApplicationSubmit
}
/>
...
...
ui/tokenInfo/TokenInfoForm.tsx
View file @
eb298eca
...
...
@@ -28,16 +28,18 @@ import TokenInfoFieldRequesterEmail from './fields/TokenInfoFieldRequesterEmail'
import
TokenInfoFieldRequesterName
from
'
./fields/TokenInfoFieldRequesterName
'
;
import
TokenInfoFieldSocialLink
from
'
./fields/TokenInfoFieldSocialLink
'
;
import
TokenInfoFieldSupport
from
'
./fields/TokenInfoFieldSupport
'
;
import
TokenInfoFieldTokenName
from
'
./fields/TokenInfoFieldTokenName
'
;
import
TokenInfoFormSectionHeader
from
'
./TokenInfoFormSectionHeader
'
;
import
{
getFormDefaultValues
,
prepareRequestBody
}
from
'
./utils
'
;
interface
Props
{
address
:
string
;
tokenName
:
string
;
application
?:
TokenInfoApplication
;
onSubmit
:
(
application
:
TokenInfoApplication
)
=>
void
;
}
const
TokenInfoForm
=
({
address
,
application
,
onSubmit
}:
Props
)
=>
{
const
TokenInfoForm
=
({
address
,
tokenName
,
application
,
onSubmit
}:
Props
)
=>
{
const
containerRef
=
React
.
useRef
<
HTMLFormElement
>
(
null
);
...
...
@@ -50,7 +52,7 @@ const TokenInfoForm = ({ address, application, onSubmit }: Props) => {
const
formApi
=
useForm
<
Fields
>
({
mode
:
'
onBlur
'
,
defaultValues
:
getFormDefaultValues
(
address
,
application
),
defaultValues
:
getFormDefaultValues
(
address
,
tokenName
,
application
),
});
const
{
handleSubmit
,
formState
,
control
,
trigger
}
=
formApi
;
...
...
@@ -107,9 +109,8 @@ const TokenInfoForm = ({ address, application, onSubmit }: Props) => {
<
Alert
status=
"warning"
mt=
{
6
}
>
Request in progress. Once an admin approves your request you can edit token info.
</
Alert
>
}
<
Grid
mt=
{
8
}
gridTemplateColumns=
{
{
base
:
'
1fr
'
,
lg
:
'
1fr 1fr
'
}
}
columnGap=
{
5
}
rowGap=
{
5
}
>
<
GridItem
colSpan=
{
{
base
:
1
,
lg
:
2
}
}
>
<
TokenInfoFieldAddress
{
...
fieldProps
}
/>
</
GridItem
>
<
TokenInfoFieldAddress
{
...
fieldProps
}
/>
<
TokenInfoFieldTokenName
{
...
fieldProps
}
/>
<
TokenInfoFieldRequesterName
{
...
fieldProps
}
/>
<
TokenInfoFieldRequesterEmail
{
...
fieldProps
}
/>
...
...
ui/tokenInfo/fields/TokenInfoFieldTokenName.tsx
0 → 100644
View file @
eb298eca
import
{
FormControl
,
Input
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
type
{
Control
,
ControllerRenderProps
}
from
'
react-hook-form
'
;
import
{
Controller
}
from
'
react-hook-form
'
;
import
type
{
Fields
}
from
'
../types
'
;
import
InputPlaceholder
from
'
ui/shared/InputPlaceholder
'
;
interface
Props
{
control
:
Control
<
Fields
>
;
}
const
TokenInfoFieldTokenName
=
({
control
}:
Props
)
=>
{
const
renderControl
=
React
.
useCallback
(({
field
}:
{
field
:
ControllerRenderProps
<
Fields
,
'
token_name
'
>
})
=>
{
return
(
<
FormControl
variant=
"floating"
id=
{
field
.
name
}
isRequired
size=
{
{
base
:
'
md
'
,
lg
:
'
lg
'
}
}
>
<
Input
{
...
field
}
required
isDisabled
/>
<
InputPlaceholder
text=
"Token name"
/>
</
FormControl
>
);
},
[]);
return
(
<
Controller
name=
"token_name"
control=
{
control
}
render=
{
renderControl
}
/>
);
};
export
default
React
.
memo
(
TokenInfoFieldTokenName
);
ui/tokenInfo/types.ts
View file @
eb298eca
...
...
@@ -2,6 +2,7 @@ import type { Option } from 'ui/shared/FancySelect/types';
export
interface
Fields
extends
SocialLinkFields
,
TickerUrlFields
{
address
:
string
;
token_name
:
string
;
requester_name
:
string
;
requester_email
:
string
;
project_name
?:
string
;
...
...
ui/tokenInfo/utils.ts
View file @
eb298eca
import
type
{
Fields
}
from
'
./types
'
;
import
type
{
TokenInfoApplication
}
from
'
types/api/account
'
;
export
function
getFormDefaultValues
(
address
:
string
,
application
:
TokenInfoApplication
|
undefined
):
Partial
<
Fields
>
{
export
function
getFormDefaultValues
(
address
:
string
,
tokenName
:
string
,
application
:
TokenInfoApplication
|
undefined
):
Partial
<
Fields
>
{
if
(
!
application
)
{
return
{
address
};
return
{
address
,
token_name
:
tokenName
};
}
return
{
address
,
token_name
:
tokenName
,
requester_name
:
application
.
requesterName
,
requester_email
:
application
.
requesterEmail
,
project_name
:
application
.
projectName
,
...
...
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