1
1
import { GitHub } from '@mui/icons-material' ;
2
2
import { AppBar , Box , Button , Hidden , IconButton , Toolbar , Typography } from '@mui/material' ;
3
- import { NavLink , Route , Switch } from 'react-router-dom' ;
3
+ import { NavLink , Route , Switch , useLocation } from 'react-router-dom' ;
4
4
import useChainHeartbeats from '../hooks/useChainHeartbeats' ;
5
5
import useHeartbeats from '../hooks/useHeartbeats' ;
6
6
import useLatestRelease from '../hooks/useLatestRelease' ;
7
7
import WormholeStatsIcon from '../icons/WormholeStatsIcon' ;
8
8
import Alerts from './Alerts' ;
9
9
import Home from './Home' ;
10
10
import Metrics from './Metrics' ;
11
+ import NTTMetrics from './NTTMetrics' ;
11
12
import NetworkSelector from './NetworkSelector' ;
12
13
import Settings from './Settings' ;
13
14
@@ -17,6 +18,51 @@ function NavButton(props: any) {
17
18
return < Button { ...rest } /> ;
18
19
}
19
20
21
+ function NavLinks ( ) {
22
+ const { search } = useLocation ( ) ;
23
+ return (
24
+ < >
25
+ < NavLink
26
+ to = { `/${ search } ` }
27
+ exact
28
+ component = { NavButton }
29
+ color = "inherit"
30
+ activeStyle = { { borderBottom : '2px solid' , paddingBottom : 4 } }
31
+ style = { { marginLeft : - 8 , textTransform : 'none' , borderRadius : 0 , minWidth : 0 } }
32
+ >
33
+ < Box display = "flex" alignItems = "center" >
34
+ < WormholeStatsIcon />
35
+ </ Box >
36
+ < Hidden smDown >
37
+ < Typography variant = "h6" sx = { { pl : 0.75 } } >
38
+ Dashboard
39
+ </ Typography >
40
+ </ Hidden >
41
+ </ NavLink >
42
+ < NavLink
43
+ to = { `/metrics${ search } ` }
44
+ exact
45
+ component = { NavButton }
46
+ color = "inherit"
47
+ activeStyle = { { borderBottom : '2px solid' , paddingBottom : 4 } }
48
+ style = { { paddingRight : 8 , marginLeft : 8 , textTransform : 'none' , borderRadius : 0 } }
49
+ >
50
+ < Typography variant = "h6" > Metrics</ Typography >
51
+ </ NavLink >
52
+ < NavLink
53
+ to = { `/ntt-metrics${ search } ` }
54
+ exact
55
+ component = { NavButton }
56
+ color = "inherit"
57
+ activeStyle = { { borderBottom : '2px solid' , paddingBottom : 4 } }
58
+ style = { { paddingRight : 8 , marginLeft : 8 , textTransform : 'none' , borderRadius : 0 } }
59
+ >
60
+ < Typography variant = "h6" > NTT</ Typography >
61
+ </ NavLink >
62
+ </ >
63
+ ) ;
64
+ }
65
+
20
66
function Main ( ) {
21
67
const heartbeats = useHeartbeats ( ) ;
22
68
const chainIdsToHeartbeats = useChainHeartbeats ( heartbeats ) ;
@@ -25,33 +71,7 @@ function Main() {
25
71
< >
26
72
< AppBar position = "static" >
27
73
< Toolbar variant = "dense" >
28
- < NavLink
29
- to = "/"
30
- exact
31
- component = { NavButton }
32
- color = "inherit"
33
- activeStyle = { { borderBottom : '2px solid' , paddingBottom : 4 } }
34
- style = { { marginLeft : - 8 , textTransform : 'none' , borderRadius : 0 , minWidth : 0 } }
35
- >
36
- < Box display = "flex" alignItems = "center" >
37
- < WormholeStatsIcon />
38
- </ Box >
39
- < Hidden smDown >
40
- < Typography variant = "h6" sx = { { pl : 0.75 } } >
41
- Dashboard
42
- </ Typography >
43
- </ Hidden >
44
- </ NavLink >
45
- < NavLink
46
- to = "/metrics"
47
- exact
48
- component = { NavButton }
49
- color = "inherit"
50
- activeStyle = { { borderBottom : '2px solid' , paddingBottom : 4 } }
51
- style = { { paddingRight : 8 , marginLeft : 8 , textTransform : 'none' , borderRadius : 0 } }
52
- >
53
- < Typography variant = "h6" > Metrics</ Typography >
54
- </ NavLink >
74
+ < NavLinks />
55
75
< Box flexGrow = { 1 } />
56
76
< Hidden smDown >
57
77
< Alerts
@@ -74,6 +94,9 @@ function Main() {
74
94
</ Toolbar >
75
95
</ AppBar >
76
96
< Switch >
97
+ < Route path = "/ntt-metrics" >
98
+ < NTTMetrics />
99
+ </ Route >
77
100
< Route path = "/metrics" >
78
101
< Metrics />
79
102
</ Route >
0 commit comments