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
888124f2
Commit
888124f2
authored
Nov 04, 2022
by
tom
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'main' of github.com:blockscout/frontend into block-sockets
parents
e6aa65e7
b2cd2daa
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
39 additions
and
26 deletions
+39
-26
values.yaml
deploy/values/main/values.yaml
+4
-0
values.yaml
deploy/values/review/values.yaml
+4
-1
appContext.tsx
lib/appContext.tsx
+2
-4
getServerSideProps.ts
lib/next/getServerSideProps.ts
+2
-0
Popover.ts
theme/components/Popover.ts
+1
-1
BlocksContent.tsx
ui/blocks/BlocksContent.tsx
+5
-5
Transaction.tsx
ui/pages/Transaction.tsx
+8
-3
TxInternals.tsx
ui/tx/TxInternals.tsx
+3
-3
TxLogs.tsx
ui/tx/TxLogs.tsx
+2
-2
TxsContent.tsx
ui/txs/TxsContent.tsx
+3
-3
TxsTableItem.tsx
ui/txs/TxsTableItem.tsx
+3
-2
TxsWithSort.tsx
ui/txs/TxsWithSort.tsx
+2
-2
No files found.
deploy/values/main/values.yaml
View file @
888124f2
...
@@ -296,6 +296,10 @@ frontend:
...
@@ -296,6 +296,10 @@ frontend:
-
"
/static"
-
"
/static"
-
"
/auth/profile"
-
"
/auth/profile"
-
"
/account"
-
"
/account"
-
"
/txs"
-
"
/tx"
-
"
/blocks"
-
"
/block"
resources
:
resources
:
limits
:
limits
:
memory
:
memory
:
...
...
deploy/values/review/values.yaml
View file @
888124f2
...
@@ -295,7 +295,10 @@ frontend:
...
@@ -295,7 +295,10 @@ frontend:
-
"
/node-api"
-
"
/node-api"
-
"
/static"
-
"
/static"
-
"
/auth/profile"
-
"
/auth/profile"
-
"
/account"
-
"
/txs"
-
"
/tx"
-
"
/blocks"
-
"
/block"
resources
:
resources
:
limits
:
limits
:
memory
:
memory
:
...
...
lib/appContext.tsx
View file @
888124f2
...
@@ -7,13 +7,11 @@ type Props = {
...
@@ -7,13 +7,11 @@ type Props = {
pageProps
:
PageProps
;
pageProps
:
PageProps
;
}
}
const
AppContext
=
createContext
<
PageProps
>
({
cookies
:
''
});
const
AppContext
=
createContext
<
PageProps
>
({
cookies
:
''
,
referrer
:
''
});
export
function
AppWrapper
({
children
,
pageProps
}:
Props
)
{
export
function
AppWrapper
({
children
,
pageProps
}:
Props
)
{
const
appProps
=
{
cookies
:
pageProps
.
cookies
};
return
(
return
(
<
AppContext
.
Provider
value=
{
app
Props
}
>
<
AppContext
.
Provider
value=
{
page
Props
}
>
{
children
}
{
children
}
</
AppContext
.
Provider
>
</
AppContext
.
Provider
>
);
);
...
...
lib/next/getServerSideProps.ts
View file @
888124f2
...
@@ -2,12 +2,14 @@ import type { GetServerSideProps, GetServerSidePropsResult } from 'next';
...
@@ -2,12 +2,14 @@ import type { GetServerSideProps, GetServerSidePropsResult } from 'next';
export
type
Props
=
{
export
type
Props
=
{
cookies
:
string
;
cookies
:
string
;
referrer
:
string
;
}
}
export
const
getServerSideProps
:
GetServerSideProps
=
async
({
req
}):
Promise
<
GetServerSidePropsResult
<
Props
>>
=>
{
export
const
getServerSideProps
:
GetServerSideProps
=
async
({
req
}):
Promise
<
GetServerSidePropsResult
<
Props
>>
=>
{
return
{
return
{
props
:
{
props
:
{
cookies
:
req
.
headers
.
cookie
||
''
,
cookies
:
req
.
headers
.
cookie
||
''
,
referrer
:
req
.
headers
.
referer
||
''
,
},
},
};
};
};
};
theme/components/Popover.ts
View file @
888124f2
...
@@ -14,7 +14,7 @@ const $arrowBg = cssVar('popper-arrow-bg');
...
@@ -14,7 +14,7 @@ const $arrowBg = cssVar('popper-arrow-bg');
const
$arrowShadowColor
=
cssVar
(
'
popper-arrow-shadow-color
'
);
const
$arrowShadowColor
=
cssVar
(
'
popper-arrow-shadow-color
'
);
const
baseStylePopper
=
defineStyle
({
const
baseStylePopper
=
defineStyle
({
zIndex
:
1
0
,
zIndex
:
2
0
,
});
});
const
baseStyleContent
=
defineStyle
((
props
)
=>
{
const
baseStyleContent
=
defineStyle
((
props
)
=>
{
...
...
ui/blocks/BlocksContent.tsx
View file @
888124f2
import
{
Box
,
Text
,
Show
,
Alert
,
Skeleton
}
from
'
@chakra-ui/react
'
;
import
{
Box
,
Text
,
Show
,
Hide
,
Skeleton
,
Alert
}
from
'
@chakra-ui/react
'
;
import
{
useQuery
,
useQueryClient
}
from
'
@tanstack/react-query
'
;
import
{
useQuery
,
useQueryClient
}
from
'
@tanstack/react-query
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
...
@@ -70,10 +70,10 @@ const BlocksContent = ({ type }: Props) => {
...
@@ -70,10 +70,10 @@ const BlocksContent = ({ type }: Props) => {
<
Show
below=
"lg"
key=
"skeleton-mobile"
>
<
Show
below=
"lg"
key=
"skeleton-mobile"
>
<
BlocksSkeletonMobile
/>
<
BlocksSkeletonMobile
/>
</
Show
>
</
Show
>
<
Show
above
=
"lg"
key=
"skeleton-desktop"
>
<
Hide
below
=
"lg"
key=
"skeleton-desktop"
>
<
Skeleton
h=
{
6
}
mb=
{
8
}
w=
"150px"
/>
<
Skeleton
h=
{
6
}
mb=
{
8
}
w=
"150px"
/>
<
SkeletonTable
columns=
{
[
'
125px
'
,
'
120px
'
,
'
21%
'
,
'
64px
'
,
'
35%
'
,
'
22%
'
,
'
22%
'
]
}
/>
<
SkeletonTable
columns=
{
[
'
125px
'
,
'
120px
'
,
'
21%
'
,
'
64px
'
,
'
35%
'
,
'
22%
'
,
'
22%
'
]
}
/>
</
Show
>
</
Hide
>
</>
</>
);
);
}
}
...
@@ -83,7 +83,7 @@ const BlocksContent = ({ type }: Props) => {
...
@@ -83,7 +83,7 @@ const BlocksContent = ({ type }: Props) => {
}
}
if
(
data
.
items
.
length
===
0
)
{
if
(
data
.
items
.
length
===
0
)
{
return
<
Alert
>
There are no blocks.
</
Aler
t
>;
return
<
Text
as=
"span"
>
There are no blocks.
</
Tex
t
>;
}
}
return
(
return
(
...
@@ -91,7 +91,7 @@ const BlocksContent = ({ type }: Props) => {
...
@@ -91,7 +91,7 @@ const BlocksContent = ({ type }: Props) => {
<
Text
as=
"span"
>
Total of
{
data
.
items
[
0
].
height
.
toLocaleString
()
}
blocks
</
Text
>
<
Text
as=
"span"
>
Total of
{
data
.
items
[
0
].
height
.
toLocaleString
()
}
blocks
</
Text
>
{
socketAlert
&&
<
Alert
status=
"warning"
mt=
{
8
}
as=
"a"
href=
{
window
.
document
.
location
.
href
}
>
{
socketAlert
}
</
Alert
>
}
{
socketAlert
&&
<
Alert
status=
"warning"
mt=
{
8
}
as=
"a"
href=
{
window
.
document
.
location
.
href
}
>
{
socketAlert
}
</
Alert
>
}
<
Show
below=
"lg"
key=
"content-mobile"
><
BlocksList
data=
{
data
.
items
}
/></
Show
>
<
Show
below=
"lg"
key=
"content-mobile"
><
BlocksList
data=
{
data
.
items
}
/></
Show
>
<
Show
above=
"lg"
key=
"content-desktop"
><
BlocksTable
data=
{
data
.
items
}
/></
Show
>
<
Hide
below=
"lg"
key=
"content-desktop"
><
BlocksTable
data=
{
data
.
items
}
/></
Hide
>
<
Box
mx=
{
{
base
:
0
,
lg
:
6
}
}
my=
{
{
base
:
6
,
lg
:
3
}
}
>
<
Box
mx=
{
{
base
:
0
,
lg
:
6
}
}
my=
{
{
base
:
6
,
lg
:
3
}
}
>
{
/* eslint-disable-next-line react/jsx-no-bind */
}
{
/* eslint-disable-next-line react/jsx-no-bind */
}
<
Pagination
page=
{
1
}
onNextPageClick=
{
()
=>
{}
}
onPrevPageClick=
{
()
=>
{}
}
resetPage=
{
()
=>
{}
}
hasNextPage
/>
<
Pagination
page=
{
1
}
onNextPageClick=
{
()
=>
{}
}
onPrevPageClick=
{
()
=>
{}
}
resetPage=
{
()
=>
{}
}
hasNextPage
/>
...
...
ui/pages/Transaction.tsx
View file @
888124f2
...
@@ -7,6 +7,7 @@ import type { Transaction } from 'types/api/transaction';
...
@@ -7,6 +7,7 @@ import type { Transaction } from 'types/api/transaction';
import
type
{
RoutedTab
}
from
'
ui/shared/RoutedTabs/types
'
;
import
type
{
RoutedTab
}
from
'
ui/shared/RoutedTabs/types
'
;
import
eastArrowIcon
from
'
icons/arrows/east.svg
'
;
import
eastArrowIcon
from
'
icons/arrows/east.svg
'
;
import
{
useAppContext
}
from
'
lib/appContext
'
;
import
useFetch
from
'
lib/hooks/useFetch
'
;
import
useFetch
from
'
lib/hooks/useFetch
'
;
import
isBrowser
from
'
lib/isBrowser
'
;
import
isBrowser
from
'
lib/isBrowser
'
;
import
networkExplorers
from
'
lib/networks/networkExplorers
'
;
import
networkExplorers
from
'
lib/networks/networkExplorers
'
;
...
@@ -32,6 +33,12 @@ const TABS: Array<RoutedTab> = [
...
@@ -32,6 +33,12 @@ const TABS: Array<RoutedTab> = [
const
TransactionPageContent
=
()
=>
{
const
TransactionPageContent
=
()
=>
{
const
router
=
useRouter
();
const
router
=
useRouter
();
const
fetch
=
useFetch
();
const
fetch
=
useFetch
();
const
appProps
=
useAppContext
();
const
isInBrowser
=
isBrowser
();
const
referrer
=
isInBrowser
?
window
.
document
.
referrer
:
appProps
.
referrer
;
const
hasGoBackLink
=
referrer
&&
referrer
.
includes
(
'
/txs
'
);
const
{
data
}
=
useQuery
<
unknown
,
unknown
,
Transaction
>
(
const
{
data
}
=
useQuery
<
unknown
,
unknown
,
Transaction
>
(
[
'
tx
'
,
router
.
query
.
id
],
[
'
tx
'
,
router
.
query
.
id
],
...
@@ -48,12 +55,10 @@ const TransactionPageContent = () => {
...
@@ -48,12 +55,10 @@ const TransactionPageContent = () => {
return
<
ExternalLink
key=
{
explorer
.
baseUrl
}
title=
{
`Open in ${ explorer.title }`
}
href=
{
url
.
toString
()
}
/>;
return
<
ExternalLink
key=
{
explorer
.
baseUrl
}
title=
{
`Open in ${ explorer.title }`
}
href=
{
url
.
toString
()
}
/>;
});
});
const
hasGoBackLink
=
isBrowser
()
&&
window
.
document
.
referrer
.
includes
(
'
/txs
'
);
return
(
return
(
<
Page
>
<
Page
>
{
hasGoBackLink
&&
(
{
hasGoBackLink
&&
(
<
Link
mb=
{
6
}
display=
"inline-flex"
href=
{
window
.
document
.
referrer
}
>
<
Link
mb=
{
6
}
display=
"inline-flex"
href=
{
referrer
}
>
<
Icon
as=
{
eastArrowIcon
}
boxSize=
{
6
}
mr=
{
2
}
transform=
"rotate(180deg)"
/>
<
Icon
as=
{
eastArrowIcon
}
boxSize=
{
6
}
mr=
{
2
}
transform=
"rotate(180deg)"
/>
Transactions
Transactions
</
Link
>
</
Link
>
...
...
ui/tx/TxInternals.tsx
View file @
888124f2
import
{
Box
,
Flex
,
Alert
,
Show
}
from
'
@chakra-ui/react
'
;
import
{
Box
,
Flex
,
Text
,
Show
,
Hide
}
from
'
@chakra-ui/react
'
;
import
{
useQuery
}
from
'
@tanstack/react-query
'
;
import
{
useQuery
}
from
'
@tanstack/react-query
'
;
import
{
useRouter
}
from
'
next/router
'
;
import
{
useRouter
}
from
'
next/router
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
...
@@ -105,7 +105,7 @@ const TxInternals = () => {
...
@@ -105,7 +105,7 @@ const TxInternals = () => {
return
(
return
(
<>
<>
<
Show
below=
"lg"
><
TxInternalsSkeletonMobile
/></
Show
>
<
Show
below=
"lg"
><
TxInternalsSkeletonMobile
/></
Show
>
<
Show
above=
"lg"
><
TxInternalsSkeletonDesktop
/></
Show
>
<
Hide
below=
"lg"
><
TxInternalsSkeletonDesktop
/></
Hide
>
</>
</>
);
);
}
}
...
@@ -115,7 +115,7 @@ const TxInternals = () => {
...
@@ -115,7 +115,7 @@ const TxInternals = () => {
}
}
if
(
data
.
items
.
length
===
0
)
{
if
(
data
.
items
.
length
===
0
)
{
return
<
Alert
>
There are no internal transactions for this transaction.
</
Aler
t
>;
return
<
Text
as=
"span"
>
There are no internal transactions for this transaction.
</
Tex
t
>;
}
}
const
content
=
(()
=>
{
const
content
=
(()
=>
{
...
...
ui/tx/TxLogs.tsx
View file @
888124f2
import
{
Box
,
Aler
t
}
from
'
@chakra-ui/react
'
;
import
{
Box
,
Tex
t
}
from
'
@chakra-ui/react
'
;
import
{
useQuery
}
from
'
@tanstack/react-query
'
;
import
{
useQuery
}
from
'
@tanstack/react-query
'
;
import
{
useRouter
}
from
'
next/router
'
;
import
{
useRouter
}
from
'
next/router
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
...
@@ -46,7 +46,7 @@ const TxLogs = () => {
...
@@ -46,7 +46,7 @@ const TxLogs = () => {
}
}
if
(
data
.
items
.
length
===
0
)
{
if
(
data
.
items
.
length
===
0
)
{
return
<
Alert
>
There are no logs for this transaction.
</
Aler
t
>;
return
<
Text
as=
"span"
>
There are no logs for this transaction.
</
Tex
t
>;
}
}
return
(
return
(
...
...
ui/txs/TxsContent.tsx
View file @
888124f2
import
{
Alert
,
Box
,
Show
}
from
'
@chakra-ui/react
'
;
import
{
Text
,
Box
,
Show
,
Hide
}
from
'
@chakra-ui/react
'
;
import
React
,
{
useState
,
useCallback
}
from
'
react
'
;
import
React
,
{
useState
,
useCallback
}
from
'
react
'
;
import
type
{
TTxsFilters
}
from
'
types/api/txsFilters
'
;
import
type
{
TTxsFilters
}
from
'
types/api/txsFilters
'
;
...
@@ -71,13 +71,13 @@ const TxsContent = ({
...
@@ -71,13 +71,13 @@ const TxsContent = ({
const
txs
=
data
?.
items
;
const
txs
=
data
?.
items
;
if
(
!
isLoading
&&
!
txs
)
{
if
(
!
isLoading
&&
!
txs
)
{
return
<
Alert
>
There are no transactions.
</
Aler
t
>;
return
<
Text
as=
"span"
>
There are no transactions.
</
Tex
t
>;
}
}
let
content
=
(
let
content
=
(
<>
<>
<
Show
below=
"lg"
ssr=
{
false
}
><
TxsSkeletonMobile
/></
Show
>
<
Show
below=
"lg"
ssr=
{
false
}
><
TxsSkeletonMobile
/></
Show
>
<
Show
above=
"lg"
ssr=
{
false
}
><
TxsSkeletonDesktop
/></
Show
>
<
Hide
below=
"lg"
ssr=
{
false
}
><
TxsSkeletonDesktop
/></
Hide
>
</>
</>
);
);
...
...
ui/txs/TxsTableItem.tsx
View file @
888124f2
...
@@ -14,6 +14,7 @@ import {
...
@@ -14,6 +14,7 @@ import {
PopoverBody
,
PopoverBody
,
useColorModeValue
,
useColorModeValue
,
Show
,
Show
,
Hide
,
}
from
'
@chakra-ui/react
'
;
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
...
@@ -113,7 +114,7 @@ const TxsTableItem = ({ tx }: {tx: Transaction}) => {
...
@@ -113,7 +114,7 @@ const TxsTableItem = ({ tx }: {tx: Transaction}) => {
{
addressTo
}
{
addressTo
}
</
Td
>
</
Td
>
</
Show
>
</
Show
>
<
Show
below
=
"xl"
ssr=
{
false
}
>
<
Hide
above
=
"xl"
ssr=
{
false
}
>
<
Td
colSpan=
{
3
}
>
<
Td
colSpan=
{
3
}
>
<
Box
>
<
Box
>
{
addressFrom
}
{
addressFrom
}
...
@@ -128,7 +129,7 @@ const TxsTableItem = ({ tx }: {tx: Transaction}) => {
...
@@ -128,7 +129,7 @@ const TxsTableItem = ({ tx }: {tx: Transaction}) => {
{
addressTo
}
{
addressTo
}
</
Box
>
</
Box
>
</
Td
>
</
Td
>
</
Show
>
</
Hide
>
<
Td
isNumeric
>
<
Td
isNumeric
>
<
CurrencyValue
value=
{
tx
.
value
}
/>
<
CurrencyValue
value=
{
tx
.
value
}
/>
</
Td
>
</
Td
>
...
...
ui/txs/TxsWithSort.tsx
View file @
888124f2
import
{
Box
,
Show
}
from
'
@chakra-ui/react
'
;
import
{
Box
,
Show
,
Hide
}
from
'
@chakra-ui/react
'
;
import
React
,
{
useEffect
,
useState
}
from
'
react
'
;
import
React
,
{
useEffect
,
useState
}
from
'
react
'
;
import
type
{
TransactionsResponse
}
from
'
types/api/transaction
'
;
import
type
{
TransactionsResponse
}
from
'
types/api/transaction
'
;
...
@@ -29,7 +29,7 @@ const TxsWithSort = ({
...
@@ -29,7 +29,7 @@ const TxsWithSort = ({
return
(
return
(
<>
<>
<
Show
below=
"lg"
ssr=
{
false
}
><
Box
>
{
sortedTxs
.
map
(
tx
=>
<
TxsListItem
tx=
{
tx
}
key=
{
tx
.
hash
}
/>)
}
</
Box
></
Show
>
<
Show
below=
"lg"
ssr=
{
false
}
><
Box
>
{
sortedTxs
.
map
(
tx
=>
<
TxsListItem
tx=
{
tx
}
key=
{
tx
.
hash
}
/>)
}
</
Box
></
Show
>
<
Show
above=
"lg"
ssr=
{
false
}
><
TxsTable
txs=
{
sortedTxs
}
sort=
{
sort
}
sorting=
{
sorting
}
/></
Show
>
<
Hide
below=
"lg"
ssr=
{
false
}
><
TxsTable
txs=
{
sortedTxs
}
sort=
{
sort
}
sorting=
{
sorting
}
/></
Hide
>
</>
</>
);
);
...
...
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