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
6cb1131a
Commit
6cb1131a
authored
Apr 05, 2023
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
price ticker fields
parent
ae7139d9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
68 additions
and
3 deletions
+68
-3
TokenInfoForm.tsx
ui/tokenInfo/TokenInfoForm.tsx
+19
-3
TokenInfoFieldPriceTicker.tsx
ui/tokenInfo/fields/TokenInfoFieldPriceTicker.tsx
+46
-0
types.ts
ui/tokenInfo/types.ts
+3
-0
No files found.
ui/tokenInfo/TokenInfoForm.tsx
View file @
6cb1131a
...
@@ -13,6 +13,7 @@ import DataFetchAlert from 'ui/shared/DataFetchAlert';
...
@@ -13,6 +13,7 @@ import DataFetchAlert from 'ui/shared/DataFetchAlert';
import
TokenInfoFieldAddress
from
'
./fields/TokenInfoFieldAddress
'
;
import
TokenInfoFieldAddress
from
'
./fields/TokenInfoFieldAddress
'
;
import
TokenInfoFieldDocs
from
'
./fields/TokenInfoFieldDocs
'
;
import
TokenInfoFieldDocs
from
'
./fields/TokenInfoFieldDocs
'
;
import
TokenInfoFieldIconUrl
from
'
./fields/TokenInfoFieldIconUrl
'
;
import
TokenInfoFieldIconUrl
from
'
./fields/TokenInfoFieldIconUrl
'
;
import
TokenInfoFieldPriceTicker
from
'
./fields/TokenInfoFieldPriceTicker
'
;
import
TokenInfoFieldProjectDescription
from
'
./fields/TokenInfoFieldProjectDescription
'
;
import
TokenInfoFieldProjectDescription
from
'
./fields/TokenInfoFieldProjectDescription
'
;
import
TokenInfoFieldProjectEmail
from
'
./fields/TokenInfoFieldProjectEmail
'
;
import
TokenInfoFieldProjectEmail
from
'
./fields/TokenInfoFieldProjectEmail
'
;
import
TokenInfoFieldProjectName
from
'
./fields/TokenInfoFieldProjectName
'
;
import
TokenInfoFieldProjectName
from
'
./fields/TokenInfoFieldProjectName
'
;
...
@@ -62,9 +63,13 @@ const TokenInfoForm = ({ id }: Props) => {
...
@@ -62,9 +63,13 @@ const TokenInfoForm = ({ id }: Props) => {
<
form
noValidate
onSubmit=
{
onSubmit
}
>
<
form
noValidate
onSubmit=
{
onSubmit
}
>
<
div
>
Requests are sent to a moderator for review and approval. This process can take several days.
</
div
>
<
div
>
Requests are sent to a moderator for review and approval. This process can take several days.
</
div
>
<
Grid
mt=
{
8
}
gridTemplateColumns=
"1fr 1fr"
columnGap=
{
5
}
rowGap=
{
5
}
>
<
Grid
mt=
{
8
}
gridTemplateColumns=
"1fr 1fr"
columnGap=
{
5
}
rowGap=
{
5
}
>
<
GridItem
colSpan=
{
2
}
><
TokenInfoFieldAddress
{
...
fieldProps
}
/></
GridItem
>
<
GridItem
colSpan=
{
2
}
>
<
TokenInfoFieldAddress
{
...
fieldProps
}
/>
</
GridItem
>
<
TokenInfoFieldRequesterName
{
...
fieldProps
}
/>
<
TokenInfoFieldRequesterName
{
...
fieldProps
}
/>
<
TokenInfoFieldRequesterEmail
{
...
fieldProps
}
/>
<
TokenInfoFieldRequesterEmail
{
...
fieldProps
}
/>
<
TokenInfoFormSectionHeader
>
Project info
</
TokenInfoFormSectionHeader
>
<
TokenInfoFormSectionHeader
>
Project info
</
TokenInfoFormSectionHeader
>
<
TokenInfoFieldProjectName
{
...
fieldProps
}
/>
<
TokenInfoFieldProjectName
{
...
fieldProps
}
/>
<
TokenInfoFieldProjectSector
{
...
fieldProps
}
config=
{
configQuery
.
data
.
projectSectors
}
/>
<
TokenInfoFieldProjectSector
{
...
fieldProps
}
config=
{
configQuery
.
data
.
projectSectors
}
/>
...
@@ -72,8 +77,19 @@ const TokenInfoForm = ({ id }: Props) => {
...
@@ -72,8 +77,19 @@ const TokenInfoForm = ({ id }: Props) => {
<
TokenInfoFieldProjectWebsite
{
...
fieldProps
}
/>
<
TokenInfoFieldProjectWebsite
{
...
fieldProps
}
/>
<
TokenInfoFieldDocs
{
...
fieldProps
}
/>
<
TokenInfoFieldDocs
{
...
fieldProps
}
/>
<
TokenInfoFieldSupport
{
...
fieldProps
}
/>
<
TokenInfoFieldSupport
{
...
fieldProps
}
/>
<
GridItem
colSpan=
{
2
}
><
TokenInfoFieldIconUrl
{
...
fieldProps
}
/></
GridItem
>
<
GridItem
colSpan=
{
2
}
>
<
GridItem
colSpan=
{
2
}
><
TokenInfoFieldProjectDescription
{
...
fieldProps
}
/></
GridItem
>
<
TokenInfoFieldIconUrl
{
...
fieldProps
}
/>
</
GridItem
>
<
GridItem
colSpan=
{
2
}
>
<
TokenInfoFieldProjectDescription
{
...
fieldProps
}
/>
</
GridItem
>
<
TokenInfoFormSectionHeader
>
Price data
</
TokenInfoFormSectionHeader
>
<
TokenInfoFieldPriceTicker
{
...
fieldProps
}
name=
"ticker_coin_market_cap"
label=
"CoinMarketCap URL"
/>
<
TokenInfoFieldPriceTicker
{
...
fieldProps
}
name=
"ticker_coin_gecko"
label=
"CoinGecko URL"
/>
<
GridItem
colSpan=
{
2
}
>
<
TokenInfoFieldPriceTicker
{
...
fieldProps
}
name=
"ticker_defi_llama"
label=
"DefiLlama URL "
/>
</
GridItem
>
</
Grid
>
</
Grid
>
<
Button
type=
"submit"
size=
"lg"
mt=
{
8
}
>
Send request
</
Button
>
<
Button
type=
"submit"
size=
"lg"
mt=
{
8
}
>
Send request
</
Button
>
</
form
>
</
form
>
...
...
ui/tokenInfo/fields/TokenInfoFieldPriceTicker.tsx
0 → 100644
View file @
6cb1131a
import
{
FormControl
,
Input
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
type
{
Control
,
ControllerRenderProps
,
FormState
}
from
'
react-hook-form
'
;
import
{
Controller
}
from
'
react-hook-form
'
;
import
type
{
Fields
}
from
'
../types
'
;
import
{
validator
}
from
'
lib/validations/url
'
;
import
InputPlaceholder
from
'
ui/shared/InputPlaceholder
'
;
interface
Props
{
formState
:
FormState
<
Fields
>
;
control
:
Control
<
Fields
>
;
isReadOnly
?:
boolean
;
name
:
'
ticker_coin_gecko
'
|
'
ticker_coin_market_cap
'
|
'
ticker_defi_llama
'
;
label
:
string
;
}
const
TokenInfoFieldPriceTicker
=
({
formState
,
control
,
isReadOnly
,
name
,
label
}:
Props
)
=>
{
const
renderControl
=
React
.
useCallback
(({
field
}:
{
field
:
ControllerRenderProps
<
Fields
,
typeof
name
>
})
=>
{
const
error
=
name
in
formState
.
errors
?
formState
.
errors
[
name
]
:
undefined
;
return
(
<
FormControl
variant=
"floating"
id=
{
field
.
name
}
size=
"lg"
>
<
Input
{
...
field
}
isInvalid=
{
Boolean
(
error
)
}
isDisabled=
{
formState
.
isSubmitting
||
isReadOnly
}
autoComplete=
"off"
/>
<
InputPlaceholder
text=
{
label
}
error=
{
error
}
/>
</
FormControl
>
);
},
[
formState
.
errors
,
formState
.
isSubmitting
,
isReadOnly
,
name
,
label
]);
return
(
<
Controller
name=
{
name
}
control=
{
control
}
render=
{
renderControl
}
rules=
{
{
validate
:
validator
}
}
/>
);
};
export
default
React
.
memo
(
TokenInfoFieldPriceTicker
);
ui/tokenInfo/types.ts
View file @
6cb1131a
...
@@ -12,4 +12,7 @@ export interface Fields {
...
@@ -12,4 +12,7 @@ export interface Fields {
docs
?:
string
;
docs
?:
string
;
support
?:
string
;
support
?:
string
;
icon_url
:
string
;
icon_url
:
string
;
ticker_coin_gecko
?:
string
;
ticker_coin_market_cap
?:
string
;
ticker_defi_llama
?:
string
;
}
}
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