fix(breadcrumb): remove manage validator path

This commit is contained in:
RadoslavDimchev 2024-04-26 20:35:12 +03:00 committed by Emil Ivanichkov
parent 16f9280354
commit a809c8af9c

View File

@ -1,81 +1,42 @@
import { NavLink } from 'react-router-dom'
import { XStack } from 'tamagui'
import useBreadcrumbs, { BreadcrumbsRoute } from 'use-react-router-breadcrumbs'
import { NavLink } from 'react-router-dom'
import BreadcrumbElement from './BreadcrumbElement'
import {
MANAGE_VALIDATOR_SUB_PATHS,
PATHS,
VALIDATOR_ONBOARDING_SUB_PATHS,
MANAGE_VALIDATOR_SUB_PATHS,
} from '../../../constants'
const CustomPropsBreadcrumb = ({ someProp }: any) => <span>{someProp}</span>
const routes = [
{
path: PATHS.LANDING,
},
{
path: PATHS.DEVICE_HEALTH_CHECK_ONBOARDING,
},
{
path: PATHS.DEVICE_HEALTH_CHECK,
},
{
path: PATHS.DEVICE_SYNC_STATUS,
},
{
path: PATHS.PAIR_DEVICE,
},
{ path: PATHS.LANDING },
{ path: PATHS.DEVICE_HEALTH_CHECK_ONBOARDING },
{ path: PATHS.DEVICE_HEALTH_CHECK },
{ path: PATHS.DEVICE_SYNC_STATUS },
{ path: PATHS.PAIR_DEVICE },
{ path: PATHS.CREATE_LOCAL_NODE },
{
path: PATHS.VALIDATOR_ONBOARDING,
children: [
{ path: VALIDATOR_ONBOARDING_SUB_PATHS.OVERVIEW },
{
path: VALIDATOR_ONBOARDING_SUB_PATHS.ADVISORIES,
},
{
path: VALIDATOR_ONBOARDING_SUB_PATHS.VALIDATOR_SETUP,
},
{
path: VALIDATOR_ONBOARDING_SUB_PATHS.VALIDATOR_SETUP_INSTALL,
},
{
path: VALIDATOR_ONBOARDING_SUB_PATHS.CONSENSUS_SELECTION,
},
{
path: VALIDATOR_ONBOARDING_SUB_PATHS.ACTIVATION_VALIDATOR_SETUP,
},
{
path: VALIDATOR_ONBOARDING_SUB_PATHS.CLIENT_SETUP,
},
{
path: VALIDATOR_ONBOARDING_SUB_PATHS.KEY_GENERATION,
},
{
path: VALIDATOR_ONBOARDING_SUB_PATHS.RECOVERY_PHRASE,
},
{ path: VALIDATOR_ONBOARDING_SUB_PATHS.ADVISORIES },
{ path: VALIDATOR_ONBOARDING_SUB_PATHS.VALIDATOR_SETUP },
{ path: VALIDATOR_ONBOARDING_SUB_PATHS.VALIDATOR_SETUP_INSTALL },
{ path: VALIDATOR_ONBOARDING_SUB_PATHS.CONSENSUS_SELECTION },
{ path: VALIDATOR_ONBOARDING_SUB_PATHS.ACTIVATION_VALIDATOR_SETUP },
{ path: VALIDATOR_ONBOARDING_SUB_PATHS.CLIENT_SETUP },
{ path: VALIDATOR_ONBOARDING_SUB_PATHS.KEY_GENERATION },
{ path: VALIDATOR_ONBOARDING_SUB_PATHS.RECOVERY_PHRASE },
{ path: VALIDATOR_ONBOARDING_SUB_PATHS.DEPOSIT },
{
path: VALIDATOR_ONBOARDING_SUB_PATHS.ACTIVATION,
},
{ path: VALIDATOR_ONBOARDING_SUB_PATHS.ACTIVATION },
],
},
{ path: PATHS.DASHBOARD },
{ path: PATHS.LOGS },
{
path: PATHS.VALIDATOR_MANAGEMENT,
},
{ path: PATHS.VALIDATOR_MANAGEMENT },
{
path: `${PATHS.MANAGE_VALIDATOR}/:validatorName`,
props: { someProp: ''},
breadcrumb: CustomPropsBreadcrumb,
children: [
{
path: MANAGE_VALIDATOR_SUB_PATHS.DEFAULT,
breadcrumb: 'DynamicValidatorBreadcrumb 2',
},
{ path: MANAGE_VALIDATOR_SUB_PATHS.DEFAULT },
{ path: MANAGE_VALIDATOR_SUB_PATHS.EXIT },
{ path: MANAGE_VALIDATOR_SUB_PATHS.MIGRATE },
{ path: MANAGE_VALIDATOR_SUB_PATHS.DEPOSIT },
@ -88,11 +49,17 @@ const Breadcrumb = () => {
return (
<XStack space={'$2'} alignItems="center">
{breadcrumbs.map(({ match, breadcrumb }) => (
<NavLink key={match.pathname} to={match.pathname}>
{breadcrumb}
</NavLink>
))}
{breadcrumbs.map(({ match, breadcrumb }) => {
if (match.pathname === `${PATHS.MANAGE_VALIDATOR}`) {
return
}
return (
<NavLink key={match.pathname} to={match.pathname}>
{breadcrumb}
</NavLink>
)
})}
</XStack>
)
}