mirror of
https://github.com/luxfi/explore.git
synced 2026-09-24 00:28:18 +00:00
* update routing * debug routing * debug profile page * add app protocol * prefix nextjs api path * remove debug * debug routing * debug deploy * debug routing * fix after merge * delete port and protocol * hard reload page for nav links * fix logo * add marketplace to sokol * debug values for review * add login link * seamless page transition inside new ui app * logout link * debug values for review * add redirect from profile to auth * static assets * debug review workflow * update values for all envs Co-authored-by: Yuliya Sharafitdinova <[email protected]> Co-authored-by: tom <[email protected]>
50 lines
2.7 KiB
TypeScript
50 lines
2.7 KiB
TypeScript
import React from 'react';
|
|
|
|
import appConfig from 'configs/app/config';
|
|
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 privateTagIcon from 'icons/privattags.svg';
|
|
import profileIcon from 'icons/profile.svg';
|
|
import publicTagIcon from 'icons/publictags.svg';
|
|
import tokensIcon from 'icons/token.svg';
|
|
import transactionsIcon from 'icons/transactions.svg';
|
|
import watchlistIcon from 'icons/watchlist.svg';
|
|
import link from 'lib/link/link';
|
|
import useCurrentRoute from 'lib/link/useCurrentRoute';
|
|
import notEmpty from 'lib/notEmpty';
|
|
|
|
export default function useNavItems() {
|
|
const isMarketplaceFilled = appConfig.marketplaceAppList.length > 0;
|
|
|
|
const currentRoute = useCurrentRoute()();
|
|
|
|
return React.useMemo(() => {
|
|
const mainNavItems = [
|
|
{ text: 'Blocks', url: link('blocks'), icon: blocksIcon, isActive: currentRoute.startsWith('block'), isNewUi: false },
|
|
{ text: 'Transactions', url: link('txs'), icon: transactionsIcon, isActive: currentRoute.startsWith('tx'), isNewUi: false },
|
|
{ text: 'Tokens', url: link('tokens'), icon: tokensIcon, isActive: currentRoute === 'tokens', isNewUi: false },
|
|
isMarketplaceFilled ?
|
|
{ text: 'Apps', url: link('apps'), icon: appsIcon, isActive: currentRoute === 'apps', isNewUi: true } : null,
|
|
// 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: currentRoute === 'other' },
|
|
].filter(notEmpty);
|
|
|
|
const accountNavItems = [
|
|
{ text: 'Watchlist', url: link('watchlist'), icon: watchlistIcon, isActive: currentRoute === 'watchlist', isNewUi: true },
|
|
{ text: 'Private tags', url: link('private_tags'), icon: privateTagIcon, isActive: currentRoute.startsWith('private_tags'), isNewUi: true },
|
|
{ text: 'Public tags', url: link('public_tags'), icon: publicTagIcon, isActive: currentRoute === 'public_tags', isNewUi: true },
|
|
{ text: 'API keys', url: link('api_keys'), icon: apiKeysIcon, isActive: currentRoute === 'api_keys', isNewUi: true },
|
|
{ text: 'Custom ABI', url: link('custom_abi'), icon: abiIcon, isActive: currentRoute === 'custom_abi', isNewUi: true },
|
|
];
|
|
|
|
const profileItem = { text: 'My profile', url: link('profile'), icon: profileIcon, isActive: currentRoute === 'profile', isNewUi: true };
|
|
|
|
return { mainNavItems, accountNavItems, profileItem };
|
|
}, [ isMarketplaceFilled, currentRoute ]);
|
|
}
|