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
345004aa
Commit
345004aa
authored
Aug 08, 2022
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
always semi rule
parent
42b43c05
Changes
94
Show whitespace changes
Inline
Side-by-side
Showing
94 changed files
with
317 additions
and
316 deletions
+317
-316
.eslintrc.js
.eslintrc.js
+1
-0
next.config.js
next.config.js
+2
-2
_app.tsx
pages/_app.tsx
+1
-1
_document.tsx
pages/_document.tsx
+4
-4
api-keys.tsx
pages/api-keys.tsx
+3
-3
[id].ts
pages/api/account/private-tags/address/[id].ts
+3
-3
[id].ts
pages/api/account/private-tags/transaction/[id].ts
+3
-3
fetch.ts
pages/api/utils/fetch.ts
+2
-2
handler.ts
pages/api/utils/handler.ts
+9
-9
index.tsx
pages/index.tsx
+1
-1
private-tags.tsx
pages/private-tags.tsx
+11
-11
public-tags.tsx
pages/public-tags.tsx
+3
-3
watchlist.tsx
pages/watchlist.tsx
+3
-3
Button.ts
theme/components/Button.ts
+7
-7
Checkbox.ts
theme/components/Checkbox.ts
+2
-2
Form.ts
theme/components/Form.ts
+4
-4
Heading.ts
theme/components/Heading.ts
+3
-3
Input.ts
theme/components/Input.ts
+5
-5
Link.ts
theme/components/Link.ts
+8
-8
Modal.ts
theme/components/Modal.ts
+14
-14
Radio.ts
theme/components/Radio.ts
+2
-2
Table.ts
theme/components/Table.ts
+3
-3
Tabs.ts
theme/components/Tabs.ts
+7
-7
Tag.ts
theme/components/Tag.ts
+4
-4
Text.ts
theme/components/Text.ts
+1
-1
Textarea.ts
theme/components/Textarea.ts
+4
-4
Tooltip.ts
theme/components/Tooltip.ts
+2
-2
index.ts
theme/components/index.ts
+1
-1
config.ts
theme/config.ts
+1
-1
borders.ts
theme/foundations/borders.ts
+1
-1
colors.ts
theme/foundations/colors.ts
+1
-1
typography.ts
theme/foundations/typography.ts
+1
-1
global.ts
theme/global.ts
+1
-1
index.ts
theme/index.ts
+1
-1
getDefaultFormColors.ts
theme/utils/getDefaultFormColors.ts
+2
-2
getDefaultTransitionProps.ts
theme/utils/getDefaultTransitionProps.ts
+1
-1
getOutlinedFieldStyles.ts
theme/utils/getOutlinedFieldStyles.ts
+2
-2
ApiKeyForm.tsx
ui/apiKey/ApiKeyModal/ApiKeyForm.tsx
+4
-4
ApiKeyModal.tsx
ui/apiKey/ApiKeyModal/ApiKeyModal.tsx
+4
-4
ApiKeyTable.tsx
ui/apiKey/ApiKeyTable/ApiKeyTable.tsx
+1
-1
ApiKeyTableItem.tsx
ui/apiKey/ApiKeyTable/ApiKeyTableItem.tsx
+2
-2
DeleteApiKeyModal.tsx
ui/apiKey/DeleteApiKeyModal.tsx
+4
-4
ColorModeToggler.tsx
ui/header/ColorModeToggler.tsx
+12
-12
Header.tsx
ui/header/Header.tsx
+3
-3
AccountNavLink.tsx
ui/navigation/AccountNavLink.tsx
+2
-2
AccountNavigation.tsx
ui/navigation/AccountNavigation.tsx
+6
-6
MainNavLink.tsx
ui/navigation/MainNavLink.tsx
+3
-3
MainNavigation.tsx
ui/navigation/MainNavigation.tsx
+6
-6
NavFooter.tsx
ui/navigation/NavFooter.tsx
+4
-4
Navigation.tsx
ui/navigation/Navigation.tsx
+3
-3
useColors.ts
ui/navigation/useColors.ts
+1
-1
ApiKeys.tsx
ui/pages/ApiKeys.tsx
+4
-4
PrivateTags.tsx
ui/pages/PrivateTags.tsx
+3
-3
PublicTags.tsx
ui/pages/PublicTags.tsx
+4
-4
Watchlist.tsx
ui/pages/Watchlist.tsx
+3
-3
AddressForm.tsx
ui/privateTags/AddressModal/AddressForm.tsx
+7
-7
AddressModal.tsx
ui/privateTags/AddressModal/AddressModal.tsx
+4
-4
AddressTagTable.tsx
ui/privateTags/AddressTagTable/AddressTagTable.tsx
+1
-1
AddressTagTableItem.tsx
ui/privateTags/AddressTagTable/AddressTagTableItem.tsx
+2
-2
DeletePrivateTagModal.tsx
ui/privateTags/DeletePrivateTagModal.tsx
+6
-6
PrivateAddressTags.tsx
ui/privateTags/PrivateAddressTags.tsx
+3
-3
PrivateTransactionTags.tsx
ui/privateTags/PrivateTransactionTags.tsx
+3
-3
TransactionForm.tsx
ui/privateTags/TransactionModal/TransactionForm.tsx
+9
-9
TransactionModal.tsx
ui/privateTags/TransactionModal/TransactionModal.tsx
+4
-4
TransactionTagTable.tsx
ui/privateTags/TransactionTagTable/TransactionTagTable.tsx
+1
-1
TransactionTagTableItem.tsx
...ivateTags/TransactionTagTable/TransactionTagTableItem.tsx
+2
-2
DeletePublicTagModal.tsx
ui/publicTags/DeletePublicTagModal.tsx
+6
-6
PublicTagTable.tsx
ui/publicTags/PublicTagTable/PublicTagTable.tsx
+1
-1
PublicTagTableItem.tsx
ui/publicTags/PublicTagTable/PublicTagTableItem.tsx
+4
-4
PublicTagsData.tsx
ui/publicTags/PublicTagsData.tsx
+4
-4
PublicTagFormAction.tsx
ui/publicTags/PublicTagsForm/PublicTagFormAction.tsx
+3
-3
PublicTagFormAddressInput.tsx
ui/publicTags/PublicTagsForm/PublicTagFormAddressInput.tsx
+2
-2
PublicTagFormComment.tsx
ui/publicTags/PublicTagsForm/PublicTagFormComment.tsx
+3
-3
PublicTagsForm.tsx
ui/publicTags/PublicTagsForm/PublicTagsForm.tsx
+3
-3
PublicTagsFormInput.tsx
ui/publicTags/PublicTagsForm/PublicTagsFormInput.tsx
+2
-2
AccountPageHeader.tsx
ui/shared/AccountPageHeader.tsx
+2
-2
AddressInput.tsx
ui/shared/AddressInput.tsx
+2
-2
AddressLinkWithTooltip.tsx
ui/shared/AddressLinkWithTooltip.tsx
+2
-2
AddressWithDots.tsx
ui/shared/AddressWithDots.tsx
+7
-7
CopyToClipboard.tsx
ui/shared/CopyToClipboard.tsx
+1
-1
DeleteButton.tsx
ui/shared/DeleteButton.tsx
+3
-3
DeleteModal.tsx
ui/shared/DeleteModal.tsx
+2
-2
EditButton.tsx
ui/shared/EditButton.tsx
+3
-3
FormModal.tsx
ui/shared/FormModal.tsx
+1
-1
Page.tsx
ui/shared/Page/Page.tsx
+1
-1
TagInput.tsx
ui/shared/TagInput.tsx
+2
-2
TransactionInput.tsx
ui/shared/TransactionInput.tsx
+4
-4
TruncatedTextTooltip.tsx
ui/shared/TruncatedTextTooltip.tsx
+6
-6
AddressForm.tsx
ui/watchlist/AddressModal/AddressForm.tsx
+5
-5
AddressModal.tsx
ui/watchlist/AddressModal/AddressModal.tsx
+4
-4
DeleteAddressModal.tsx
ui/watchlist/DeleteAddressModal.tsx
+4
-4
WatchListAddressItem.tsx
ui/watchlist/WatchlistTable/WatchListAddressItem.tsx
+2
-2
WatchListTableItem.tsx
ui/watchlist/WatchlistTable/WatchListTableItem.tsx
+2
-2
WatchlistTable.tsx
ui/watchlist/WatchlistTable/WatchlistTable.tsx
+1
-1
No files found.
.eslintrc.js
View file @
345004aa
...
@@ -178,6 +178,7 @@ module.exports = {
...
@@ -178,6 +178,7 @@ module.exports = {
'
space-unary-ops
'
:
'
off
'
,
'
space-unary-ops
'
:
'
off
'
,
'
template-curly-spacing
'
:
[
'
error
'
,
'
always
'
],
'
template-curly-spacing
'
:
[
'
error
'
,
'
always
'
],
'
wrap-iife
'
:
[
'
error
'
,
'
inside
'
],
'
wrap-iife
'
:
[
'
error
'
,
'
inside
'
],
semi
:
[
'
error
'
,
'
always
'
],
'
react/jsx-key
'
:
'
error
'
,
'
react/jsx-key
'
:
'
error
'
,
'
react/jsx-no-bind
'
:
[
'
error
'
,
{
'
react/jsx-no-bind
'
:
[
'
error
'
,
{
...
...
next.config.js
View file @
345004aa
...
@@ -5,6 +5,6 @@ module.exports = withReactSvg({
...
@@ -5,6 +5,6 @@ module.exports = withReactSvg({
include
:
path
.
resolve
(
__dirname
,
'
icons
'
),
include
:
path
.
resolve
(
__dirname
,
'
icons
'
),
reactStrictMode
:
true
,
reactStrictMode
:
true
,
webpack
(
config
)
{
webpack
(
config
)
{
return
config
return
config
;
},
},
})
})
;
pages/_app.tsx
View file @
345004aa
...
@@ -23,4 +23,4 @@ function MyApp({ Component, pageProps }: AppProps) {
...
@@ -23,4 +23,4 @@ function MyApp({ Component, pageProps }: AppProps) {
);
);
}
}
export
default
MyApp
export
default
MyApp
;
pages/_document.tsx
View file @
345004aa
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
Document
,
{
Html
,
Head
,
Main
,
NextScript
}
from
'
next/document
'
import
Document
,
{
Html
,
Head
,
Main
,
NextScript
}
from
'
next/document
'
;
import
{
ColorModeScript
}
from
'
@chakra-ui/react
'
;
import
{
ColorModeScript
}
from
'
@chakra-ui/react
'
;
import
theme
from
'
theme
'
import
theme
from
'
theme
'
;
class
MyDocument
extends
Document
{
class
MyDocument
extends
Document
{
render
()
{
render
()
{
...
@@ -23,8 +23,8 @@ class MyDocument extends Document {
...
@@ -23,8 +23,8 @@ class MyDocument extends Document {
<
NextScript
/>
<
NextScript
/>
</
body
>
</
body
>
</
Html
>
</
Html
>
)
)
;
}
}
}
}
export
default
MyDocument
export
default
MyDocument
;
pages/api-keys.tsx
View file @
345004aa
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
type
{
NextPage
}
from
'
next
'
;
import
type
{
NextPage
}
from
'
next
'
;
import
Head
from
'
next/head
'
import
Head
from
'
next/head
'
;
import
ApiKeys
from
'
ui/pages/ApiKeys
'
;
import
ApiKeys
from
'
ui/pages/ApiKeys
'
;
...
@@ -11,6 +11,6 @@ const ApiKeysPage: NextPage = () => {
...
@@ -11,6 +11,6 @@ const ApiKeysPage: NextPage = () => {
<
ApiKeys
/>
<
ApiKeys
/>
</>
</>
);
);
}
}
;
export
default
ApiKeysPage
export
default
ApiKeysPage
;
pages/api/account/private-tags/address/[id].ts
View file @
345004aa
import
type
{
NextApiRequest
}
from
'
next
'
import
type
{
NextApiRequest
}
from
'
next
'
;
import
handler
from
'
pages/api/utils/handler
'
;
import
handler
from
'
pages/api/utils/handler
'
;
...
@@ -7,10 +7,10 @@ const getUrl = (req: NextApiRequest) => {
...
@@ -7,10 +7,10 @@ const getUrl = (req: NextApiRequest) => {
if
(
req
.
method
===
'
PUT
'
)
{
if
(
req
.
method
===
'
PUT
'
)
{
const
params
=
{
address_hash
:
req
.
query
.
address_hash
as
string
,
name
:
req
.
query
.
name
as
string
};
const
params
=
{
address_hash
:
req
.
query
.
address_hash
as
string
,
name
:
req
.
query
.
name
as
string
};
const
searchParams
=
new
URLSearchParams
(
params
);
const
searchParams
=
new
URLSearchParams
(
params
);
url
+=
`?
${
searchParams
.
toString
()
}
`
url
+=
`?
${
searchParams
.
toString
()
}
`
;
}
}
return
url
;
return
url
;
}
}
;
const
addressDeleteHandler
=
handler
(
getUrl
,
[
'
DELETE
'
,
'
PUT
'
]);
const
addressDeleteHandler
=
handler
(
getUrl
,
[
'
DELETE
'
,
'
PUT
'
]);
...
...
pages/api/account/private-tags/transaction/[id].ts
View file @
345004aa
import
type
{
NextApiRequest
}
from
'
next
'
import
type
{
NextApiRequest
}
from
'
next
'
;
import
handler
from
'
pages/api/utils/handler
'
;
import
handler
from
'
pages/api/utils/handler
'
;
...
@@ -7,10 +7,10 @@ const getUrl = (req: NextApiRequest) => {
...
@@ -7,10 +7,10 @@ const getUrl = (req: NextApiRequest) => {
if
(
req
.
method
===
'
PUT
'
)
{
if
(
req
.
method
===
'
PUT
'
)
{
const
params
=
{
transaction_hash
:
req
.
query
.
transaction_hash
as
string
,
name
:
req
.
query
.
name
as
string
};
const
params
=
{
transaction_hash
:
req
.
query
.
transaction_hash
as
string
,
name
:
req
.
query
.
name
as
string
};
const
searchParams
=
new
URLSearchParams
(
params
);
const
searchParams
=
new
URLSearchParams
(
params
);
url
+=
`?
${
searchParams
.
toString
()
}
`
url
+=
`?
${
searchParams
.
toString
()
}
`
;
}
}
return
url
;
return
url
;
}
}
;
const
transactionDeleteHandler
=
handler
(
getUrl
,
[
'
DELETE
'
,
'
PUT
'
]);
const
transactionDeleteHandler
=
handler
(
getUrl
,
[
'
DELETE
'
,
'
PUT
'
]);
...
...
pages/api/utils/fetch.ts
View file @
345004aa
...
@@ -8,11 +8,11 @@ export default function fetch(path: string, init?: RequestInit): Promise<Respons
...
@@ -8,11 +8,11 @@ export default function fetch(path: string, init?: RequestInit): Promise<Respons
accept
:
'
application/json
'
,
accept
:
'
application/json
'
,
authorization
:
`Bearer
${
process
.
env
.
API_AUTHORIZATION_TOKEN
}
`
,
authorization
:
`Bearer
${
process
.
env
.
API_AUTHORIZATION_TOKEN
}
`
,
'
content-type
'
:
'
application/json
'
,
'
content-type
'
:
'
application/json
'
,
}
}
;
const
url
=
`https://
${
process
.
env
.
API_HOST
}${
process
.
env
.
API_BASE_PATH
}${
path
}
`
;
const
url
=
`https://
${
process
.
env
.
API_HOST
}${
process
.
env
.
API_BASE_PATH
}${
path
}
`
;
return
nodeFetch
(
url
,
{
return
nodeFetch
(
url
,
{
headers
,
headers
,
...
init
,
...
init
,
})
})
;
}
}
pages/api/utils/handler.ts
View file @
345004aa
import
type
{
NextApiRequest
,
NextApiResponse
}
from
'
next
'
import
type
{
NextApiRequest
,
NextApiResponse
}
from
'
next
'
;
import
fetch
from
'
./fetch
'
;
import
fetch
from
'
./fetch
'
;
...
@@ -7,7 +7,7 @@ type Methods = 'GET' | 'POST' | 'PUT' | 'DELETE';
...
@@ -7,7 +7,7 @@ type Methods = 'GET' | 'POST' | 'PUT' | 'DELETE';
export
default
function
handler
<
TRes
>
(
getUrl
:
(
_req
:
NextApiRequest
)
=>
string
,
allowedMethods
:
Array
<
Methods
>
)
{
export
default
function
handler
<
TRes
>
(
getUrl
:
(
_req
:
NextApiRequest
)
=>
string
,
allowedMethods
:
Array
<
Methods
>
)
{
return
async
(
_req
:
NextApiRequest
,
res
:
NextApiResponse
<
TRes
>
)
=>
{
return
async
(
_req
:
NextApiRequest
,
res
:
NextApiResponse
<
TRes
>
)
=>
{
if
(
_req
.
method
===
'
GET
'
&&
allowedMethods
.
includes
(
'
GET
'
))
{
if
(
_req
.
method
===
'
GET
'
&&
allowedMethods
.
includes
(
'
GET
'
))
{
const
response
=
await
fetch
(
getUrl
(
_req
))
const
response
=
await
fetch
(
getUrl
(
_req
))
;
const
data
=
await
response
.
json
()
as
TRes
;
const
data
=
await
response
.
json
()
as
TRes
;
res
.
status
(
200
).
json
(
data
);
res
.
status
(
200
).
json
(
data
);
...
@@ -15,17 +15,17 @@ export default function handler<TRes>(getUrl: (_req: NextApiRequest) => string,
...
@@ -15,17 +15,17 @@ export default function handler<TRes>(getUrl: (_req: NextApiRequest) => string,
const
response
=
await
fetch
(
getUrl
(
_req
),
{
const
response
=
await
fetch
(
getUrl
(
_req
),
{
method
:
'
POST
'
,
method
:
'
POST
'
,
body
:
_req
.
body
,
body
:
_req
.
body
,
})
})
;
const
data
=
await
response
.
json
()
as
TRes
;
const
data
=
await
response
.
json
()
as
TRes
;
res
.
status
(
200
).
json
(
data
)
res
.
status
(
200
).
json
(
data
)
;
}
else
if
(
allowedMethods
.
includes
(
'
PUT
'
)
&&
_req
.
method
===
'
PUT
'
)
{
}
else
if
(
allowedMethods
.
includes
(
'
PUT
'
)
&&
_req
.
method
===
'
PUT
'
)
{
const
response
=
await
fetch
(
getUrl
(
_req
),
{
const
response
=
await
fetch
(
getUrl
(
_req
),
{
method
:
'
PUT
'
,
method
:
'
PUT
'
,
})
})
;
const
data
=
await
response
.
json
()
as
TRes
;
const
data
=
await
response
.
json
()
as
TRes
;
res
.
status
(
200
).
json
(
data
)
res
.
status
(
200
).
json
(
data
)
;
}
else
if
(
allowedMethods
.
includes
(
'
DELETE
'
)
&&
_req
.
method
===
'
DELETE
'
)
{
}
else
if
(
allowedMethods
.
includes
(
'
DELETE
'
)
&&
_req
.
method
===
'
DELETE
'
)
{
const
response
=
await
fetch
(
getUrl
(
_req
),
{
method
:
'
DELETE
'
});
const
response
=
await
fetch
(
getUrl
(
_req
),
{
method
:
'
DELETE
'
});
// FIXME: add error handlers
// FIXME: add error handlers
...
@@ -35,8 +35,8 @@ export default function handler<TRes>(getUrl: (_req: NextApiRequest) => string,
...
@@ -35,8 +35,8 @@ export default function handler<TRes>(getUrl: (_req: NextApiRequest) => string,
}
}
res
.
status
(
200
).
end
();
res
.
status
(
200
).
end
();
}
else
{
}
else
{
res
.
setHeader
(
'
Allow
'
,
allowedMethods
)
res
.
setHeader
(
'
Allow
'
,
allowedMethods
);
res
.
status
(
405
).
end
(
`Method
${
_req
.
method
}
Not Allowed`
)
res
.
status
(
405
).
end
(
`Method
${
_req
.
method
}
Not Allowed`
);
}
}
}
};
}
}
pages/index.tsx
View file @
345004aa
...
@@ -13,4 +13,4 @@ const Home: NextPage = () => {
...
@@ -13,4 +13,4 @@ const Home: NextPage = () => {
);
);
};
};
export
default
Home
export
default
Home
;
pages/private-tags.tsx
View file @
345004aa
import
React
,
{
useCallback
,
useState
}
from
'
react
'
;
import
React
,
{
useCallback
,
useState
}
from
'
react
'
;
import
type
{
NextPage
}
from
'
next
'
;
import
type
{
NextPage
}
from
'
next
'
;
import
Head
from
'
next/head
'
import
Head
from
'
next/head
'
;
import
{
useQuery
}
from
'
@tanstack/react-query
'
import
{
useQuery
}
from
'
@tanstack/react-query
'
;
import
PrivateTags
from
'
ui/pages/PrivateTags
'
;
import
PrivateTags
from
'
ui/pages/PrivateTags
'
;
...
@@ -20,20 +20,20 @@ const PrivateTagsPage: NextPage = () => {
...
@@ -20,20 +20,20 @@ const PrivateTagsPage: NextPage = () => {
// FIXME: request data only for active tab and only once
// FIXME: request data only for active tab and only once
// don't refetch after tab change
// don't refetch after tab change
useQuery
([
'
address
'
],
async
()
=>
{
useQuery
([
'
address
'
],
async
()
=>
{
const
response
=
await
fetch
(
'
/api/account/private-tags/address
'
)
const
response
=
await
fetch
(
'
/api/account/private-tags/address
'
)
;
if
(
!
response
.
ok
)
{
if
(
!
response
.
ok
)
{
throw
new
Error
(
'
Network response was not ok
'
)
throw
new
Error
(
'
Network response was not ok
'
)
;
}
}
return
response
.
json
()
return
response
.
json
()
;
})
})
;
useQuery
([
'
transaction
'
],
async
()
=>
{
useQuery
([
'
transaction
'
],
async
()
=>
{
const
response
=
await
fetch
(
'
/api/account/private-tags/transaction
'
)
const
response
=
await
fetch
(
'
/api/account/private-tags/transaction
'
)
;
if
(
!
response
.
ok
)
{
if
(
!
response
.
ok
)
{
throw
new
Error
(
'
Network response was not ok
'
)
throw
new
Error
(
'
Network response was not ok
'
)
;
}
}
return
response
.
json
()
return
response
.
json
()
;
})
})
;
return
(
return
(
<>
<>
...
@@ -41,6 +41,6 @@ const PrivateTagsPage: NextPage = () => {
...
@@ -41,6 +41,6 @@ const PrivateTagsPage: NextPage = () => {
<
PrivateTags
onChangeTab=
{
onChangeTab
}
/>
<
PrivateTags
onChangeTab=
{
onChangeTab
}
/>
</>
</>
);
);
}
}
;
export
default
PrivateTagsPage
;
export
default
PrivateTagsPage
;
pages/public-tags.tsx
View file @
345004aa
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
type
{
NextPage
}
from
'
next
'
;
import
type
{
NextPage
}
from
'
next
'
;
import
Head
from
'
next/head
'
import
Head
from
'
next/head
'
;
import
PublicTags
from
'
ui/pages/PublicTags
'
;
import
PublicTags
from
'
ui/pages/PublicTags
'
;
...
@@ -11,6 +11,6 @@ const PublicTagsPage: NextPage = () => {
...
@@ -11,6 +11,6 @@ const PublicTagsPage: NextPage = () => {
<
PublicTags
/>
<
PublicTags
/>
</>
</>
);
);
}
}
;
export
default
PublicTagsPage
export
default
PublicTagsPage
;
pages/watchlist.tsx
View file @
345004aa
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
type
{
NextPage
}
from
'
next
'
;
import
type
{
NextPage
}
from
'
next
'
;
import
Head
from
'
next/head
'
import
Head
from
'
next/head
'
;
import
WatchList
from
'
ui/pages/Watchlist
'
;
import
WatchList
from
'
ui/pages/Watchlist
'
;
...
@@ -11,6 +11,6 @@ const WatchListPage: NextPage = () => {
...
@@ -11,6 +11,6 @@ const WatchListPage: NextPage = () => {
<
WatchList
/>
<
WatchList
/>
</>
</>
);
);
}
}
;
export
default
WatchListPage
export
default
WatchListPage
;
theme/components/Button.ts
View file @
345004aa
...
@@ -15,7 +15,7 @@ const variantPrimary = {
...
@@ -15,7 +15,7 @@ const variantPrimary = {
_disabled
:
{
_disabled
:
{
opacity
:
0.2
,
opacity
:
0.2
,
},
},
}
}
;
const
variantSecondary
=
{
const
variantSecondary
=
{
color
:
'
blue.600
'
,
color
:
'
blue.600
'
,
...
@@ -29,7 +29,7 @@ const variantSecondary = {
...
@@ -29,7 +29,7 @@ const variantSecondary = {
_disabled
:
{
_disabled
:
{
opacity
:
0.2
,
opacity
:
0.2
,
},
},
}
}
;
const
variantIcon
:
SystemStyleFunction
=
(
props
)
=>
{
const
variantIcon
:
SystemStyleFunction
=
(
props
)
=>
{
return
{
return
{
...
@@ -37,8 +37,8 @@ const variantIcon: SystemStyleFunction = (props) => {
...
@@ -37,8 +37,8 @@ const variantIcon: SystemStyleFunction = (props) => {
_hover
:
{
_hover
:
{
color
:
mode
(
'
blue.400
'
,
'
blue.200
'
)(
props
),
color
:
mode
(
'
blue.400
'
,
'
blue.200
'
)(
props
),
},
},
}
}
;
}
}
;
const
variantIconBorder
=
{
const
variantIconBorder
=
{
color
:
'
blue.600
'
,
color
:
'
blue.600
'
,
...
@@ -51,14 +51,14 @@ const variantIconBorder = {
...
@@ -51,14 +51,14 @@ const variantIconBorder = {
_disabled
:
{
_disabled
:
{
opacity
:
0.2
,
opacity
:
0.2
,
},
},
}
}
;
const
variants
=
{
const
variants
=
{
primary
:
variantPrimary
,
primary
:
variantPrimary
,
secondary
:
variantSecondary
,
secondary
:
variantSecondary
,
icon
:
variantIcon
,
icon
:
variantIcon
,
iconBorder
:
variantIconBorder
,
iconBorder
:
variantIconBorder
,
}
}
;
const
Button
:
ComponentStyleConfig
=
{
const
Button
:
ComponentStyleConfig
=
{
baseStyle
:
{
baseStyle
:
{
...
@@ -91,6 +91,6 @@ const Button: ComponentStyleConfig = {
...
@@ -91,6 +91,6 @@ const Button: ComponentStyleConfig = {
px
:
2
,
px
:
2
,
},
},
},
},
}
}
;
export
default
Button
;
export
default
Button
;
theme/components/Checkbox.ts
View file @
345004aa
...
@@ -3,12 +3,12 @@ import type { SystemStyleObject } from '@chakra-ui/theme-tools';
...
@@ -3,12 +3,12 @@ import type { SystemStyleObject } from '@chakra-ui/theme-tools';
const
baseStyleLabel
:
SystemStyleObject
=
{
const
baseStyleLabel
:
SystemStyleObject
=
{
_disabled
:
{
opacity
:
0.2
},
_disabled
:
{
opacity
:
0.2
},
}
}
;
const
Checkbox
:
ComponentStyleConfig
=
{
const
Checkbox
:
ComponentStyleConfig
=
{
baseStyle
:
{
baseStyle
:
{
label
:
baseStyleLabel
,
label
:
baseStyleLabel
,
},
},
}
}
;
export
default
Checkbox
;
export
default
Checkbox
;
theme/components/Form.ts
View file @
345004aa
...
@@ -8,7 +8,7 @@ import getDefaultFormColors from '../utils/getDefaultFormColors';
...
@@ -8,7 +8,7 @@ import getDefaultFormColors from '../utils/getDefaultFormColors';
const
activeInputStyles
=
{
const
activeInputStyles
=
{
paddingTop
:
'
30px
'
,
paddingTop
:
'
30px
'
,
paddingBottom
:
'
10px
'
,
paddingBottom
:
'
10px
'
,
}
}
;
const
getActiveLabelStyles
=
(
theme
:
Dict
,
fc
:
string
)
=>
({
const
getActiveLabelStyles
=
(
theme
:
Dict
,
fc
:
string
)
=>
({
color
:
getColor
(
theme
,
fc
),
color
:
getColor
(
theme
,
fc
),
...
@@ -78,13 +78,13 @@ const variantFloating: PartsStyleFunction<typeof parts> = (props: StyleFunctionP
...
@@ -78,13 +78,13 @@ const variantFloating: PartsStyleFunction<typeof parts> = (props: StyleFunctionP
marginStart
:
0
,
marginStart
:
0
,
color
:
mode
(
'
gray.500
'
,
'
whiteAlpha.400
'
)(
props
),
color
:
mode
(
'
gray.500
'
,
'
whiteAlpha.400
'
)(
props
),
},
},
}
}
;
}
}
;
const
Form
:
ComponentStyleConfig
=
{
const
Form
:
ComponentStyleConfig
=
{
variants
:
{
variants
:
{
floating
:
variantFloating
,
floating
:
variantFloating
,
},
},
}
}
;
export
default
Form
;
export
default
Form
;
theme/components/Heading.ts
View file @
345004aa
...
@@ -3,7 +3,7 @@ import type { ComponentStyleConfig } from '@chakra-ui/theme';
...
@@ -3,7 +3,7 @@ import type { ComponentStyleConfig } from '@chakra-ui/theme';
const
baseStyle
=
{
const
baseStyle
=
{
fontWeight
:
'
500
'
,
fontWeight
:
'
500
'
,
letterSpacing
:
'
-0.5px
'
,
letterSpacing
:
'
-0.5px
'
,
}
}
;
// WIP
// WIP
// designer promised to sync theme and page mock-ups
// designer promised to sync theme and page mock-ups
...
@@ -13,11 +13,11 @@ const sizes = {
...
@@ -13,11 +13,11 @@ const sizes = {
fontSize
:
'
32px
'
,
fontSize
:
'
32px
'
,
lineHeight
:
'
40px
'
,
lineHeight
:
'
40px
'
,
},
},
}
}
;
const
Heading
:
ComponentStyleConfig
=
{
const
Heading
:
ComponentStyleConfig
=
{
sizes
,
sizes
,
baseStyle
,
baseStyle
,
}
}
;
export
default
Heading
;
export
default
Heading
;
theme/components/Input.ts
View file @
345004aa
...
@@ -24,7 +24,7 @@ const sizes: Record<string, SystemStyleObject> = {
...
@@ -24,7 +24,7 @@ const sizes: Record<string, SystemStyleObject> = {
h
:
'
80px
'
,
h
:
'
80px
'
,
borderRadius
:
'
base
'
,
borderRadius
:
'
base
'
,
},
},
}
}
;
const
variantOutline
:
PartsStyleFunction
<
typeof
parts
>
=
(
props
)
=>
{
const
variantOutline
:
PartsStyleFunction
<
typeof
parts
>
=
(
props
)
=>
{
const
transitionProps
=
getDefaultTransitionProps
();
const
transitionProps
=
getDefaultTransitionProps
();
...
@@ -37,8 +37,8 @@ const variantOutline: PartsStyleFunction<typeof parts> = (props) => {
...
@@ -37,8 +37,8 @@ const variantOutline: PartsStyleFunction<typeof parts> = (props) => {
bg
:
mode
(
'
gray.100
'
,
'
whiteAlpha.200
'
)(
props
),
bg
:
mode
(
'
gray.100
'
,
'
whiteAlpha.200
'
)(
props
),
...
transitionProps
,
...
transitionProps
,
},
},
}
}
;
}
}
;
const
Input
:
ComponentStyleConfig
=
{
const
Input
:
ComponentStyleConfig
=
{
sizes
:
{
sizes
:
{
...
@@ -57,11 +57,11 @@ const Input: ComponentStyleConfig = {
...
@@ -57,11 +57,11 @@ const Input: ComponentStyleConfig = {
variants
:
{
variants
:
{
outline
:
variantOutline
,
outline
:
variantOutline
,
},
},
}
}
;
InputComponent
.
defaultProps
=
{
InputComponent
.
defaultProps
=
{
...
InputComponent
.
defaultProps
,
...
InputComponent
.
defaultProps
,
placeholder
:
'
'
,
placeholder
:
'
'
,
}
}
;
export
default
Input
;
export
default
Input
;
theme/components/Link.ts
View file @
345004aa
...
@@ -5,7 +5,7 @@ import getDefaultTransitionProps from '../utils/getDefaultTransitionProps';
...
@@ -5,7 +5,7 @@ import getDefaultTransitionProps from '../utils/getDefaultTransitionProps';
const
baseStyle
:
SystemStyleInterpolation
=
{
const
baseStyle
:
SystemStyleInterpolation
=
{
...
getDefaultTransitionProps
(),
...
getDefaultTransitionProps
(),
}
}
;
const
variantPrimary
:
SystemStyleFunction
=
(
props
)
=>
{
const
variantPrimary
:
SystemStyleFunction
=
(
props
)
=>
{
return
{
return
{
...
@@ -13,8 +13,8 @@ const variantPrimary: SystemStyleFunction = (props) => {
...
@@ -13,8 +13,8 @@ const variantPrimary: SystemStyleFunction = (props) => {
_hover
:
{
_hover
:
{
color
:
mode
(
'
blue.400
'
,
'
blue.200
'
)(
props
),
color
:
mode
(
'
blue.400
'
,
'
blue.200
'
)(
props
),
},
},
}
}
;
}
}
;
const
variantSecondary
:
SystemStyleFunction
=
(
props
)
=>
{
const
variantSecondary
:
SystemStyleFunction
=
(
props
)
=>
{
return
{
return
{
...
@@ -22,22 +22,22 @@ const variantSecondary: SystemStyleFunction = (props) => {
...
@@ -22,22 +22,22 @@ const variantSecondary: SystemStyleFunction = (props) => {
_hover
:
{
_hover
:
{
color
:
mode
(
'
gray.600
'
,
'
gray.400
'
)(
props
),
color
:
mode
(
'
gray.600
'
,
'
gray.400
'
)(
props
),
},
},
}
}
;
}
}
;
const
variants
=
{
const
variants
=
{
primary
:
variantPrimary
,
primary
:
variantPrimary
,
secondary
:
variantSecondary
,
secondary
:
variantSecondary
,
}
}
;
const
defaultProps
=
{
const
defaultProps
=
{
variant
:
'
primary
'
,
variant
:
'
primary
'
,
}
}
;
const
Link
:
ComponentStyleConfig
=
{
const
Link
:
ComponentStyleConfig
=
{
variants
,
variants
,
defaultProps
,
defaultProps
,
baseStyle
,
baseStyle
,
}
}
;
export
default
Link
;
export
default
Link
;
theme/components/Modal.ts
View file @
345004aa
import
{
modalAnatomy
as
parts
}
from
'
@chakra-ui/anatomy
'
import
{
modalAnatomy
as
parts
}
from
'
@chakra-ui/anatomy
'
;
import
type
{
PartsStyleFunction
,
SystemStyleFunction
}
from
'
@chakra-ui/theme-tools
'
import
type
{
PartsStyleFunction
,
SystemStyleFunction
}
from
'
@chakra-ui/theme-tools
'
;
import
{
mode
}
from
'
@chakra-ui/theme-tools
'
import
{
mode
}
from
'
@chakra-ui/theme-tools
'
;
import
type
{
ComponentMultiStyleConfig
}
from
'
@chakra-ui/theme
'
;
import
type
{
ComponentMultiStyleConfig
}
from
'
@chakra-ui/theme
'
;
const
baseStyleDialog
:
SystemStyleFunction
=
(
props
)
=>
{
const
baseStyleDialog
:
SystemStyleFunction
=
(
props
)
=>
{
...
@@ -8,25 +8,25 @@ const baseStyleDialog: SystemStyleFunction = (props) => {
...
@@ -8,25 +8,25 @@ const baseStyleDialog: SystemStyleFunction = (props) => {
padding
:
8
,
padding
:
8
,
borderRadius
:
'
lg
'
,
borderRadius
:
'
lg
'
,
bg
:
mode
(
'
white
'
,
'
gray.800
'
)(
props
),
bg
:
mode
(
'
white
'
,
'
gray.800
'
)(
props
),
}
}
;
}
}
;
const
baseStyleHeader
=
{
const
baseStyleHeader
=
{
padding
:
0
,
padding
:
0
,
marginBottom
:
8
,
marginBottom
:
8
,
fontSize
:
'
2xl
'
,
fontSize
:
'
2xl
'
,
lineHeight
:
10
,
lineHeight
:
10
,
}
}
;
const
baseStyleBody
=
{
const
baseStyleBody
=
{
padding
:
0
,
padding
:
0
,
marginBottom
:
8
,
marginBottom
:
8
,
}
}
;
const
baseStyleFooter
=
{
const
baseStyleFooter
=
{
padding
:
0
,
padding
:
0
,
justifyContent
:
'
flex-start
'
,
justifyContent
:
'
flex-start
'
,
}
}
;
const
baseStyleCloseButton
:
SystemStyleFunction
=
(
props
)
=>
{
const
baseStyleCloseButton
:
SystemStyleFunction
=
(
props
)
=>
{
return
{
return
{
...
@@ -37,11 +37,11 @@ const baseStyleCloseButton: SystemStyleFunction = (props) => {
...
@@ -37,11 +37,11 @@ const baseStyleCloseButton: SystemStyleFunction = (props) => {
color
:
mode
(
'
gray.700
'
,
'
gray.600
'
)(
props
),
color
:
mode
(
'
gray.700
'
,
'
gray.600
'
)(
props
),
_hover
:
{
color
:
'
blue.400
'
},
_hover
:
{
color
:
'
blue.400
'
},
_active
:
{
bg
:
'
none
'
},
_active
:
{
bg
:
'
none
'
},
}
}
;
}
}
;
const
baseStyleOverlay
=
{
const
baseStyleOverlay
=
{
bg
:
'
blackAlpha.800
'
,
bg
:
'
blackAlpha.800
'
,
}
}
;
const
baseStyle
:
PartsStyleFunction
<
typeof
parts
>
=
(
props
)
=>
({
const
baseStyle
:
PartsStyleFunction
<
typeof
parts
>
=
(
props
)
=>
({
dialog
:
baseStyleDialog
(
props
),
dialog
:
baseStyleDialog
(
props
),
...
@@ -50,7 +50,7 @@ const baseStyle: PartsStyleFunction<typeof parts> = (props) => ({
...
@@ -50,7 +50,7 @@ const baseStyle: PartsStyleFunction<typeof parts> = (props) => ({
footer
:
baseStyleFooter
,
footer
:
baseStyleFooter
,
closeButton
:
baseStyleCloseButton
(
props
),
closeButton
:
baseStyleCloseButton
(
props
),
overlay
:
baseStyleOverlay
,
overlay
:
baseStyleOverlay
,
})
})
;
const
sizes
=
{
const
sizes
=
{
md
:
{
md
:
{
...
@@ -58,13 +58,13 @@ const sizes = {
...
@@ -58,13 +58,13 @@ const sizes = {
maxW
:
'
760px
'
,
maxW
:
'
760px
'
,
},
},
},
},
}
}
;
const
Modal
:
ComponentMultiStyleConfig
=
{
const
Modal
:
ComponentMultiStyleConfig
=
{
parts
:
parts
.
keys
,
parts
:
parts
.
keys
,
sizes
,
sizes
,
baseStyle
,
baseStyle
,
}
}
;
Modal
.
defaultProps
=
{
isCentered
:
true
};
Modal
.
defaultProps
=
{
isCentered
:
true
};
...
...
theme/components/Radio.ts
View file @
345004aa
...
@@ -3,12 +3,12 @@ import type { SystemStyleObject } from '@chakra-ui/theme-tools';
...
@@ -3,12 +3,12 @@ import type { SystemStyleObject } from '@chakra-ui/theme-tools';
const
baseStyleLabel
:
SystemStyleObject
=
{
const
baseStyleLabel
:
SystemStyleObject
=
{
_disabled
:
{
opacity
:
0.2
},
_disabled
:
{
opacity
:
0.2
},
}
}
;
const
Radio
:
ComponentStyleConfig
=
{
const
Radio
:
ComponentStyleConfig
=
{
baseStyle
:
{
baseStyle
:
{
label
:
baseStyleLabel
,
label
:
baseStyleLabel
,
},
},
}
}
;
export
default
Radio
;
export
default
Radio
;
theme/components/Table.ts
View file @
345004aa
...
@@ -21,8 +21,8 @@ const variantSimple: PartsStyleFunction<typeof parts> = (props) => {
...
@@ -21,8 +21,8 @@ const variantSimple: PartsStyleFunction<typeof parts> = (props) => {
borderColor
:
mode
(
'
gray.200
'
,
'
whiteAlpha.200
'
)(
props
),
borderColor
:
mode
(
'
gray.200
'
,
'
whiteAlpha.200
'
)(
props
),
...
transitionProps
,
...
transitionProps
,
},
},
}
}
;
}
}
;
const
Table
:
ComponentMultiStyleConfig
=
{
const
Table
:
ComponentMultiStyleConfig
=
{
parts
:
[
'
th
'
,
'
td
'
,
'
table
'
,
'
thead
'
],
parts
:
[
'
th
'
,
'
td
'
,
'
table
'
,
'
thead
'
],
...
@@ -65,6 +65,6 @@ const Table: ComponentMultiStyleConfig = {
...
@@ -65,6 +65,6 @@ const Table: ComponentMultiStyleConfig = {
variants
:
{
variants
:
{
simple
:
variantSimple
,
simple
:
variantSimple
,
},
},
}
}
;
export
default
Table
;
export
default
Table
;
theme/components/Tabs.ts
View file @
345004aa
import
type
{
ComponentStyleConfig
}
from
'
@chakra-ui/theme
'
;
import
type
{
ComponentStyleConfig
}
from
'
@chakra-ui/theme
'
;
import
type
{
import
type
{
PartsStyleFunction
,
PartsStyleFunction
,
}
from
'
@chakra-ui/theme-tools
'
}
from
'
@chakra-ui/theme-tools
'
;
import
{
getColor
}
from
'
@chakra-ui/theme-tools
'
import
{
getColor
}
from
'
@chakra-ui/theme-tools
'
;
import
type
{
tabsAnatomy
as
parts
}
from
'
@chakra-ui/anatomy
'
import
type
{
tabsAnatomy
as
parts
}
from
'
@chakra-ui/anatomy
'
;
const
variantSoftRounded
:
PartsStyleFunction
<
typeof
parts
>
=
(
props
)
=>
{
const
variantSoftRounded
:
PartsStyleFunction
<
typeof
parts
>
=
(
props
)
=>
{
const
{
colorScheme
:
c
,
theme
}
=
props
const
{
colorScheme
:
c
,
theme
}
=
props
;
return
{
return
{
tab
:
{
tab
:
{
borderRadius
:
'
12px
'
,
borderRadius
:
'
12px
'
,
...
@@ -21,13 +21,13 @@ const variantSoftRounded: PartsStyleFunction<typeof parts> = (props) => {
...
@@ -21,13 +21,13 @@ const variantSoftRounded: PartsStyleFunction<typeof parts> = (props) => {
color
:
getColor
(
theme
,
`
${
c
}
.400`
),
color
:
getColor
(
theme
,
`
${
c
}
.400`
),
},
},
},
},
}
}
;
}
}
;
const
Tabs
:
ComponentStyleConfig
=
{
const
Tabs
:
ComponentStyleConfig
=
{
variants
:
{
variants
:
{
'
soft-rounded
'
:
variantSoftRounded
,
'
soft-rounded
'
:
variantSoftRounded
,
},
},
}
}
;
export
default
Tabs
;
export
default
Tabs
;
theme/components/Tag.ts
View file @
345004aa
...
@@ -13,12 +13,12 @@ const variantGray: PartsStyleFunction<typeof parts> = (props) => {
...
@@ -13,12 +13,12 @@ const variantGray: PartsStyleFunction<typeof parts> = (props) => {
color
:
mode
(
'
gray.600
'
,
'
gray.50
'
)(
props
),
color
:
mode
(
'
gray.600
'
,
'
gray.50
'
)(
props
),
...
transitionProps
,
...
transitionProps
,
},
},
}
}
;
}
}
;
const
variants
=
{
const
variants
=
{
gray
:
variantGray
,
gray
:
variantGray
,
}
}
;
const
Tag
:
ComponentStyleConfig
=
{
const
Tag
:
ComponentStyleConfig
=
{
baseStyle
:
{
baseStyle
:
{
...
@@ -30,6 +30,6 @@ const Tag: ComponentStyleConfig = {
...
@@ -30,6 +30,6 @@ const Tag: ComponentStyleConfig = {
},
},
},
},
variants
,
variants
,
}
}
;
export
default
Tag
;
export
default
Tag
;
theme/components/Text.ts
View file @
345004aa
...
@@ -10,6 +10,6 @@ const Text: ComponentStyleConfig = {
...
@@ -10,6 +10,6 @@ const Text: ComponentStyleConfig = {
variants
:
{
variants
:
{
secondary
:
variantSecondary
,
secondary
:
variantSecondary
,
},
},
}
}
;
export
default
Text
;
export
default
Text
;
theme/components/Textarea.ts
View file @
345004aa
import
type
{
import
type
{
SystemStyleObject
,
SystemStyleObject
,
}
from
'
@chakra-ui/theme-tools
'
}
from
'
@chakra-ui/theme-tools
'
;
import
type
{
ComponentStyleConfig
}
from
'
@chakra-ui/theme
'
;
import
type
{
ComponentStyleConfig
}
from
'
@chakra-ui/theme
'
;
import
getOutlinedFieldStyles
from
'
../utils/getOutlinedFieldStyles
'
;
import
getOutlinedFieldStyles
from
'
../utils/getOutlinedFieldStyles
'
;
...
@@ -16,7 +16,7 @@ const sizes: Record<string, SystemStyleObject> = {
...
@@ -16,7 +16,7 @@ const sizes: Record<string, SystemStyleObject> = {
h
:
'
160px
'
,
h
:
'
160px
'
,
borderRadius
:
'
base
'
,
borderRadius
:
'
base
'
,
},
},
}
}
;
const
Textarea
:
ComponentStyleConfig
=
{
const
Textarea
:
ComponentStyleConfig
=
{
sizes
,
sizes
,
...
@@ -27,11 +27,11 @@ const Textarea: ComponentStyleConfig = {
...
@@ -27,11 +27,11 @@ const Textarea: ComponentStyleConfig = {
size
:
'
md
'
,
size
:
'
md
'
,
variant
:
'
outline
'
,
variant
:
'
outline
'
,
},
},
}
}
;
TextareaComponent
.
defaultProps
=
{
TextareaComponent
.
defaultProps
=
{
...
TextareaComponent
.
defaultProps
,
...
TextareaComponent
.
defaultProps
,
placeholder
:
'
'
,
placeholder
:
'
'
,
}
}
;
export
default
Textarea
;
export
default
Textarea
;
theme/components/Tooltip.ts
View file @
345004aa
...
@@ -5,8 +5,8 @@ const Tooltip: ComponentStyleConfig = {
...
@@ -5,8 +5,8 @@ const Tooltip: ComponentStyleConfig = {
baseStyle
:
{
baseStyle
:
{
maxWidth
:
'
unset
'
,
maxWidth
:
'
unset
'
,
},
},
}
}
;
TooltipComponent
.
defaultProps
=
{
...
TooltipComponent
.
defaultProps
,
hasArrow
:
true
}
TooltipComponent
.
defaultProps
=
{
...
TooltipComponent
.
defaultProps
,
hasArrow
:
true
}
;
export
default
Tooltip
;
export
default
Tooltip
;
theme/components/index.ts
View file @
345004aa
...
@@ -28,6 +28,6 @@ const components = {
...
@@ -28,6 +28,6 @@ const components = {
Text
,
Text
,
Textarea
,
Textarea
,
Tooltip
,
Tooltip
,
}
}
;
export
default
components
;
export
default
components
;
theme/config.ts
View file @
345004aa
...
@@ -4,6 +4,6 @@ const config: ThemeConfig = {
...
@@ -4,6 +4,6 @@ const config: ThemeConfig = {
initialColorMode
:
'
system
'
,
initialColorMode
:
'
system
'
,
useSystemColorMode
:
false
,
useSystemColorMode
:
false
,
disableTransitionOnChange
:
false
,
disableTransitionOnChange
:
false
,
}
}
;
export
default
config
;
export
default
config
;
theme/foundations/borders.ts
View file @
345004aa
...
@@ -7,6 +7,6 @@ const borders = {
...
@@ -7,6 +7,6 @@ const borders = {
lg
:
'
24px
'
,
lg
:
'
24px
'
,
full
:
'
9999px
'
,
full
:
'
9999px
'
,
},
},
}
}
;
export
default
borders
;
export
default
borders
;
theme/foundations/colors.ts
View file @
345004aa
...
@@ -46,6 +46,6 @@ const colors = {
...
@@ -46,6 +46,6 @@ const colors = {
'
800
'
:
'
RGBA(16, 17, 18, 0.80)
'
,
'
800
'
:
'
RGBA(16, 17, 18, 0.80)
'
,
'
900
'
:
'
RGBA(16, 17, 18, 0.92)
'
,
'
900
'
:
'
RGBA(16, 17, 18, 0.92)
'
,
},
},
}
}
;
export
default
colors
;
export
default
colors
;
theme/foundations/typography.ts
View file @
345004aa
...
@@ -21,6 +21,6 @@ const typography = {
...
@@ -21,6 +21,6 @@ const typography = {
fontFamily
:
'
heading
'
,
fontFamily
:
'
heading
'
,
},
},
},
},
}
}
;
export
default
typography
;
export
default
typography
;
theme/global.ts
View file @
345004aa
...
@@ -7,6 +7,6 @@ const global = (props: StyleFunctionProps) => ({
...
@@ -7,6 +7,6 @@ const global = (props: StyleFunctionProps) => ({
bg
:
mode
(
'
white
'
,
'
black
'
)(
props
),
bg
:
mode
(
'
white
'
,
'
black
'
)(
props
),
...
getDefaultTransitionProps
(),
...
getDefaultTransitionProps
(),
},
},
})
})
;
export
default
global
;
export
default
global
;
theme/index.ts
View file @
345004aa
...
@@ -16,6 +16,6 @@ const overrides = {
...
@@ -16,6 +16,6 @@ const overrides = {
styles
:
{
styles
:
{
global
,
global
,
},
},
}
}
;
export
default
extendTheme
(
overrides
);
export
default
extendTheme
(
overrides
);
theme/utils/getDefaultFormColors.ts
View file @
345004aa
...
@@ -2,10 +2,10 @@ import type { StyleFunctionProps } from '@chakra-ui/theme-tools';
...
@@ -2,10 +2,10 @@ import type { StyleFunctionProps } from '@chakra-ui/theme-tools';
import
{
mode
}
from
'
@chakra-ui/theme-tools
'
;
import
{
mode
}
from
'
@chakra-ui/theme-tools
'
;
export
default
function
getDefaultFormColors
(
props
:
StyleFunctionProps
)
{
export
default
function
getDefaultFormColors
(
props
:
StyleFunctionProps
)
{
const
{
focusBorderColor
:
fc
,
errorBorderColor
:
ec
,
filledBorderColor
:
flc
}
=
props
const
{
focusBorderColor
:
fc
,
errorBorderColor
:
ec
,
filledBorderColor
:
flc
}
=
props
;
return
{
return
{
focusColor
:
fc
||
mode
(
'
brand.700
'
,
'
brand.300
'
)(
props
),
focusColor
:
fc
||
mode
(
'
brand.700
'
,
'
brand.300
'
)(
props
),
errorColor
:
ec
||
mode
(
'
red.400
'
,
'
red.300
'
)(
props
),
errorColor
:
ec
||
mode
(
'
red.400
'
,
'
red.300
'
)(
props
),
filledColor
:
flc
||
mode
(
'
gray.300
'
,
'
gray.600
'
)(
props
),
filledColor
:
flc
||
mode
(
'
gray.300
'
,
'
gray.600
'
)(
props
),
}
}
;
}
}
theme/utils/getDefaultTransitionProps.ts
View file @
345004aa
...
@@ -3,5 +3,5 @@ export default function getDefaultTransitionProps() {
...
@@ -3,5 +3,5 @@ export default function getDefaultTransitionProps() {
transitionProperty
:
'
background-color, color, border-color
'
,
transitionProperty
:
'
background-color, color, border-color
'
,
transitionDuration
:
'
normal
'
,
transitionDuration
:
'
normal
'
,
transitionTimingFunction
:
'
ease
'
,
transitionTimingFunction
:
'
ease
'
,
}
}
;
}
}
theme/utils/getOutlinedFieldStyles.ts
View file @
345004aa
...
@@ -4,7 +4,7 @@ import getDefaultFormColors from './getDefaultFormColors';
...
@@ -4,7 +4,7 @@ import getDefaultFormColors from './getDefaultFormColors';
import
getDefaultTransitionProps
from
'
./getDefaultTransitionProps
'
;
import
getDefaultTransitionProps
from
'
./getDefaultTransitionProps
'
;
export
default
function
getOutlinedFieldStyles
(
props
:
StyleFunctionProps
)
{
export
default
function
getOutlinedFieldStyles
(
props
:
StyleFunctionProps
)
{
const
{
theme
}
=
props
const
{
theme
}
=
props
;
const
{
focusColor
:
fc
,
errorColor
:
ec
,
filledColor
:
flc
}
=
getDefaultFormColors
(
props
);
const
{
focusColor
:
fc
,
errorColor
:
ec
,
filledColor
:
flc
}
=
getDefaultFormColors
(
props
);
const
transitionProps
=
getDefaultTransitionProps
();
const
transitionProps
=
getDefaultTransitionProps
();
...
@@ -39,5 +39,5 @@ export default function getOutlinedFieldStyles(props: StyleFunctionProps) {
...
@@ -39,5 +39,5 @@ export default function getOutlinedFieldStyles(props: StyleFunctionProps) {
'
:-webkit-autofill
'
:
{
transition
:
'
background-color 5000s ease-in-out 0s
'
},
'
:-webkit-autofill
'
:
{
transition
:
'
background-color 5000s ease-in-out 0s
'
},
'
:-webkit-autofill:hover
'
:
{
transition
:
'
background-color 5000s ease-in-out 0s
'
},
'
:-webkit-autofill:hover
'
:
{
transition
:
'
background-color 5000s ease-in-out 0s
'
},
'
:-webkit-autofill:focus
'
:
{
transition
:
'
background-color 5000s ease-in-out 0s
'
},
'
:-webkit-autofill:focus
'
:
{
transition
:
'
background-color 5000s ease-in-out 0s
'
},
}
}
;
}
}
ui/apiKey/ApiKeyModal/ApiKeyForm.tsx
View file @
345004aa
...
@@ -44,7 +44,7 @@ const ApiKeyForm: React.FC<Props> = ({ data }) => {
...
@@ -44,7 +44,7 @@ const ApiKeyForm: React.FC<Props> = ({ data }) => {
/>
/>
<
FormLabel
>
Auto-generated API key token
</
FormLabel
>
<
FormLabel
>
Auto-generated API key token
</
FormLabel
>
</
FormControl
>
</
FormControl
>
)
)
;
},
[]);
},
[]);
const
renderNameInput
=
useCallback
(({
field
}:
{
field
:
ControllerRenderProps
<
Inputs
,
'
name
'
>
})
=>
{
const
renderNameInput
=
useCallback
(({
field
}:
{
field
:
ControllerRenderProps
<
Inputs
,
'
name
'
>
})
=>
{
...
@@ -57,7 +57,7 @@ const ApiKeyForm: React.FC<Props> = ({ data }) => {
...
@@ -57,7 +57,7 @@ const ApiKeyForm: React.FC<Props> = ({ data }) => {
/>
/>
<
FormLabel
>
Application name for API key (e.g Web3 project)
</
FormLabel
>
<
FormLabel
>
Application name for API key (e.g Web3 project)
</
FormLabel
>
</
FormControl
>
</
FormControl
>
)
)
;
},
[
errors
]);
},
[
errors
]);
return
(
return
(
...
@@ -92,7 +92,7 @@ const ApiKeyForm: React.FC<Props> = ({ data }) => {
...
@@ -92,7 +92,7 @@ const ApiKeyForm: React.FC<Props> = ({ data }) => {
</
Button
>
</
Button
>
</
Box
>
</
Box
>
</>
</>
)
)
;
}
}
;
export
default
ApiKeyForm
;
export
default
ApiKeyForm
;
ui/apiKey/ApiKeyModal/ApiKeyModal.tsx
View file @
345004aa
...
@@ -13,10 +13,10 @@ type Props = {
...
@@ -13,10 +13,10 @@ type Props = {
const
AddressModal
:
React
.
FC
<
Props
>
=
({
isOpen
,
onClose
,
data
})
=>
{
const
AddressModal
:
React
.
FC
<
Props
>
=
({
isOpen
,
onClose
,
data
})
=>
{
const
title
=
data
?
'
Edit API key
'
:
'
New API key
'
;
const
title
=
data
?
'
Edit API key
'
:
'
New API key
'
;
const
text
=
'
Add an application name to identify your API key. Click the button below to auto-generate the associated key.
'
const
text
=
'
Add an application name to identify your API key. Click the button below to auto-generate the associated key.
'
;
const
renderForm
=
useCallback
(()
=>
{
const
renderForm
=
useCallback
(()
=>
{
return
<
ApiKeyForm
data=
{
data
}
/>
return
<
ApiKeyForm
data=
{
data
}
/>
;
},
[
data
]);
},
[
data
]);
return
(
return
(
<
FormModal
<
TApiKeyItem
>
<
FormModal
<
TApiKeyItem
>
...
@@ -27,7 +27,7 @@ const AddressModal: React.FC<Props> = ({ isOpen, onClose, data }) => {
...
@@ -27,7 +27,7 @@ const AddressModal: React.FC<Props> = ({ isOpen, onClose, data }) => {
data=
{
data
}
data=
{
data
}
renderForm=
{
renderForm
}
renderForm=
{
renderForm
}
/
>
/
>
)
)
;
}
}
;
export default AddressModal;
export default AddressModal;
ui/apiKey/ApiKeyTable/ApiKeyTable.tsx
View file @
345004aa
...
@@ -7,7 +7,7 @@ import {
...
@@ -7,7 +7,7 @@ import {
Tr
,
Tr
,
Th
,
Th
,
TableContainer
,
TableContainer
,
}
from
'
@chakra-ui/react
'
}
from
'
@chakra-ui/react
'
;
import
type
{
TApiKey
,
TApiKeyItem
}
from
'
data/apiKey
'
;
import
type
{
TApiKey
,
TApiKeyItem
}
from
'
data/apiKey
'
;
...
...
ui/apiKey/ApiKeyTable/ApiKeyTableItem.tsx
View file @
345004aa
...
@@ -5,7 +5,7 @@ import {
...
@@ -5,7 +5,7 @@ import {
Td
,
Td
,
HStack
,
HStack
,
Text
,
Text
,
}
from
'
@chakra-ui/react
'
}
from
'
@chakra-ui/react
'
;
import
EditButton
from
'
ui/shared/EditButton
'
;
import
EditButton
from
'
ui/shared/EditButton
'
;
import
DeleteButton
from
'
ui/shared/DeleteButton
'
;
import
DeleteButton
from
'
ui/shared/DeleteButton
'
;
...
@@ -45,7 +45,7 @@ const WatchlistTableItem = ({ item, onEditClick, onDeleteClick }: Props) => {
...
@@ -45,7 +45,7 @@ const WatchlistTableItem = ({ item, onEditClick, onDeleteClick }: Props) => {
</
HStack
>
</
HStack
>
</
Td
>
</
Td
>
</
Tr
>
</
Tr
>
)
)
;
};
};
export
default
WatchlistTableItem
;
export
default
WatchlistTableItem
;
ui/apiKey/DeleteApiKeyModal.tsx
View file @
345004aa
import
React
,
{
useCallback
}
from
'
react
'
;
import
React
,
{
useCallback
}
from
'
react
'
;
import
{
Text
}
from
'
@chakra-ui/react
'
;
import
{
Text
}
from
'
@chakra-ui/react
'
;
import
DeleteModal
from
'
ui/shared/DeleteModal
'
import
DeleteModal
from
'
ui/shared/DeleteModal
'
;
type
Props
=
{
type
Props
=
{
isOpen
:
boolean
;
isOpen
:
boolean
;
...
@@ -17,7 +17,7 @@ const DeleteAddressModal: React.FC<Props> = ({ isOpen, onClose, name }) => {
...
@@ -17,7 +17,7 @@ const DeleteAddressModal: React.FC<Props> = ({ isOpen, onClose, name }) => {
const
renderText
=
useCallback
(()
=>
{
const
renderText
=
useCallback
(()
=>
{
return
(
return
(
<
Text
display=
"flex"
>
API key for
<
Text
fontWeight=
"600"
whiteSpace=
"pre"
>
{
` "${ name || 'name' }" `
}
</
Text
>
will be deleted
</
Text
>
<
Text
display=
"flex"
>
API key for
<
Text
fontWeight=
"600"
whiteSpace=
"pre"
>
{
` "${ name || 'name' }" `
}
</
Text
>
will be deleted
</
Text
>
)
)
;
},
[
name
]);
},
[
name
]);
return
(
return
(
<
DeleteModal
<
DeleteModal
...
@@ -27,7 +27,7 @@ const DeleteAddressModal: React.FC<Props> = ({ isOpen, onClose, name }) => {
...
@@ -27,7 +27,7 @@ const DeleteAddressModal: React.FC<Props> = ({ isOpen, onClose, name }) => {
title=
"Remove API key"
title=
"Remove API key"
renderContent=
{
renderText
}
renderContent=
{
renderText
}
/>
/>
)
)
;
}
}
;
export
default
DeleteAddressModal
;
export
default
DeleteAddressModal
;
ui/header/ColorModeToggler.tsx
View file @
345004aa
import
type
{
UseCheckboxProps
}
from
'
@chakra-ui/checkbox
'
;
import
type
{
UseCheckboxProps
}
from
'
@chakra-ui/checkbox
'
;
import
{
useCheckbox
}
from
'
@chakra-ui/checkbox
'
import
{
useCheckbox
}
from
'
@chakra-ui/checkbox
'
;
import
type
{
import
type
{
SystemStyleObject
,
SystemStyleObject
,
ThemingProps
,
ThemingProps
,
...
@@ -9,10 +9,10 @@ import {
...
@@ -9,10 +9,10 @@ import {
chakra
,
chakra
,
forwardRef
,
forwardRef
,
omitThemingProps
,
omitThemingProps
,
}
from
'
@chakra-ui/system
'
}
from
'
@chakra-ui/system
'
;
import
{
dataAttr
,
__DEV__
}
from
'
@chakra-ui/utils
'
import
{
dataAttr
,
__DEV__
}
from
'
@chakra-ui/utils
'
;
import
*
as
React
from
'
react
'
import
*
as
React
from
'
react
'
;
import
{
SunIcon
}
from
'
@chakra-ui/icons
'
import
{
SunIcon
}
from
'
@chakra-ui/icons
'
;
import
{
useColorMode
,
useColorModeValue
,
Icon
}
from
'
@chakra-ui/react
'
;
import
{
useColorMode
,
useColorModeValue
,
Icon
}
from
'
@chakra-ui/react
'
;
import
getDefaultTransitionProps
from
'
../../theme/utils/getDefaultTransitionProps
'
;
import
getDefaultTransitionProps
from
'
../../theme/utils/getDefaultTransitionProps
'
;
import
moonIcon
from
'
../../icons/moon.svg
'
;
import
moonIcon
from
'
../../icons/moon.svg
'
;
...
@@ -36,22 +36,22 @@ export const ColorModeToggler = forwardRef<ColorModeTogglerProps, 'input'>((prop
...
@@ -36,22 +36,22 @@ export const ColorModeToggler = forwardRef<ColorModeTogglerProps, 'input'>((prop
getRootProps
,
getRootProps
,
}
=
useCheckbox
({
...
ownProps
,
isChecked
:
colorMode
===
'
light
'
});
}
=
useCheckbox
({
...
ownProps
,
isChecked
:
colorMode
===
'
light
'
});
const
trackBg
=
useColorModeValue
(
'
blackAlpha.100
'
,
'
whiteAlpha.200
'
)
const
trackBg
=
useColorModeValue
(
'
blackAlpha.100
'
,
'
whiteAlpha.200
'
)
;
const
thumbBg
=
useColorModeValue
(
'
white
'
,
'
black
'
)
const
thumbBg
=
useColorModeValue
(
'
white
'
,
'
black
'
)
;
const
transitionProps
=
getDefaultTransitionProps
();
const
transitionProps
=
getDefaultTransitionProps
();
const
trackStyles
:
SystemStyleObject
=
React
.
useMemo
(()
=>
({
const
trackStyles
:
SystemStyleObject
=
React
.
useMemo
(()
=>
({
bg
:
trackBg
,
bg
:
trackBg
,
...
transitionProps
,
...
transitionProps
,
transitionDuration
:
'
500ms
'
,
transitionDuration
:
'
500ms
'
,
}),
[
trackBg
,
transitionProps
])
}),
[
trackBg
,
transitionProps
])
;
const
thumbStyles
:
SystemStyleObject
=
React
.
useMemo
(()
=>
({
const
thumbStyles
:
SystemStyleObject
=
React
.
useMemo
(()
=>
({
bg
:
thumbBg
,
bg
:
thumbBg
,
...
transitionProps
,
...
transitionProps
,
transitionProperty
:
'
background-color, transform
'
,
transitionProperty
:
'
background-color, transform
'
,
transitionDuration
:
'
500ms
'
,
transitionDuration
:
'
500ms
'
,
}),
[
thumbBg
,
transitionProps
])
}),
[
thumbBg
,
transitionProps
])
;
return
(
return
(
<
chakra
.
label
<
chakra
.
label
...
@@ -85,9 +85,9 @@ export const ColorModeToggler = forwardRef<ColorModeTogglerProps, 'input'>((prop
...
@@ -85,9 +85,9 @@ export const ColorModeToggler = forwardRef<ColorModeTogglerProps, 'input'>((prop
/>
/>
</
chakra
.
div
>
</
chakra
.
div
>
</
chakra
.
label
>
</
chakra
.
label
>
)
)
;
})
})
;
if
(
__DEV__
)
{
if
(
__DEV__
)
{
ColorModeToggler
.
displayName
=
'
ColorModeToggler
'
ColorModeToggler
.
displayName
=
'
ColorModeToggler
'
;
}
}
ui/header/Header.tsx
View file @
345004aa
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
{
HStack
,
InputGroup
,
Input
,
InputLeftAddon
,
InputLeftElement
,
Center
,
useColorModeValue
}
from
'
@chakra-ui/react
'
;
import
{
HStack
,
InputGroup
,
Input
,
InputLeftAddon
,
InputLeftElement
,
Center
,
useColorModeValue
}
from
'
@chakra-ui/react
'
;
import
{
SearchIcon
}
from
'
@chakra-ui/icons
'
import
{
SearchIcon
}
from
'
@chakra-ui/icons
'
;
import
Identicon
from
'
react-identicons
'
;
import
Identicon
from
'
react-identicons
'
;
import
{
ColorModeToggler
}
from
'
./ColorModeToggler
'
;
import
{
ColorModeToggler
}
from
'
./ColorModeToggler
'
;
...
@@ -30,7 +30,7 @@ const Header = () => {
...
@@ -30,7 +30,7 @@ const Header = () => {
<
Identicon
className=
{
styles
.
identicon
}
string=
"randomness"
size=
{
96
}
/>
<
Identicon
className=
{
styles
.
identicon
}
string=
"randomness"
size=
{
96
}
/>
</
Center
>
</
Center
>
</
HStack
>
</
HStack
>
)
)
;
}
}
;
export
default
Header
;
export
default
Header
;
ui/navigation/AccountNavLink.tsx
View file @
345004aa
...
@@ -35,7 +35,7 @@ const AccountNavLink = ({ text, pathname, icon }: Props) => {
...
@@ -35,7 +35,7 @@ const AccountNavLink = ({ text, pathname, icon }: Props) => {
</
HStack
>
</
HStack
>
</
Link
>
</
Link
>
</
NextLink
>
</
NextLink
>
)
)
;
}
}
;
export
default
AccountNavLink
;
export
default
AccountNavLink
;
ui/navigation/AccountNavigation.tsx
View file @
345004aa
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
{
Box
,
VStack
}
from
'
@chakra-ui/react
'
;
import
{
Box
,
VStack
}
from
'
@chakra-ui/react
'
;
import
AccountNavLink
from
'
./AccountNavLink
'
;
import
AccountNavLink
from
'
./AccountNavLink
'
;
import
WatchlistIcon
from
'
icons/watchlist.svg
'
import
WatchlistIcon
from
'
icons/watchlist.svg
'
;
import
PrivateTagIcon
from
'
icons/privattags.svg
'
import
PrivateTagIcon
from
'
icons/privattags.svg
'
;
import
PublicTagIcon
from
'
icons/publictags.svg
'
import
PublicTagIcon
from
'
icons/publictags.svg
'
;
import
ApiKeysIcon
from
'
icons/API.svg
'
;
import
ApiKeysIcon
from
'
icons/API.svg
'
;
import
ABIIcon
from
'
icons/ABI.svg
'
;
import
ABIIcon
from
'
icons/ABI.svg
'
;
...
@@ -13,7 +13,7 @@ const navItems = [
...
@@ -13,7 +13,7 @@ const navItems = [
{
text
:
'
Public tags
'
,
pathname
:
'
/public-tags
'
,
icon
:
PublicTagIcon
},
{
text
:
'
Public tags
'
,
pathname
:
'
/public-tags
'
,
icon
:
PublicTagIcon
},
{
text
:
'
API keys
'
,
pathname
:
'
/api-keys
'
,
icon
:
ApiKeysIcon
},
{
text
:
'
API keys
'
,
pathname
:
'
/api-keys
'
,
icon
:
ApiKeysIcon
},
{
text
:
'
Custom ABI
'
,
pathname
:
'
/custom-abi
'
,
icon
:
ABIIcon
},
{
text
:
'
Custom ABI
'
,
pathname
:
'
/custom-abi
'
,
icon
:
ABIIcon
},
]
]
;
const
AccountNavigation
=
()
=>
{
const
AccountNavigation
=
()
=>
{
return
(
return
(
...
@@ -22,7 +22,7 @@ const AccountNavigation = () => {
...
@@ -22,7 +22,7 @@ const AccountNavigation = () => {
{
navItems
.
map
((
item
)
=>
<
AccountNavLink
key=
{
item
.
text
}
{
...
item
}
/>)
}
{
navItems
.
map
((
item
)
=>
<
AccountNavLink
key=
{
item
.
text
}
{
...
item
}
/>)
}
</
VStack
>
</
VStack
>
</
Box
>
</
Box
>
)
)
;
}
}
;
export
default
AccountNavigation
;
export
default
AccountNavigation
;
ui/navigation/MainNavLink.tsx
View file @
345004aa
...
@@ -2,7 +2,7 @@ import React from 'react';
...
@@ -2,7 +2,7 @@ import React from 'react';
import
{
Link
,
Icon
,
Text
,
HStack
}
from
'
@chakra-ui/react
'
;
import
{
Link
,
Icon
,
Text
,
HStack
}
from
'
@chakra-ui/react
'
;
import
NextLink
from
'
next/link
'
;
import
NextLink
from
'
next/link
'
;
import
{
useRouter
}
from
'
next/router
'
;
import
{
useRouter
}
from
'
next/router
'
;
import
{
ChevronRightIcon
}
from
'
@chakra-ui/icons
'
import
{
ChevronRightIcon
}
from
'
@chakra-ui/icons
'
;
import
useColors
from
'
./useColors
'
;
import
useColors
from
'
./useColors
'
;
interface
Props
{
interface
Props
{
...
@@ -39,7 +39,7 @@ const MainNavLink = ({ text, pathname, icon }: Props) => {
...
@@ -39,7 +39,7 @@ const MainNavLink = ({ text, pathname, icon }: Props) => {
</
HStack
>
</
HStack
>
</
Link
>
</
Link
>
</
NextLink
>
</
NextLink
>
)
)
;
}
}
;
export
default
MainNavLink
;
export
default
MainNavLink
;
ui/navigation/MainNavigation.tsx
View file @
345004aa
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
{
Box
,
VStack
}
from
'
@chakra-ui/react
'
;
import
{
Box
,
VStack
}
from
'
@chakra-ui/react
'
;
import
MainNavLink
from
'
./MainNavLink
'
;
import
MainNavLink
from
'
./MainNavLink
'
;
import
BlocksIcon
from
'
icons/block.svg
'
import
BlocksIcon
from
'
icons/block.svg
'
;
import
TransactionsIcon
from
'
icons/transactions.svg
'
import
TransactionsIcon
from
'
icons/transactions.svg
'
;
import
TokensIcon
from
'
icons/token.svg
'
import
TokensIcon
from
'
icons/token.svg
'
;
import
AppsIcon
from
'
icons/apps.svg
'
;
import
AppsIcon
from
'
icons/apps.svg
'
;
import
BlockscoutIcon
from
'
icons/blockscout.svg
'
;
import
BlockscoutIcon
from
'
icons/blockscout.svg
'
;
...
@@ -13,7 +13,7 @@ const navItems = [
...
@@ -13,7 +13,7 @@ const navItems = [
{
text
:
'
Tokens
'
,
pathname
:
'
/tokens
'
,
icon
:
TokensIcon
},
{
text
:
'
Tokens
'
,
pathname
:
'
/tokens
'
,
icon
:
TokensIcon
},
{
text
:
'
Apps
'
,
pathname
:
'
/apps
'
,
icon
:
AppsIcon
},
{
text
:
'
Apps
'
,
pathname
:
'
/apps
'
,
icon
:
AppsIcon
},
{
text
:
'
Blockscout
'
,
pathname
:
'
/blockscout
'
,
icon
:
BlockscoutIcon
},
{
text
:
'
Blockscout
'
,
pathname
:
'
/blockscout
'
,
icon
:
BlockscoutIcon
},
]
]
;
const
MainNavigation
=
()
=>
{
const
MainNavigation
=
()
=>
{
return
(
return
(
...
@@ -22,7 +22,7 @@ const MainNavigation = () => {
...
@@ -22,7 +22,7 @@ const MainNavigation = () => {
{
navItems
.
map
((
item
)
=>
<
MainNavLink
key=
{
item
.
text
}
{
...
item
}
/>)
}
{
navItems
.
map
((
item
)
=>
<
MainNavLink
key=
{
item
.
text
}
{
...
item
}
/>)
}
</
VStack
>
</
VStack
>
</
Box
>
</
Box
>
)
)
;
}
}
;
export
default
MainNavigation
;
export
default
MainNavigation
;
ui/navigation/NavFooter.tsx
View file @
345004aa
...
@@ -13,7 +13,7 @@ const SOCIAL_LINKS = [
...
@@ -13,7 +13,7 @@ const SOCIAL_LINKS = [
{
link
:
'
#tw
'
,
icon
:
twIcon
},
{
link
:
'
#tw
'
,
icon
:
twIcon
},
{
link
:
'
#tg
'
,
icon
:
tgIcon
},
{
link
:
'
#tg
'
,
icon
:
tgIcon
},
{
link
:
'
#stats
'
,
icon
:
statsIcon
},
{
link
:
'
#stats
'
,
icon
:
statsIcon
},
]
]
;
const
NavFooter
=
()
=>
{
const
NavFooter
=
()
=>
{
return
(
return
(
...
@@ -35,7 +35,7 @@ const NavFooter = () => {
...
@@ -35,7 +35,7 @@ const NavFooter = () => {
<
Link
href=
{
sl
.
link
}
key=
{
sl
.
link
}
variant=
"secondary"
>
<
Link
href=
{
sl
.
link
}
key=
{
sl
.
link
}
variant=
"secondary"
>
<
Icon
as=
{
sl
.
icon
}
boxSize=
{
5
}
/>
<
Icon
as=
{
sl
.
icon
}
boxSize=
{
5
}
/>
</
Link
>
</
Link
>
)
)
;
})
}
})
}
</
HStack
>
</
HStack
>
<
Text
>
<
Text
>
...
@@ -43,7 +43,7 @@ const NavFooter = () => {
...
@@ -43,7 +43,7 @@ const NavFooter = () => {
</
Text
>
</
Text
>
<
Text
>
Version:
<
Link
color=
"blue.500"
>
v4.2.1-beta
</
Link
></
Text
>
<
Text
>
Version:
<
Link
color=
"blue.500"
>
v4.2.1-beta
</
Link
></
Text
>
</
VStack
>
</
VStack
>
)
)
;
}
}
;
export
default
NavFooter
;
export
default
NavFooter
;
ui/navigation/Navigation.tsx
View file @
345004aa
...
@@ -3,7 +3,7 @@ import { VStack, HStack, Icon, useColorModeValue } from '@chakra-ui/react';
...
@@ -3,7 +3,7 @@ import { VStack, HStack, Icon, useColorModeValue } from '@chakra-ui/react';
import
AccountNavigation
from
'
./AccountNavigation
'
;
import
AccountNavigation
from
'
./AccountNavigation
'
;
import
MainNavigation
from
'
./MainNavigation
'
;
import
MainNavigation
from
'
./MainNavigation
'
;
import
NavFooter
from
'
./NavFooter
'
import
NavFooter
from
'
./NavFooter
'
;
import
logoIcon
from
'
icons/logo.svg
'
;
import
logoIcon
from
'
icons/logo.svg
'
;
import
networksIcon
from
'
icons/networks.svg
'
;
import
networksIcon
from
'
icons/networks.svg
'
;
...
@@ -42,7 +42,7 @@ const Navigation = () => {
...
@@ -42,7 +42,7 @@ const Navigation = () => {
<
AccountNavigation
/>
<
AccountNavigation
/>
<
NavFooter
/>
<
NavFooter
/>
</
VStack
>
</
VStack
>
)
)
;
}
}
;
export
default
Navigation
;
export
default
Navigation
;
ui/navigation/useColors.ts
View file @
345004aa
...
@@ -11,5 +11,5 @@ export default function useColors() {
...
@@ -11,5 +11,5 @@ export default function useColors() {
'
default
'
:
'
transparent
'
,
'
default
'
:
'
transparent
'
,
active
:
useColorModeValue
(
'
blue.50
'
,
'
whiteAlpha.200
'
),
active
:
useColorModeValue
(
'
blue.50
'
,
'
whiteAlpha.200
'
),
},
},
}
}
;
}
}
ui/pages/ApiKeys.tsx
View file @
345004aa
...
@@ -25,7 +25,7 @@ const ApiKeys: React.FC = () => {
...
@@ -25,7 +25,7 @@ const ApiKeys: React.FC = () => {
const
onEditClick
=
useCallback
((
data
:
TApiKeyItem
)
=>
{
const
onEditClick
=
useCallback
((
data
:
TApiKeyItem
)
=>
{
setApiKeyModalData
(
data
);
setApiKeyModalData
(
data
);
apiKeyModalProps
.
onOpen
();
apiKeyModalProps
.
onOpen
();
},
[
apiKeyModalProps
])
},
[
apiKeyModalProps
])
;
const
onApiKeyModalClose
=
useCallback
(()
=>
{
const
onApiKeyModalClose
=
useCallback
(()
=>
{
setApiKeyModalData
(
undefined
);
setApiKeyModalData
(
undefined
);
...
@@ -35,14 +35,14 @@ const ApiKeys: React.FC = () => {
...
@@ -35,14 +35,14 @@ const ApiKeys: React.FC = () => {
const
onDeleteClick
=
useCallback
((
data
:
TApiKeyItem
)
=>
{
const
onDeleteClick
=
useCallback
((
data
:
TApiKeyItem
)
=>
{
setDeleteModalData
(
data
.
name
);
setDeleteModalData
(
data
.
name
);
deleteModalProps
.
onOpen
();
deleteModalProps
.
onOpen
();
},
[
deleteModalProps
])
},
[
deleteModalProps
])
;
const
onDeleteModalClose
=
useCallback
(()
=>
{
const
onDeleteModalClose
=
useCallback
(()
=>
{
setDeleteModalData
(
undefined
);
setDeleteModalData
(
undefined
);
deleteModalProps
.
onClose
();
deleteModalProps
.
onClose
();
},
[
deleteModalProps
]);
},
[
deleteModalProps
]);
const
canAdd
=
apiKey
.
length
<
DATA_LIMIT
const
canAdd
=
apiKey
.
length
<
DATA_LIMIT
;
return
(
return
(
<
Page
>
<
Page
>
...
@@ -82,4 +82,4 @@ const ApiKeys: React.FC = () => {
...
@@ -82,4 +82,4 @@ const ApiKeys: React.FC = () => {
);
);
};
};
export
default
ApiKeys
export
default
ApiKeys
;
ui/pages/PrivateTags.tsx
View file @
345004aa
import
React
,
{
useCallback
}
from
'
react
'
;
import
React
,
{
useCallback
}
from
'
react
'
;
import
{
useQueryClient
}
from
'
@tanstack/react-query
'
import
{
useQueryClient
}
from
'
@tanstack/react-query
'
;
import
type
{
AddressTags
,
TransactionTags
}
from
'
types/api/account
'
;
import
type
{
AddressTags
,
TransactionTags
}
from
'
types/api/account
'
;
...
@@ -28,7 +28,7 @@ const PrivateTags = ({ onChangeTab: onChangeTabProps }: Props) => {
...
@@ -28,7 +28,7 @@ const PrivateTags = ({ onChangeTab: onChangeTabProps }: Props) => {
const
onTabChange
=
useCallback
((
index
:
number
)
=>
{
const
onTabChange
=
useCallback
((
index
:
number
)
=>
{
onChangeTabProps
(
index
);
onChangeTabProps
(
index
);
},
[
onChangeTabProps
])
},
[
onChangeTabProps
])
;
return
(
return
(
<
Page
>
<
Page
>
...
@@ -53,4 +53,4 @@ const PrivateTags = ({ onChangeTab: onChangeTabProps }: Props) => {
...
@@ -53,4 +53,4 @@ const PrivateTags = ({ onChangeTab: onChangeTabProps }: Props) => {
);
);
};
};
export
default
PrivateTags
export
default
PrivateTags
;
ui/pages/PublicTags.tsx
View file @
345004aa
...
@@ -26,7 +26,7 @@ const PublicTags: React.FC = () => {
...
@@ -26,7 +26,7 @@ const PublicTags: React.FC = () => {
const
[
screen
,
setScreen
]
=
useState
<
TScreen
>
(
'
data
'
);
const
[
screen
,
setScreen
]
=
useState
<
TScreen
>
(
'
data
'
);
const
[
formData
,
setFormData
]
=
useState
<
TPublicTagItem
>
();
const
[
formData
,
setFormData
]
=
useState
<
TPublicTagItem
>
();
const
toast
=
useToast
()
const
toast
=
useToast
()
;
const
showToast
=
useCallback
((
action
:
TToastAction
)
=>
{
const
showToast
=
useCallback
((
action
:
TToastAction
)
=>
{
toast
({
toast
({
...
@@ -67,10 +67,10 @@ const PublicTags: React.FC = () => {
...
@@ -67,10 +67,10 @@ const PublicTags: React.FC = () => {
let
header
;
let
header
;
if
(
screen
===
'
data
'
)
{
if
(
screen
===
'
data
'
)
{
content
=
<
PublicTagsData
changeToFormScreen=
{
changeToFormScreen
}
onTagDelete=
{
onTagDelete
}
/>
content
=
<
PublicTagsData
changeToFormScreen=
{
changeToFormScreen
}
onTagDelete=
{
onTagDelete
}
/>
;
header
=
'
Public tags
'
header
=
'
Public tags
'
;
}
else
{
}
else
{
content
=
<
PublicTagsForm
changeToDataScreen=
{
changeToDataScreen
}
data=
{
formData
}
/>
content
=
<
PublicTagsForm
changeToDataScreen=
{
changeToDataScreen
}
data=
{
formData
}
/>
;
header
=
formData
?
'
Request to edit a public tag/label
'
:
'
Request a public tag/label
'
;
header
=
formData
?
'
Request to edit a public tag/label
'
:
'
Request a public tag/label
'
;
}
}
...
...
ui/pages/Watchlist.tsx
View file @
345004aa
...
@@ -21,7 +21,7 @@ const WatchList: React.FC = () => {
...
@@ -21,7 +21,7 @@ const WatchList: React.FC = () => {
const
onEditClick
=
useCallback
((
data
:
TWatchlistItem
)
=>
{
const
onEditClick
=
useCallback
((
data
:
TWatchlistItem
)
=>
{
setAddressModalData
(
data
);
setAddressModalData
(
data
);
addressModalProps
.
onOpen
();
addressModalProps
.
onOpen
();
},
[
addressModalProps
])
},
[
addressModalProps
])
;
const
onAddressModalClose
=
useCallback
(()
=>
{
const
onAddressModalClose
=
useCallback
(()
=>
{
setAddressModalData
(
undefined
);
setAddressModalData
(
undefined
);
...
@@ -31,7 +31,7 @@ const WatchList: React.FC = () => {
...
@@ -31,7 +31,7 @@ const WatchList: React.FC = () => {
const
onDeleteClick
=
useCallback
((
data
:
TWatchlistItem
)
=>
{
const
onDeleteClick
=
useCallback
((
data
:
TWatchlistItem
)
=>
{
setDeleteModalData
(
data
.
address
);
setDeleteModalData
(
data
.
address
);
deleteModalProps
.
onOpen
();
deleteModalProps
.
onOpen
();
},
[
deleteModalProps
])
},
[
deleteModalProps
])
;
const
onDeleteModalClose
=
useCallback
(()
=>
{
const
onDeleteModalClose
=
useCallback
(()
=>
{
setDeleteModalData
(
undefined
);
setDeleteModalData
(
undefined
);
...
@@ -66,4 +66,4 @@ const WatchList: React.FC = () => {
...
@@ -66,4 +66,4 @@ const WatchList: React.FC = () => {
);
);
};
};
export
default
WatchList
export
default
WatchList
;
ui/privateTags/AddressModal/AddressForm.tsx
View file @
345004aa
...
@@ -42,14 +42,14 @@ const AddressForm: React.FC<Props> = ({ data, onClose }) => {
...
@@ -42,14 +42,14 @@ const AddressForm: React.FC<Props> = ({ data, onClose }) => {
const
requestParams
=
{
const
requestParams
=
{
name
:
formData
?.
tag
,
name
:
formData
?.
tag
,
address_hash
:
formData
?.
address
,
address_hash
:
formData
?.
address
,
}
}
;
if
(
data
)
{
if
(
data
)
{
// edit tag
// edit tag
const
params
=
new
URLSearchParams
(
requestParams
);
const
params
=
new
URLSearchParams
(
requestParams
);
mutationFunction
=
()
=>
fetch
(
`/api/account/private-tags/address/
${
data
.
id
}
?
${
params
.
toString
()
}
`
,
{
method
:
'
PUT
'
})
mutationFunction
=
()
=>
fetch
(
`/api/account/private-tags/address/
${
data
.
id
}
?
${
params
.
toString
()
}
`
,
{
method
:
'
PUT
'
})
;
}
else
{
}
else
{
// add tag
// add tag
mutationFunction
=
()
=>
fetch
(
'
/api/account/private-tags/address
'
,
{
method
:
'
POST
'
,
body
:
JSON
.
stringify
(
requestParams
)
})
mutationFunction
=
()
=>
fetch
(
'
/api/account/private-tags/address
'
,
{
method
:
'
POST
'
,
body
:
JSON
.
stringify
(
requestParams
)
})
;
}
}
return
mutationFunction
();
return
mutationFunction
();
},
{
},
{
...
@@ -71,11 +71,11 @@ const AddressForm: React.FC<Props> = ({ data, onClose }) => {
...
@@ -71,11 +71,11 @@ const AddressForm: React.FC<Props> = ({ data, onClose }) => {
};
};
const
renderAddressInput
=
useCallback
(({
field
}:
{
field
:
ControllerRenderProps
<
Inputs
,
'
address
'
>
})
=>
{
const
renderAddressInput
=
useCallback
(({
field
}:
{
field
:
ControllerRenderProps
<
Inputs
,
'
address
'
>
})
=>
{
return
<
AddressInput
<
Inputs
,
'
address
'
>
field=
{
field
}
isInvalid=
{
Boolean
(
errors
.
address
)
}
/
>
return
<
AddressInput
<
Inputs
,
'
address
'
>
field=
{
field
}
isInvalid=
{
Boolean
(
errors
.
address
)
}
/
>
;
}, [ errors ]);
}, [ errors ]);
const renderTagInput = useCallback((
{
field
}
:
{
field
:
ControllerRenderProps
<
Inputs
,
'
tag
'
>
}
) =
>
{
const renderTagInput = useCallback((
{
field
}
:
{
field
:
ControllerRenderProps
<
Inputs
,
'
tag
'
>
}
) =
>
{
return
<
TagInput
field=
{
field
}
isInvalid=
{
Boolean
(
errors
.
tag
)
}
/>
return
<
TagInput
field=
{
field
}
isInvalid=
{
Boolean
(
errors
.
tag
)
}
/>
;
}
, [ errors ]);
}
, [ errors ]);
return (
return (
...
@@ -113,7 +113,7 @@ const AddressForm: React.FC<Props> = ({ data, onClose }) => {
...
@@ -113,7 +113,7 @@ const AddressForm: React.FC<Props> = ({ data, onClose }) => {
</
Button
>
</
Button
>
</
Box
>
</
Box
>
</>
</>
)
)
;
}
}
;
export default AddressForm;
export default AddressForm;
ui/privateTags/AddressModal/AddressModal.tsx
View file @
345004aa
...
@@ -13,10 +13,10 @@ type Props = {
...
@@ -13,10 +13,10 @@ type Props = {
const
AddressModal
:
React
.
FC
<
Props
>
=
({
isOpen
,
onClose
,
data
})
=>
{
const
AddressModal
:
React
.
FC
<
Props
>
=
({
isOpen
,
onClose
,
data
})
=>
{
const
title
=
data
?
'
Edit address tag
'
:
'
New address tag
'
;
const
title
=
data
?
'
Edit address tag
'
:
'
New address tag
'
;
const
text
=
'
Label any address with a private address tag (up to 35 chars) to customize your explorer experience.
'
const
text
=
'
Label any address with a private address tag (up to 35 chars) to customize your explorer experience.
'
;
const
renderForm
=
useCallback
(()
=>
{
const
renderForm
=
useCallback
(()
=>
{
return
<
AddressForm
data=
{
data
}
onClose=
{
onClose
}
/>
return
<
AddressForm
data=
{
data
}
onClose=
{
onClose
}
/>
;
},
[
data
,
onClose
]);
},
[
data
,
onClose
]);
return
(
return
(
<
FormModal
<
AddressTag
>
<
FormModal
<
AddressTag
>
...
@@ -27,7 +27,7 @@ const AddressModal: React.FC<Props> = ({ isOpen, onClose, data }) => {
...
@@ -27,7 +27,7 @@ const AddressModal: React.FC<Props> = ({ isOpen, onClose, data }) => {
data=
{
data
}
data=
{
data
}
renderForm=
{
renderForm
}
renderForm=
{
renderForm
}
/
>
/
>
)
)
;
}
}
;
export default AddressModal;
export default AddressModal;
ui/privateTags/AddressTagTable/AddressTagTable.tsx
View file @
345004aa
...
@@ -7,7 +7,7 @@ import {
...
@@ -7,7 +7,7 @@ import {
Tr
,
Tr
,
Th
,
Th
,
TableContainer
,
TableContainer
,
}
from
'
@chakra-ui/react
'
}
from
'
@chakra-ui/react
'
;
import
type
{
AddressTags
,
AddressTag
}
from
'
types/api/account
'
;
import
type
{
AddressTags
,
AddressTag
}
from
'
types/api/account
'
;
...
...
ui/privateTags/AddressTagTable/AddressTagTableItem.tsx
View file @
345004aa
...
@@ -5,7 +5,7 @@ import {
...
@@ -5,7 +5,7 @@ import {
Tr
,
Tr
,
Td
,
Td
,
HStack
,
HStack
,
}
from
'
@chakra-ui/react
'
}
from
'
@chakra-ui/react
'
;
import
AddressIcon
from
'
ui/shared/AddressIcon
'
;
import
AddressIcon
from
'
ui/shared/AddressIcon
'
;
import
AddressLinkWithTooltip
from
'
ui/shared/AddressLinkWithTooltip
'
;
import
AddressLinkWithTooltip
from
'
ui/shared/AddressLinkWithTooltip
'
;
...
@@ -52,7 +52,7 @@ const AddressTagTableItem = ({ item, onEditClick, onDeleteClick }: Props) => {
...
@@ -52,7 +52,7 @@ const AddressTagTableItem = ({ item, onEditClick, onDeleteClick }: Props) => {
</
HStack
>
</
HStack
>
</
Td
>
</
Td
>
</
Tr
>
</
Tr
>
)
)
;
};
};
export
default
AddressTagTableItem
;
export
default
AddressTagTableItem
;
ui/privateTags/DeletePrivateTagModal.tsx
View file @
345004aa
import
React
,
{
useCallback
,
useState
}
from
'
react
'
;
import
React
,
{
useCallback
,
useState
}
from
'
react
'
;
import
{
Text
}
from
'
@chakra-ui/react
'
;
import
{
Text
}
from
'
@chakra-ui/react
'
;
import
DeleteModal
from
'
ui/shared/DeleteModal
'
import
DeleteModal
from
'
ui/shared/DeleteModal
'
;
import
{
useMutation
,
useQueryClient
}
from
'
@tanstack/react-query
'
;
import
{
useMutation
,
useQueryClient
}
from
'
@tanstack/react-query
'
;
...
@@ -22,7 +22,7 @@ const DeletePrivateTagModal: React.FC<Props> = ({ isOpen, onClose, data, type })
...
@@ -22,7 +22,7 @@ const DeletePrivateTagModal: React.FC<Props> = ({ isOpen, onClose, data, type })
const
queryClient
=
useQueryClient
();
const
queryClient
=
useQueryClient
();
const
{
mutate
}
=
useMutation
(()
=>
{
const
{
mutate
}
=
useMutation
(()
=>
{
return
fetch
(
`/api/account/private-tags/
${
type
}
/
${
id
}
`
,
{
method
:
'
DELETE
'
})
return
fetch
(
`/api/account/private-tags/
${
type
}
/
${
id
}
`
,
{
method
:
'
DELETE
'
})
;
},
{
},
{
onError
:
()
=>
{
onError
:
()
=>
{
// eslint-disable-next-line no-console
// eslint-disable-next-line no-console
...
@@ -38,13 +38,13 @@ const DeletePrivateTagModal: React.FC<Props> = ({ isOpen, onClose, data, type })
...
@@ -38,13 +38,13 @@ const DeletePrivateTagModal: React.FC<Props> = ({ isOpen, onClose, data, type })
const
onDelete
=
useCallback
(()
=>
{
const
onDelete
=
useCallback
(()
=>
{
setPending
(
true
);
setPending
(
true
);
mutate
()
mutate
()
;
},
[
mutate
]);
},
[
mutate
]);
const
renderText
=
useCallback
(()
=>
{
const
renderText
=
useCallback
(()
=>
{
return
(
return
(
<
Text
display=
"flex"
>
Tag
<
Text
fontWeight=
"600"
whiteSpace=
"pre"
>
{
` "${ tag || 'tag' }" `
}
</
Text
>
will be deleted
</
Text
>
<
Text
display=
"flex"
>
Tag
<
Text
fontWeight=
"600"
whiteSpace=
"pre"
>
{
` "${ tag || 'tag' }" `
}
</
Text
>
will be deleted
</
Text
>
)
)
;
},
[
tag
]);
},
[
tag
]);
return
(
return
(
...
@@ -56,7 +56,7 @@ const DeletePrivateTagModal: React.FC<Props> = ({ isOpen, onClose, data, type })
...
@@ -56,7 +56,7 @@ const DeletePrivateTagModal: React.FC<Props> = ({ isOpen, onClose, data, type })
renderContent=
{
renderText
}
renderContent=
{
renderText
}
pending=
{
pending
}
pending=
{
pending
}
/>
/>
)
)
;
}
}
;
export
default
DeletePrivateTagModal
;
export
default
DeletePrivateTagModal
;
ui/privateTags/PrivateAddressTags.tsx
View file @
345004aa
...
@@ -21,7 +21,7 @@ const PrivateAddressTags = ({ addressTags }: Props) => {
...
@@ -21,7 +21,7 @@ const PrivateAddressTags = ({ addressTags }: Props) => {
const
onEditClick
=
useCallback
((
data
:
AddressTag
)
=>
{
const
onEditClick
=
useCallback
((
data
:
AddressTag
)
=>
{
setAddressModalData
(
data
);
setAddressModalData
(
data
);
addressModalProps
.
onOpen
();
addressModalProps
.
onOpen
();
},
[
addressModalProps
])
},
[
addressModalProps
])
;
const
onAddressModalClose
=
useCallback
(()
=>
{
const
onAddressModalClose
=
useCallback
(()
=>
{
setAddressModalData
(
undefined
);
setAddressModalData
(
undefined
);
...
@@ -31,7 +31,7 @@ const PrivateAddressTags = ({ addressTags }: Props) => {
...
@@ -31,7 +31,7 @@ const PrivateAddressTags = ({ addressTags }: Props) => {
const
onDeleteClick
=
useCallback
((
data
:
AddressTag
)
=>
{
const
onDeleteClick
=
useCallback
((
data
:
AddressTag
)
=>
{
setDeleteModalData
(
data
);
setDeleteModalData
(
data
);
deleteModalProps
.
onOpen
();
deleteModalProps
.
onOpen
();
},
[
deleteModalProps
])
},
[
deleteModalProps
])
;
const
onDeleteModalClose
=
useCallback
(()
=>
{
const
onDeleteModalClose
=
useCallback
(()
=>
{
setDeleteModalData
(
undefined
);
setDeleteModalData
(
undefined
);
...
@@ -72,4 +72,4 @@ const PrivateAddressTags = ({ addressTags }: Props) => {
...
@@ -72,4 +72,4 @@ const PrivateAddressTags = ({ addressTags }: Props) => {
);
);
};
};
export
default
PrivateAddressTags
export
default
PrivateAddressTags
;
ui/privateTags/PrivateTransactionTags.tsx
View file @
345004aa
...
@@ -23,7 +23,7 @@ const PrivateTransactionTags = ({ transactionTags }: Props) => {
...
@@ -23,7 +23,7 @@ const PrivateTransactionTags = ({ transactionTags }: Props) => {
const
onEditClick
=
useCallback
((
data
:
TransactionTag
)
=>
{
const
onEditClick
=
useCallback
((
data
:
TransactionTag
)
=>
{
setTransactionModalData
(
data
);
setTransactionModalData
(
data
);
transactionModalProps
.
onOpen
();
transactionModalProps
.
onOpen
();
},
[
transactionModalProps
])
},
[
transactionModalProps
])
;
const
onAddressModalClose
=
useCallback
(()
=>
{
const
onAddressModalClose
=
useCallback
(()
=>
{
setTransactionModalData
(
undefined
);
setTransactionModalData
(
undefined
);
...
@@ -33,7 +33,7 @@ const PrivateTransactionTags = ({ transactionTags }: Props) => {
...
@@ -33,7 +33,7 @@ const PrivateTransactionTags = ({ transactionTags }: Props) => {
const
onDeleteClick
=
useCallback
((
data
:
TransactionTag
)
=>
{
const
onDeleteClick
=
useCallback
((
data
:
TransactionTag
)
=>
{
setDeleteModalData
(
data
);
setDeleteModalData
(
data
);
deleteModalProps
.
onOpen
();
deleteModalProps
.
onOpen
();
},
[
deleteModalProps
])
},
[
deleteModalProps
])
;
const
onDeleteModalClose
=
useCallback
(()
=>
{
const
onDeleteModalClose
=
useCallback
(()
=>
{
setDeleteModalData
(
undefined
);
setDeleteModalData
(
undefined
);
...
@@ -73,4 +73,4 @@ const PrivateTransactionTags = ({ transactionTags }: Props) => {
...
@@ -73,4 +73,4 @@ const PrivateTransactionTags = ({ transactionTags }: Props) => {
);
);
};
};
export
default
PrivateTransactionTags
export
default
PrivateTransactionTags
;
ui/privateTags/TransactionModal/TransactionForm.tsx
View file @
345004aa
...
@@ -43,14 +43,14 @@ const TransactionForm: React.FC<Props> = ({ data, onClose }) => {
...
@@ -43,14 +43,14 @@ const TransactionForm: React.FC<Props> = ({ data, onClose }) => {
const
requestParams
=
{
const
requestParams
=
{
name
:
formData
?.
tag
,
name
:
formData
?.
tag
,
transaction_hash
:
formData
?.
transaction
,
transaction_hash
:
formData
?.
transaction
,
}
}
;
if
(
data
)
{
if
(
data
)
{
// edit tag
// edit tag
const
params
=
new
URLSearchParams
(
requestParams
);
const
params
=
new
URLSearchParams
(
requestParams
);
mutationFunction
=
()
=>
fetch
(
`/api/account/private-tags/transaction/
${
data
.
id
}
?
${
params
.
toString
()
}
`
,
{
method
:
'
PUT
'
})
mutationFunction
=
()
=>
fetch
(
`/api/account/private-tags/transaction/
${
data
.
id
}
?
${
params
.
toString
()
}
`
,
{
method
:
'
PUT
'
})
;
}
else
{
}
else
{
// add tag
// add tag
mutationFunction
=
()
=>
fetch
(
'
/api/account/private-tags/transaction
'
,
{
method
:
'
POST
'
,
body
:
JSON
.
stringify
(
requestParams
)
})
mutationFunction
=
()
=>
fetch
(
'
/api/account/private-tags/transaction
'
,
{
method
:
'
POST
'
,
body
:
JSON
.
stringify
(
requestParams
)
})
;
}
}
return
mutationFunction
();
return
mutationFunction
();
},
{
},
{
...
@@ -69,15 +69,15 @@ const TransactionForm: React.FC<Props> = ({ data, onClose }) => {
...
@@ -69,15 +69,15 @@ const TransactionForm: React.FC<Props> = ({ data, onClose }) => {
const
onSubmit
:
SubmitHandler
<
Inputs
>
=
formData
=>
{
const
onSubmit
:
SubmitHandler
<
Inputs
>
=
formData
=>
{
setPending
(
true
);
setPending
(
true
);
// api method for editing is not implemented now!!!
// api method for editing is not implemented now!!!
mutate
(
formData
)
mutate
(
formData
)
;
}
}
;
const
renderTransactionInput
=
useCallback
(({
field
}:
{
field
:
ControllerRenderProps
<
Inputs
,
'
transaction
'
>
})
=>
{
const
renderTransactionInput
=
useCallback
(({
field
}:
{
field
:
ControllerRenderProps
<
Inputs
,
'
transaction
'
>
})
=>
{
return
<
TransactionInput
field=
{
field
}
isInvalid=
{
Boolean
(
errors
.
transaction
)
}
/>
return
<
TransactionInput
field=
{
field
}
isInvalid=
{
Boolean
(
errors
.
transaction
)
}
/>
;
},
[
errors
]);
},
[
errors
]);
const
renderTagInput
=
useCallback
(({
field
}:
{
field
:
ControllerRenderProps
<
Inputs
,
'
tag
'
>
})
=>
{
const
renderTagInput
=
useCallback
(({
field
}:
{
field
:
ControllerRenderProps
<
Inputs
,
'
tag
'
>
})
=>
{
return
<
TagInput
field=
{
field
}
isInvalid=
{
Boolean
(
errors
.
tag
)
}
/>
return
<
TagInput
field=
{
field
}
isInvalid=
{
Boolean
(
errors
.
tag
)
}
/>
;
},
[
errors
]);
},
[
errors
]);
return
(
return
(
...
@@ -115,7 +115,7 @@ const TransactionForm: React.FC<Props> = ({ data, onClose }) => {
...
@@ -115,7 +115,7 @@ const TransactionForm: React.FC<Props> = ({ data, onClose }) => {
</
Button
>
</
Button
>
</
Box
>
</
Box
>
</>
</>
)
)
;
}
}
;
export
default
TransactionForm
;
export
default
TransactionForm
;
ui/privateTags/TransactionModal/TransactionModal.tsx
View file @
345004aa
...
@@ -13,10 +13,10 @@ type Props = {
...
@@ -13,10 +13,10 @@ type Props = {
const
AddressModal
:
React
.
FC
<
Props
>
=
({
isOpen
,
onClose
,
data
})
=>
{
const
AddressModal
:
React
.
FC
<
Props
>
=
({
isOpen
,
onClose
,
data
})
=>
{
const
title
=
data
?
'
Edit transaction tag
'
:
'
New transaction tag
'
;
const
title
=
data
?
'
Edit transaction tag
'
:
'
New transaction tag
'
;
const
text
=
'
Label any transaction with a private transaction tag (up to 35 chars) to customize your explorer experience.
'
const
text
=
'
Label any transaction with a private transaction tag (up to 35 chars) to customize your explorer experience.
'
;
const
renderForm
=
useCallback
(()
=>
{
const
renderForm
=
useCallback
(()
=>
{
return
<
TransactionForm
data=
{
data
}
onClose=
{
onClose
}
/>
return
<
TransactionForm
data=
{
data
}
onClose=
{
onClose
}
/>
;
},
[
data
,
onClose
]);
},
[
data
,
onClose
]);
return
(
return
(
<
FormModal
<
TransactionTag
>
<
FormModal
<
TransactionTag
>
...
@@ -27,7 +27,7 @@ const AddressModal: React.FC<Props> = ({ isOpen, onClose, data }) => {
...
@@ -27,7 +27,7 @@ const AddressModal: React.FC<Props> = ({ isOpen, onClose, data }) => {
data=
{
data
}
data=
{
data
}
renderForm=
{
renderForm
}
renderForm=
{
renderForm
}
/
>
/
>
)
)
;
}
}
;
export default AddressModal;
export default AddressModal;
ui/privateTags/TransactionTagTable/TransactionTagTable.tsx
View file @
345004aa
...
@@ -9,7 +9,7 @@ import {
...
@@ -9,7 +9,7 @@ import {
Tr
,
Tr
,
Th
,
Th
,
TableContainer
,
TableContainer
,
}
from
'
@chakra-ui/react
'
}
from
'
@chakra-ui/react
'
;
import
TransactionTagTableItem
from
'
./TransactionTagTableItem
'
;
import
TransactionTagTableItem
from
'
./TransactionTagTableItem
'
;
...
...
ui/privateTags/TransactionTagTable/TransactionTagTableItem.tsx
View file @
345004aa
...
@@ -6,7 +6,7 @@ import {
...
@@ -6,7 +6,7 @@ import {
Td
,
Td
,
HStack
,
HStack
,
Tooltip
,
Tooltip
,
}
from
'
@chakra-ui/react
'
}
from
'
@chakra-ui/react
'
;
import
EditButton
from
'
ui/shared/EditButton
'
;
import
EditButton
from
'
ui/shared/EditButton
'
;
import
DeleteButton
from
'
ui/shared/DeleteButton
'
;
import
DeleteButton
from
'
ui/shared/DeleteButton
'
;
...
@@ -49,7 +49,7 @@ const AddressTagTableItem = ({ item, onEditClick, onDeleteClick }: Props) => {
...
@@ -49,7 +49,7 @@ const AddressTagTableItem = ({ item, onEditClick, onDeleteClick }: Props) => {
</
HStack
>
</
HStack
>
</
Td
>
</
Td
>
</
Tr
>
</
Tr
>
)
)
;
};
};
export
default
AddressTagTableItem
;
export
default
AddressTagTableItem
;
ui/publicTags/DeletePublicTagModal.tsx
View file @
345004aa
...
@@ -35,7 +35,7 @@ const DeletePublicTagModal: React.FC<Props> = ({ isOpen, onClose, tags = [], onD
...
@@ -35,7 +35,7 @@ const DeletePublicTagModal: React.FC<Props> = ({ isOpen, onClose, tags = [], onD
<
Text
fontWeight=
"600"
whiteSpace=
"pre"
>
{
` "${ tags[0].name }" `
}
</
Text
>
<
Text
fontWeight=
"600"
whiteSpace=
"pre"
>
{
` "${ tags[0].name }" `
}
</
Text
>
<
Text
>
will be removed.
</
Text
>
<
Text
>
will be removed.
</
Text
>
</>
</>
)
)
;
}
}
if
(
tags
.
length
>
1
)
{
if
(
tags
.
length
>
1
)
{
const
tagsText
:
Array
<
JSX
.
Element
|
string
>
=
[];
const
tagsText
:
Array
<
JSX
.
Element
|
string
>
=
[];
...
@@ -51,12 +51,12 @@ const DeletePublicTagModal: React.FC<Props> = ({ isOpen, onClose, tags = [], onD
...
@@ -51,12 +51,12 @@ const DeletePublicTagModal: React.FC<Props> = ({ isOpen, onClose, tags = [], onD
if
(
index
===
tags
.
length
-
1
)
{
if
(
index
===
tags
.
length
-
1
)
{
tagsText
.
push
(<
Text
fontWeight=
"600"
whiteSpace=
"pre"
>
{
` "${ tag.name }" `
}
</
Text
>);
tagsText
.
push
(<
Text
fontWeight=
"600"
whiteSpace=
"pre"
>
{
` "${ tag.name }" `
}
</
Text
>);
}
}
})
})
;
text
=
(
text
=
(
<>
<>
<
Text
>
Public tags
</
Text
>
{
tagsText
}
<
Text
>
will be removed.
</
Text
>
<
Text
>
Public tags
</
Text
>
{
tagsText
}
<
Text
>
will be removed.
</
Text
>
</>
</>
)
)
;
}
}
return
(
return
(
<>
<>
...
@@ -72,7 +72,7 @@ const DeletePublicTagModal: React.FC<Props> = ({ isOpen, onClose, tags = [], onD
...
@@ -72,7 +72,7 @@ const DeletePublicTagModal: React.FC<Props> = ({ isOpen, onClose, tags = [], onD
<
FormLabel
>
Why do you want to remove tags?
</
FormLabel
>
<
FormLabel
>
Why do you want to remove tags?
</
FormLabel
>
</
FormControl
>
</
FormControl
>
</>
</>
)
)
;
},
[
tags
,
reason
,
onFieldChange
]);
},
[
tags
,
reason
,
onFieldChange
]);
return
(
return
(
...
@@ -83,7 +83,7 @@ const DeletePublicTagModal: React.FC<Props> = ({ isOpen, onClose, tags = [], onD
...
@@ -83,7 +83,7 @@ const DeletePublicTagModal: React.FC<Props> = ({ isOpen, onClose, tags = [], onD
title=
"Request to remove a public tag"
title=
"Request to remove a public tag"
renderContent=
{
renderContent
}
renderContent=
{
renderContent
}
/>
/>
)
)
;
}
}
;
export
default
DeletePublicTagModal
;
export
default
DeletePublicTagModal
;
ui/publicTags/PublicTagTable/PublicTagTable.tsx
View file @
345004aa
...
@@ -7,7 +7,7 @@ import {
...
@@ -7,7 +7,7 @@ import {
Tr
,
Tr
,
Th
,
Th
,
TableContainer
,
TableContainer
,
}
from
'
@chakra-ui/react
'
}
from
'
@chakra-ui/react
'
;
import
type
{
TPublicTagItem
,
TPublicTags
}
from
'
data/publicTags
'
;
import
type
{
TPublicTagItem
,
TPublicTags
}
from
'
data/publicTags
'
;
...
...
ui/publicTags/PublicTagTable/PublicTagTableItem.tsx
View file @
345004aa
...
@@ -9,7 +9,7 @@ import {
...
@@ -9,7 +9,7 @@ import {
HStack
,
HStack
,
VStack
,
VStack
,
useColorModeValue
,
useColorModeValue
,
}
from
'
@chakra-ui/react
'
}
from
'
@chakra-ui/react
'
;
import
AddressIcon
from
'
ui/shared/AddressIcon
'
;
import
AddressIcon
from
'
ui/shared/AddressIcon
'
;
import
AddressLinkWithTooltip
from
'
ui/shared/AddressLinkWithTooltip
'
;
import
AddressLinkWithTooltip
from
'
ui/shared/AddressLinkWithTooltip
'
;
...
@@ -49,7 +49,7 @@ const PublicTagTableItem = ({ item, onEditClick, onDeleteClick }: Props) => {
...
@@ -49,7 +49,7 @@ const PublicTagTableItem = ({ item, onEditClick, onDeleteClick }: Props) => {
{
adr
.
addressName
&&
<
Text
fontSize=
"sm"
color=
{
secondaryColor
}
mt=
{
0.5
}
>
{
adr
.
addressName
}
</
Text
>
}
{
adr
.
addressName
&&
<
Text
fontSize=
"sm"
color=
{
secondaryColor
}
mt=
{
0.5
}
>
{
adr
.
addressName
}
</
Text
>
}
</
Box
>
</
Box
>
</
HStack
>
</
HStack
>
)
)
;
})
}
})
}
</
VStack
>
</
VStack
>
</
Td
>
</
Td
>
...
@@ -62,7 +62,7 @@ const PublicTagTableItem = ({ item, onEditClick, onDeleteClick }: Props) => {
...
@@ -62,7 +62,7 @@ const PublicTagTableItem = ({ item, onEditClick, onDeleteClick }: Props) => {
{
tag
.
name
}
{
tag
.
name
}
</
Tag
>
</
Tag
>
</
TruncatedTextTooltip
>
</
TruncatedTextTooltip
>
)
)
;
})
}
})
}
</
VStack
>
</
VStack
>
</
Td
>
</
Td
>
...
@@ -76,7 +76,7 @@ const PublicTagTableItem = ({ item, onEditClick, onDeleteClick }: Props) => {
...
@@ -76,7 +76,7 @@ const PublicTagTableItem = ({ item, onEditClick, onDeleteClick }: Props) => {
</
HStack
>
</
HStack
>
</
Td
>
</
Td
>
</
Tr
>
</
Tr
>
)
)
;
};
};
export
default
PublicTagTableItem
;
export
default
PublicTagTableItem
;
ui/publicTags/PublicTagsData.tsx
View file @
345004aa
...
@@ -4,7 +4,7 @@ import React, { useCallback, useState } from 'react';
...
@@ -4,7 +4,7 @@ import React, { useCallback, useState } from 'react';
import
type
{
TPublicTagItem
,
TPublicTag
}
from
'
data/publicTags
'
;
import
type
{
TPublicTagItem
,
TPublicTag
}
from
'
data/publicTags
'
;
import
{
publicTags
}
from
'
data/publicTags
'
;
import
{
publicTags
}
from
'
data/publicTags
'
;
import
PublicTagTable
from
'
./PublicTagTable/PublicTagTable
'
;
import
PublicTagTable
from
'
./PublicTagTable/PublicTagTable
'
;
import
DeletePublicTagModal
from
'
./DeletePublicTagModal
'
import
DeletePublicTagModal
from
'
./DeletePublicTagModal
'
;
type
Props
=
{
type
Props
=
{
changeToFormScreen
:
(
data
?:
TPublicTagItem
)
=>
void
;
changeToFormScreen
:
(
data
?:
TPublicTagItem
)
=>
void
;
...
@@ -26,7 +26,7 @@ const PublicTagsData = ({ changeToFormScreen, onTagDelete }: Props) => {
...
@@ -26,7 +26,7 @@ const PublicTagsData = ({ changeToFormScreen, onTagDelete }: Props) => {
const
onItemEditClick
=
useCallback
((
item
:
TPublicTagItem
)
=>
{
const
onItemEditClick
=
useCallback
((
item
:
TPublicTagItem
)
=>
{
changeToFormScreen
(
item
);
changeToFormScreen
(
item
);
},
[
changeToFormScreen
])
},
[
changeToFormScreen
])
;
const
onItemDeleteClick
=
useCallback
((
item
:
TPublicTagItem
)
=>
{
const
onItemDeleteClick
=
useCallback
((
item
:
TPublicTagItem
)
=>
{
setDeleteModalData
(
item
.
tags
);
setDeleteModalData
(
item
.
tags
);
...
@@ -58,7 +58,7 @@ const PublicTagsData = ({ changeToFormScreen, onTagDelete }: Props) => {
...
@@ -58,7 +58,7 @@ const PublicTagsData = ({ changeToFormScreen, onTagDelete }: Props) => {
onDeleteSuccess=
{
onTagDelete
}
onDeleteSuccess=
{
onTagDelete
}
/>
/>
</>
</>
)
)
;
}
}
;
export
default
PublicTagsData
;
export
default
PublicTagsData
;
ui/publicTags/PublicTagsForm/PublicTagFormAction.tsx
View file @
345004aa
...
@@ -22,8 +22,8 @@ export default function PublicTagFormAction({ control, canReport }: Props) {
...
@@ -22,8 +22,8 @@ export default function PublicTagFormAction({ control, canReport }: Props) {
</
Radio
>
</
Radio
>
</
Stack
>
</
Stack
>
</
RadioGroup
>
</
RadioGroup
>
)
)
;
},
[
canReport
])
},
[
canReport
])
;
return
(
return
(
<
Controller
<
Controller
...
@@ -31,5 +31,5 @@ export default function PublicTagFormAction({ control, canReport }: Props) {
...
@@ -31,5 +31,5 @@ export default function PublicTagFormAction({ control, canReport }: Props) {
control=
{
control
}
control=
{
control
}
render=
{
renderRadioGroup
}
render=
{
renderRadioGroup
}
/>
/>
)
)
;
}
}
ui/publicTags/PublicTagsForm/PublicTagFormAddressInput.tsx
View file @
345004aa
...
@@ -28,7 +28,7 @@ export default function PublicTagFormAction({ control, index, fieldsLength, hasE
...
@@ -28,7 +28,7 @@ export default function PublicTagFormAction({ control, index, fieldsLength, hasE
size="lg"
size="lg"
placeholder="Smart contract / Address (0x...)"
placeholder="Smart contract / Address (0x...)"
/
>
/
>
)
)
;
}, [ hasError ]);
}, [ hasError ]);
return (
return (
...
@@ -64,5 +64,5 @@ export default function PublicTagFormAction({ control, index, fieldsLength, hasE
...
@@ -64,5 +64,5 @@ export default function PublicTagFormAction({ control, index, fieldsLength, hasE
top=
"25px"
top=
"25px"
/>
/>
)
}
</>
)
}
</>
)
)
;
}
}
ui/publicTags/PublicTagsForm/PublicTagFormComment.tsx
View file @
345004aa
...
@@ -18,8 +18,8 @@ export default function PublicTagFormComment({ control }: Props) {
...
@@ -18,8 +18,8 @@ export default function PublicTagFormComment({ control }: Props) {
/>
/>
<
FormLabel
>
Specify the reason for adding tags and color preference(s).
</
FormLabel
>
<
FormLabel
>
Specify the reason for adding tags and color preference(s).
</
FormLabel
>
</
FormControl
>
</
FormControl
>
)
)
;
},
[])
},
[])
;
return
(
return
(
<
Controller
<
Controller
...
@@ -27,5 +27,5 @@ export default function PublicTagFormComment({ control }: Props) {
...
@@ -27,5 +27,5 @@ export default function PublicTagFormComment({ control }: Props) {
control=
{
control
}
control=
{
control
}
render=
{
renderComment
}
render=
{
renderComment
}
/>
/>
)
)
;
}
}
ui/publicTags/PublicTagsForm/PublicTagsForm.tsx
View file @
345004aa
...
@@ -110,7 +110,7 @@ const PublicTagsForm = ({ changeToDataScreen, data }: Props) => {
...
@@ -110,7 +110,7 @@ const PublicTagsForm = ({ changeToDataScreen, data }: Props) => {
onRemoveFieldClick=
{
onRemoveFieldClick
}
onRemoveFieldClick=
{
onRemoveFieldClick
}
/>
/>
</
Box
>
</
Box
>
)
)
;
})
}
})
}
<
Box
marginBottom=
{
8
}
>
<
Box
marginBottom=
{
8
}
>
<
PublicTagFormComment
control=
{
control
}
/>
<
PublicTagFormComment
control=
{
control
}
/>
...
@@ -133,7 +133,7 @@ const PublicTagsForm = ({ changeToDataScreen, data }: Props) => {
...
@@ -133,7 +133,7 @@ const PublicTagsForm = ({ changeToDataScreen, data }: Props) => {
</
Button
>
</
Button
>
</
HStack
>
</
HStack
>
</
Box
>
</
Box
>
)
)
;
}
}
;
export default PublicTagsForm;
export default PublicTagsForm;
ui/publicTags/PublicTagsForm/PublicTagsFormInput.tsx
View file @
345004aa
...
@@ -21,7 +21,7 @@ export default function PublicTagsFormInput<Inputs extends FieldValues>({ label,
...
@@ -21,7 +21,7 @@ export default function PublicTagsFormInput<Inputs extends FieldValues>({ label,
/>
/>
<
FormLabel
>
{
label
}
</
FormLabel
>
<
FormLabel
>
{
label
}
</
FormLabel
>
</
FormControl
>
</
FormControl
>
)
)
;
},
[
label
,
required
]);
},
[
label
,
required
]);
return
(
return
(
<
Controller
<
Controller
...
@@ -29,5 +29,5 @@ export default function PublicTagsFormInput<Inputs extends FieldValues>({ label,
...
@@ -29,5 +29,5 @@ export default function PublicTagsFormInput<Inputs extends FieldValues>({ label,
control=
{
control
}
control=
{
control
}
render=
{
renderInput
}
render=
{
renderInput
}
/>
/>
)
)
;
}
}
ui/shared/AccountPageHeader.tsx
View file @
345004aa
...
@@ -5,7 +5,7 @@ import { Heading } from '@chakra-ui/react';
...
@@ -5,7 +5,7 @@ import { Heading } from '@chakra-ui/react';
const
PageHeader
=
({
text
}:
{
text
:
string
})
=>
{
const
PageHeader
=
({
text
}:
{
text
:
string
})
=>
{
return
(
return
(
<
Heading
as=
"h1"
size=
"lg"
marginBottom=
{
8
}
>
{
text
}
</
Heading
>
<
Heading
as=
"h1"
size=
"lg"
marginBottom=
{
8
}
>
{
text
}
</
Heading
>
)
)
;
}
}
;
export
default
PageHeader
;
export
default
PageHeader
;
ui/shared/AddressInput.tsx
View file @
345004aa
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
{
import
{
...
@@ -33,5 +33,5 @@ export default function AddressInput<Inputs extends FieldValues, Name extends Pa
...
@@ -33,5 +33,5 @@ export default function AddressInput<Inputs extends FieldValues, Name extends Pa
/>
/>
<
FormLabel
>
{
placeholder
}
</
FormLabel
>
<
FormLabel
>
{
placeholder
}
</
FormLabel
>
</
FormControl
>
</
FormControl
>
)
)
;
}
}
ui/shared/AddressLinkWithTooltip.tsx
View file @
345004aa
...
@@ -20,7 +20,7 @@ const AddressLinkWithTooltip = ({ address }: {address: string}) => {
...
@@ -20,7 +20,7 @@ const AddressLinkWithTooltip = ({ address }: {address: string}) => {
</
Link
>
</
Link
>
<
CopyToClipboard
text=
{
address
}
/>
<
CopyToClipboard
text=
{
address
}
/>
</
HStack
>
</
HStack
>
)
)
;
}
}
;
export
default
React
.
memo
(
AddressLinkWithTooltip
);
export
default
React
.
memo
(
AddressLinkWithTooltip
);
ui/shared/AddressWithDots.tsx
View file @
345004aa
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
// so i did it with js
// so i did it with js
import
React
,
{
useCallback
,
useEffect
,
useRef
}
from
'
react
'
;
import
React
,
{
useCallback
,
useEffect
,
useRef
}
from
'
react
'
;
import
{
Tooltip
}
from
'
@chakra-ui/react
'
import
{
Tooltip
}
from
'
@chakra-ui/react
'
;
import
_debounce
from
'
lodash/debounce
'
;
import
_debounce
from
'
lodash/debounce
'
;
import
type
{
FontFace
}
from
'
use-font-face-observer
'
;
import
type
{
FontFace
}
from
'
use-font-face-observer
'
;
import
useFontFaceObserver
from
'
use-font-face-observer
'
;
import
useFontFaceObserver
from
'
use-font-face-observer
'
;
...
@@ -65,13 +65,13 @@ const AddressWithDots = ({ address, fontWeight }: {address: string; fontWeight:
...
@@ -65,13 +65,13 @@ const AddressWithDots = ({ address, fontWeight }: {address: string; fontWeight:
// that's why there are separate useEffect hooks
// that's why there are separate useEffect hooks
useEffect
(()
=>
{
useEffect
(()
=>
{
calculateString
();
calculateString
();
},
[
calculateString
,
isFontFaceLoaded
])
},
[
calculateString
,
isFontFaceLoaded
])
;
useEffect
(()
=>
{
useEffect
(()
=>
{
const
resizeHandler
=
_debounce
(
calculateString
,
50
)
const
resizeHandler
=
_debounce
(
calculateString
,
50
)
;
window
.
addEventListener
(
'
resize
'
,
resizeHandler
)
window
.
addEventListener
(
'
resize
'
,
resizeHandler
)
;
return
function
cleanup
()
{
return
function
cleanup
()
{
window
.
removeEventListener
(
'
resize
'
,
resizeHandler
)
window
.
removeEventListener
(
'
resize
'
,
resizeHandler
)
;
};
};
},
[
calculateString
]);
},
[
calculateString
]);
...
@@ -81,11 +81,11 @@ const AddressWithDots = ({ address, fontWeight }: {address: string; fontWeight:
...
@@ -81,11 +81,11 @@ const AddressWithDots = ({ address, fontWeight }: {address: string; fontWeight:
if
(
isTruncated
)
{
if
(
isTruncated
)
{
return
(
return
(
<
Tooltip
label=
{
address
}
>
{
content
}
</
Tooltip
>
<
Tooltip
label=
{
address
}
>
{
content
}
</
Tooltip
>
)
)
;
}
}
return
content
;
return
content
;
}
}
;
function
getWidth
(
el
:
HTMLElement
)
{
function
getWidth
(
el
:
HTMLElement
)
{
return
el
.
getBoundingClientRect
().
width
;
return
el
.
getBoundingClientRect
().
width
;
...
...
ui/shared/CopyToClipboard.tsx
View file @
345004aa
...
@@ -27,6 +27,6 @@ const CopyToClipboard = ({ text }: {text: string}) => {
...
@@ -27,6 +27,6 @@ const CopyToClipboard = ({ text }: {text: string}) => {
/>
/>
</
Tooltip
>
</
Tooltip
>
);
);
}
}
;
export
default
CopyToClipboard
;
export
default
CopyToClipboard
;
ui/shared/DeleteButton.tsx
View file @
345004aa
...
@@ -9,7 +9,7 @@ type Props = {
...
@@ -9,7 +9,7 @@ type Props = {
}
}
const
DeleteButton
=
({
onClick
}:
Props
)
=>
{
const
DeleteButton
=
({
onClick
}:
Props
)
=>
{
const
onFocusCapture
=
useCallback
((
e
:
React
.
SyntheticEvent
)
=>
e
.
stopPropagation
(),
[])
const
onFocusCapture
=
useCallback
((
e
:
React
.
SyntheticEvent
)
=>
e
.
stopPropagation
(),
[])
;
return
(
return
(
<
Tooltip
label=
"Delete"
>
<
Tooltip
label=
"Delete"
>
<
IconButton
<
IconButton
...
@@ -22,7 +22,7 @@ const DeleteButton = ({ onClick }: Props) => {
...
@@ -22,7 +22,7 @@ const DeleteButton = ({ onClick }: Props) => {
onFocusCapture=
{
onFocusCapture
}
onFocusCapture=
{
onFocusCapture
}
/>
/>
</
Tooltip
>
</
Tooltip
>
)
)
;
}
}
;
export
default
DeleteButton
;
export
default
DeleteButton
;
ui/shared/DeleteModal.tsx
View file @
345004aa
...
@@ -49,7 +49,7 @@ const DeleteModal: React.FC<Props> = ({ isOpen, onClose, onDelete, title, render
...
@@ -49,7 +49,7 @@ const DeleteModal: React.FC<Props> = ({ isOpen, onClose, onDelete, title, render
</
ModalFooter
>
</
ModalFooter
>
</
ModalContent
>
</
ModalContent
>
</
Modal
>
</
Modal
>
)
)
;
}
}
;
export
default
DeleteModal
;
export
default
DeleteModal
;
ui/shared/EditButton.tsx
View file @
345004aa
...
@@ -9,7 +9,7 @@ type Props = {
...
@@ -9,7 +9,7 @@ type Props = {
}
}
const
EditButton
=
({
onClick
}:
Props
)
=>
{
const
EditButton
=
({
onClick
}:
Props
)
=>
{
const
onFocusCapture
=
useCallback
((
e
:
React
.
SyntheticEvent
)
=>
e
.
stopPropagation
(),
[])
const
onFocusCapture
=
useCallback
((
e
:
React
.
SyntheticEvent
)
=>
e
.
stopPropagation
(),
[])
;
return
(
return
(
<
Tooltip
label=
"Edit"
>
<
Tooltip
label=
"Edit"
>
<
IconButton
<
IconButton
...
@@ -22,7 +22,7 @@ const EditButton = ({ onClick }: Props) => {
...
@@ -22,7 +22,7 @@ const EditButton = ({ onClick }: Props) => {
onFocusCapture=
{
onFocusCapture
}
onFocusCapture=
{
onFocusCapture
}
/>
/>
</
Tooltip
>
</
Tooltip
>
)
)
;
}
}
;
export
default
EditButton
;
export
default
EditButton
;
ui/shared/FormModal.tsx
View file @
345004aa
...
@@ -36,5 +36,5 @@ export default function FormModal<TData>({ isOpen, onClose, data, title, text, r
...
@@ -36,5 +36,5 @@ export default function FormModal<TData>({ isOpen, onClose, data, title, text, r
</
ModalBody
>
</
ModalBody
>
</
ModalContent
>
</
ModalContent
>
</
Modal
>
</
Modal
>
)
)
;
}
}
ui/shared/Page/Page.tsx
View file @
345004aa
...
@@ -34,4 +34,4 @@ const Page = ({ children }: Props) => {
...
@@ -34,4 +34,4 @@ const Page = ({ children }: Props) => {
);
);
};
};
export
default
Page
export
default
Page
;
ui/shared/TagInput.tsx
View file @
345004aa
...
@@ -25,7 +25,7 @@ const TagInput: React.FC<Props> = ({ field, isInvalid }) => {
...
@@ -25,7 +25,7 @@ const TagInput: React.FC<Props> = ({ field, isInvalid }) => {
/>
/>
<
FormLabel
>
Private tag (max 35 characters)
</
FormLabel
>
<
FormLabel
>
Private tag (max 35 characters)
</
FormLabel
>
</
FormControl
>
</
FormControl
>
)
)
;
}
}
;
export
default
TagInput
;
export
default
TagInput
;
ui/shared/TransactionInput.tsx
View file @
345004aa
import
React
from
'
react
'
import
React
from
'
react
'
;
import
type
{
ControllerRenderProps
,
FieldValues
}
from
'
react-hook-form
'
;
import
type
{
ControllerRenderProps
,
FieldValues
}
from
'
react-hook-form
'
;
import
{
import
{
...
@@ -24,7 +24,7 @@ const AddressInput: React.FC<Props> = ({ field, isInvalid }) => {
...
@@ -24,7 +24,7 @@ const AddressInput: React.FC<Props> = ({ field, isInvalid }) => {
/>
/>
<
FormLabel
>
Transaction hash (0x...)
</
FormLabel
>
<
FormLabel
>
Transaction hash (0x...)
</
FormLabel
>
</
FormControl
>
</
FormControl
>
)
)
;
}
}
;
export
default
AddressInput
export
default
AddressInput
;
ui/shared/TruncatedTextTooltip.tsx
View file @
345004aa
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
{
Tooltip
}
from
'
@chakra-ui/react
'
import
{
Tooltip
}
from
'
@chakra-ui/react
'
;
import
debounce
from
'
lodash/debounce
'
;
import
debounce
from
'
lodash/debounce
'
;
import
useFontFaceObserver
from
'
use-font-face-observer
'
;
import
useFontFaceObserver
from
'
use-font-face-observer
'
;
import
{
BODY_TYPEFACE
}
from
'
theme/foundations/typography
'
;
import
{
BODY_TYPEFACE
}
from
'
theme/foundations/typography
'
;
...
@@ -33,18 +33,18 @@ const TruncatedTextTooltip = ({ children, label }: Props) => {
...
@@ -33,18 +33,18 @@ const TruncatedTextTooltip = ({ children, label }: Props) => {
// FIXME: that should be useLayoutEffect, but it keeps complaining about SSR
// FIXME: that should be useLayoutEffect, but it keeps complaining about SSR
// let's keep it as it is until the first issue
// let's keep it as it is until the first issue
React
.
useEffect
(()
=>
{
React
.
useEffect
(()
=>
{
updatedTruncateState
()
updatedTruncateState
()
;
},
[
updatedTruncateState
,
isFontFaceLoaded
]);
},
[
updatedTruncateState
,
isFontFaceLoaded
]);
// we want to do recalculation when isFontFaceLoaded flag is changed
// we want to do recalculation when isFontFaceLoaded flag is changed
// but we don't want to create more resize event listeners
// but we don't want to create more resize event listeners
// that's why there are separate useEffect hooks
// that's why there are separate useEffect hooks
React
.
useEffect
(()
=>
{
React
.
useEffect
(()
=>
{
const
handleResize
=
debounce
(
updatedTruncateState
,
1000
)
const
handleResize
=
debounce
(
updatedTruncateState
,
1000
)
;
window
.
addEventListener
(
'
resize
'
,
handleResize
)
window
.
addEventListener
(
'
resize
'
,
handleResize
)
;
return
function
cleanup
()
{
return
function
cleanup
()
{
window
.
removeEventListener
(
'
resize
'
,
handleResize
)
window
.
removeEventListener
(
'
resize
'
,
handleResize
)
;
};
};
},
[
updatedTruncateState
]);
},
[
updatedTruncateState
]);
...
@@ -52,7 +52,7 @@ const TruncatedTextTooltip = ({ children, label }: Props) => {
...
@@ -52,7 +52,7 @@ const TruncatedTextTooltip = ({ children, label }: Props) => {
// and it is not cleared how to manage case with two or more children
// and it is not cleared how to manage case with two or more children
const
child
=
React
.
Children
.
only
(
children
)
as
React
.
ReactElement
&
{
const
child
=
React
.
Children
.
only
(
children
)
as
React
.
ReactElement
&
{
ref
?:
React
.
Ref
<
React
.
ReactNode
>
;
ref
?:
React
.
Ref
<
React
.
ReactNode
>
;
}
}
;
const
modifiedChildren
=
React
.
cloneElement
(
const
modifiedChildren
=
React
.
cloneElement
(
child
,
child
,
{
ref
:
childRef
},
{
ref
:
childRef
},
...
...
ui/watchlist/AddressModal/AddressForm.tsx
View file @
345004aa
...
@@ -43,11 +43,11 @@ const AddressForm: React.FC<Props> = ({ data }) => {
...
@@ -43,11 +43,11 @@ const AddressForm: React.FC<Props> = ({ data }) => {
const
onSubmit
:
SubmitHandler
<
Inputs
>
=
data
=>
console
.
log
(
data
);
const
onSubmit
:
SubmitHandler
<
Inputs
>
=
data
=>
console
.
log
(
data
);
const
renderAddressInput
=
useCallback
(({
field
}:
{
field
:
ControllerRenderProps
<
Inputs
,
'
address
'
>
})
=>
{
const
renderAddressInput
=
useCallback
(({
field
}:
{
field
:
ControllerRenderProps
<
Inputs
,
'
address
'
>
})
=>
{
return
<
AddressInput
<
Inputs
,
'
address
'
>
field=
{
field
}
isInvalid=
{
Boolean
(
errors
.
address
)
}
/
>
return
<
AddressInput
<
Inputs
,
'
address
'
>
field=
{
field
}
isInvalid=
{
Boolean
(
errors
.
address
)
}
/
>
;
}, [ errors ]);
}, [ errors ]);
const renderTagInput = useCallback((
{
field
}
:
{
field
:
ControllerRenderProps
<
Inputs
,
'
tag
'
>
}
) =
>
{
const renderTagInput = useCallback((
{
field
}
:
{
field
:
ControllerRenderProps
<
Inputs
,
'
tag
'
>
}
) =
>
{
return
<
TagInput
field=
{
field
}
isInvalid=
{
Boolean
(
errors
.
tag
)
}
/>
return
<
TagInput
field=
{
field
}
isInvalid=
{
Boolean
(
errors
.
tag
)
}
/>
;
}
, [ errors ]);
}
, [ errors ]);
const renderCheckbox = useCallback((
{
field
}
:
{
field
:
ControllerRenderProps
<
Inputs
,
'
notification
'
>
}
) =
>
(
const renderCheckbox = useCallback((
{
field
}
:
{
field
:
ControllerRenderProps
<
Inputs
,
'
notification
'
>
}
) =
>
(
...
@@ -98,7 +98,7 @@ const AddressForm: React.FC<Props> = ({ data }) => {
...
@@ -98,7 +98,7 @@ const AddressForm: React.FC<Props> = ({ data }) => {
<
GridItem
><
Checkbox
colorScheme=
"blue"
size=
"lg"
>
Incoming
</
Checkbox
></
GridItem
>
<
GridItem
><
Checkbox
colorScheme=
"blue"
size=
"lg"
>
Incoming
</
Checkbox
></
GridItem
>
<
GridItem
><
Checkbox
colorScheme=
"blue"
size=
"lg"
>
Outgoing
</
Checkbox
></
GridItem
>
<
GridItem
><
Checkbox
colorScheme=
"blue"
size=
"lg"
>
Outgoing
</
Checkbox
></
GridItem
>
</
React
.
Fragment
>
</
React
.
Fragment
>
)
)
;
})
}
})
}
</
Grid
>
</
Grid
>
</
Box
>
</
Box
>
...
@@ -119,7 +119,7 @@ const AddressForm: React.FC<Props> = ({ data }) => {
...
@@ -119,7 +119,7 @@ const AddressForm: React.FC<Props> = ({ data }) => {
</
Button
>
</
Button
>
</
Box
>
</
Box
>
</>
</>
)
)
;
}
}
;
export default AddressForm;
export default AddressForm;
ui/watchlist/AddressModal/AddressModal.tsx
View file @
345004aa
...
@@ -13,10 +13,10 @@ type Props = {
...
@@ -13,10 +13,10 @@ type Props = {
const
AddressModal
:
React
.
FC
<
Props
>
=
({
isOpen
,
onClose
,
data
})
=>
{
const
AddressModal
:
React
.
FC
<
Props
>
=
({
isOpen
,
onClose
,
data
})
=>
{
const
title
=
data
?
'
Edit watch list address
'
:
'
New address to watch list
'
;
const
title
=
data
?
'
Edit watch list address
'
:
'
New address to watch list
'
;
const
text
=
'
An email notification can be sent to you when an address on your watch list sends or receives any transactions.
'
const
text
=
'
An email notification can be sent to you when an address on your watch list sends or receives any transactions.
'
;
const
renderForm
=
useCallback
(()
=>
{
const
renderForm
=
useCallback
(()
=>
{
return
<
AddressForm
data=
{
data
}
/>
return
<
AddressForm
data=
{
data
}
/>
;
},
[
data
]);
},
[
data
]);
return
(
return
(
<
FormModal
<
TWatchlistItem
>
<
FormModal
<
TWatchlistItem
>
...
@@ -27,7 +27,7 @@ const AddressModal: React.FC<Props> = ({ isOpen, onClose, data }) => {
...
@@ -27,7 +27,7 @@ const AddressModal: React.FC<Props> = ({ isOpen, onClose, data }) => {
data=
{
data
}
data=
{
data
}
renderForm=
{
renderForm
}
renderForm=
{
renderForm
}
/
>
/
>
)
)
;
}
}
;
export default AddressModal;
export default AddressModal;
ui/watchlist/DeleteAddressModal.tsx
View file @
345004aa
import
React
,
{
useCallback
}
from
'
react
'
;
import
React
,
{
useCallback
}
from
'
react
'
;
import
{
Text
}
from
'
@chakra-ui/react
'
;
import
{
Text
}
from
'
@chakra-ui/react
'
;
import
DeleteModal
from
'
ui/shared/DeleteModal
'
import
DeleteModal
from
'
ui/shared/DeleteModal
'
;
type
Props
=
{
type
Props
=
{
isOpen
:
boolean
;
isOpen
:
boolean
;
...
@@ -17,7 +17,7 @@ const DeleteAddressModal: React.FC<Props> = ({ isOpen, onClose, address }) => {
...
@@ -17,7 +17,7 @@ const DeleteAddressModal: React.FC<Props> = ({ isOpen, onClose, address }) => {
const
renderText
=
useCallback
(()
=>
{
const
renderText
=
useCallback
(()
=>
{
return
(
return
(
<
Text
display=
"flex"
>
Address
<
Text
fontWeight=
"600"
whiteSpace=
"pre"
>
{
address
||
'
address
'
}
</
Text
>
will be deleted
</
Text
>
<
Text
display=
"flex"
>
Address
<
Text
fontWeight=
"600"
whiteSpace=
"pre"
>
{
address
||
'
address
'
}
</
Text
>
will be deleted
</
Text
>
)
)
;
},
[
address
]);
},
[
address
]);
return
(
return
(
...
@@ -28,7 +28,7 @@ const DeleteAddressModal: React.FC<Props> = ({ isOpen, onClose, address }) => {
...
@@ -28,7 +28,7 @@ const DeleteAddressModal: React.FC<Props> = ({ isOpen, onClose, address }) => {
title=
"Remove address from watch list"
title=
"Remove address from watch list"
renderContent=
{
renderText
}
renderContent=
{
renderText
}
/>
/>
)
)
;
}
}
;
export
default
DeleteAddressModal
;
export
default
DeleteAddressModal
;
ui/watchlist/WatchlistTable/WatchListAddressItem.tsx
View file @
345004aa
...
@@ -40,7 +40,7 @@ const WatchListAddressItem = ({ item }: {item: TWatchlistItem}) => {
...
@@ -40,7 +40,7 @@ const WatchListAddressItem = ({ item }: {item: TWatchlistItem}) => {
)
}
)
}
</
VStack
>
</
VStack
>
</
HStack
>
</
HStack
>
)
)
;
}
}
;
export
default
WatchListAddressItem
;
export
default
WatchListAddressItem
;
ui/watchlist/WatchlistTable/WatchListTableItem.tsx
View file @
345004aa
...
@@ -6,7 +6,7 @@ import {
...
@@ -6,7 +6,7 @@ import {
Td
,
Td
,
Switch
,
Switch
,
HStack
,
HStack
,
}
from
'
@chakra-ui/react
'
}
from
'
@chakra-ui/react
'
;
import
EditButton
from
'
ui/shared/EditButton
'
;
import
EditButton
from
'
ui/shared/EditButton
'
;
import
DeleteButton
from
'
ui/shared/DeleteButton
'
;
import
DeleteButton
from
'
ui/shared/DeleteButton
'
;
...
@@ -49,7 +49,7 @@ const WatchlistTableItem = ({ item, onEditClick, onDeleteClick }: Props) => {
...
@@ -49,7 +49,7 @@ const WatchlistTableItem = ({ item, onEditClick, onDeleteClick }: Props) => {
</
HStack
>
</
HStack
>
</
Td
>
</
Td
>
</
Tr
>
</
Tr
>
)
)
;
};
};
export
default
WatchlistTableItem
;
export
default
WatchlistTableItem
;
ui/watchlist/WatchlistTable/WatchlistTable.tsx
View file @
345004aa
...
@@ -7,7 +7,7 @@ import {
...
@@ -7,7 +7,7 @@ import {
Tr
,
Tr
,
Th
,
Th
,
TableContainer
,
TableContainer
,
}
from
'
@chakra-ui/react
'
}
from
'
@chakra-ui/react
'
;
import
type
{
TWatchlist
,
TWatchlistItem
}
from
'
data/watchlist
'
;
import
type
{
TWatchlist
,
TWatchlistItem
}
from
'
data/watchlist
'
;
...
...
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