1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-04-15 01:16:22 +02:00

Update menu for billing page ()

## About the changes

- [x] Show admin menu on billing page in cloud offering. Category menu
was not showing up because we have 2 different pages for billing (hosted
or not)
  - [x] Fix menu tab padding
 
https://linear.app/unleash/issue/1-1266/update-menu-for-billing-page
This commit is contained in:
Tymoteusz Czech 2023-08-18 10:40:35 +02:00 committed by GitHub
parent 26e7267c5e
commit 208ca05933
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 35 additions and 39 deletions

View File

@ -90,7 +90,7 @@ export const adminRoutes: INavigationMenuItem[] = [
{ {
path: '/admin/admin-invoices', path: '/admin/admin-invoices',
title: 'Billing & invoices', title: 'Billing & invoices',
menu: { adminSettings: true, mode: ['pro'], billing: true }, menu: { adminSettings: true, billing: true },
group: 'instance', group: 'instance',
}, },
{ {

View File

@ -115,7 +115,9 @@ const InvoiceList = () => {
</div> </div>
</PageContent> </PageContent>
} }
elseShow={<div>{isLoaded && 'No invoices to show.'}</div>} elseShow={
<PageContent>{isLoaded && 'No invoices to show.'}</PageContent>
}
/> />
); );
}; };

View File

@ -55,6 +55,7 @@ export const AdminTabsMenu: VFC = () => {
> >
{tabs.map(tab => ( {tabs.map(tab => (
<Tab <Tab
sx={{ padding: 0 }}
key={tab.route} key={tab.route}
value={tab.route?.split('/')?.[2]} value={tab.route?.split('/')?.[2]}
label={ label={

View File

@ -1,41 +1,21 @@
import { Theme } from '@mui/material'; import { styled } from '@mui/material';
import React, { FC } from 'react'; import { FC } from 'react';
import { NavLink } from 'react-router-dom'; import { NavLink } from 'react-router-dom';
import { useTheme } from '@mui/material/styles';
const createNavLinkStyle = (props: { const StyledNavLink = styled(NavLink)(({ theme }) => ({
isActive: boolean;
theme: Theme;
}): React.CSSProperties => {
const navLinkStyle = {
display: 'flex', display: 'flex',
justifyContent: 'center', justifyContent: 'center',
alignItems: 'center', alignItems: 'center',
width: '100%', width: '100%',
height: '100%',
textDecoration: 'none', textDecoration: 'none',
color: 'inherit', color: 'inherit',
padding: props.theme.spacing(1.5, 3), padding: theme.spacing(0, 5),
}; '&.active': {
const activeNavLinkStyle: React.CSSProperties = {
fontWeight: 'bold', fontWeight: 'bold',
borderRadius: '3px', },
padding: props.theme.spacing(1.5, 3), }));
};
return props.isActive
? { ...navLinkStyle, ...activeNavLinkStyle }
: navLinkStyle;
};
export const CenteredNavLink: FC<{ to: string }> = ({ to, children }) => { export const CenteredNavLink: FC<{ to: string }> = ({ to, children }) => {
const theme = useTheme(); return <StyledNavLink to={to}>{children}</StyledNavLink>;
return (
<NavLink
to={to}
style={({ isActive }) => createNavLinkStyle({ isActive, theme })}
>
{children}
</NavLink>
);
}; };

View File

@ -43,6 +43,7 @@ export const Network = () => {
<span>{label}</span> <span>{label}</span>
</CenteredNavLink> </CenteredNavLink>
} }
sx={{ padding: 0 }}
/> />
))} ))}
</Tabs> </Tabs>

View File

@ -97,6 +97,7 @@ export const RolesPage = () => {
</span> </span>
</CenteredNavLink> </CenteredNavLink>
} }
sx={{ padding: 0 }}
/> />
))} ))}
</Tabs> </Tabs>

View File

@ -10,8 +10,19 @@ export const useAdminRoutes = () => {
const showEnterpriseOptionsInPro = Boolean( const showEnterpriseOptionsInPro = Boolean(
uiConfig?.flags?.frontendNavigationUpdate uiConfig?.flags?.frontendNavigationUpdate
); );
const routes = [...adminRoutes];
return adminRoutes if (uiConfig.flags.UNLEASH_CLOUD) {
const adminBillingMenuItem = adminRoutes.findIndex(
route => route.title === 'Billing & invoices'
);
routes[adminBillingMenuItem] = {
...routes[adminBillingMenuItem],
path: '/admin/billing',
};
}
return routes
.filter(filterByConfig(uiConfig)) .filter(filterByConfig(uiConfig))
.filter(route => .filter(route =>
filterAdminRoutes( filterAdminRoutes(

View File

@ -98,9 +98,9 @@ export const NavigationMenu = ({
} }
arrow arrow
placement="left" placement="left"
key={option.path}
> >
<MenuItem <MenuItem
key={option.path}
component={StyledLink} component={StyledLink}
to={option.path} to={option.path}
onClick={handleClose} onClick={handleClose}