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
686a6354
Commit
686a6354
authored
Feb 20, 2023
by
isstuev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add menu item and fix url
parent
946c9b44
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
5 deletions
+29
-5
.env.poa_core
configs/envs/.env.poa_core
+0
-1
useNavItems.tsx
lib/hooks/useNavItems.tsx
+16
-3
SwaggerUI.tsx
ui/SwaggerUI.tsx
+13
-1
No files found.
configs/envs/.env.poa_core
View file @
686a6354
...
...
@@ -7,7 +7,6 @@ NEXT_PUBLIC_HOMEPAGE_CHARTS=['daily_txs','coin_price','market_cup']
NEXT_PUBLIC_HOMEPAGE_PLATE_GRADIENT=radial-gradient(at 12% 37%, hsla(324,73%,67%,1) 0px, transparent 50%), radial-gradient(at 62% 14%, hsla(256,87%,73%,1) 0px, transparent 50%), radial-gradient(at 84% 80%, hsla(128,75%,73%,1) 0px, transparent 50%), radial-gradient(at 57% 46%, hsla(285,63%,72%,1) 0px, transparent 50%), radial-gradient(at 37% 30%, hsla(174,70%,61%,1) 0px, transparent 50%), radial-gradient(at 15% 86%, hsla(350,65%,70%,1) 0px, transparent 50%), radial-gradient(at 67% 57%, hsla(14,95%,76%,1) 0px, transparent 50%)
#NEXT_PUBLIC_NETWORK_LOGO=https://placekitten.com/300/60
#NEXT_PUBLIC_NETWORK_SMALL_LOGO=https://placekitten.com/300/300
NEXT_PUBLIC_API_SPEC_URL=https://raw.githubusercontent.com/blockscout/blockscout-api-v2-swagger/main/swagger.yaml
# network config
NEXT_PUBLIC_NETWORK_NAME=POA
...
...
lib/hooks/useNavItems.tsx
View file @
686a6354
...
...
@@ -7,8 +7,8 @@ import abiIcon from 'icons/ABI.svg';
import
apiKeysIcon
from
'
icons/API.svg
'
;
import
appsIcon
from
'
icons/apps.svg
'
;
import
blocksIcon
from
'
icons/block.svg
'
;
import
gearIcon
from
'
icons/gear.svg
'
;
import
globeIcon
from
'
icons/globe-b.svg
'
;
// import gearIcon from 'icons/gear.svg';
import
privateTagIcon
from
'
icons/privattags.svg
'
;
import
profileIcon
from
'
icons/profile.svg
'
;
import
publicTagIcon
from
'
icons/publictags.svg
'
;
...
...
@@ -44,6 +44,7 @@ export function isGroupItem(item: NavItem | NavGroupItem): item is NavGroupItem
export
default
function
useNavItems
():
ReturnType
{
const
isMarketplaceFilled
=
appConfig
.
marketplaceAppList
.
length
>
0
&&
appConfig
.
network
.
rpcUrl
;
const
hasAPIDocs
=
appConfig
.
apiDoc
.
specUrl
;
const
router
=
useRouter
();
const
pathname
=
router
.
pathname
;
...
...
@@ -57,6 +58,17 @@ export default function useNavItems(): ReturnType {
// { text: 'Verified contracts', nextRoute: { pathname: '/verified_contracts' as const }, icon: verifiedIcon, isActive: pathname === '/verified_contracts', isNewUi: false },
];
const
otherNavItems
:
Array
<
NavItem
>
=
[
hasAPIDocs
?
{
text
:
'
API documentation
'
,
nextRoute
:
{
pathname
:
'
/api-docs
'
as
const
},
// FIXME: need icon for this item
icon
:
topAccountsIcon
,
isActive
:
pathname
===
'
/api-docs
'
,
isNewUi
:
true
,
}
:
null
,
].
filter
(
notEmpty
);
const
mainNavItems
=
[
{
text
:
'
Blockchain
'
,
...
...
@@ -72,7 +84,8 @@ export default function useNavItems(): ReturnType {
// there should be custom site sections like Stats, Faucet, More, etc but never an 'other'
// examples https://explorer-edgenet.polygon.technology/ and https://explorer.celo.org/
// at this stage custom menu items is under development, we will implement it later
// { text: 'Other', url: link('other'), icon: gearIcon, isActive: pathname === 'other' },
otherNavItems
.
length
>
0
?
{
text
:
'
Other
'
,
icon
:
gearIcon
,
isActive
:
otherNavItems
.
some
(
item
=>
item
.
isActive
),
subItems
:
otherNavItems
}
:
null
,
].
filter
(
notEmpty
);
const
accountNavItems
=
[
...
...
@@ -109,5 +122,5 @@ export default function useNavItems(): ReturnType {
text
:
'
My profile
'
,
nextRoute
:
{
pathname
:
'
/auth/profile
'
as
const
},
icon
:
profileIcon
,
isActive
:
pathname
===
'
/auth/profile
'
,
isNewUi
:
true
};
return
{
mainNavItems
,
accountNavItems
,
profileItem
};
},
[
isMarketplaceFilled
,
pathname
]);
},
[
hasAPIDocs
,
isMarketplaceFilled
,
pathname
]);
}
ui/SwaggerUI.tsx
View file @
686a6354
...
...
@@ -12,6 +12,8 @@ import appConfig from 'configs/app/config';
import
'
swagger-ui-react/swagger-ui.css
'
;
const
DEFAULT_SERVER
=
'
blockscout.com/poa/core
'
;
const
NeverShowInfoPlugin
=
()
=>
{
return
{
components
:
{
...
...
@@ -47,7 +49,17 @@ const SwaggerUI = () => {
return
(
<
Box
sx=
{
swaggerStyle
}
>
<
SwaggerUIReact
url=
{
appConfig
.
apiDoc
.
specUrl
}
plugins=
{
[
NeverShowInfoPlugin
]
}
/>
<
SwaggerUIReact
url=
{
appConfig
.
apiDoc
.
specUrl
}
plugins=
{
[
NeverShowInfoPlugin
]
}
// eslint-disable-next-line react/jsx-no-bind
requestInterceptor=
{
(
req
)
=>
{
if
(
!
req
.
loadSpec
)
{
req
.
url
=
req
.
url
.
replace
(
DEFAULT_SERVER
,
appConfig
.
api
.
host
);
}
return
req
;
}
}
/>
</
Box
>
);
};
...
...
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