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
36edbc39
Commit
36edbc39
authored
Sep 28, 2022
by
isstuev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
responsive fix
parent
bea9b9a0
Changes
18
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
124 additions
and
177 deletions
+124
-177
cookies.ts
lib/cookies.ts
+1
-1
FilterButton.tsx
ui/shared/FilterButton.tsx
+5
-6
Page.tsx
ui/shared/Page.tsx
+4
-6
Pagination.tsx
ui/shared/Pagination.tsx
+14
-43
RoutedTabs.tsx
ui/shared/RoutedTabs/RoutedTabs.tsx
+2
-4
SortButton.tsx
ui/shared/SortButton.tsx
+5
-4
Header.tsx
ui/snippets/header/Header.tsx
+16
-21
NavFooter.tsx
ui/snippets/navigation/NavFooter.tsx
+11
-23
NavLink.tsx
ui/snippets/navigation/NavLink.tsx
+11
-11
NavigationDesktop.tsx
ui/snippets/navigation/NavigationDesktop.tsx
+23
-13
NetworkLogo.tsx
ui/snippets/networkMenu/NetworkLogo.tsx
+1
-1
NetworkMenu.tsx
ui/snippets/networkMenu/NetworkMenu.tsx
+2
-2
SearchBar.tsx
ui/snippets/searchBar/SearchBar.tsx
+4
-9
SearchBarDesktop.tsx
ui/snippets/searchBar/SearchBarDesktop.tsx
+3
-3
SearchBarMobile.tsx
ui/snippets/searchBar/SearchBarMobile.tsx
+2
-0
TxInternalsFilter.tsx
ui/tx/internals/TxInternalsFilter.tsx
+0
-3
TxsContent.tsx
ui/txs/TxsContent.tsx
+6
-10
TxsTableItem.tsx
ui/txs/TxsTableItem.tsx
+14
-17
No files found.
lib/cookies.ts
View file @
36edbc39
...
@@ -12,7 +12,7 @@ export enum NAMES {
...
@@ -12,7 +12,7 @@ export enum NAMES {
export
function
get
(
name
?:
string
|
undefined
|
null
)
{
export
function
get
(
name
?:
string
|
undefined
|
null
)
{
if
(
!
isBrowser
())
{
if
(
!
isBrowser
())
{
return
()
=>
{}
;
return
undefined
;
}
}
return
Cookies
.
get
(
name
);
return
Cookies
.
get
(
name
);
}
}
...
...
ui/shared/FilterButton.tsx
View file @
36edbc39
import
{
Button
,
Circle
,
Icon
,
useColorModeValue
}
from
'
@chakra-ui/react
'
;
import
{
B
ox
,
B
utton
,
Circle
,
Icon
,
useColorModeValue
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
filterIcon
from
'
icons/filter.svg
'
;
import
filterIcon
from
'
icons/filter.svg
'
;
const
FilterIcon
=
<
Icon
as=
{
filterIcon
}
boxSize=
{
5
}
/>;
const
FilterIcon
=
<
Icon
as=
{
filterIcon
}
boxSize=
{
5
}
mr=
{
{
base
:
0
,
lg
:
2
}
}
/>;
interface
Props
{
interface
Props
{
isActive
:
boolean
;
isActive
:
boolean
;
isCollapsed
?:
boolean
;
appliedFiltersNum
?:
number
;
appliedFiltersNum
?:
number
;
onClick
:
()
=>
void
;
onClick
:
()
=>
void
;
}
}
const
FilterButton
=
({
isActive
,
appliedFiltersNum
,
onClick
,
isCollapsed
}:
Props
,
ref
:
React
.
ForwardedRef
<
HTMLButtonElement
>
)
=>
{
const
FilterButton
=
({
isActive
,
appliedFiltersNum
,
onClick
}:
Props
,
ref
:
React
.
ForwardedRef
<
HTMLButtonElement
>
)
=>
{
const
badgeColor
=
useColorModeValue
(
'
white
'
,
'
black
'
);
const
badgeColor
=
useColorModeValue
(
'
white
'
,
'
black
'
);
const
badgeBgColor
=
useColorModeValue
(
'
blue.700
'
,
'
gray.50
'
);
const
badgeBgColor
=
useColorModeValue
(
'
blue.700
'
,
'
gray.50
'
);
return
(
return
(
<
Button
<
Button
ref=
{
ref
}
ref=
{
ref
}
leftIcon=
{
isCollapsed
?
undefined
:
FilterIcon
}
rightIcon=
{
appliedFiltersNum
?
<
Circle
bg=
{
badgeBgColor
}
size=
{
5
}
color=
{
badgeColor
}
>
{
appliedFiltersNum
}
</
Circle
>
:
undefined
}
rightIcon=
{
appliedFiltersNum
?
<
Circle
bg=
{
badgeBgColor
}
size=
{
5
}
color=
{
badgeColor
}
>
{
appliedFiltersNum
}
</
Circle
>
:
undefined
}
size=
"sm"
size=
"sm"
fontWeight=
"500"
fontWeight=
"500"
...
@@ -30,7 +28,8 @@ const FilterButton = ({ isActive, appliedFiltersNum, onClick, isCollapsed }: Pro
...
@@ -30,7 +28,8 @@ const FilterButton = ({ isActive, appliedFiltersNum, onClick, isCollapsed }: Pro
px=
{
1.5
}
px=
{
1.5
}
flexShrink=
{
0
}
flexShrink=
{
0
}
>
>
{
isCollapsed
?
FilterIcon
:
'
Filter
'
}
{
FilterIcon
}
<
Box
display=
{
{
base
:
'
none
'
,
lg
:
'
block
'
}
}
>
Filter
</
Box
>
</
Button
>
</
Button
>
);
);
};
};
...
...
ui/shared/Page.tsx
View file @
36edbc39
...
@@ -5,7 +5,6 @@ import React from 'react';
...
@@ -5,7 +5,6 @@ import React from 'react';
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
useIsMobile
from
'
lib/hooks/useIsMobile
'
;
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
'
;
...
@@ -14,7 +13,6 @@ interface Props {
...
@@ -14,7 +13,6 @@ interface Props {
}
}
const
Page
=
({
children
}:
Props
)
=>
{
const
Page
=
({
children
}:
Props
)
=>
{
const
isMobile
=
useIsMobile
();
const
router
=
useRouter
();
const
router
=
useRouter
();
const
fetch
=
useFetch
();
const
fetch
=
useFetch
();
...
@@ -38,11 +36,11 @@ const Page = ({ children }: Props) => {
...
@@ -38,11 +36,11 @@ const Page = ({ children }: Props) => {
minH=
"100vh"
minH=
"100vh"
alignItems=
"stretch"
alignItems=
"stretch"
>
>
{
!
isMobile
&&
<
NavigationDesktop
/>
}
<
NavigationDesktop
/>
<
VStack
<
VStack
width=
"100%"
width=
"100%"
paddingX=
{
isMobile
?
4
:
8
}
paddingX=
{
{
base
:
4
,
lg
:
8
}
}
paddingTop=
{
isMobile
?
0
:
9
}
paddingTop=
{
{
base
:
0
,
lg
:
9
}
}
paddingBottom=
{
10
}
paddingBottom=
{
10
}
spacing=
{
0
}
spacing=
{
0
}
>
>
...
@@ -50,7 +48,7 @@ const Page = ({ children }: Props) => {
...
@@ -50,7 +48,7 @@ const Page = ({ children }: Props) => {
<
Box
<
Box
as=
"main"
as=
"main"
w=
"100%"
w=
"100%"
paddingTop=
{
isMobile
?
'
138px
'
:
'
52px
'
}
paddingTop=
{
{
base
:
'
138px
'
,
lg
:
'
52px
'
}
}
>
>
{
children
}
{
children
}
</
Box
>
</
Box
>
...
...
ui/shared/Pagination.tsx
View file @
36edbc39
...
@@ -6,13 +6,11 @@ import arrowIcon from 'icons/arrows/east-mini.svg';
...
@@ -6,13 +6,11 @@ import arrowIcon from 'icons/arrows/east-mini.svg';
type
Props
=
{
type
Props
=
{
currentPage
:
number
;
currentPage
:
number
;
maxPage
?:
number
;
maxPage
?:
number
;
isMobile
?:
boolean
;
}
}
const
MAX_PAGE_DEFAULT
=
50
;
const
MAX_PAGE_DEFAULT
=
50
;
const
Pagination
=
({
currentPage
,
maxPage
,
isMobile
}:
Props
)
=>
{
const
Pagination
=
({
currentPage
,
maxPage
}:
Props
)
=>
{
const
pageNumber
=
(
const
pageNumber
=
(
<
Flex
alignItems=
"center"
>
<
Flex
alignItems=
"center"
>
<
Button
<
Button
...
@@ -42,20 +40,21 @@ const Pagination = ({ currentPage, maxPage, isMobile }: Props) => {
...
@@ -42,20 +40,21 @@ const Pagination = ({ currentPage, maxPage, isMobile }: Props) => {
</
Flex
>
</
Flex
>
);
);
if
(
isMobile
)
{
return
(
return
(
<
Flex
<
Flex
fontSize=
"sm"
fontSize=
"sm"
width=
{
{
base
:
'
100%
'
,
lg
:
'
auto
'
}
}
width=
"100%"
justifyContent=
{
{
base
:
'
space-between
'
,
lg
:
'
unset
'
}
}
justifyContent=
"space-between
"
alignItems=
"center
"
alignItems=
"center"
>
>
<
Flex
alignItems=
"center"
justifyContent=
"space-between"
w=
{
{
base
:
'
100%
'
,
lg
:
'
auto
'
}
}
>
<
IconButton
<
IconButton
variant=
"outline"
variant=
"outline"
size=
"sm"
size=
"sm"
aria
-
label=
"Next page"
aria
-
label=
"Next page"
w=
"36px"
w=
"36px"
icon=
{
<
Icon
as=
{
arrowIcon
}
w=
{
5
}
h=
{
5
}
/>
}
icon=
{
<
Icon
as=
{
arrowIcon
}
w=
{
5
}
h=
{
5
}
/>
}
mr=
{
8
}
/>
/>
{
pageNumber
}
{
pageNumber
}
<
IconButton
<
IconButton
...
@@ -64,42 +63,14 @@ const Pagination = ({ currentPage, maxPage, isMobile }: Props) => {
...
@@ -64,42 +63,14 @@ const Pagination = ({ currentPage, maxPage, isMobile }: Props) => {
aria
-
label=
"Next page"
aria
-
label=
"Next page"
w=
"36px"
w=
"36px"
icon=
{
<
Icon
as=
{
arrowIcon
}
w=
{
5
}
h=
{
5
}
transform=
"rotate(180deg)"
/>
}
icon=
{
<
Icon
as=
{
arrowIcon
}
w=
{
5
}
h=
{
5
}
transform=
"rotate(180deg)"
/>
}
/>
</
Flex
>
);
}
return
(
<
Flex
fontSize=
"sm"
>
<
Flex
alignItems=
"center"
justifyContent=
"space-between"
>
<
Button
variant=
"outline"
size=
"sm"
aria
-
label=
"Next page"
leftIcon=
{
<
Icon
as=
{
arrowIcon
}
w=
{
5
}
h=
{
5
}
/>
}
mr=
{
8
}
pl=
{
1
}
>
Previous
</
Button
>
{
pageNumber
}
<
Button
variant=
"outline"
size=
"sm"
aria
-
label=
"Next page"
rightIcon=
{
<
Icon
as=
{
arrowIcon
}
w=
{
5
}
h=
{
5
}
transform=
"rotate(180deg)"
/>
}
ml=
{
8
}
ml=
{
8
}
pr=
{
1
}
/>
>
Next
</
Button
>
</
Flex
>
</
Flex
>
<
Flex
alignItems=
"center"
width=
"132px"
ml=
{
16
}
>
<
Flex
alignItems=
"center"
width=
"132px"
ml=
{
16
}
display=
{
{
base
:
'
none
'
,
lg
:
'
flex
'
}
}
>
Go to
<
Input
w=
"84px"
size=
"xs"
ml=
{
2
}
/>
Go to
<
Input
w=
"84px"
size=
"xs"
ml=
{
2
}
/>
</
Flex
>
</
Flex
>
</
Flex
>
</
Flex
>
);
);
};
};
...
...
ui/shared/RoutedTabs/RoutedTabs.tsx
View file @
36edbc39
...
@@ -33,7 +33,7 @@ const RoutedTabs = ({ tabs, defaultActiveTab }: Props) => {
...
@@ -33,7 +33,7 @@ const RoutedTabs = ({ tabs, defaultActiveTab }: Props) => {
const
defaultIndex
=
tabs
.
findIndex
(({
routeName
})
=>
routeName
===
defaultActiveTab
);
const
defaultIndex
=
tabs
.
findIndex
(({
routeName
})
=>
routeName
===
defaultActiveTab
);
const
isMobile
=
useIsMobile
();
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
{
tabsCut
,
tabsList
,
tabsRefs
,
listRef
}
=
useAdaptiveTabs
(
tabs
,
isMobile
);
const
router
=
useRouter
();
const
router
=
useRouter
();
...
@@ -45,8 +45,6 @@ const RoutedTabs = ({ tabs, defaultActiveTab }: Props) => {
...
@@ -45,8 +45,6 @@ const RoutedTabs = ({ tabs, defaultActiveTab }: Props) => {
const
newUrl
=
link
(
nextTab
.
routeName
,
router
.
query
);
const
newUrl
=
link
(
nextTab
.
routeName
,
router
.
query
);
router
.
push
(
newUrl
,
undefined
,
{
shallow
:
true
});
router
.
push
(
newUrl
,
undefined
,
{
shallow
:
true
});
}
}
setActiveTab
(
index
);
},
[
tabs
,
router
]);
},
[
tabs
,
router
]);
return
(
return
(
...
@@ -57,7 +55,7 @@ const RoutedTabs = ({ tabs, defaultActiveTab }: Props) => {
...
@@ -57,7 +55,7 @@ const RoutedTabs = ({ tabs, defaultActiveTab }: Props) => {
whiteSpace=
"nowrap"
whiteSpace=
"nowrap"
ref=
{
listRef
}
ref=
{
listRef
}
overflowY=
"hidden"
overflowY=
"hidden"
overflowX=
{
isMobile
?
'
auto
'
:
undefined
}
overflowX=
{
{
base
:
'
auto
'
,
lg
:
undefined
}
}
overscrollBehaviorX=
"contain"
overscrollBehaviorX=
"contain"
css=
{
{
css=
{
{
'
scroll-snap-type
'
:
'
x mandatory
'
,
'
scroll-snap-type
'
:
'
x mandatory
'
,
...
...
ui/shared/SortButton.tsx
View file @
36edbc39
import
{
Icon
,
IconButton
}
from
'
@chakra-ui/react
'
;
import
{
Icon
,
IconButton
,
chakra
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
upDownArrow
from
'
icons/arrows/up-down.svg
'
;
import
upDownArrow
from
'
icons/arrows/up-down.svg
'
;
...
@@ -6,9 +6,10 @@ import upDownArrow from 'icons/arrows/up-down.svg';
...
@@ -6,9 +6,10 @@ import upDownArrow from 'icons/arrows/up-down.svg';
type
Props
=
{
type
Props
=
{
handleSort
:
()
=>
void
;
handleSort
:
()
=>
void
;
isSortActive
:
boolean
;
isSortActive
:
boolean
;
className
?:
string
;
}
}
const
SortButton
=
({
handleSort
,
isSortActive
}:
Props
)
=>
{
const
SortButton
=
({
handleSort
,
isSortActive
,
className
}:
Props
)
=>
{
return
(
return
(
<
IconButton
<
IconButton
icon=
{
<
Icon
as=
{
upDownArrow
}
boxSize=
{
5
}
/>
}
icon=
{
<
Icon
as=
{
upDownArrow
}
boxSize=
{
5
}
/>
}
...
@@ -16,12 +17,12 @@ const SortButton = ({ handleSort, isSortActive }: Props) => {
...
@@ -16,12 +17,12 @@ const SortButton = ({ handleSort, isSortActive }: Props) => {
size=
"sm"
size=
"sm"
variant=
"outline"
variant=
"outline"
colorScheme=
"gray-dark"
colorScheme=
"gray-dark"
ml=
{
2
}
minWidth=
"36px"
minWidth=
"36px"
onClick=
{
handleSort
}
onClick=
{
handleSort
}
isActive=
{
isSortActive
}
isActive=
{
isSortActive
}
className=
{
className
}
/>
/>
);
);
};
};
export
default
SortButton
;
export
default
chakra
(
SortButton
)
;
ui/snippets/header/Header.tsx
View file @
36edbc39
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
useIsMobile
from
'
lib/hooks/useIsMobile
'
;
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,12 +10,10 @@ import Burger from './Burger';
...
@@ -11,12 +10,10 @@ import Burger from './Burger';
import
ColorModeToggler
from
'
./ColorModeToggler
'
;
import
ColorModeToggler
from
'
./ColorModeToggler
'
;
const
Header
=
()
=>
{
const
Header
=
()
=>
{
const
isMobile
=
useIsMobile
();
const
bgColor
=
useColorModeValue
(
'
white
'
,
'
black
'
);
const
bgColor
=
useColorModeValue
(
'
white
'
,
'
black
'
);
return
(
if
(
isMobile
)
{
<>
return
(
<
Box
bgColor=
{
bgColor
}
display=
{
{
base
:
'
block
'
,
lg
:
'
none
'
}
}
>
<
Box
bgColor=
{
bgColor
}
>
<
Flex
<
Flex
as=
"header"
as=
"header"
position=
"fixed"
position=
"fixed"
...
@@ -36,21 +33,19 @@ const Header = () => {
...
@@ -36,21 +33,19 @@ const Header = () => {
</
Flex
>
</
Flex
>
<
SearchBar
/>
<
SearchBar
/>
</
Box
>
</
Box
>
);
<
HStack
}
as=
"header"
width=
"100%"
return
(
alignItems=
"center"
<
HStack
justifyContent=
"center"
as=
"header"
gap=
{
12
}
width=
"100%"
display=
{
{
base
:
'
none
'
,
lg
:
'
flex
'
}
}
alignItems=
"center"
>
justifyContent=
"center"
<
SearchBar
/>
gap=
{
12
}
<
ColorModeToggler
/>
>
<
ProfileMenuDesktop
/>
<
SearchBar
/>
</
HStack
>
<
ColorModeToggler
/>
</>
<
ProfileMenuDesktop
/>
</
HStack
>
);
);
};
};
...
...
ui/snippets/navigation/NavFooter.tsx
View file @
36edbc39
import
{
VStack
,
Text
,
Stack
,
Icon
,
Link
,
useColorModeValue
}
from
'
@chakra-ui/react
'
;
import
{
Box
,
VStack
,
Text
,
Stack
,
Icon
,
Link
,
useColorModeValue
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
ghIcon
from
'
icons/social/git.svg
'
;
import
ghIcon
from
'
icons/social/git.svg
'
;
import
statsIcon
from
'
icons/social/stats.svg
'
;
import
statsIcon
from
'
icons/social/stats.svg
'
;
import
tgIcon
from
'
icons/social/telega.svg
'
;
import
tgIcon
from
'
icons/social/telega.svg
'
;
import
twIcon
from
'
icons/social/tweet.svg
'
;
import
twIcon
from
'
icons/social/tweet.svg
'
;
import
useIsMobile
from
'
lib/hooks/useIsMobile
'
;
import
getDefaultTransitionProps
from
'
theme/utils/getDefaultTransitionProps
'
;
import
getDefaultTransitionProps
from
'
theme/utils/getDefaultTransitionProps
'
;
const
SOCIAL_LINKS
=
[
const
SOCIAL_LINKS
=
[
...
@@ -24,22 +23,13 @@ interface Props {
...
@@ -24,22 +23,13 @@ interface Props {
}
}
const
NavFooter
=
({
isCollapsed
,
hasAccount
}:
Props
)
=>
{
const
NavFooter
=
({
isCollapsed
,
hasAccount
}:
Props
)
=>
{
const
isMobile
=
useIsMobile
();
const
isExpanded
=
isCollapsed
===
false
;
const
width
=
(()
=>
{
if
(
isMobile
)
{
return
'
100%
'
;
}
return
isCollapsed
?
'
20px
'
:
'
180px
'
;
})();
const
marginTop
=
(()
=>
{
const
marginTop
=
(()
=>
{
if
(
!
hasAccount
)
{
if
(
!
hasAccount
)
{
return
'
auto
'
;
return
'
auto
'
;
}
}
return
isMobile
?
6
:
20
;
return
{
base
:
6
,
lg
:
20
}
;
})();
})();
return
(
return
(
...
@@ -48,8 +38,8 @@ const NavFooter = ({ isCollapsed, hasAccount }: Props) => {
...
@@ -48,8 +38,8 @@ const NavFooter = ({ isCollapsed, hasAccount }: Props) => {
spacing=
{
8
}
spacing=
{
8
}
borderTop=
"1px solid"
borderTop=
"1px solid"
borderColor=
{
useColorModeValue
(
'
blackAlpha.200
'
,
'
whiteAlpha.200
'
)
}
borderColor=
{
useColorModeValue
(
'
blackAlpha.200
'
,
'
whiteAlpha.200
'
)
}
width=
{
width
}
width=
{
{
base
:
'
100%
'
,
lg
:
isExpanded
?
'
180px
'
:
'
20px
'
,
xl
:
isCollapsed
?
'
20px
'
:
'
180px
'
}
}
paddingTop=
{
isMobile
?
6
:
8
}
paddingTop=
{
{
base
:
6
,
lg
:
8
}
}
marginTop=
{
marginTop
}
marginTop=
{
marginTop
}
alignItems=
"flex-start"
alignItems=
"flex-start"
alignSelf=
"center"
alignSelf=
"center"
...
@@ -57,7 +47,7 @@ const NavFooter = ({ isCollapsed, hasAccount }: Props) => {
...
@@ -57,7 +47,7 @@ const NavFooter = ({ isCollapsed, hasAccount }: Props) => {
fontSize=
"xs"
fontSize=
"xs"
{
...
getDefaultTransitionProps
({
transitionProperty
:
'
width
'
})
}
{
...
getDefaultTransitionProps
({
transitionProperty
:
'
width
'
})
}
>
>
<
Stack
direction=
{
isCollapsed
?
'
column
'
:
'
row
'
}
>
<
Stack
direction=
{
{
base
:
'
row
'
,
lg
:
isExpanded
?
'
row
'
:
'
column
'
,
xl
:
isCollapsed
?
'
column
'
:
'
row
'
}
}
>
{
SOCIAL_LINKS
.
map
(
sl
=>
{
{
SOCIAL_LINKS
.
map
(
sl
=>
{
return
(
return
(
<
Link
href=
{
sl
.
link
}
key=
{
sl
.
link
}
variant=
"secondary"
w=
{
5
}
h=
{
5
}
aria
-
label=
{
sl
.
label
}
>
<
Link
href=
{
sl
.
link
}
key=
{
sl
.
link
}
variant=
"secondary"
w=
{
5
}
h=
{
5
}
aria
-
label=
{
sl
.
label
}
>
...
@@ -66,14 +56,12 @@ const NavFooter = ({ isCollapsed, hasAccount }: Props) => {
...
@@ -66,14 +56,12 @@ const NavFooter = ({ isCollapsed, hasAccount }: Props) => {
);
);
})
}
})
}
</
Stack
>
</
Stack
>
{
!
isCollapsed
&&
(
<
Box
display=
{
{
base
:
'
block
'
,
lg
:
isExpanded
?
'
block
'
:
'
none
'
,
xl
:
isCollapsed
?
'
none
'
:
'
block
'
}
}
>
<>
<
Text
variant=
"secondary"
mb=
{
8
}
>
<
Text
variant=
"secondary"
>
Blockscout is a tool for inspecting and analyzing EVM based blockchains. Blockchain explorer for Ethereum Networks.
Blockscout is a tool for inspecting and analyzing EVM based blockchains. Blockchain explorer for Ethereum Networks.
</
Text
>
</
Text
>
<
Text
variant=
"secondary"
>
Version:
<
Link
href=
{
VERSION_URL
}
target=
"_blank"
>
{
BLOCKSCOUT_VERSION
}
</
Link
></
Text
>
<
Text
variant=
"secondary"
>
Version:
<
Link
href=
{
VERSION_URL
}
target=
"_blank"
>
{
BLOCKSCOUT_VERSION
}
</
Link
></
Text
>
</>
</
Box
>
)
}
</
VStack
>
</
VStack
>
);
);
};
};
...
...
ui/snippets/navigation/NavLink.tsx
View file @
36edbc39
...
@@ -2,7 +2,6 @@ import { Link, Icon, Text, HStack, Tooltip, Box } from '@chakra-ui/react';
...
@@ -2,7 +2,6 @@ import { Link, Icon, Text, HStack, Tooltip, Box } from '@chakra-ui/react';
import
NextLink
from
'
next/link
'
;
import
NextLink
from
'
next/link
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
useIsMobile
from
'
lib/hooks/useIsMobile
'
;
import
getDefaultTransitionProps
from
'
theme/utils/getDefaultTransitionProps
'
;
import
getDefaultTransitionProps
from
'
theme/utils/getDefaultTransitionProps
'
;
import
useColors
from
'
./useColors
'
;
import
useColors
from
'
./useColors
'
;
...
@@ -18,21 +17,15 @@ interface Props {
...
@@ -18,21 +17,15 @@ interface Props {
const
NavLink
=
({
text
,
url
,
icon
,
isCollapsed
,
isActive
,
px
}:
Props
)
=>
{
const
NavLink
=
({
text
,
url
,
icon
,
isCollapsed
,
isActive
,
px
}:
Props
)
=>
{
const
colors
=
useColors
();
const
colors
=
useColors
();
const
isMobile
=
useIsMobile
();
const
width
=
(()
=>
{
if
(
isMobile
)
{
return
'
100%
'
;
}
return
isCollapsed
?
'
60px
'
:
'
180px
'
;
const
isExpanded
=
isCollapsed
===
false
;
})();
return
(
return
(
<
Box
as=
"li"
listStyleType=
"none"
w=
"100%"
>
<
Box
as=
"li"
listStyleType=
"none"
w=
"100%"
>
<
NextLink
href=
{
url
}
passHref
>
<
NextLink
href=
{
url
}
passHref
>
<
Link
<
Link
w=
{
width
}
w=
{
{
base
:
'
100%
'
,
lg
:
isExpanded
?
'
180px
'
:
'
60px
'
,
xl
:
isCollapsed
?
'
60px
'
:
'
180px
'
}
}
px=
{
px
||
(
isCollapsed
?
'
15px
'
:
3
)
}
px=
{
px
||
{
base
:
3
,
lg
:
isExpanded
?
3
:
'
15px
'
,
xl
:
isCollapsed
?
'
15px
'
:
3
}
}
py=
{
2.5
}
py=
{
2.5
}
display=
"flex"
display=
"flex"
color=
{
isActive
?
colors
.
text
.
active
:
colors
.
text
.
default
}
color=
{
isActive
?
colors
.
text
.
active
:
colors
.
text
.
default
}
...
@@ -53,7 +46,14 @@ const NavLink = ({ text, url, icon, isCollapsed, isActive, px }: Props) => {
...
@@ -53,7 +46,14 @@ const NavLink = ({ text, url, icon, isCollapsed, isActive, px }: Props) => {
>
>
<
HStack
spacing=
{
3
}
>
<
HStack
spacing=
{
3
}
>
<
Icon
as=
{
icon
}
boxSize=
"30px"
/>
<
Icon
as=
{
icon
}
boxSize=
"30px"
/>
{
!
isCollapsed
&&
<
Text
variant=
"inherit"
fontSize=
"sm"
lineHeight=
"20px"
>
{
text
}
</
Text
>
}
<
Text
variant=
"inherit"
fontSize=
"sm"
lineHeight=
"20px"
display=
{
{
base
:
'
block
'
,
lg
:
isExpanded
?
'
block
'
:
'
none
'
,
xl
:
isCollapsed
?
'
none
'
:
'
block
'
}
}
>
{
text
}
</
Text
>
</
HStack
>
</
HStack
>
</
Tooltip
>
</
Tooltip
>
</
Link
>
</
Link
>
...
...
ui/snippets/navigation/NavigationDesktop.tsx
View file @
36edbc39
import
{
Flex
,
Box
,
VStack
,
Icon
,
useColorModeValue
,
useBreakpointValue
}
from
'
@chakra-ui/react
'
;
import
{
Flex
,
Box
,
VStack
,
Icon
,
useColorModeValue
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
chevronIcon
from
'
icons/arrows/east-mini.svg
'
;
import
chevronIcon
from
'
icons/arrows/east-mini.svg
'
;
import
*
as
cookies
from
'
lib/cookies
'
;
import
*
as
cookies
from
'
lib/cookies
'
;
import
useNavItems
from
'
lib/hooks/useNavItems
'
;
import
useNavItems
from
'
lib/hooks/useNavItems
'
;
import
useNetwork
from
'
lib/hooks/useNetwork
'
;
import
useNetwork
from
'
lib/hooks/useNetwork
'
;
import
isBrowser
from
'
lib/isBrowser
'
;
import
getDefaultTransitionProps
from
'
theme/utils/getDefaultTransitionProps
'
;
import
getDefaultTransitionProps
from
'
theme/utils/getDefaultTransitionProps
'
;
import
NetworkLogo
from
'
ui/snippets/networkMenu/NetworkLogo
'
;
import
NetworkLogo
from
'
ui/snippets/networkMenu/NetworkLogo
'
;
import
NetworkMenu
from
'
ui/snippets/networkMenu/NetworkMenu
'
;
import
NetworkMenu
from
'
ui/snippets/networkMenu/NetworkMenu
'
;
...
@@ -15,18 +16,24 @@ import NavLink from './NavLink';
...
@@ -15,18 +16,24 @@ import NavLink from './NavLink';
const
NavigationDesktop
=
()
=>
{
const
NavigationDesktop
=
()
=>
{
const
{
mainNavItems
,
accountNavItems
}
=
useNavItems
();
const
{
mainNavItems
,
accountNavItems
}
=
useNavItems
();
const
selectedNetwork
=
useNetwork
();
const
selectedNetwork
=
useNetwork
();
const
isLargeScreen
=
useBreakpointValue
({
base
:
false
,
xl
:
true
});
const
navBarCollapsedCookie
=
cookies
.
get
(
cookies
.
NAMES
.
NAV_BAR_COLLAPSED
);
const
isAuth
=
Boolean
(
cookies
.
get
(
cookies
.
NAMES
.
API_TOKEN
));
const
hasAccount
=
selectedNetwork
?.
isAccountSupported
&&
isAuth
;
const
[
isCollapsed
,
setCollapsedState
]
=
React
.
useState
(
navBarCollapsedCookie
===
'
true
'
);
const
isInBrowser
=
isBrowser
();
const
[
hasAccount
,
setHasAccount
]
=
React
.
useState
(
false
);
const
[
isCollapsed
,
setCollapsedState
]
=
React
.
useState
<
boolean
|
undefined
>
();
React
.
useEffect
(()
=>
{
React
.
useEffect
(()
=>
{
if
(
!
navBarCollapsedCookie
)
{
const
navBarCollapsedCookie
=
cookies
.
get
(
cookies
.
NAMES
.
NAV_BAR_COLLAPSED
);
setCollapsedState
(
!
isLargeScreen
);
const
isAuth
=
Boolean
(
cookies
.
get
(
cookies
.
NAMES
.
API_TOKEN
));
if
(
isInBrowser
)
{
if
(
navBarCollapsedCookie
===
'
true
'
)
{
setCollapsedState
(
true
);
}
if
(
navBarCollapsedCookie
===
'
false
'
)
{
setCollapsedState
(
false
);
}
setHasAccount
(
Boolean
(
selectedNetwork
?.
isAccountSupported
&&
isAuth
&&
isInBrowser
));
}
}
},
[
is
LargeScreen
,
navBarCollapsedCookie
]);
},
[
is
InBrowser
,
selectedNetwork
?.
isAccountSupported
]);
const
handleTogglerClick
=
React
.
useCallback
(()
=>
{
const
handleTogglerClick
=
React
.
useCallback
(()
=>
{
setCollapsedState
((
flag
)
=>
!
flag
);
setCollapsedState
((
flag
)
=>
!
flag
);
...
@@ -40,16 +47,19 @@ const NavigationDesktop = () => {
...
@@ -40,16 +47,19 @@ const NavigationDesktop = () => {
borderColor
:
useColorModeValue
(
'
blackAlpha.200
'
,
'
whiteAlpha.200
'
),
borderColor
:
useColorModeValue
(
'
blackAlpha.200
'
,
'
whiteAlpha.200
'
),
};
};
const
isExpanded
=
isCollapsed
===
false
;
return
(
return
(
<
Flex
<
Flex
display=
{
{
base
:
'
none
'
,
lg
:
'
flex
'
}
}
position=
"relative"
position=
"relative"
flexDirection=
"column"
flexDirection=
"column"
alignItems=
"flex-start"
alignItems=
"flex-start"
borderRight=
"1px solid"
borderRight=
"1px solid"
borderColor=
{
containerBorderColor
}
borderColor=
{
containerBorderColor
}
px=
{
isCollapsed
?
4
:
6
}
px=
{
{
lg
:
isExpanded
?
6
:
4
,
xl
:
isCollapsed
?
4
:
6
}
}
py=
{
12
}
py=
{
12
}
width=
{
isCollapsed
?
'
92px
'
:
'
229px
'
}
width=
{
{
lg
:
isExpanded
?
'
229px
'
:
'
92px
'
,
xl
:
isCollapsed
?
'
92px
'
:
'
229px
'
}
}
{
...
getDefaultTransitionProps
({
transitionProperty
:
'
width
,
padding
'
})
}
{
...
getDefaultTransitionProps
({
transitionProperty
:
'
width
,
padding
'
})
}
>
>
<
Box
<
Box
...
@@ -86,12 +96,12 @@ const NavigationDesktop = () => {
...
@@ -86,12 +96,12 @@ const NavigationDesktop = () => {
_hover=
{
{
color
:
'
blue.400
'
}
}
_hover=
{
{
color
:
'
blue.400
'
}
}
borderRadius=
"base"
borderRadius=
"base"
{
...
chevronIconStyles
}
{
...
chevronIconStyles
}
transform=
{
isCollapsed
?
'
rotate(180deg)
'
:
'
rotate(0)
'
}
transform=
{
{
lg
:
isExpanded
?
'
rotate(0)
'
:
'
rotate(180deg)
'
,
xl
:
isCollapsed
?
'
rotate(180deg)
'
:
'
rotate(0)
'
}
}
{
...
getDefaultTransitionProps
({
transitionProperty
:
'
transform
,
left
'
})
}
{
...
getDefaultTransitionProps
({
transitionProperty
:
'
transform
,
left
'
})
}
transformOrigin=
"center"
transformOrigin=
"center"
position=
"absolute"
position=
"absolute"
top=
"104px"
top=
"104px"
left=
{
isCollapsed
?
'
80px
'
:
'
216px
'
}
left=
{
{
lg
:
isExpanded
?
'
216px
'
:
'
80px
'
,
xl
:
isCollapsed
?
'
80px
'
:
'
216px
'
}
}
cursor=
"pointer"
cursor=
"pointer"
onClick=
{
handleTogglerClick
}
onClick=
{
handleTogglerClick
}
/>
/>
...
...
ui/snippets/networkMenu/NetworkLogo.tsx
View file @
36edbc39
...
@@ -57,7 +57,7 @@ const NetworkLogo = ({ isCollapsed, onClick }: Props) => {
...
@@ -57,7 +57,7 @@ const NetworkLogo = ({ isCollapsed, onClick }: Props) => {
<
NextLink
href=
{
href
}
passHref
>
<
NextLink
href=
{
href
}
passHref
>
<
Box
<
Box
as=
"a"
as=
"a"
width=
{
isCollapsed
?
'
0
'
:
'
113px
'
}
width=
{
{
base
:
'
113px
'
,
lg
:
isCollapsed
===
false
?
'
113px
'
:
0
,
xl
:
isCollapsed
?
'
0
'
:
'
113px
'
}
}
display=
"inline-flex"
display=
"inline-flex"
overflow=
"hidden"
overflow=
"hidden"
onClick=
{
onClick
}
onClick=
{
onClick
}
...
...
ui/snippets/networkMenu/NetworkMenu.tsx
View file @
36edbc39
...
@@ -4,7 +4,7 @@ import React from 'react';
...
@@ -4,7 +4,7 @@ import React from 'react';
import
NetworkMenuButton
from
'
./NetworkMenuButton
'
;
import
NetworkMenuButton
from
'
./NetworkMenuButton
'
;
import
NetworkMenuContentDesktop
from
'
./NetworkMenuContentDesktop
'
;
import
NetworkMenuContentDesktop
from
'
./NetworkMenuContentDesktop
'
;
interface
Props
{
interface
Props
{
isCollapsed
:
boolean
;
isCollapsed
?
:
boolean
;
}
}
const
NetworkMenu
=
({
isCollapsed
}:
Props
)
=>
{
const
NetworkMenu
=
({
isCollapsed
}:
Props
)
=>
{
...
@@ -13,7 +13,7 @@ const NetworkMenu = ({ isCollapsed }: Props) => {
...
@@ -13,7 +13,7 @@ const NetworkMenu = ({ isCollapsed }: Props) => {
{
({
isOpen
})
=>
(
{
({
isOpen
})
=>
(
<>
<>
<
PopoverTrigger
>
<
PopoverTrigger
>
<
Box
marginLeft=
{
isCollapsed
?
'
0px
'
:
'
7px
'
}
>
<
Box
marginLeft=
{
{
base
:
'
7px
'
,
lg
:
isCollapsed
===
false
?
'
7px
'
:
'
0px
'
,
xl
:
isCollapsed
?
'
0px
'
:
'
7px
'
}
}
>
<
NetworkMenuButton
isActive=
{
isOpen
}
/>
<
NetworkMenuButton
isActive=
{
isOpen
}
/>
</
Box
>
</
Box
>
</
PopoverTrigger
>
</
PopoverTrigger
>
...
...
ui/snippets/searchBar/SearchBar.tsx
View file @
36edbc39
import
type
{
ChangeEvent
,
FormEvent
}
from
'
react
'
;
import
type
{
ChangeEvent
,
FormEvent
}
from
'
react
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
useIsMobile
from
'
lib/hooks/useIsMobile
'
;
import
useLink
from
'
lib/link/useLink
'
;
import
useLink
from
'
lib/link/useLink
'
;
import
SearchBarDesktop
from
'
./SearchBarDesktop
'
;
import
SearchBarDesktop
from
'
./SearchBarDesktop
'
;
...
@@ -10,7 +9,6 @@ import SearchBarMobile from './SearchBarMobile';
...
@@ -10,7 +9,6 @@ import SearchBarMobile from './SearchBarMobile';
const
SearchBar
=
()
=>
{
const
SearchBar
=
()
=>
{
const
[
value
,
setValue
]
=
React
.
useState
(
''
);
const
[
value
,
setValue
]
=
React
.
useState
(
''
);
const
link
=
useLink
();
const
link
=
useLink
();
const
isMobile
=
useIsMobile
();
const
handleChange
=
React
.
useCallback
((
event
:
ChangeEvent
<
HTMLInputElement
>
)
=>
{
const
handleChange
=
React
.
useCallback
((
event
:
ChangeEvent
<
HTMLInputElement
>
)
=>
{
setValue
(
event
.
target
.
value
);
setValue
(
event
.
target
.
value
);
...
@@ -22,14 +20,11 @@ const SearchBar = () => {
...
@@ -22,14 +20,11 @@ const SearchBar = () => {
window
.
location
.
assign
(
url
);
window
.
location
.
assign
(
url
);
},
[
link
,
value
]);
},
[
link
,
value
]);
if
(
isMobile
)
{
return
(
<
SearchBarMobile
onChange=
{
handleChange
}
onSubmit=
{
handleSubmit
}
/>
);
}
return
(
return
(
<
SearchBarDesktop
onChange=
{
handleChange
}
onSubmit=
{
handleSubmit
}
/>
<>
<
SearchBarDesktop
onChange=
{
handleChange
}
onSubmit=
{
handleSubmit
}
/>
<
SearchBarMobile
onChange=
{
handleChange
}
onSubmit=
{
handleSubmit
}
/>
</>
);
);
};
};
...
...
ui/snippets/searchBar/SearchBarDesktop.tsx
View file @
36edbc39
import
{
InputGroup
,
Input
,
InputLeftAddon
,
InputLeftElement
,
Icon
,
useColorModeValue
}
from
'
@chakra-ui/react
'
;
import
{
InputGroup
,
Input
,
InputLeftAddon
,
InputLeftElement
,
Icon
,
chakra
,
useColorModeValue
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
type
{
ChangeEvent
,
FormEvent
}
from
'
react
'
;
import
type
{
ChangeEvent
,
FormEvent
}
from
'
react
'
;
...
@@ -11,7 +11,7 @@ interface Props {
...
@@ -11,7 +11,7 @@ interface Props {
const
SearchBarDesktop
=
({
onChange
,
onSubmit
}:
Props
)
=>
{
const
SearchBarDesktop
=
({
onChange
,
onSubmit
}:
Props
)
=>
{
return
(
return
(
<
form
noValidate
onSubmit=
{
onSubmit
}
>
<
chakra
.
form
noValidate
onSubmit=
{
onSubmit
}
display=
{
{
base
:
'
none
'
,
lg
:
'
block
'
}
}
w=
"100%"
>
<
InputGroup
>
<
InputGroup
>
<
InputLeftAddon
w=
"111px"
>
All filters
</
InputLeftAddon
>
<
InputLeftAddon
w=
"111px"
>
All filters
</
InputLeftAddon
>
<
InputLeftElement
w=
{
6
}
ml=
"132px"
mr=
{
2.5
}
>
<
InputLeftElement
w=
{
6
}
ml=
"132px"
mr=
{
2.5
}
>
...
@@ -25,7 +25,7 @@ const SearchBarDesktop = ({ onChange, onSubmit }: Props) => {
...
@@ -25,7 +25,7 @@ const SearchBarDesktop = ({ onChange, onSubmit }: Props) => {
borderColor=
{
useColorModeValue
(
'
blackAlpha.100
'
,
'
whiteAlpha.200
'
)
}
borderColor=
{
useColorModeValue
(
'
blackAlpha.100
'
,
'
whiteAlpha.200
'
)
}
/>
/>
</
InputGroup
>
</
InputGroup
>
</
form
>
</
chakra
.
form
>
);
);
};
};
...
...
ui/snippets/searchBar/SearchBarMobile.tsx
View file @
36edbc39
...
@@ -61,6 +61,8 @@ const SearchBarMobile = ({ onChange, onSubmit }: Props) => {
...
@@ -61,6 +61,8 @@ const SearchBarMobile = ({ onChange, onSubmit }: Props) => {
transform=
{
isVisible
?
'
translateY(0)
'
:
'
translateY(-100%)
'
}
transform=
{
isVisible
?
'
translateY(0)
'
:
'
translateY(-100%)
'
}
transitionProperty=
"transform"
transitionProperty=
"transform"
transitionDuration=
"slow"
transitionDuration=
"slow"
display=
{
{
base
:
'
block
'
,
lg
:
'
none
'
}
}
w=
"100%"
>
>
<
InputGroup
size=
"sm"
>
<
InputGroup
size=
"sm"
>
<
InputLeftElement
>
<
InputLeftElement
>
...
...
ui/tx/internals/TxInternalsFilter.tsx
View file @
36edbc39
...
@@ -3,7 +3,6 @@ import React from 'react';
...
@@ -3,7 +3,6 @@ import React from 'react';
import
type
{
TxInternalsType
}
from
'
types/api/tx
'
;
import
type
{
TxInternalsType
}
from
'
types/api/tx
'
;
import
useIsMobile
from
'
lib/hooks/useIsMobile
'
;
import
FilterButton
from
'
ui/shared/FilterButton
'
;
import
FilterButton
from
'
ui/shared/FilterButton
'
;
import
{
TX_INTERNALS_ITEMS
}
from
'
ui/tx/internals/utils
'
;
import
{
TX_INTERNALS_ITEMS
}
from
'
ui/tx/internals/utils
'
;
...
@@ -15,14 +14,12 @@ interface Props {
...
@@ -15,14 +14,12 @@ interface Props {
const
TxInternalsFilter
=
({
onFilterChange
,
defaultFilters
,
appliedFiltersNum
}:
Props
)
=>
{
const
TxInternalsFilter
=
({
onFilterChange
,
defaultFilters
,
appliedFiltersNum
}:
Props
)
=>
{
const
{
isOpen
,
onToggle
,
onClose
}
=
useDisclosure
();
const
{
isOpen
,
onToggle
,
onClose
}
=
useDisclosure
();
const
isMobile
=
useIsMobile
();
return
(
return
(
<
Popover
isOpen=
{
isOpen
}
onClose=
{
onClose
}
placement=
"bottom-start"
isLazy
>
<
Popover
isOpen=
{
isOpen
}
onClose=
{
onClose
}
placement=
"bottom-start"
isLazy
>
<
PopoverTrigger
>
<
PopoverTrigger
>
<
FilterButton
<
FilterButton
isActive=
{
isOpen
||
Number
(
appliedFiltersNum
)
>
0
}
isActive=
{
isOpen
||
Number
(
appliedFiltersNum
)
>
0
}
isCollapsed=
{
isMobile
}
onClick=
{
onToggle
}
onClick=
{
onToggle
}
appliedFiltersNum=
{
appliedFiltersNum
}
appliedFiltersNum=
{
appliedFiltersNum
}
/>
/>
...
...
ui/txs/TxsContent.tsx
View file @
36edbc39
import
{
Box
,
HStack
}
from
'
@chakra-ui/react
'
;
import
{
Box
,
HStack
,
Show
}
from
'
@chakra-ui/react
'
;
import
React
,
{
useCallback
,
useEffect
,
useState
}
from
'
react
'
;
import
React
,
{
useCallback
,
useEffect
,
useState
}
from
'
react
'
;
import
type
{
Sort
}
from
'
types/client/txs-sort
'
;
import
type
{
Sort
}
from
'
types/client/txs-sort
'
;
import
{
txs
}
from
'
data/txs
'
;
import
{
txs
}
from
'
data/txs
'
;
import
useIsMobile
from
'
lib/hooks/useIsMobile
'
;
import
FilterButton
from
'
ui/shared/FilterButton
'
;
import
FilterButton
from
'
ui/shared/FilterButton
'
;
import
FilterInput
from
'
ui/shared/FilterInput
'
;
import
FilterInput
from
'
ui/shared/FilterInput
'
;
import
Pagination
from
'
ui/shared/Pagination
'
;
import
Pagination
from
'
ui/shared/Pagination
'
;
...
@@ -18,8 +17,6 @@ type Props = {
...
@@ -18,8 +17,6 @@ type Props = {
}
}
const
TxsContent
=
({
isPending
}:
Props
)
=>
{
const
TxsContent
=
({
isPending
}:
Props
)
=>
{
const
isMobile
=
useIsMobile
();
const
[
sorting
,
setSorting
]
=
useState
<
Sort
>
();
const
[
sorting
,
setSorting
]
=
useState
<
Sort
>
();
const
[
sortedTxs
,
setSortedTxs
]
=
useState
(
txs
);
const
[
sortedTxs
,
setSortedTxs
]
=
useState
(
txs
);
...
@@ -75,15 +72,15 @@ const TxsContent = ({ isPending }: Props) => {
...
@@ -75,15 +72,15 @@ const TxsContent = ({ isPending }: Props) => {
{
/* TODO */
}
{
/* TODO */
}
<
FilterButton
<
FilterButton
isActive=
{
false
}
isActive=
{
false
}
isCollapsed=
{
isMobile
}
// eslint-disable-next-line react/jsx-no-bind
// eslint-disable-next-line react/jsx-no-bind
onClick=
{
()
=>
{}
}
onClick=
{
()
=>
{}
}
appliedFiltersNum=
{
0
}
appliedFiltersNum=
{
0
}
/>
/>
<
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
)
}
display=
{
{
base
:
'
block
'
,
lg
:
'
none
'
}
}
/>
/>
<
FilterInput
<
FilterInput
// eslint-disable-next-line react/jsx-no-bind
// eslint-disable-next-line react/jsx-no-bind
...
@@ -93,11 +90,10 @@ const TxsContent = ({ isPending }: Props) => {
...
@@ -93,11 +90,10 @@ const TxsContent = ({ isPending }: Props) => {
placeholder=
"Search by addresses, hash, method..."
placeholder=
"Search by addresses, hash, method..."
/>
/>
</
HStack
>
</
HStack
>
{
isMobile
?
<
Show
below=
"lg"
>
{
sortedTxs
.
map
(
tx
=>
<
TxsListItem
tx=
{
tx
}
key=
{
tx
.
hash
}
/>)
}
</
Show
>
sortedTxs
.
map
(
tx
=>
<
TxsListItem
tx=
{
tx
}
key=
{
tx
.
hash
}
/>)
:
<
Show
above=
"lg"
><
TxsTable
txs=
{
sortedTxs
}
sort=
{
sort
}
sorting=
{
sorting
}
/></
Show
>
<
TxsTable
txs=
{
sortedTxs
}
sort=
{
sort
}
sorting=
{
sorting
}
/>
}
<
Box
mx=
{
{
base
:
0
,
lg
:
6
}
}
my=
{
{
base
:
6
,
lg
:
3
}
}
>
<
Box
mx=
{
{
base
:
0
,
lg
:
6
}
}
my=
{
{
base
:
6
,
lg
:
3
}
}
>
<
Pagination
currentPage=
{
1
}
isMobile=
{
isMobile
}
/>
<
Pagination
currentPage=
{
1
}
/>
</
Box
>
</
Box
>
</>
</>
);
);
...
...
ui/txs/TxsTableItem.tsx
View file @
36edbc39
...
@@ -13,8 +13,8 @@ import {
...
@@ -13,8 +13,8 @@ import {
PopoverContent
,
PopoverContent
,
PopoverBody
,
PopoverBody
,
Portal
,
Portal
,
useBreakpointValue
,
useColorModeValue
,
useColorModeValue
,
Show
,
}
from
'
@chakra-ui/react
'
;
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
...
@@ -37,8 +37,6 @@ import TxType from './TxType';
...
@@ -37,8 +37,6 @@ import TxType from './TxType';
const
TxsTableItem
=
({
tx
}:
{
tx
:
ArrayElement
<
typeof
txs
>
})
=>
{
const
TxsTableItem
=
({
tx
}:
{
tx
:
ArrayElement
<
typeof
txs
>
})
=>
{
const
link
=
useLink
();
const
link
=
useLink
();
const
isLargeScreen
=
useBreakpointValue
({
base
:
false
,
xl
:
true
});
const
addressFrom
=
(
const
addressFrom
=
(
<
Address
>
<
Address
>
<
Tooltip
label=
{
tx
.
address_from
.
type
}
>
<
Tooltip
label=
{
tx
.
address_from
.
type
}
>
...
@@ -108,19 +106,18 @@ const TxsTableItem = ({ tx }: {tx: ArrayElement<typeof txs>}) => {
...
@@ -108,19 +106,18 @@ const TxsTableItem = ({ tx }: {tx: ArrayElement<typeof txs>}) => {
<
Td
>
<
Td
>
<
Link
href=
{
link
(
'
block
'
,
{
id
:
tx
.
block_num
.
toString
()
})
}
>
{
tx
.
block_num
}
</
Link
>
<
Link
href=
{
link
(
'
block
'
,
{
id
:
tx
.
block_num
.
toString
()
})
}
>
{
tx
.
block_num
}
</
Link
>
</
Td
>
</
Td
>
{
isLargeScreen
?
(
<
Show
above=
"xl"
>
<>
<
Td
>
<
Td
>
{
addressFrom
}
{
addressFrom
}
</
Td
>
</
Td
>
<
Td
>
<
Td
>
<
Icon
as=
{
rightArrowIcon
}
boxSize=
{
6
}
mr=
{
2
}
color=
"gray.500"
/>
<
Icon
as=
{
rightArrowIcon
}
boxSize=
{
6
}
mr=
{
2
}
color=
"gray.500"
/>
</
Td
>
</
Td
>
<
Td
>
<
Td
>
{
addressTo
}
{
addressTo
}
</
Td
>
</
Td
>
</
Show
>
</>
<
Show
below=
"xl"
>
)
:
(
<
Td
colSpan=
{
3
}
>
<
Td
colSpan=
{
3
}
>
<
Box
>
<
Box
>
{
addressFrom
}
{
addressFrom
}
...
@@ -135,7 +132,7 @@ const TxsTableItem = ({ tx }: {tx: ArrayElement<typeof txs>}) => {
...
@@ -135,7 +132,7 @@ const TxsTableItem = ({ tx }: {tx: ArrayElement<typeof txs>}) => {
{
addressTo
}
{
addressTo
}
</
Box
>
</
Box
>
</
Td
>
</
Td
>
)
}
</
Show
>
<
Td
isNumeric
>
<
Td
isNumeric
>
{
tx
.
amount
.
value
.
toFixed
(
8
)
}
{
tx
.
amount
.
value
.
toFixed
(
8
)
}
</
Td
>
</
Td
>
...
...
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