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
1ca78283
Commit
1ca78283
authored
Oct 26, 2022
by
isstuev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new version of sticky, probably final
parent
1a974c78
Changes
20
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
422 additions
and
380 deletions
+422
-380
useScrollDirection.ts
lib/hooks/useScrollDirection.ts
+3
-1
Table.ts
theme/components/Table.ts
+8
-5
ScrollDirectionContext.tsx
ui/ScrollDirectionContext.tsx
+5
-0
ApiKeyTable.tsx
ui/apiKey/ApiKeyTable/ApiKeyTable.tsx
+18
-21
BlocksTable.tsx
ui/blocks/BlocksTable.tsx
+20
-22
CustomAbiTable.tsx
ui/customAbi/CustomAbiTable/CustomAbiTable.tsx
+18
-21
AddressTagTable.tsx
ui/privateTags/AddressTagTable/AddressTagTable.tsx
+19
-22
TransactionTagTable.tsx
ui/privateTags/TransactionTagTable/TransactionTagTable.tsx
+19
-22
PublicTagTable.tsx
ui/publicTags/PublicTagTable/PublicTagTable.tsx
+20
-23
Page.tsx
ui/shared/Page/Page.tsx
+12
-6
TheadSticky.tsx
ui/shared/TheadSticky.tsx
+48
-0
Header.tsx
ui/snippets/header/Header.tsx
+44
-44
SearchBar.tsx
ui/snippets/searchBar/SearchBar.tsx
+2
-2
SearchBarMobile.tsx
ui/snippets/searchBar/SearchBarMobile.tsx
+42
-40
TxInternalsTable.tsx
ui/tx/internals/TxInternalsTable.tsx
+26
-28
TxStateTable.tsx
ui/tx/state/TxStateTable.tsx
+15
-18
TxsContent.tsx
ui/txs/TxsContent.tsx
+1
-5
TxsHeader.tsx
ui/txs/TxsHeader.tsx
+44
-38
TxsTable.tsx
ui/txs/TxsTable.tsx
+38
-39
WatchlistTable.tsx
ui/watchlist/WatchlistTable/WatchlistTable.tsx
+20
-23
No files found.
lib/hooks/useScrollDirection.ts
View file @
1ca78283
...
@@ -16,7 +16,9 @@ export default function useScrollDirection() {
...
@@ -16,7 +16,9 @@ export default function useScrollDirection() {
const
currentScrollPosition
=
clamp
(
window
.
pageYOffset
,
0
,
window
.
document
.
body
.
scrollHeight
-
window
.
innerHeight
);
const
currentScrollPosition
=
clamp
(
window
.
pageYOffset
,
0
,
window
.
document
.
body
.
scrollHeight
-
window
.
innerHeight
);
const
scrollDiff
=
currentScrollPosition
-
prevScrollPosition
.
current
;
const
scrollDiff
=
currentScrollPosition
-
prevScrollPosition
.
current
;
if
(
Math
.
abs
(
scrollDiff
)
>
SCROLL_DIFF_THRESHOLD
)
{
if
(
window
.
pageYOffset
===
0
)
{
setDirection
(
undefined
);
}
else
if
(
Math
.
abs
(
scrollDiff
)
>
SCROLL_DIFF_THRESHOLD
)
{
setDirection
(
scrollDiff
<
0
?
'
up
'
:
'
down
'
);
setDirection
(
scrollDiff
<
0
?
'
up
'
:
'
down
'
);
}
}
...
...
theme/components/Table.ts
View file @
1ca78283
...
@@ -16,10 +16,10 @@ const variantSimple = definePartsStyle((props) => {
...
@@ -16,10 +16,10 @@ const variantSimple = definePartsStyle((props) => {
th
:
{
th
:
{
border
:
0
,
border
:
0
,
color
:
mode
(
'
gray.600
'
,
'
whiteAlpha.700
'
)(
props
),
color
:
mode
(
'
gray.600
'
,
'
whiteAlpha.700
'
)(
props
),
backgroundColor
:
mode
(
'
blackAlpha.100
'
,
'
whiteAlpha.200
'
)(
props
),
...
transitionProps
,
...
transitionProps
,
},
},
thead
:
{
thead
:
{
backgroundColor
:
mode
(
'
blackAlpha.100
'
,
'
whiteAlpha.200
'
)(
props
),
...
transitionProps
,
...
transitionProps
,
},
},
td
:
{
td
:
{
...
@@ -73,9 +73,6 @@ const variants = {
...
@@ -73,9 +73,6 @@ const variants = {
};
};
const
baseStyle
=
definePartsStyle
({
const
baseStyle
=
definePartsStyle
({
thead
:
{
backgroundColor
:
'
gray.50
'
,
},
th
:
{
th
:
{
textTransform
:
'
none
'
,
textTransform
:
'
none
'
,
fontFamily
:
'
body
'
,
fontFamily
:
'
body
'
,
...
@@ -83,6 +80,12 @@ const baseStyle = definePartsStyle({
...
@@ -83,6 +80,12 @@ const baseStyle = definePartsStyle({
overflow
:
'
hidden
'
,
overflow
:
'
hidden
'
,
color
:
'
gray.500
'
,
color
:
'
gray.500
'
,
letterSpacing
:
'
none
'
,
letterSpacing
:
'
none
'
,
_first
:
{
borderTopLeftRadius
:
'
8px
'
,
},
_last
:
{
borderTopRightRadius
:
'
8px
'
,
},
},
},
td
:
{
td
:
{
fontSize
:
'
md
'
,
fontSize
:
'
md
'
,
...
@@ -92,7 +95,7 @@ const baseStyle = definePartsStyle({
...
@@ -92,7 +95,7 @@ const baseStyle = definePartsStyle({
tableLayout
:
'
fixed
'
,
tableLayout
:
'
fixed
'
,
borderTopLeftRadius
:
'
base
'
,
borderTopLeftRadius
:
'
base
'
,
borderTopRightRadius
:
'
base
'
,
borderTopRightRadius
:
'
base
'
,
overflow
:
'
hidden
'
,
overflow
:
'
unset
'
,
fontVariant
:
'
normal
'
,
fontVariant
:
'
normal
'
,
},
},
});
});
...
...
ui/ScrollDirectionContext.tsx
0 → 100644
View file @
1ca78283
import
React
from
'
react
'
;
const
ScrollDirectionContext
=
React
.
createContext
<
'
up
'
|
'
down
'
|
undefined
>
(
undefined
);
export
default
ScrollDirectionContext
;
ui/apiKey/ApiKeyTable/ApiKeyTable.tsx
View file @
1ca78283
...
@@ -4,7 +4,6 @@ import {
...
@@ -4,7 +4,6 @@ import {
Tbody
,
Tbody
,
Tr
,
Tr
,
Th
,
Th
,
TableContainer
,
}
from
'
@chakra-ui/react
'
;
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
...
@@ -21,26 +20,24 @@ interface Props {
...
@@ -21,26 +20,24 @@ interface Props {
const
ApiKeyTable
=
({
data
,
onDeleteClick
,
onEditClick
,
limit
}:
Props
)
=>
{
const
ApiKeyTable
=
({
data
,
onDeleteClick
,
onEditClick
,
limit
}:
Props
)
=>
{
return
(
return
(
<
TableContainer
width=
"100%"
>
<
Table
variant=
"simple"
minWidth=
"600px"
>
<
Table
variant=
"simple"
minWidth=
"600px"
>
<
Thead
>
<
Thead
>
<
Tr
>
<
Tr
>
<
Th
>
{
`API key token (limit ${ limit } keys)`
}
</
Th
>
<
Th
>
{
`API key token (limit ${ limit } keys)`
}
</
Th
>
<
Th
width=
"108px"
></
Th
>
<
Th
width=
"108px"
></
Th
>
</
Tr
>
</
Tr
>
</
Thead
>
</
Thead
>
<
Tbody
>
<
Tbody
>
{
data
.
map
((
item
)
=>
(
{
data
.
map
((
item
)
=>
(
<
ApiKeyTableItem
<
ApiKeyTableItem
item=
{
item
}
item=
{
item
}
key=
{
item
.
api_key
}
key=
{
item
.
api_key
}
onDeleteClick=
{
onDeleteClick
}
onDeleteClick=
{
onDeleteClick
}
onEditClick=
{
onEditClick
}
onEditClick=
{
onEditClick
}
/>
/>
))
}
))
}
</
Tbody
>
</
Tbody
>
</
Table
>
</
Table
>
</
TableContainer
>
);
);
};
};
...
...
ui/blocks/BlocksTable.tsx
View file @
1ca78283
import
{
Table
,
Thead
,
Tbody
,
Tr
,
Th
,
TableContainer
}
from
'
@chakra-ui/react
'
;
import
{
Table
,
Thead
,
Tbody
,
Tr
,
Th
}
from
'
@chakra-ui/react
'
;
import
{
AnimatePresence
}
from
'
framer-motion
'
;
import
{
AnimatePresence
}
from
'
framer-motion
'
;
import
capitalize
from
'
lodash/capitalize
'
;
import
capitalize
from
'
lodash/capitalize
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
...
@@ -16,27 +16,25 @@ interface Props {
...
@@ -16,27 +16,25 @@ interface Props {
const
BlocksTable
=
({
data
}:
Props
)
=>
{
const
BlocksTable
=
({
data
}:
Props
)
=>
{
return
(
return
(
<
TableContainer
width=
"100%"
mt=
{
8
}
>
<
Table
variant=
"simple"
minWidth=
"1040px"
size=
"md"
fontWeight=
{
500
}
mt=
{
8
}
>
<
Table
variant=
"simple"
minWidth=
"1040px"
size=
"md"
fontWeight=
{
500
}
>
<
Thead
>
<
Thead
>
<
Tr
>
<
Tr
>
<
Th
width=
"125px"
>
Block
</
Th
>
<
Th
width=
"125px"
>
Block
</
Th
>
<
Th
width=
"120px"
>
Size
</
Th
>
<
Th
width=
"120px"
>
Size
</
Th
>
<
Th
width=
"21%"
minW=
"144px"
>
{
capitalize
(
getNetworkValidatorTitle
())
}
</
Th
>
<
Th
width=
"21%"
minW=
"144px"
>
{
capitalize
(
getNetworkValidatorTitle
())
}
</
Th
>
<
Th
width=
"64px"
isNumeric
>
Txn
</
Th
>
<
Th
width=
"64px"
isNumeric
>
Txn
</
Th
>
<
Th
width=
"35%"
>
Gas used
</
Th
>
<
Th
width=
"35%"
>
Gas used
</
Th
>
<
Th
width=
"22%"
>
Reward
{
appConfig
.
network
.
currency
.
symbol
}
</
Th
>
<
Th
width=
"22%"
>
Reward
{
appConfig
.
network
.
currency
.
symbol
}
</
Th
>
<
Th
width=
"22%"
>
Burnt fees
{
appConfig
.
network
.
currency
.
symbol
}
</
Th
>
<
Th
width=
"22%"
>
Burnt fees
{
appConfig
.
network
.
currency
.
symbol
}
</
Th
>
</
Tr
>
</
Tr
>
</
Thead
>
</
Thead
>
<
Tbody
>
<
Tbody
>
<
AnimatePresence
initial=
{
false
}
>
<
AnimatePresence
initial=
{
false
}
>
{
/* TODO prop "enableTimeIncrement" should be set to false for second and later pages */
}
{
/* TODO prop "enableTimeIncrement" should be set to false for second and later pages */
}
{
data
.
map
((
item
)
=>
<
BlocksTableItem
key=
{
item
.
height
}
data=
{
item
}
enableTimeIncrement
/>)
}
{
data
.
map
((
item
)
=>
<
BlocksTableItem
key=
{
item
.
height
}
data=
{
item
}
enableTimeIncrement
/>)
}
</
AnimatePresence
>
</
AnimatePresence
>
</
Tbody
>
</
Tbody
>
</
Table
>
</
Table
>
</
TableContainer
>
);
);
};
};
...
...
ui/customAbi/CustomAbiTable/CustomAbiTable.tsx
View file @
1ca78283
...
@@ -4,7 +4,6 @@ import {
...
@@ -4,7 +4,6 @@ import {
Tbody
,
Tbody
,
Tr
,
Tr
,
Th
,
Th
,
TableContainer
,
}
from
'
@chakra-ui/react
'
;
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
...
@@ -20,26 +19,24 @@ interface Props {
...
@@ -20,26 +19,24 @@ interface Props {
const
CustomAbiTable
=
({
data
,
onDeleteClick
,
onEditClick
}:
Props
)
=>
{
const
CustomAbiTable
=
({
data
,
onDeleteClick
,
onEditClick
}:
Props
)
=>
{
return
(
return
(
<
TableContainer
width=
"100%"
>
<
Table
variant=
"simple"
minWidth=
"600px"
>
<
Table
variant=
"simple"
minWidth=
"600px"
>
<
Thead
>
<
Thead
>
<
Tr
>
<
Tr
>
<
Th
>
ABI for Smart contract address (0x...)
</
Th
>
<
Th
>
ABI for Smart contract address (0x...)
</
Th
>
<
Th
width=
"108px"
></
Th
>
<
Th
width=
"108px"
></
Th
>
</
Tr
>
</
Tr
>
</
Thead
>
</
Thead
>
<
Tbody
>
<
Tbody
>
{
data
.
map
((
item
)
=>
(
{
data
.
map
((
item
)
=>
(
<
CustomAbiTableItem
<
CustomAbiTableItem
item=
{
item
}
item=
{
item
}
key=
{
item
.
id
}
key=
{
item
.
id
}
onDeleteClick=
{
onDeleteClick
}
onDeleteClick=
{
onDeleteClick
}
onEditClick=
{
onEditClick
}
onEditClick=
{
onEditClick
}
/>
/>
))
}
))
}
</
Tbody
>
</
Tbody
>
</
Table
>
</
Table
>
</
TableContainer
>
);
);
};
};
...
...
ui/privateTags/AddressTagTable/AddressTagTable.tsx
View file @
1ca78283
...
@@ -4,7 +4,6 @@ import {
...
@@ -4,7 +4,6 @@ import {
Tbody
,
Tbody
,
Tr
,
Tr
,
Th
,
Th
,
TableContainer
,
}
from
'
@chakra-ui/react
'
;
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
...
@@ -20,27 +19,25 @@ interface Props {
...
@@ -20,27 +19,25 @@ interface Props {
const
AddressTagTable
=
({
data
,
onDeleteClick
,
onEditClick
}:
Props
)
=>
{
const
AddressTagTable
=
({
data
,
onDeleteClick
,
onEditClick
}:
Props
)
=>
{
return
(
return
(
<
TableContainer
width=
"100%"
>
<
Table
variant=
"simple"
minWidth=
"600px"
>
<
Table
variant=
"simple"
minWidth=
"600px"
>
<
Thead
>
<
Thead
>
<
Tr
>
<
Tr
>
<
Th
width=
"60%"
>
Address
</
Th
>
<
Th
width=
"60%"
>
Address
</
Th
>
<
Th
width=
"40%"
>
Private tag
</
Th
>
<
Th
width=
"40%"
>
Private tag
</
Th
>
<
Th
width=
"108px"
></
Th
>
<
Th
width=
"108px"
></
Th
>
</
Tr
>
</
Tr
>
</
Thead
>
</
Thead
>
<
Tbody
>
<
Tbody
>
{
data
.
map
((
item
:
AddressTag
)
=>
(
{
data
.
map
((
item
:
AddressTag
)
=>
(
<
AddressTagTableItem
<
AddressTagTableItem
item=
{
item
}
item=
{
item
}
key=
{
item
.
id
}
key=
{
item
.
id
}
onDeleteClick=
{
onDeleteClick
}
onDeleteClick=
{
onDeleteClick
}
onEditClick=
{
onEditClick
}
onEditClick=
{
onEditClick
}
/>
/>
))
}
))
}
</
Tbody
>
</
Tbody
>
</
Table
>
</
Table
>
</
TableContainer
>
);
);
};
};
...
...
ui/privateTags/TransactionTagTable/TransactionTagTable.tsx
View file @
1ca78283
...
@@ -4,7 +4,6 @@ import {
...
@@ -4,7 +4,6 @@ import {
Tbody
,
Tbody
,
Tr
,
Tr
,
Th
,
Th
,
TableContainer
,
}
from
'
@chakra-ui/react
'
;
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
...
@@ -20,27 +19,25 @@ interface Props {
...
@@ -20,27 +19,25 @@ interface Props {
const
AddressTagTable
=
({
data
,
onDeleteClick
,
onEditClick
}:
Props
)
=>
{
const
AddressTagTable
=
({
data
,
onDeleteClick
,
onEditClick
}:
Props
)
=>
{
return
(
return
(
<
TableContainer
width=
"100%"
>
<
Table
variant=
"simple"
minWidth=
"600px"
>
<
Table
variant=
"simple"
minWidth=
"600px"
>
<
Thead
>
<
Thead
>
<
Tr
>
<
Tr
>
<
Th
width=
"75%"
>
Transaction
</
Th
>
<
Th
width=
"75%"
>
Transaction
</
Th
>
<
Th
width=
"25%"
>
Private tag
</
Th
>
<
Th
width=
"25%"
>
Private tag
</
Th
>
<
Th
width=
"108px"
></
Th
>
<
Th
width=
"108px"
></
Th
>
</
Tr
>
</
Tr
>
</
Thead
>
</
Thead
>
<
Tbody
>
<
Tbody
>
{
data
.
map
((
item
)
=>
(
{
data
.
map
((
item
)
=>
(
<
TransactionTagTableItem
<
TransactionTagTableItem
item=
{
item
}
item=
{
item
}
key=
{
item
.
id
}
key=
{
item
.
id
}
onDeleteClick=
{
onDeleteClick
}
onDeleteClick=
{
onDeleteClick
}
onEditClick=
{
onEditClick
}
onEditClick=
{
onEditClick
}
/>
/>
))
}
))
}
</
Tbody
>
</
Tbody
>
</
Table
>
</
Table
>
</
TableContainer
>
);
);
};
};
...
...
ui/publicTags/PublicTagTable/PublicTagTable.tsx
View file @
1ca78283
...
@@ -4,7 +4,6 @@ import {
...
@@ -4,7 +4,6 @@ import {
Tbody
,
Tbody
,
Tr
,
Tr
,
Th
,
Th
,
TableContainer
,
}
from
'
@chakra-ui/react
'
;
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
...
@@ -20,28 +19,26 @@ interface Props {
...
@@ -20,28 +19,26 @@ interface Props {
const
PublicTagTable
=
({
data
,
onEditClick
,
onDeleteClick
}:
Props
)
=>
{
const
PublicTagTable
=
({
data
,
onEditClick
,
onDeleteClick
}:
Props
)
=>
{
return
(
return
(
<
TableContainer
width=
"100%"
>
<
Table
variant=
"simple"
minWidth=
"600px"
>
<
Table
variant=
"simple"
minWidth=
"600px"
>
<
Thead
>
<
Thead
>
<
Tr
>
<
Tr
>
<
Th
width=
"50%"
>
Smart contract / Address (0x...)
</
Th
>
<
Th
width=
"50%"
>
Smart contract / Address (0x...)
</
Th
>
<
Th
width=
"25%"
>
Public tag
</
Th
>
<
Th
width=
"25%"
>
Public tag
</
Th
>
<
Th
width=
"25%"
>
Request status
</
Th
>
<
Th
width=
"25%"
>
Request status
</
Th
>
<
Th
width=
"108px"
></
Th
>
<
Th
width=
"108px"
></
Th
>
</
Tr
>
</
Tr
>
</
Thead
>
</
Thead
>
<
Tbody
>
<
Tbody
>
{
data
.
map
((
item
)
=>
(
{
data
.
map
((
item
)
=>
(
<
PublicTagTableItem
<
PublicTagTableItem
item=
{
item
}
item=
{
item
}
key=
{
item
.
id
}
key=
{
item
.
id
}
onDeleteClick=
{
onDeleteClick
}
onDeleteClick=
{
onDeleteClick
}
onEditClick=
{
onEditClick
}
onEditClick=
{
onEditClick
}
/>
/>
))
}
))
}
</
Tbody
>
</
Tbody
>
</
Table
>
</
Table
>
</
TableContainer
>
);
);
};
};
...
...
ui/shared/Page/Page.tsx
View file @
1ca78283
...
@@ -6,6 +6,8 @@ import { QueryKeys } from 'types/client/queries';
...
@@ -6,6 +6,8 @@ import { QueryKeys } from 'types/client/queries';
import
*
as
cookies
from
'
lib/cookies
'
;
import
*
as
cookies
from
'
lib/cookies
'
;
import
useFetch
from
'
lib/hooks/useFetch
'
;
import
useFetch
from
'
lib/hooks/useFetch
'
;
import
useScrollDirection
from
'
lib/hooks/useScrollDirection
'
;
import
ScrollDirectionContext
from
'
ui/ScrollDirectionContext
'
;
import
PageContent
from
'
ui/shared/Page/PageContent
'
;
import
PageContent
from
'
ui/shared/Page/PageContent
'
;
import
Header
from
'
ui/snippets/header/Header
'
;
import
Header
from
'
ui/snippets/header/Header
'
;
import
NavigationDesktop
from
'
ui/snippets/navigation/NavigationDesktop
'
;
import
NavigationDesktop
from
'
ui/snippets/navigation/NavigationDesktop
'
;
...
@@ -23,18 +25,22 @@ const Page = ({ children, wrapChildren = true, hideMobileHeaderOnScrollDown }: P
...
@@ -23,18 +25,22 @@ const Page = ({ children, wrapChildren = true, hideMobileHeaderOnScrollDown }: P
enabled
:
Boolean
(
cookies
.
get
(
cookies
.
NAMES
.
API_TOKEN
)),
enabled
:
Boolean
(
cookies
.
get
(
cookies
.
NAMES
.
API_TOKEN
)),
});
});
const
directionContext
=
useScrollDirection
();
const
renderedChildren
=
wrapChildren
?
(
const
renderedChildren
=
wrapChildren
?
(
<
PageContent
>
{
children
}
</
PageContent
>
<
PageContent
>
{
children
}
</
PageContent
>
)
:
children
;
)
:
children
;
return
(
return
(
<
Flex
w=
"100%"
minH=
"100vh"
alignItems=
"stretch"
>
<
ScrollDirectionContext
.
Provider
value=
{
directionContext
}
>
<
NavigationDesktop
/>
<
Flex
w=
"100%"
minH=
"100vh"
alignItems=
"stretch"
>
<
Flex
flexDir=
"column"
width=
"100%"
>
<
NavigationDesktop
/>
<
Header
hideOnScrollDown=
{
hideMobileHeaderOnScrollDown
}
/>
<
Flex
flexDir=
"column"
width=
"100%"
>
{
renderedChildren
}
<
Header
hideOnScrollDown=
{
hideMobileHeaderOnScrollDown
}
/>
{
renderedChildren
}
</
Flex
>
</
Flex
>
</
Flex
>
</
Flex
>
</
ScrollDirectionContext
.
Provider
>
);
);
};
};
...
...
ui/shared/TheadSticky.tsx
0 → 100644
View file @
1ca78283
import
{
Thead
,
useColorModeValue
}
from
'
@chakra-ui/react
'
;
import
type
{
TableHeadProps
,
PositionProps
}
from
'
@chakra-ui/react
'
;
import
throttle
from
'
lodash/throttle
'
;
import
React
from
'
react
'
;
interface
Props
extends
TableHeadProps
{
top
?:
number
;
children
?:
React
.
ReactNode
;
}
const
TheadSticky
=
({
top
,
children
,
...
restProps
}:
Props
)
=>
{
const
ref
=
React
.
useRef
<
HTMLTableSectionElement
>
(
null
);
const
[
isSticky
,
setIsSticky
]
=
React
.
useState
(
false
);
const
handleScroll
=
React
.
useCallback
(()
=>
{
if
(
Number
(
ref
.
current
?.
getBoundingClientRect
().
y
)
<=
(
top
||
0
))
{
setIsSticky
(
true
);
}
else
{
setIsSticky
(
false
);
}
},
[
top
]);
React
.
useEffect
(()
=>
{
const
throttledHandleScroll
=
throttle
(
handleScroll
,
300
);
window
.
addEventListener
(
'
scroll
'
,
throttledHandleScroll
);
return
()
=>
{
window
.
removeEventListener
(
'
scroll
'
,
throttledHandleScroll
);
};
},
[
handleScroll
]);
const
props
=
{
...
restProps
,
position
:
'
sticky
'
as
PositionProps
[
'
position
'
],
top
:
`
${
top
}
px`
||
0
,
backgroundColor
:
useColorModeValue
(
'
white
'
,
'
black
'
),
boxShadow
:
isSticky
?
'
md
'
:
'
none
'
,
};
return
(
<
Thead
{
...
props
}
ref=
{
ref
}
>
{
children
}
</
Thead
>
);
};
export
default
TheadSticky
;
ui/snippets/header/Header.tsx
View file @
1ca78283
import
{
HStack
,
Box
,
Flex
,
useColorModeValue
}
from
'
@chakra-ui/react
'
;
import
{
HStack
,
Box
,
Flex
,
useColorModeValue
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
useScrollDirection
from
'
lib/hooks/useScrollDirection
'
;
import
ScrollDirectionContext
from
'
ui/ScrollDirectionContext
'
;
import
NetworkLogo
from
'
ui/snippets/networkMenu/NetworkLogo
'
;
import
NetworkLogo
from
'
ui/snippets/networkMenu/NetworkLogo
'
;
import
ProfileMenuDesktop
from
'
ui/snippets/profileMenu/ProfileMenuDesktop
'
;
import
ProfileMenuDesktop
from
'
ui/snippets/profileMenu/ProfileMenuDesktop
'
;
import
ProfileMenuMobile
from
'
ui/snippets/profileMenu/ProfileMenuMobile
'
;
import
ProfileMenuMobile
from
'
ui/snippets/profileMenu/ProfileMenuMobile
'
;
...
@@ -11,52 +11,52 @@ import Burger from './Burger';
...
@@ -11,52 +11,52 @@ import Burger from './Burger';
import
ColorModeToggler
from
'
./ColorModeToggler
'
;
import
ColorModeToggler
from
'
./ColorModeToggler
'
;
const
Header
=
({
hideOnScrollDown
}:
{
hideOnScrollDown
?:
boolean
})
=>
{
const
Header
=
({
hideOnScrollDown
}:
{
hideOnScrollDown
?:
boolean
})
=>
{
const
scrollDirection
=
useScrollDirection
();
const
bgColor
=
useColorModeValue
(
'
white
'
,
'
black
'
);
const
bgColor
=
useColorModeValue
(
'
white
'
,
'
black
'
);
const
transform
=
hideOnScrollDown
&&
scrollDirection
===
'
down
'
?
'
translateY(-60px)
'
:
'
translateY(0)
'
;
return
(
return
(
<>
<
ScrollDirectionContext
.
Consumer
>
<
Box
bgColor=
{
bgColor
}
display=
{
{
base
:
'
block
'
,
lg
:
'
none
'
}
}
>
{
(
scrollDirection
)
=>
(
<
Flex
<>
as=
"header"
<
Box
bgColor=
{
bgColor
}
display=
{
{
base
:
'
block
'
,
lg
:
'
none
'
}
}
>
position=
"fixed"
<
Flex
top=
{
0
}
as=
"header"
left=
{
0
}
position=
"fixed"
paddingX=
{
4
}
top=
{
0
}
paddingY=
{
2
}
left=
{
0
}
bgColor=
{
bgColor
}
paddingX=
{
4
}
width=
"100%"
paddingY=
{
2
}
alignItems=
"center"
bgColor=
{
bgColor
}
justifyContent=
"space-between"
width=
"100%"
zIndex=
"sticky2"
alignItems=
"center"
transform=
{
transform
}
justifyContent=
"space-between"
transitionProperty=
"transform,box-shadow"
zIndex=
"sticky2"
transitionDuration=
"slow"
transitionProperty=
"box-shadow"
boxShadow=
{
scrollDirection
===
'
down
'
?
'
md
'
:
'
none
'
}
transitionDuration=
"slow"
>
boxShadow=
{
!
hideOnScrollDown
&&
scrollDirection
===
'
down
'
?
'
md
'
:
'
none
'
}
<
Burger
/>
>
<
NetworkLogo
/>
<
Burger
/>
<
ProfileMenuMobile
/>
<
NetworkLogo
/>
</
Flex
>
<
ProfileMenuMobile
/>
<
SearchBar
/>
</
Flex
>
</
Box
>
<
SearchBar
withShadow=
{
!
hideOnScrollDown
}
/>
<
HStack
</
Box
><
HStack
as=
"header"
as=
"header"
width=
"100%"
width=
"100%"
alignItems=
"center"
alignItems=
"center"
justifyContent=
"center"
justifyContent=
"center"
gap=
{
12
}
gap=
{
12
}
display=
{
{
base
:
'
none
'
,
lg
:
'
flex
'
}
}
display=
{
{
base
:
'
none
'
,
lg
:
'
flex
'
}
}
paddingX=
{
12
}
paddingX=
{
12
}
paddingTop=
{
9
}
paddingTop=
{
9
}
paddingBottom=
"52px"
paddingBottom=
"52px"
>
>
<
SearchBar
/>
<
SearchBar
/>
<
ColorModeToggler
/>
<
ColorModeToggler
/>
<
ProfileMenuDesktop
/>
<
ProfileMenuDesktop
/>
</
HStack
>
</
HStack
>
</>
</>
)
}
</
ScrollDirectionContext
.
Consumer
>
);
);
};
};
...
...
ui/snippets/searchBar/SearchBar.tsx
View file @
1ca78283
...
@@ -6,7 +6,7 @@ import link from 'lib/link/link';
...
@@ -6,7 +6,7 @@ import link from 'lib/link/link';
import
SearchBarDesktop
from
'
./SearchBarDesktop
'
;
import
SearchBarDesktop
from
'
./SearchBarDesktop
'
;
import
SearchBarMobile
from
'
./SearchBarMobile
'
;
import
SearchBarMobile
from
'
./SearchBarMobile
'
;
const
SearchBar
=
()
=>
{
const
SearchBar
=
(
{
withShadow
}:
{
withShadow
?:
boolean
}
)
=>
{
const
[
value
,
setValue
]
=
React
.
useState
(
''
);
const
[
value
,
setValue
]
=
React
.
useState
(
''
);
const
handleChange
=
React
.
useCallback
((
event
:
ChangeEvent
<
HTMLInputElement
>
)
=>
{
const
handleChange
=
React
.
useCallback
((
event
:
ChangeEvent
<
HTMLInputElement
>
)
=>
{
...
@@ -22,7 +22,7 @@ const SearchBar = () => {
...
@@ -22,7 +22,7 @@ const SearchBar = () => {
return
(
return
(
<>
<>
<
SearchBarDesktop
onChange=
{
handleChange
}
onSubmit=
{
handleSubmit
}
/>
<
SearchBarDesktop
onChange=
{
handleChange
}
onSubmit=
{
handleSubmit
}
/>
<
SearchBarMobile
onChange=
{
handleChange
}
onSubmit=
{
handleSubmit
}
/>
<
SearchBarMobile
onChange=
{
handleChange
}
onSubmit=
{
handleSubmit
}
withShadow=
{
withShadow
}
/>
</>
</>
);
);
};
};
...
...
ui/snippets/searchBar/SearchBarMobile.tsx
View file @
1ca78283
...
@@ -4,29 +4,27 @@ import React from 'react';
...
@@ -4,29 +4,27 @@ import React from 'react';
import
type
{
ChangeEvent
,
FormEvent
}
from
'
react
'
;
import
type
{
ChangeEvent
,
FormEvent
}
from
'
react
'
;
import
searchIcon
from
'
icons/search.svg
'
;
import
searchIcon
from
'
icons/search.svg
'
;
import
useScrollDirection
from
'
lib/hooks/useScrollDirection
'
;
import
ScrollDirectionContext
from
'
ui/ScrollDirectionContext
'
;
const
TOP
=
55
;
const
TOP
=
55
;
interface
Props
{
interface
Props
{
onChange
:
(
event
:
ChangeEvent
<
HTMLInputElement
>
)
=>
void
;
onChange
:
(
event
:
ChangeEvent
<
HTMLInputElement
>
)
=>
void
;
onSubmit
:
(
event
:
FormEvent
<
HTMLFormElement
>
)
=>
void
;
onSubmit
:
(
event
:
FormEvent
<
HTMLFormElement
>
)
=>
void
;
withShadow
?:
boolean
;
}
}
const
SearchBarMobile
=
({
onChange
,
onSubmit
}:
Props
)
=>
{
const
SearchBarMobile
=
({
onChange
,
onSubmit
,
withShadow
}:
Props
)
=>
{
const
scrollDirection
=
useScrollDirection
();
const
isVisible
=
!
scrollDirection
||
scrollDirection
===
'
up
'
;
const
[
isSticky
,
setIsSticky
]
=
React
.
useState
(
false
);
const
[
isSticky
,
setIsSticky
]
=
React
.
useState
(
false
);
const
handleScroll
=
React
.
useCallback
(()
=>
{
const
handleScroll
=
React
.
useCallback
(()
=>
{
if
(
window
.
pageYOffset
===
0
||
!
isVisible
)
{
if
(
window
.
pageYOffset
!==
0
)
{
setIsSticky
(
false
);
}
else
{
setIsSticky
(
true
);
setIsSticky
(
true
);
}
else
{
setIsSticky
(
false
);
}
}
},
[
isVisible
]);
},
[]);
React
.
useEffect
(()
=>
{
React
.
useEffect
(()
=>
{
const
throttledHandleScroll
=
throttle
(
handleScroll
,
300
);
const
throttledHandleScroll
=
throttle
(
handleScroll
,
300
);
...
@@ -45,37 +43,41 @@ const SearchBarMobile = ({ onChange, onSubmit }: Props) => {
...
@@ -45,37 +43,41 @@ const SearchBarMobile = ({ onChange, onSubmit }: Props) => {
const
bgColor
=
useColorModeValue
(
'
white
'
,
'
black
'
);
const
bgColor
=
useColorModeValue
(
'
white
'
,
'
black
'
);
return
(
return
(
<
chakra
.
form
<
ScrollDirectionContext
.
Consumer
>
noValidate
{
(
scrollDirection
)
=>
(
onSubmit=
{
onSubmit
}
<
chakra
.
form
paddingX=
{
4
}
noValidate
paddingTop=
{
1
}
onSubmit=
{
onSubmit
}
paddingBottom=
{
2
}
paddingX=
{
4
}
position=
"fixed"
paddingTop=
{
1
}
top=
{
`${ TOP }px`
}
paddingBottom=
{
2
}
left=
"0"
position=
"fixed"
zIndex=
"sticky1"
top=
{
`${ TOP }px`
}
bgColor=
{
bgColor
}
left=
"0"
transform=
{
isVisible
?
'
translateY(0)
'
:
'
translateY(-112px)
'
}
zIndex=
"sticky1"
transitionProperty=
"transform,box-shadow"
bgColor=
{
bgColor
}
transitionDuration=
"slow"
transform=
{
scrollDirection
!==
'
down
'
?
'
translateY(0)
'
:
'
translateY(-100%)
'
}
display=
{
{
base
:
'
block
'
,
lg
:
'
none
'
}
}
transitionProperty=
"transform,box-shadow"
w=
"100%"
transitionDuration=
"slow"
boxShadow=
{
isVisible
&&
isSticky
?
'
md
'
:
'
none
'
}
display=
{
{
base
:
'
block
'
,
lg
:
'
none
'
}
}
>
w=
"100%"
<
InputGroup
size=
"sm"
>
boxShadow=
{
withShadow
&&
scrollDirection
!==
'
down
'
&&
isSticky
?
'
md
'
:
'
none
'
}
<
InputLeftElement
>
>
<
Icon
as=
{
searchIcon
}
boxSize=
{
4
}
color=
{
searchIconColor
}
/>
<
InputGroup
size=
"sm"
>
</
InputLeftElement
>
<
InputLeftElement
>
<
Input
<
Icon
as=
{
searchIcon
}
boxSize=
{
4
}
color=
{
searchIconColor
}
/>
paddingInlineStart=
"38px"
</
InputLeftElement
>
placeholder=
"Search by addresses / ... "
<
Input
ml=
"1px"
paddingInlineStart=
"38px"
onChange=
{
onChange
}
placeholder=
"Search by addresses / ... "
borderColor=
{
inputBorderColor
}
ml=
"1px"
/>
onChange=
{
onChange
}
</
InputGroup
>
borderColor=
{
inputBorderColor
}
</
chakra
.
form
>
/>
</
InputGroup
>
</
chakra
.
form
>
)
}
</
ScrollDirectionContext
.
Consumer
>
);
);
};
};
...
...
ui/tx/internals/TxInternalsTable.tsx
View file @
1ca78283
import
{
Table
,
Thead
,
Tbody
,
Tr
,
Th
,
TableContainer
,
Link
,
Icon
}
from
'
@chakra-ui/react
'
;
import
{
Table
,
Thead
,
Tbody
,
Tr
,
Th
,
Link
,
Icon
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
type
{
InternalTransaction
}
from
'
types/api/internalTransaction
'
;
import
type
{
InternalTransaction
}
from
'
types/api/internalTransaction
'
;
...
@@ -18,35 +18,33 @@ const TxInternalsTable = ({ data, sort, onSortToggle }: Props) => {
...
@@ -18,35 +18,33 @@ const TxInternalsTable = ({ data, sort, onSortToggle }: Props) => {
const
sortIconTransform
=
sort
?.
includes
(
'
asc
'
)
?
'
rotate(-90deg)
'
:
'
rotate(90deg)
'
;
const
sortIconTransform
=
sort
?.
includes
(
'
asc
'
)
?
'
rotate(-90deg)
'
:
'
rotate(90deg)
'
;
return
(
return
(
<
TableContainer
width=
"100%"
mt=
{
6
}
>
<
Table
variant=
"simple"
size=
"sm"
mt=
{
6
}
>
<
Table
variant=
"simple"
size=
"sm"
>
<
Thead
>
<
Thead
>
<
Tr
>
<
Tr
>
<
Th
width=
"28%"
>
Type
</
Th
>
<
Th
width=
"28%"
>
Type
</
Th
>
<
Th
width=
"20%"
>
From
</
Th
>
<
Th
width=
"20%"
>
From
</
Th
>
<
Th
width=
"24px"
px=
{
0
}
/>
<
Th
width=
"24px"
px=
{
0
}
/>
<
Th
width=
"20%"
>
To
</
Th
>
<
Th
width=
"20%"
>
To
</
Th
>
<
Th
width=
"16%"
isNumeric
>
<
Th
width=
"16%"
isNumeric
>
<
Link
display=
"flex"
alignItems=
"center"
justifyContent=
"flex-end"
onClick=
{
onSortToggle
(
'
value
'
)
}
columnGap=
{
1
}
>
<
Link
display=
"flex"
alignItems=
"center"
justifyContent=
"flex-end"
onClick=
{
onSortToggle
(
'
value
'
)
}
columnGap=
{
1
}
>
{
sort
?.
includes
(
'
value
'
)
&&
<
Icon
as=
{
arrowIcon
}
boxSize=
{
4
}
transform=
{
sortIconTransform
}
/>
}
{
sort
?.
includes
(
'
value
'
)
&&
<
Icon
as=
{
arrowIcon
}
boxSize=
{
4
}
transform=
{
sortIconTransform
}
/>
}
Value
{
appConfig
.
network
.
currency
.
symbol
}
Value
{
appConfig
.
network
.
currency
.
symbol
}
</
Link
>
</
Link
>
</
Th
>
</
Th
>
<
Th
width=
"16%"
isNumeric
>
<
Th
width=
"16%"
isNumeric
>
<
Link
display=
"flex"
alignItems=
"center"
justifyContent=
"flex-end"
onClick=
{
onSortToggle
(
'
gas-limit
'
)
}
columnGap=
{
1
}
>
<
Link
display=
"flex"
alignItems=
"center"
justifyContent=
"flex-end"
onClick=
{
onSortToggle
(
'
gas-limit
'
)
}
columnGap=
{
1
}
>
{
sort
?.
includes
(
'
gas-limit
'
)
&&
<
Icon
as=
{
arrowIcon
}
boxSize=
{
4
}
transform=
{
sortIconTransform
}
/>
}
{
sort
?.
includes
(
'
gas-limit
'
)
&&
<
Icon
as=
{
arrowIcon
}
boxSize=
{
4
}
transform=
{
sortIconTransform
}
/>
}
Gas limit
{
appConfig
.
network
.
currency
.
symbol
}
Gas limit
{
appConfig
.
network
.
currency
.
symbol
}
</
Link
>
</
Link
>
</
Th
>
</
Th
>
</
Tr
>
</
Tr
>
</
Thead
>
</
Thead
>
<
Tbody
>
<
Tbody
>
{
data
.
map
((
item
)
=>
(
{
data
.
map
((
item
)
=>
(
<
TxInternalsTableItem
key=
{
item
.
transaction_hash
}
{
...
item
}
/>
<
TxInternalsTableItem
key=
{
item
.
transaction_hash
}
{
...
item
}
/>
))
}
))
}
</
Tbody
>
</
Tbody
>
</
Table
>
</
Table
>
</
TableContainer
>
);
);
};
};
...
...
ui/tx/state/TxStateTable.tsx
View file @
1ca78283
...
@@ -4,7 +4,6 @@ import {
...
@@ -4,7 +4,6 @@ import {
Tbody
,
Tbody
,
Tr
,
Tr
,
Th
,
Th
,
TableContainer
,
}
from
'
@chakra-ui/react
'
;
}
from
'
@chakra-ui/react
'
;
import
capitalize
from
'
lodash/capitalize
'
;
import
capitalize
from
'
lodash/capitalize
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
...
@@ -16,23 +15,21 @@ import TxStateTableItem from 'ui/tx/state/TxStateTableItem';
...
@@ -16,23 +15,21 @@ import TxStateTableItem from 'ui/tx/state/TxStateTableItem';
const
TxStateTable
=
()
=>
{
const
TxStateTable
=
()
=>
{
return
(
return
(
<
TableContainer
width=
"100%"
mt=
{
6
}
>
<
Table
variant=
"simple"
minWidth=
"950px"
size=
"sm"
w=
"auto"
mt=
{
6
}
>
<
Table
variant=
"simple"
minWidth=
"950px"
size=
"sm"
w=
"auto"
>
<
Thead
>
<
Thead
>
<
Tr
>
<
Tr
>
<
Th
width=
"92px"
>
Storage
</
Th
>
<
Th
width=
"92px"
>
Storage
</
Th
>
<
Th
width=
"146px"
>
Address
</
Th
>
<
Th
width=
"146px"
>
Address
</
Th
>
<
Th
width=
"120px"
>
{
capitalize
(
getNetworkValidatorTitle
())
}
</
Th
>
<
Th
width=
"120px"
>
{
capitalize
(
getNetworkValidatorTitle
())
}
</
Th
>
<
Th
width=
"33%"
isNumeric
>
{
`After ${ appConfig.network.currency.symbol }`
}
</
Th
>
<
Th
width=
"33%"
isNumeric
>
{
`After ${ appConfig.network.currency.symbol }`
}
</
Th
>
<
Th
width=
"33%"
isNumeric
>
{
`Before ${ appConfig.network.currency.symbol }`
}
</
Th
>
<
Th
width=
"33%"
isNumeric
>
{
`Before ${ appConfig.network.currency.symbol }`
}
</
Th
>
<
Th
width=
"33%"
isNumeric
>
{
`State difference ${ appConfig.network.currency.symbol }`
}
</
Th
>
<
Th
width=
"33%"
isNumeric
>
{
`State difference ${ appConfig.network.currency.symbol }`
}
</
Th
>
</
Tr
>
</
Tr
>
</
Thead
>
</
Thead
>
<
Tbody
>
<
Tbody
>
{
data
.
map
((
item
,
index
)
=>
<
TxStateTableItem
txStateItem=
{
item
}
key=
{
index
}
/>)
}
{
data
.
map
((
item
,
index
)
=>
<
TxStateTableItem
txStateItem=
{
item
}
key=
{
index
}
/>)
}
</
Tbody
>
</
Tbody
>
</
Table
>
</
Table
>
</
TableContainer
>
);
);
};
};
...
...
ui/txs/TxsContent.tsx
View file @
1ca78283
...
@@ -6,15 +6,11 @@ import type { QueryKeys } from 'types/client/queries';
...
@@ -6,15 +6,11 @@ import type { QueryKeys } from 'types/client/queries';
import
type
{
Sort
}
from
'
types/client/txs-sort
'
;
import
type
{
Sort
}
from
'
types/client/txs-sort
'
;
import
*
as
cookies
from
'
lib/cookies
'
;
import
*
as
cookies
from
'
lib/cookies
'
;
import
useIsMobile
from
'
lib/hooks/useIsMobile
'
;
import
DataFetchAlert
from
'
ui/shared/DataFetchAlert
'
;
import
DataFetchAlert
from
'
ui/shared/DataFetchAlert
'
;
// import FilterInput from 'ui/shared/FilterInput';
import
Pagination
from
'
ui/shared/Pagination
'
;
import
TxsHeader
from
'
./TxsHeader
'
;
import
TxsHeader
from
'
./TxsHeader
'
;
import
TxsSkeletonDesktop
from
'
./TxsSkeletonDesktop
'
;
import
TxsSkeletonDesktop
from
'
./TxsSkeletonDesktop
'
;
import
TxsSkeletonMobile
from
'
./TxsSkeletonMobile
'
;
import
TxsSkeletonMobile
from
'
./TxsSkeletonMobile
'
;
import
TxsSorting
from
'
./TxsSorting
'
;
import
TxsWithSort
from
'
./TxsWithSort
'
;
import
TxsWithSort
from
'
./TxsWithSort
'
;
import
useQueryWithPages
from
'
./useQueryWithPages
'
;
import
useQueryWithPages
from
'
./useQueryWithPages
'
;
...
@@ -91,7 +87,7 @@ const TxsContent = ({
...
@@ -91,7 +87,7 @@ const TxsContent = ({
const
paginationProps
=
{
const
paginationProps
=
{
...
pagination
,
...
pagination
,
hasNextPage
:
data
?.
next_page_params
!==
undefined
&&
Object
.
keys
(
data
?.
next_page_params
).
length
>
0
,
hasNextPage
:
data
?.
next_page_params
!==
undefined
&&
data
?.
next_page_params
!==
null
&&
Object
.
keys
(
data
?.
next_page_params
).
length
>
0
,
};
};
return
(
return
(
...
...
ui/txs/TxsHeader.tsx
View file @
1ca78283
...
@@ -6,7 +6,7 @@ import type { Sort } from 'types/client/txs-sort';
...
@@ -6,7 +6,7 @@ import type { Sort } from 'types/client/txs-sort';
import
useIsMobile
from
'
lib/hooks/useIsMobile
'
;
import
useIsMobile
from
'
lib/hooks/useIsMobile
'
;
// import FilterInput from 'ui/shared/FilterInput';
// import FilterInput from 'ui/shared/FilterInput';
import
useScrollDirection
from
'
lib/hooks/useScrollDirection
'
;
import
ScrollDirectionContext
from
'
ui/ScrollDirectionContext
'
;
import
Pagination
from
'
ui/shared/Pagination
'
;
import
Pagination
from
'
ui/shared/Pagination
'
;
import
type
{
Props
as
PaginationProps
}
from
'
ui/shared/Pagination
'
;
import
type
{
Props
as
PaginationProps
}
from
'
ui/shared/Pagination
'
;
import
SortButton
from
'
ui/shared/SortButton
'
;
import
SortButton
from
'
ui/shared/SortButton
'
;
...
@@ -22,7 +22,6 @@ const TOP_UP = 106;
...
@@ -22,7 +22,6 @@ const TOP_UP = 106;
const
TOP_DOWN
=
0
;
const
TOP_DOWN
=
0
;
const
TxsHeader
=
({
sorting
,
paginationProps
}:
Props
)
=>
{
const
TxsHeader
=
({
sorting
,
paginationProps
}:
Props
)
=>
{
const
scrollDirection
=
useScrollDirection
();
const
[
isSticky
,
setIsSticky
]
=
React
.
useState
(
false
);
const
[
isSticky
,
setIsSticky
]
=
React
.
useState
(
false
);
const
ref
=
React
.
useRef
<
HTMLDivElement
>
(
null
);
const
ref
=
React
.
useRef
<
HTMLDivElement
>
(
null
);
...
@@ -30,14 +29,13 @@ const TxsHeader = ({ sorting, paginationProps }: Props) => {
...
@@ -30,14 +29,13 @@ const TxsHeader = ({ sorting, paginationProps }: Props) => {
const
handleScroll
=
useCallback
(()
=>
{
const
handleScroll
=
useCallback
(()
=>
{
if
(
if
(
Number
(
ref
.
current
?.
getBoundingClientRect
().
y
)
<=
TOP_DOWN
||
Number
(
ref
.
current
?.
getBoundingClientRect
().
y
)
<
TOP_UP
+
5
(
scrollDirection
===
'
up
'
&&
Number
(
ref
.
current
?.
getBoundingClientRect
().
y
)
<=
TOP_UP
)
)
{
)
{
setIsSticky
(
true
);
setIsSticky
(
true
);
}
else
{
}
else
{
setIsSticky
(
false
);
setIsSticky
(
false
);
}
}
},
[
scrollDirection
]);
},
[
]);
React
.
useEffect
(()
=>
{
React
.
useEffect
(()
=>
{
const
throttledHandleScroll
=
throttle
(
handleScroll
,
300
);
const
throttledHandleScroll
=
throttle
(
handleScroll
,
300
);
...
@@ -47,51 +45,59 @@ const TxsHeader = ({ sorting, paginationProps }: Props) => {
...
@@ -47,51 +45,59 @@ const TxsHeader = ({ sorting, paginationProps }: Props) => {
return
()
=>
{
return
()
=>
{
window
.
removeEventListener
(
'
scroll
'
,
throttledHandleScroll
);
window
.
removeEventListener
(
'
scroll
'
,
throttledHandleScroll
);
};
};
},
[
handleScroll
]);
// replicate componentDidMount
// eslint-disable-next-line react-hooks/exhaustive-deps
},
[
]);
const
bgColor
=
useColorModeValue
(
'
white
'
,
'
black
'
);
return
(
return
(
<
Flex
<
ScrollDirectionContext
.
Consumer
>
backgroundColor=
{
useColorModeValue
(
'
white
'
,
'
black
'
)
}
{
(
scrollDirection
)
=>
(
mt=
{
-
6
}
<
Flex
pt=
{
6
}
backgroundColor=
{
bgColor
}
pb=
{
6
}
mt=
{
-
6
}
mx=
{
{
base
:
-
4
,
lg
:
0
}
}
pt=
{
6
}
px=
{
{
base
:
4
,
lg
:
0
}
}
pb=
{
6
}
justifyContent=
"space-between"
mx=
{
{
base
:
-
4
,
lg
:
0
}
}
width=
{
{
base
:
'
100vw
'
,
lg
:
'
unset
'
}
}
px=
{
{
base
:
4
,
lg
:
0
}
}
position=
"sticky"
justifyContent=
"space-between"
top=
{
{
base
:
scrollDirection
===
'
down
'
?
`${ TOP_DOWN }px`
:
`${ TOP_UP }px`
,
lg
:
0
}
}
width=
{
{
base
:
'
100vw
'
,
lg
:
'
unset
'
}
}
transitionProperty=
"top"
position=
"sticky"
transitionDuration=
"slow"
top=
{
{
base
:
scrollDirection
===
'
down
'
?
`${ TOP_DOWN }px`
:
`${ TOP_UP }px`
,
lg
:
0
}
}
zIndex=
{
{
base
:
'
sticky2
'
,
lg
:
'
docked
'
}
}
transitionProperty=
"top,box-shadow"
boxShadow=
{
{
base
:
isSticky
?
'
md
'
:
'
none
'
,
lg
:
'
none
'
}
}
transitionDuration=
"slow"
ref=
{
ref
}
zIndex=
{
{
base
:
'
sticky2
'
,
lg
:
'
docked
'
}
}
>
boxShadow=
{
{
base
:
isSticky
?
'
md
'
:
'
none
'
,
lg
:
'
none
'
}
}
<
HStack
>
ref=
{
ref
}
{
/* api is not implemented */
}
>
{
/* <TxsFilters
<
HStack
>
{
/* api is not implemented */
}
{
/* <TxsFilters
filters={ filters }
filters={ filters }
onFiltersChange={ setFilters }
onFiltersChange={ setFilters }
appliedFiltersNum={ 0 }
appliedFiltersNum={ 0 }
/> */
}
/> */
}
{
isMobile
&&
(
{
isMobile
&&
(
<
SortButton
<
SortButton
// eslint-disable-next-line react/jsx-no-bind
// eslint-disable-next-line react/jsx-no-bind
handleSort=
{
()
=>
{}
}
handleSort=
{
()
=>
{}
}
isSortActive=
{
Boolean
(
sorting
)
}
isSortActive=
{
Boolean
(
sorting
)
}
/>
/>
)
}
)
}
{
/* api is not implemented */
}
{
/* api is not implemented */
}
{
/* <FilterInput
{
/* <FilterInput
// eslint-disable-next-line react/jsx-no-bind
// eslint-disable-next-line react/jsx-no-bind
onChange={ () => {} }
onChange={ () => {} }
maxW="360px"
maxW="360px"
size="xs"
size="xs"
placeholder="Search by addresses, hash, method..."
placeholder="Search by addresses, hash, method..."
/> */
}
/> */
}
</
HStack
>
</
HStack
>
<
Pagination
{
...
paginationProps
}
/>
<
Pagination
{
...
paginationProps
}
/>
</
Flex
>
</
Flex
>
)
}
</
ScrollDirectionContext
.
Consumer
>
);
);
};
};
...
...
ui/txs/TxsTable.tsx
View file @
1ca78283
import
{
Link
,
Table
,
T
head
,
Tbody
,
Tr
,
Th
,
TableContainer
,
Icon
}
from
'
@chakra-ui/react
'
;
import
{
Link
,
Table
,
T
body
,
Tr
,
Th
,
Icon
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
type
{
Transaction
}
from
'
types/api/transaction
'
;
import
type
{
Transaction
}
from
'
types/api/transaction
'
;
...
@@ -6,6 +6,7 @@ import type { Sort } from 'types/client/txs-sort';
...
@@ -6,6 +6,7 @@ import type { Sort } from 'types/client/txs-sort';
import
appConfig
from
'
configs/app/config
'
;
import
appConfig
from
'
configs/app/config
'
;
import
rightArrowIcon
from
'
icons/arrows/east.svg
'
;
import
rightArrowIcon
from
'
icons/arrows/east.svg
'
;
import
TheadSticky
from
'
ui/shared/TheadSticky
'
;
import
TxsTableItem
from
'
./TxsTableItem
'
;
import
TxsTableItem
from
'
./TxsTableItem
'
;
...
@@ -17,44 +18,42 @@ type Props = {
...
@@ -17,44 +18,42 @@ type Props = {
const
TxsTable
=
({
txs
,
sort
,
sorting
}:
Props
)
=>
{
const
TxsTable
=
({
txs
,
sort
,
sorting
}:
Props
)
=>
{
return
(
return
(
<
TableContainer
width=
"100%"
>
<
Table
variant=
"simple"
minWidth=
"810px"
size=
"xs"
>
<
Table
variant=
"simple"
minWidth=
"810px"
size=
"xs"
>
<
TheadSticky
top=
{
80
}
>
<
Thead
>
<
Tr
>
<
Tr
>
<
Th
width=
"54px"
></
Th
>
<
Th
width=
"54px"
></
Th
>
<
Th
width=
"20%"
>
Type
</
Th
>
<
Th
width=
"20%"
>
Type
</
Th
>
<
Th
width=
"18%"
>
Txn hash
</
Th
>
<
Th
width=
"18%"
>
Txn hash
</
Th
>
<
Th
width=
"15%"
>
Method
</
Th
>
<
Th
width=
"15%"
>
Method
</
Th
>
<
Th
width=
"11%"
>
Block
</
Th
>
<
Th
width=
"11%"
>
Block
</
Th
>
<
Th
width=
{
{
xl
:
'
128px
'
,
base
:
'
66px
'
}
}
>
From
</
Th
>
<
Th
width=
{
{
xl
:
'
128px
'
,
base
:
'
66px
'
}
}
>
From
</
Th
>
<
Th
width=
{
{
xl
:
'
36px
'
,
base
:
'
0
'
}
}
></
Th
>
<
Th
width=
{
{
xl
:
'
36px
'
,
base
:
'
0
'
}
}
></
Th
>
<
Th
width=
{
{
xl
:
'
128px
'
,
base
:
'
66px
'
}
}
>
To
</
Th
>
<
Th
width=
{
{
xl
:
'
128px
'
,
base
:
'
66px
'
}
}
>
To
</
Th
>
<
Th
width=
"18%"
isNumeric
>
<
Th
width=
"18%"
isNumeric
>
<
Link
onClick=
{
sort
(
'
val
'
)
}
display=
"flex"
justifyContent=
"end"
>
<
Link
onClick=
{
sort
(
'
val
'
)
}
display=
"flex"
justifyContent=
"end"
>
{
sorting
===
'
val-asc
'
&&
<
Icon
boxSize=
{
5
}
as=
{
rightArrowIcon
}
transform=
"rotate(-90deg)"
/>
}
{
sorting
===
'
val-asc
'
&&
<
Icon
boxSize=
{
5
}
as=
{
rightArrowIcon
}
transform=
"rotate(-90deg)"
/>
}
{
sorting
===
'
val-desc
'
&&
<
Icon
boxSize=
{
5
}
as=
{
rightArrowIcon
}
transform=
"rotate(90deg)"
/>
}
{
sorting
===
'
val-desc
'
&&
<
Icon
boxSize=
{
5
}
as=
{
rightArrowIcon
}
transform=
"rotate(90deg)"
/>
}
{
`Value ${ appConfig.network.currency.symbol }`
}
{
`Value ${ appConfig.network.currency.symbol }`
}
</
Link
>
</
Link
>
</
Th
>
</
Th
>
<
Th
width=
"18%"
isNumeric
pr=
{
5
}
>
<
Th
width=
"18%"
isNumeric
pr=
{
5
}
>
<
Link
onClick=
{
sort
(
'
fee
'
)
}
display=
"flex"
justifyContent=
"end"
>
<
Link
onClick=
{
sort
(
'
fee
'
)
}
display=
"flex"
justifyContent=
"end"
>
{
sorting
===
'
fee-asc
'
&&
<
Icon
boxSize=
{
5
}
as=
{
rightArrowIcon
}
transform=
"rotate(-90deg)"
/>
}
{
sorting
===
'
fee-asc
'
&&
<
Icon
boxSize=
{
5
}
as=
{
rightArrowIcon
}
transform=
"rotate(-90deg)"
/>
}
{
sorting
===
'
fee-desc
'
&&
<
Icon
boxSize=
{
5
}
as=
{
rightArrowIcon
}
transform=
"rotate(90deg)"
/>
}
{
sorting
===
'
fee-desc
'
&&
<
Icon
boxSize=
{
5
}
as=
{
rightArrowIcon
}
transform=
"rotate(90deg)"
/>
}
{
`Fee ${ appConfig.network.currency.symbol }`
}
{
`Fee ${ appConfig.network.currency.symbol }`
}
</
Link
>
</
Link
>
</
Th
>
</
Th
>
</
Tr
>
</
Tr
>
</
TheadSticky
>
</
Thead
>
<
Tbody
>
<
Tbody
>
{
txs
.
map
((
item
)
=>
(
{
txs
.
map
((
item
)
=>
(
<
TxsTableItem
<
TxsTableItem
key=
{
item
.
hash
}
key=
{
item
.
hash
}
tx=
{
item
}
tx=
{
item
}
/>
/>
))
}
))
}
</
Tbody
>
</
Tbody
>
</
Table
>
</
Table
>
</
TableContainer
>
);
);
};
};
...
...
ui/watchlist/WatchlistTable/WatchlistTable.tsx
View file @
1ca78283
...
@@ -4,7 +4,6 @@ import {
...
@@ -4,7 +4,6 @@ import {
Tbody
,
Tbody
,
Tr
,
Tr
,
Th
,
Th
,
TableContainer
,
}
from
'
@chakra-ui/react
'
;
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
...
@@ -20,28 +19,26 @@ interface Props {
...
@@ -20,28 +19,26 @@ interface Props {
const
WatchlistTable
=
({
data
,
onDeleteClick
,
onEditClick
}:
Props
)
=>
{
const
WatchlistTable
=
({
data
,
onDeleteClick
,
onEditClick
}:
Props
)
=>
{
return
(
return
(
<
TableContainer
width=
"100%"
>
<
Table
variant=
"simple"
minWidth=
"600px"
>
<
Table
variant=
"simple"
minWidth=
"600px"
>
<
Thead
>
<
Thead
>
<
Tr
>
<
Tr
>
<
Th
width=
"70%"
>
Address
</
Th
>
<
Th
width=
"70%"
>
Address
</
Th
>
<
Th
width=
"30%"
>
Private tag
</
Th
>
<
Th
width=
"30%"
>
Private tag
</
Th
>
<
Th
width=
"160px"
>
Email notification
</
Th
>
<
Th
width=
"160px"
>
Email notification
</
Th
>
<
Th
width=
"108px"
></
Th
>
<
Th
width=
"108px"
></
Th
>
</
Tr
>
</
Tr
>
</
Thead
>
</
Thead
>
<
Tbody
>
<
Tbody
>
{
data
.
map
((
item
)
=>
(
{
data
.
map
((
item
)
=>
(
<
WatchlistTableItem
<
WatchlistTableItem
item=
{
item
}
item=
{
item
}
key=
{
item
.
address_hash
}
key=
{
item
.
address_hash
}
onDeleteClick=
{
onDeleteClick
}
onDeleteClick=
{
onDeleteClick
}
onEditClick=
{
onEditClick
}
onEditClick=
{
onEditClick
}
/>
/>
))
}
))
}
</
Tbody
>
</
Tbody
>
</
Table
>
</
Table
>
</
TableContainer
>
);
);
};
};
...
...
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