|
1 | | -import { recordEntries } from '@curvefi/prices-api/objects.util' |
2 | 1 | import Box from '@mui/material/Box' |
3 | 2 | import Button from '@mui/material/Button' |
4 | | -import { useAnalyticsApp } from '@ui-kit/hooks/useFeatureFlags' |
5 | | -import { APP_LINK, type AppMenuOption, getInternalUrl } from '@ui-kit/shared/routes' |
| 3 | +import { type AppMenuOption, getInternalUrl } from '@ui-kit/shared/routes' |
6 | 4 | import { RouterLink } from '@ui-kit/shared/ui/RouterLink' |
| 5 | +import { useVisibleAppLinks } from './useVisibleAppLinks' |
7 | 6 |
|
8 | 7 | type AppNavAppsProps = { currentMenu: AppMenuOption; onChange: (appName: AppMenuOption) => void; networkId: string } |
9 | 8 |
|
10 | | -export const AppButtonLinks = ({ currentMenu, onChange, networkId }: AppNavAppsProps) => { |
11 | | - const showAnalytics = useAnalyticsApp() |
12 | | - const apps = recordEntries(APP_LINK).filter(([app]) => app !== 'analytics' || showAnalytics) |
13 | | - |
14 | | - return ( |
15 | | - <Box display="flex" alignItems="center" marginX={[2, 3, 4]} gap={2}> |
16 | | - {apps.map(([menu, { label, routes }]) => ( |
17 | | - <Button |
18 | | - key={menu} |
19 | | - color="navigation" |
20 | | - size="small" |
21 | | - className={currentMenu === menu ? 'current' : ''} |
22 | | - component={RouterLink} |
23 | | - onClick={() => onChange(menu as AppMenuOption)} |
24 | | - href={getInternalUrl(routes[0].app, networkId)} |
25 | | - data-testid={`app-link-${menu}`} |
26 | | - > |
27 | | - {label} |
28 | | - </Button> |
29 | | - ))} |
30 | | - </Box> |
31 | | - ) |
32 | | -} |
| 9 | +export const AppButtonLinks = ({ currentMenu, onChange, networkId }: AppNavAppsProps) => ( |
| 10 | + <Box display="flex" alignItems="center" marginX={[2, 3, 4]} gap={2}> |
| 11 | + {useVisibleAppLinks().map(([menu, { label, routes }]) => ( |
| 12 | + <Button |
| 13 | + key={menu} |
| 14 | + color="navigation" |
| 15 | + size="small" |
| 16 | + className={currentMenu === menu ? 'current' : ''} |
| 17 | + component={RouterLink} |
| 18 | + onClick={() => onChange(menu as AppMenuOption)} |
| 19 | + href={getInternalUrl(routes[0].app, networkId)} |
| 20 | + data-testid={`app-link-${menu}`} |
| 21 | + > |
| 22 | + {label} |
| 23 | + </Button> |
| 24 | + ))} |
| 25 | + </Box> |
| 26 | +) |
0 commit comments