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
ee02cfae
Unverified
Commit
ee02cfae
authored
May 22, 2023
by
tom goriunov
Committed by
GitHub
May 22, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #829 from blockscout/remove-is-new-ui
remove isNewUi flag from nav items
parents
e35dc1e0
87163a6b
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
13 additions
and
42 deletions
+13
-42
useNavItems.tsx
lib/hooks/useNavItems.tsx
+6
-22
navigation-items.ts
types/client/navigation-items.ts
+0
-1
nextjs-routes.d.ts
types/nextjs-routes.d.ts
+0
-1
NavLink.tsx
ui/snippets/navigation/NavLink.tsx
+7
-17
types.ts
ui/snippets/networkMenu/types.ts
+0
-1
No files found.
lib/hooks/useNavItems.tsx
View file @
ee02cfae
...
@@ -57,41 +57,38 @@ export default function useNavItems(): ReturnType {
...
@@ -57,41 +57,38 @@ export default function useNavItems(): ReturnType {
nextRoute
:
{
pathname
:
'
/accounts
'
as
const
},
nextRoute
:
{
pathname
:
'
/accounts
'
as
const
},
icon
:
topAccountsIcon
,
icon
:
topAccountsIcon
,
isActive
:
pathname
===
'
/accounts
'
,
isActive
:
pathname
===
'
/accounts
'
,
isNewUi
:
true
,
};
};
const
blocks
=
{
const
blocks
=
{
text
:
'
Blocks
'
,
text
:
'
Blocks
'
,
nextRoute
:
{
pathname
:
'
/blocks
'
as
const
},
nextRoute
:
{
pathname
:
'
/blocks
'
as
const
},
icon
:
blocksIcon
,
icon
:
blocksIcon
,
isActive
:
pathname
===
'
/blocks
'
||
pathname
===
'
/block/[height]
'
,
isActive
:
pathname
===
'
/blocks
'
||
pathname
===
'
/block/[height]
'
,
isNewUi
:
true
,
};
};
const
txs
=
{
const
txs
=
{
text
:
'
Transactions
'
,
text
:
'
Transactions
'
,
nextRoute
:
{
pathname
:
'
/txs
'
as
const
},
nextRoute
:
{
pathname
:
'
/txs
'
as
const
},
icon
:
transactionsIcon
,
icon
:
transactionsIcon
,
isActive
:
pathname
===
'
/txs
'
||
pathname
===
'
/tx/[hash]
'
,
isActive
:
pathname
===
'
/txs
'
||
pathname
===
'
/tx/[hash]
'
,
isNewUi
:
true
,
};
};
const
verifiedContracts
=
const
verifiedContracts
=
// eslint-disable-next-line max-len
// eslint-disable-next-line max-len
{
text
:
'
Verified contracts
'
,
nextRoute
:
{
pathname
:
'
/verified-contracts
'
as
const
},
icon
:
verifiedIcon
,
isActive
:
pathname
===
'
/verified-contracts
'
,
isNewUi
:
true
};
{
text
:
'
Verified contracts
'
,
nextRoute
:
{
pathname
:
'
/verified-contracts
'
as
const
},
icon
:
verifiedIcon
,
isActive
:
pathname
===
'
/verified-contracts
'
};
if
(
appConfig
.
L2
.
isL2Network
)
{
if
(
appConfig
.
L2
.
isL2Network
)
{
blockchainNavItems
=
[
blockchainNavItems
=
[
[
[
txs
,
txs
,
// eslint-disable-next-line max-len
// eslint-disable-next-line max-len
{
text
:
`Deposits (L1
${
rightLineArrow
}
L2)`
,
nextRoute
:
{
pathname
:
'
/l2-deposits
'
as
const
},
icon
:
depositsIcon
,
isActive
:
pathname
===
'
/l2-deposits
'
,
isNewUi
:
true
},
{
text
:
`Deposits (L1
${
rightLineArrow
}
L2)`
,
nextRoute
:
{
pathname
:
'
/l2-deposits
'
as
const
},
icon
:
depositsIcon
,
isActive
:
pathname
===
'
/l2-deposits
'
},
// eslint-disable-next-line max-len
// eslint-disable-next-line max-len
{
text
:
`Withdrawals (L2
${
rightLineArrow
}
L1)`
,
nextRoute
:
{
pathname
:
'
/l2-withdrawals
'
as
const
},
icon
:
withdrawalsIcon
,
isActive
:
pathname
===
'
/l2-withdrawals
'
,
isNewUi
:
true
},
{
text
:
`Withdrawals (L2
${
rightLineArrow
}
L1)`
,
nextRoute
:
{
pathname
:
'
/l2-withdrawals
'
as
const
},
icon
:
withdrawalsIcon
,
isActive
:
pathname
===
'
/l2-withdrawals
'
},
],
],
[
[
blocks
,
blocks
,
// eslint-disable-next-line max-len
// eslint-disable-next-line max-len
{
text
:
'
Txn batches
'
,
nextRoute
:
{
pathname
:
'
/l2-txn-batches
'
as
const
},
icon
:
txnBatchIcon
,
isActive
:
pathname
===
'
/l2-txn-batches
'
,
isNewUi
:
true
},
{
text
:
'
Txn batches
'
,
nextRoute
:
{
pathname
:
'
/l2-txn-batches
'
as
const
},
icon
:
txnBatchIcon
,
isActive
:
pathname
===
'
/l2-txn-batches
'
},
// eslint-disable-next-line max-len
// eslint-disable-next-line max-len
{
text
:
'
Output roots
'
,
nextRoute
:
{
pathname
:
'
/l2-output-roots
'
as
const
},
icon
:
outputRootsIcon
,
isActive
:
pathname
===
'
/l2-output-roots
'
,
isNewUi
:
true
},
{
text
:
'
Output roots
'
,
nextRoute
:
{
pathname
:
'
/l2-output-roots
'
as
const
},
icon
:
outputRootsIcon
,
isActive
:
pathname
===
'
/l2-output-roots
'
},
],
],
[
[
topAccounts
,
topAccounts
,
...
@@ -109,7 +106,6 @@ export default function useNavItems(): ReturnType {
...
@@ -109,7 +106,6 @@ export default function useNavItems(): ReturnType {
nextRoute
:
{
pathname
:
'
/withdrawals
'
as
const
},
nextRoute
:
{
pathname
:
'
/withdrawals
'
as
const
},
icon
:
withdrawalsIcon
,
icon
:
withdrawalsIcon
,
isActive
:
pathname
===
'
/withdrawals
'
,
isActive
:
pathname
===
'
/withdrawals
'
,
isNewUi
:
true
,
},
},
].
filter
(
Boolean
);
].
filter
(
Boolean
);
}
}
...
@@ -120,14 +116,12 @@ export default function useNavItems(): ReturnType {
...
@@ -120,14 +116,12 @@ export default function useNavItems(): ReturnType {
nextRoute
:
{
pathname
:
'
/api-docs
'
as
const
},
nextRoute
:
{
pathname
:
'
/api-docs
'
as
const
},
icon
:
apiDocsIcon
,
icon
:
apiDocsIcon
,
isActive
:
pathname
===
'
/api-docs
'
,
isActive
:
pathname
===
'
/api-docs
'
,
isNewUi
:
true
,
}
:
null
,
}
:
null
,
{
{
text
:
'
GraphQL
'
,
text
:
'
GraphQL
'
,
nextRoute
:
{
pathname
:
'
/graphiql
'
as
const
},
nextRoute
:
{
pathname
:
'
/graphiql
'
as
const
},
icon
:
graphQLIcon
,
icon
:
graphQLIcon
,
isActive
:
pathname
===
'
/graphiql
'
,
isActive
:
pathname
===
'
/graphiql
'
,
isNewUi
:
true
,
},
},
{
{
text
:
'
RPC API
'
,
text
:
'
RPC API
'
,
...
@@ -146,7 +140,6 @@ export default function useNavItems(): ReturnType {
...
@@ -146,7 +140,6 @@ export default function useNavItems(): ReturnType {
text
:
'
Blockchain
'
,
text
:
'
Blockchain
'
,
icon
:
globeIcon
,
icon
:
globeIcon
,
isActive
:
blockchainNavItems
.
flat
().
some
(
item
=>
isInternalItem
(
item
)
&&
item
.
isActive
),
isActive
:
blockchainNavItems
.
flat
().
some
(
item
=>
isInternalItem
(
item
)
&&
item
.
isActive
),
isNewUi
:
true
,
subItems
:
blockchainNavItems
,
subItems
:
blockchainNavItems
,
},
},
{
{
...
@@ -154,16 +147,14 @@ export default function useNavItems(): ReturnType {
...
@@ -154,16 +147,14 @@ export default function useNavItems(): ReturnType {
nextRoute
:
{
pathname
:
'
/tokens
'
as
const
},
nextRoute
:
{
pathname
:
'
/tokens
'
as
const
},
icon
:
tokensIcon
,
icon
:
tokensIcon
,
isActive
:
pathname
.
startsWith
(
'
/token
'
),
isActive
:
pathname
.
startsWith
(
'
/token
'
),
isNewUi
:
true
,
},
},
isMarketplaceAvailable
?
{
isMarketplaceAvailable
?
{
text
:
'
Apps
'
,
text
:
'
Apps
'
,
nextRoute
:
{
pathname
:
'
/apps
'
as
const
},
nextRoute
:
{
pathname
:
'
/apps
'
as
const
},
icon
:
appsIcon
,
icon
:
appsIcon
,
isActive
:
pathname
.
startsWith
(
'
/app
'
),
isActive
:
pathname
.
startsWith
(
'
/app
'
),
isNewUi
:
true
,
}
:
null
,
}
:
null
,
{
text
:
'
Charts & stats
'
,
nextRoute
:
{
pathname
:
'
/stats
'
as
const
},
icon
:
statsIcon
,
isActive
:
pathname
===
'
/stats
'
,
isNewUi
:
true
},
{
text
:
'
Charts & stats
'
,
nextRoute
:
{
pathname
:
'
/stats
'
as
const
},
icon
:
statsIcon
,
isActive
:
pathname
===
'
/stats
'
},
{
{
text
:
'
API
'
,
text
:
'
API
'
,
icon
:
apiDocsIcon
,
icon
:
apiDocsIcon
,
...
@@ -183,40 +174,34 @@ export default function useNavItems(): ReturnType {
...
@@ -183,40 +174,34 @@ export default function useNavItems(): ReturnType {
nextRoute
:
{
pathname
:
'
/account/watchlist
'
as
const
},
nextRoute
:
{
pathname
:
'
/account/watchlist
'
as
const
},
icon
:
watchlistIcon
,
icon
:
watchlistIcon
,
isActive
:
pathname
===
'
/account/watchlist
'
,
isActive
:
pathname
===
'
/account/watchlist
'
,
isNewUi
:
true
,
},
},
{
{
text
:
'
Private tags
'
,
text
:
'
Private tags
'
,
nextRoute
:
{
pathname
:
'
/account/tag_address
'
as
const
},
nextRoute
:
{
pathname
:
'
/account/tag_address
'
as
const
},
icon
:
privateTagIcon
,
icon
:
privateTagIcon
,
isActive
:
pathname
===
'
/account/tag_address
'
,
isActive
:
pathname
===
'
/account/tag_address
'
,
isNewUi
:
true
,
},
},
{
{
text
:
'
Public tags
'
,
text
:
'
Public tags
'
,
nextRoute
:
{
pathname
:
'
/account/public_tags_request
'
as
const
},
nextRoute
:
{
pathname
:
'
/account/public_tags_request
'
as
const
},
icon
:
publicTagIcon
,
isActive
:
pathname
===
'
/account/public_tags_request
'
,
icon
:
publicTagIcon
,
isActive
:
pathname
===
'
/account/public_tags_request
'
,
isNewUi
:
true
,
},
},
{
{
text
:
'
API keys
'
,
text
:
'
API keys
'
,
nextRoute
:
{
pathname
:
'
/account/api_key
'
as
const
},
nextRoute
:
{
pathname
:
'
/account/api_key
'
as
const
},
icon
:
apiKeysIcon
,
isActive
:
pathname
===
'
/account/api_key
'
,
icon
:
apiKeysIcon
,
isActive
:
pathname
===
'
/account/api_key
'
,
isNewUi
:
true
,
},
},
{
{
text
:
'
Custom ABI
'
,
text
:
'
Custom ABI
'
,
nextRoute
:
{
pathname
:
'
/account/custom_abi
'
as
const
},
nextRoute
:
{
pathname
:
'
/account/custom_abi
'
as
const
},
icon
:
abiIcon
,
icon
:
abiIcon
,
isActive
:
pathname
===
'
/account/custom_abi
'
,
isActive
:
pathname
===
'
/account/custom_abi
'
,
isNewUi
:
true
,
},
},
appConfig
.
contractInfoApi
.
endpoint
&&
appConfig
.
adminServiceApi
.
endpoint
&&
{
appConfig
.
contractInfoApi
.
endpoint
&&
appConfig
.
adminServiceApi
.
endpoint
&&
{
text
:
'
Verified addrs
'
,
text
:
'
Verified addrs
'
,
nextRoute
:
{
pathname
:
'
/account/verified_addresses
'
as
const
},
nextRoute
:
{
pathname
:
'
/account/verified_addresses
'
as
const
},
icon
:
verifiedIcon
,
icon
:
verifiedIcon
,
isActive
:
pathname
===
'
/account/verified_addresses
'
,
isActive
:
pathname
===
'
/account/verified_addresses
'
,
isNewUi
:
true
,
},
},
].
filter
(
Boolean
);
].
filter
(
Boolean
);
...
@@ -225,7 +210,6 @@ export default function useNavItems(): ReturnType {
...
@@ -225,7 +210,6 @@ export default function useNavItems(): ReturnType {
nextRoute
:
{
pathname
:
'
/auth/profile
'
as
const
},
nextRoute
:
{
pathname
:
'
/auth/profile
'
as
const
},
icon
:
profileIcon
,
icon
:
profileIcon
,
isActive
:
pathname
===
'
/auth/profile
'
,
isActive
:
pathname
===
'
/auth/profile
'
,
isNewUi
:
true
,
};
};
return
{
mainNavItems
,
accountNavItems
,
profileItem
};
return
{
mainNavItems
,
accountNavItems
,
profileItem
};
...
...
types/client/navigation-items.ts
View file @
ee02cfae
...
@@ -8,7 +8,6 @@ type NavItemCommon = {
...
@@ -8,7 +8,6 @@ type NavItemCommon = {
export
type
NavItemInternal
=
NavItemCommon
&
{
export
type
NavItemInternal
=
NavItemCommon
&
{
nextRoute
:
Route
;
nextRoute
:
Route
;
isActive
?:
boolean
;
isActive
?:
boolean
;
isNewUi
?:
boolean
;
}
}
export
type
NavItemExternal
=
NavItemCommon
&
{
export
type
NavItemExternal
=
NavItemCommon
&
{
...
...
types/nextjs-routes.d.ts
View file @
ee02cfae
...
@@ -26,7 +26,6 @@ declare module "nextjs-routes" {
...
@@ -26,7 +26,6 @@ declare module "nextjs-routes" {
|
DynamicRoute
<
"
/block/[height]
"
,
{
"
height
"
:
string
}
>
|
DynamicRoute
<
"
/block/[height]
"
,
{
"
height
"
:
string
}
>
|
StaticRoute
<
"
/blocks
"
>
|
StaticRoute
<
"
/blocks
"
>
|
StaticRoute
<
"
/csv-export
"
>
|
StaticRoute
<
"
/csv-export
"
>
|
StaticRoute
<
"
/graph
"
>
|
StaticRoute
<
"
/graphiql
"
>
|
StaticRoute
<
"
/graphiql
"
>
|
StaticRoute
<
"
/
"
>
|
StaticRoute
<
"
/
"
>
|
StaticRoute
<
"
/l2-deposits
"
>
|
StaticRoute
<
"
/l2-deposits
"
>
...
...
ui/snippets/navigation/NavLink.tsx
View file @
ee02cfae
...
@@ -21,26 +21,18 @@ type Props = {
...
@@ -21,26 +21,18 @@ type Props = {
const
NavLink
=
({
item
,
isCollapsed
,
px
,
className
}:
Props
)
=>
{
const
NavLink
=
({
item
,
isCollapsed
,
px
,
className
}:
Props
)
=>
{
const
isMobile
=
useIsMobile
();
const
isMobile
=
useIsMobile
();
const
colors
=
useColors
();
const
colors
=
useColors
();
const
isExpanded
=
isCollapsed
===
false
;
const
styleProps
=
useNavLinkStyleProps
({
isCollapsed
,
isExpanded
,
isActive
:
isInternalItem
(
item
)
&&
item
.
isActive
});
const
isExpanded
=
isCollapsed
===
false
;
const
isInternalLink
=
isInternalItem
(
item
);
const
styleProps
=
useNavLinkStyleProps
({
isCollapsed
,
isExpanded
,
isActive
:
isInternalLink
&&
item
.
isActive
});
const
isXLScreen
=
useBreakpointValue
({
base
:
false
,
xl
:
true
});
const
isXLScreen
=
useBreakpointValue
({
base
:
false
,
xl
:
true
});
const
href
=
isInternalLink
?
route
(
item
.
nextRoute
)
:
item
.
url
;
let
href
:
string
|
undefined
;
const
isInternal
=
isInternalItem
(
item
);
if
(
isInternal
)
{
href
=
!
item
.
isNewUi
?
route
(
item
.
nextRoute
)
:
undefined
;
}
else
{
href
=
item
.
url
;
}
const
content
=
(
const
content
=
(
<
Link
<
Link
href=
{
href
}
href=
{
href
}
target=
{
isInternal
?
'
_self
'
:
'
_blank
'
}
target=
{
isInternal
Link
?
'
_self
'
:
'
_blank
'
}
{
...
styleProps
.
itemProps
}
{
...
styleProps
.
itemProps
}
w=
{
{
base
:
'
100%
'
,
lg
:
isExpanded
?
'
100%
'
:
'
60px
'
,
xl
:
isCollapsed
?
'
60px
'
:
'
100%
'
}
}
w=
{
{
base
:
'
100%
'
,
lg
:
isExpanded
?
'
100%
'
:
'
60px
'
,
xl
:
isCollapsed
?
'
60px
'
:
'
100%
'
}
}
display=
"flex"
display=
"flex"
...
@@ -55,7 +47,7 @@ const NavLink = ({ item, isCollapsed, px, className }: Props) => {
...
@@ -55,7 +47,7 @@ const NavLink = ({ item, isCollapsed, px, className }: Props) => {
placement=
"right"
placement=
"right"
variant=
"nav"
variant=
"nav"
gutter=
{
20
}
gutter=
{
20
}
color=
{
isInternal
Item
(
item
)
&&
item
.
isActive
?
colors
.
text
.
active
:
colors
.
text
.
hover
}
color=
{
isInternal
Link
&&
item
.
isActive
?
colors
.
text
.
active
:
colors
.
text
.
hover
}
>
>
<
HStack
spacing=
{
3
}
overflow=
"hidden"
>
<
HStack
spacing=
{
3
}
overflow=
"hidden"
>
{
item
.
icon
&&
<
Icon
as=
{
item
.
icon
}
boxSize=
"30px"
/>
}
{
item
.
icon
&&
<
Icon
as=
{
item
.
icon
}
boxSize=
"30px"
/>
}
...
@@ -69,9 +61,7 @@ const NavLink = ({ item, isCollapsed, px, className }: Props) => {
...
@@ -69,9 +61,7 @@ const NavLink = ({ item, isCollapsed, px, className }: Props) => {
return
(
return
(
<
Box
as=
"li"
listStyleType=
"none"
w=
"100%"
className=
{
className
}
>
<
Box
as=
"li"
listStyleType=
"none"
w=
"100%"
className=
{
className
}
>
{
/* why not NextLink in all cases? since prev UI and new one are hosting in the same domain and global routing is managed by nginx */
}
{
isInternalLink
?
(
{
/* we have to hard reload page on every transition between urls from different part of the app */
}
{
isInternalItem
(
item
)
&&
item
.
isNewUi
?
(
<
NextLink
href=
{
item
.
nextRoute
}
passHref
legacyBehavior
>
<
NextLink
href=
{
item
.
nextRoute
}
passHref
legacyBehavior
>
{
content
}
{
content
}
</
NextLink
>
</
NextLink
>
...
...
ui/snippets/networkMenu/types.ts
View file @
ee02cfae
...
@@ -4,5 +4,4 @@ export interface NetworkLink {
...
@@ -4,5 +4,4 @@ export interface NetworkLink {
pathname
:
string
;
pathname
:
string
;
name
:
string
;
name
:
string
;
icon
?:
FunctionComponent
<
SVGAttributes
<
SVGElement
>>
;
icon
?:
FunctionComponent
<
SVGAttributes
<
SVGElement
>>
;
isNewUi
?:
boolean
;
}
}
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