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
45911808
Commit
45911808
authored
Sep 28, 2022
by
tom
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'main' of github.com:blockscout/frontend into tx-page-fixes
parents
524c68a7
296347cf
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
61 additions
and
23 deletions
+61
-23
dayjs.ts
lib/date/dayjs.ts
+36
-1
getStaticPaths.ts
lib/next/account/getStaticPaths.ts
+1
-3
api_key.tsx
pages/[network_type]/[network_sub_type]/account/api_key.tsx
+1
-1
custom_abi.tsx
.../[network_type]/[network_sub_type]/account/custom_abi.tsx
+1
-1
public_tags_request.tsx
..._type]/[network_sub_type]/account/public_tags_request.tsx
+1
-1
tag_address.tsx
...[network_type]/[network_sub_type]/account/tag_address.tsx
+1
-1
tag_transaction.tsx
...work_type]/[network_sub_type]/account/tag_transaction.tsx
+1
-1
watchlist.tsx
...s/[network_type]/[network_sub_type]/account/watchlist.tsx
+1
-1
pending-transactions.tsx
...network_type]/[network_sub_type]/pending-transactions.tsx
+1
-1
txs.tsx
pages/[network_type]/[network_sub_type]/txs.tsx
+1
-1
RoutedTabs.tsx
ui/shared/RoutedTabs/RoutedTabs.tsx
+1
-3
Utilization.tsx
ui/shared/Utilization.tsx
+7
-3
AddressLink.tsx
ui/shared/address/AddressLink.tsx
+8
-5
No files found.
lib/date/dayjs.ts
View file @
45911808
// eslint-disable-next-line no-restricted-imports
import
dayjs
from
'
dayjs
'
;
import
duration
from
'
dayjs/plugin/duration
'
;
import
localizedFormat
from
'
dayjs/plugin/localizedFormat
'
;
import
relativeTime
from
'
dayjs/plugin/relativeTime
'
;
import
updateLocale
from
'
dayjs/plugin/updateLocale
'
;
dayjs
.
locale
(
'
en
'
);
dayjs
.
extend
(
relativeTime
);
const
relativeTimeConfig
=
{
thresholds
:
[
{
l
:
'
s
'
,
r
:
1
},
{
l
:
'
ss
'
,
r
:
59
,
d
:
'
second
'
},
{
l
:
'
m
'
,
r
:
1
},
{
l
:
'
mm
'
,
r
:
59
,
d
:
'
minute
'
},
{
l
:
'
h
'
,
r
:
1
},
{
l
:
'
hh
'
,
r
:
23
,
d
:
'
hour
'
},
{
l
:
'
d
'
,
r
:
1
},
{
l
:
'
dd
'
,
r
:
29
,
d
:
'
day
'
},
{
l
:
'
M
'
,
r
:
1
},
{
l
:
'
MM
'
,
r
:
11
,
d
:
'
month
'
},
{
l
:
'
y
'
},
{
l
:
'
yy
'
,
d
:
'
year
'
},
],
};
dayjs
.
extend
(
relativeTime
,
relativeTimeConfig
);
dayjs
.
extend
(
updateLocale
);
dayjs
.
extend
(
localizedFormat
);
dayjs
.
extend
(
duration
);
dayjs
.
updateLocale
(
'
en
'
,
{
formats
:
{
LLLL
:
'
MMMM-DD-YYYY HH:mm:ss A Z UTC
'
,
},
relativeTime
:
{
s
:
'
a sec
'
,
ss
:
'
%d secs
'
,
future
:
'
in %s
'
,
past
:
'
%s ago
'
,
m
:
'
a min
'
,
mm
:
'
%d mins
'
,
h
:
'
an hour
'
,
hh
:
'
%d hours
'
,
d
:
'
a day
'
,
dd
:
'
%d days
'
,
M
:
'
a month
'
,
MM
:
'
%d months
'
,
y
:
'
a year
'
,
yy
:
'
%d years
'
,
},
});
export
default
dayjs
;
lib/next/account/getStaticPaths.ts
View file @
45911808
import
type
{
GetStaticPaths
}
from
'
next
'
;
import
getAvailablePaths
from
'
lib/networks/getAvailablePaths
'
;
export
const
getStaticPaths
:
GetStaticPaths
=
async
()
=>
{
return
{
paths
:
getAvailablePaths
(),
fallback
:
fals
e
};
return
{
paths
:
[],
fallback
:
tru
e
};
};
pages/[network_type]/[network_sub_type]/account/api_key.tsx
View file @
45911808
...
...
@@ -15,7 +15,7 @@ type Props = {
}
const
ApiKeysPage
:
NextPage
<
Props
>
=
({
pageParams
}:
Props
)
=>
{
const
title
=
getNetworkTitle
(
pageParams
);
const
title
=
getNetworkTitle
(
pageParams
||
{}
);
return
(
<>
<
Head
><
title
>
{
title
}
</
title
></
Head
>
...
...
pages/[network_type]/[network_sub_type]/account/custom_abi.tsx
View file @
45911808
...
...
@@ -15,7 +15,7 @@ type Props = {
}
const
CustomAbiPage
:
NextPage
<
Props
>
=
({
pageParams
}:
Props
)
=>
{
const
title
=
getNetworkTitle
(
pageParams
);
const
title
=
getNetworkTitle
(
pageParams
||
{}
);
return
(
<>
<
Head
><
title
>
{
title
}
</
title
></
Head
>
...
...
pages/[network_type]/[network_sub_type]/account/public_tags_request.tsx
View file @
45911808
...
...
@@ -15,7 +15,7 @@ type Props = {
}
const
PublicTagsPage
:
NextPage
<
Props
>
=
({
pageParams
}:
Props
)
=>
{
const
title
=
getNetworkTitle
(
pageParams
);
const
title
=
getNetworkTitle
(
pageParams
||
{}
);
return
(
<>
<
Head
><
title
>
{
title
}
</
title
></
Head
>
...
...
pages/[network_type]/[network_sub_type]/account/tag_address.tsx
View file @
45911808
...
...
@@ -15,7 +15,7 @@ type Props = {
}
const
AddressTagsPage
:
NextPage
<
Props
>
=
({
pageParams
}:
Props
)
=>
{
const
title
=
getNetworkTitle
(
pageParams
);
const
title
=
getNetworkTitle
(
pageParams
||
{}
);
return
(
<>
<
Head
><
title
>
{
title
}
</
title
></
Head
>
...
...
pages/[network_type]/[network_sub_type]/account/tag_transaction.tsx
View file @
45911808
...
...
@@ -15,7 +15,7 @@ type Props = {
}
const
TransactionTagsPage
:
NextPage
<
Props
>
=
({
pageParams
}:
Props
)
=>
{
const
title
=
getNetworkTitle
(
pageParams
);
const
title
=
getNetworkTitle
(
pageParams
||
{}
);
return
(
<>
<
Head
><
title
>
{
title
}
</
title
></
Head
>
...
...
pages/[network_type]/[network_sub_type]/account/watchlist.tsx
View file @
45911808
...
...
@@ -15,7 +15,7 @@ type Props = {
}
const
WatchListPage
:
NextPage
<
Props
>
=
({
pageParams
}:
Props
)
=>
{
const
title
=
getNetworkTitle
(
pageParams
);
const
title
=
getNetworkTitle
(
pageParams
||
{}
);
return
(
<>
<
Head
>
...
...
pages/[network_type]/[network_sub_type]/pending-transactions.tsx
View file @
45911808
...
...
@@ -15,7 +15,7 @@ type Props = {
}
const
AddressTagsPage
:
NextPage
<
Props
>
=
({
pageParams
}:
Props
)
=>
{
const
title
=
getNetworkTitle
(
pageParams
);
const
title
=
getNetworkTitle
(
pageParams
||
{}
);
return
(
<>
<
Head
><
title
>
{
title
}
</
title
></
Head
>
...
...
pages/[network_type]/[network_sub_type]/txs.tsx
View file @
45911808
...
...
@@ -15,7 +15,7 @@ type Props = {
}
const
AddressTagsPage
:
NextPage
<
Props
>
=
({
pageParams
}:
Props
)
=>
{
const
title
=
getNetworkTitle
(
pageParams
);
const
title
=
getNetworkTitle
(
pageParams
||
{}
);
return
(
<>
<
Head
><
title
>
{
title
}
</
title
></
Head
>
...
...
ui/shared/RoutedTabs/RoutedTabs.tsx
View file @
45911808
...
...
@@ -33,7 +33,7 @@ const RoutedTabs = ({ tabs, defaultActiveTab }: Props) => {
const
defaultIndex
=
tabs
.
findIndex
(({
routeName
})
=>
routeName
===
defaultActiveTab
);
const
isMobile
=
useIsMobile
();
const
[
activeTab
,
setActiveTab
]
=
React
.
useState
<
number
>
(
defaultIndex
);
const
[
activeTab
]
=
React
.
useState
<
number
>
(
defaultIndex
);
const
{
tabsCut
,
tabsList
,
tabsRefs
,
listRef
}
=
useAdaptiveTabs
(
tabs
,
isMobile
);
const
router
=
useRouter
();
...
...
@@ -45,8 +45,6 @@ const RoutedTabs = ({ tabs, defaultActiveTab }: Props) => {
const
newUrl
=
link
(
nextTab
.
routeName
,
router
.
query
);
router
.
push
(
newUrl
,
undefined
,
{
shallow
:
true
});
}
setActiveTab
(
index
);
},
[
tabs
,
router
]);
return
(
...
...
ui/shared/Utilization.tsx
View file @
45911808
...
...
@@ -4,18 +4,22 @@ import React from 'react';
interface
Props
{
className
?:
string
;
value
:
number
;
colorScheme
?:
'
green
'
|
'
gray
'
;
}
const
WIDTH
=
50
;
const
Utilization
=
({
className
,
value
}:
Props
)
=>
{
const
Utilization
=
({
className
,
value
,
colorScheme
=
'
green
'
}:
Props
)
=>
{
const
valueString
=
(
value
*
100
).
toFixed
(
2
)
+
'
%
'
;
const
colorGrayScheme
=
useColorModeValue
(
'
gray.500
'
,
'
gray.500
'
);
const
color
=
colorScheme
===
'
gray
'
?
colorGrayScheme
:
'
green.500
'
;
return
(
<
Flex
className=
{
className
}
alignItems=
"center"
>
<
Box
bg=
{
useColorModeValue
(
'
blackAlpha.200
'
,
'
whiteAlpha.200
'
)
}
w=
{
`${ WIDTH }px`
}
h=
"4px"
borderRadius=
"full"
overflow=
"hidden"
>
<
Box
bg=
"green.500"
w=
{
valueString
}
h=
"100%"
/>
<
Box
bg=
{
color
}
w=
{
valueString
}
h=
"100%"
/>
</
Box
>
<
Text
color=
"green.500"
ml=
"10px"
fontWeight=
"bold"
>
{
valueString
}
</
Text
>
<
Text
color=
{
color
}
ml=
"10px"
fontWeight=
"bold"
>
{
valueString
}
</
Text
>
</
Flex
>
);
};
...
...
ui/shared/address/AddressLink.tsx
View file @
45911808
...
...
@@ -6,23 +6,26 @@ import HashStringShorten from 'ui/shared/HashStringShorten';
import
HashStringShortenDynamic
from
'
ui/shared/HashStringShortenDynamic
'
;
interface
Props
{
type
?:
'
address
'
|
'
transaction
'
|
'
token
'
;
type
?:
'
address
'
|
'
transaction
'
|
'
token
'
|
'
block
'
;
alias
?:
string
;
className
?:
string
;
hash
:
string
;
truncation
?:
'
constant
'
|
'
dynamic
'
|
'
none
'
;
fontWeight
?:
string
;
id
?:
string
;
}
const
AddressLink
=
({
alias
,
type
,
className
,
truncation
=
'
dynamic
'
,
hash
,
fontWeight
}:
Props
)
=>
{
const
AddressLink
=
({
alias
,
type
,
className
,
truncation
=
'
dynamic
'
,
hash
,
id
,
fontWeight
}:
Props
)
=>
{
const
link
=
useLink
();
let
url
;
if
(
type
===
'
transaction
'
)
{
url
=
link
(
'
tx_index
'
,
{
id
:
hash
});
url
=
link
(
'
tx_index
'
,
{
id
:
id
||
hash
});
}
else
if
(
type
===
'
token
'
)
{
url
=
link
(
'
token_index
'
,
{
id
:
hash
});
url
=
link
(
'
token_index
'
,
{
id
:
id
||
hash
});
}
else
if
(
type
===
'
block
'
)
{
url
=
link
(
'
block
'
,
{
id
:
id
||
hash
});
}
else
{
url
=
link
(
'
address_index
'
,
{
id
:
hash
});
url
=
link
(
'
address_index
'
,
{
id
:
id
||
hash
});
}
const
content
=
(()
=>
{
...
...
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