refactor(web): remove typescript
This commit is contained in:
@@ -4,42 +4,22 @@ import GroupsIcon from '@mui/icons-material/Groups';
|
||||
import LockIcon from '@mui/icons-material/LockPerson';
|
||||
import BrushIcon from '@mui/icons-material/Brush';
|
||||
import AppsIcon from '@mui/icons-material/Apps';
|
||||
|
||||
import Box from '@mui/material/Box';
|
||||
import Toolbar from '@mui/material/Toolbar';
|
||||
import { useTheme } from '@mui/material/styles';
|
||||
import useMediaQuery from '@mui/material/useMediaQuery';
|
||||
import * as React from 'react';
|
||||
|
||||
import { SvgIconComponent } from '@mui/icons-material';
|
||||
import AppBar from 'components/AppBar';
|
||||
import Drawer from 'components/Drawer';
|
||||
import * as URLS from 'config/urls';
|
||||
import useFormatMessage from 'hooks/useFormatMessage';
|
||||
import useCurrentUserAbility from 'hooks/useCurrentUserAbility';
|
||||
|
||||
type SettingsLayoutProps = {
|
||||
children: React.ReactNode;
|
||||
};
|
||||
|
||||
type DrawerLink = {
|
||||
Icon: SvgIconComponent;
|
||||
primary: string;
|
||||
to: string;
|
||||
};
|
||||
|
||||
function createDrawerLinks({
|
||||
canReadRole,
|
||||
canReadUser,
|
||||
canUpdateConfig,
|
||||
canManageSamlAuthProvider,
|
||||
canUpdateApp,
|
||||
}: {
|
||||
canReadRole: boolean;
|
||||
canReadUser: boolean;
|
||||
canUpdateConfig: boolean;
|
||||
canManageSamlAuthProvider: boolean;
|
||||
canUpdateApp: boolean;
|
||||
}) {
|
||||
const items = [
|
||||
canReadUser
|
||||
@@ -82,20 +62,15 @@ function createDrawerLinks({
|
||||
dataTest: 'apps-drawer-link',
|
||||
}
|
||||
: null,
|
||||
].filter(Boolean) as DrawerLink[];
|
||||
|
||||
].filter(Boolean);
|
||||
return items;
|
||||
}
|
||||
|
||||
export default function SettingsLayout({
|
||||
children,
|
||||
}: SettingsLayoutProps): React.ReactElement {
|
||||
export default function SettingsLayout({ children }) {
|
||||
const theme = useTheme();
|
||||
const formatMessage = useFormatMessage();
|
||||
const currentUserAbility = useCurrentUserAbility();
|
||||
const matchSmallScreens = useMediaQuery(theme.breakpoints.down('lg'));
|
||||
const [isDrawerOpen, setDrawerOpen] = React.useState(!matchSmallScreens);
|
||||
|
||||
const openDrawer = () => setDrawerOpen(true);
|
||||
const closeDrawer = () => setDrawerOpen(false);
|
||||
const drawerLinks = createDrawerLinks({
|
||||
@@ -108,7 +83,7 @@ export default function SettingsLayout({
|
||||
currentUserAbility.can('create', 'SamlAuthProvider'),
|
||||
canUpdateApp: currentUserAbility.can('update', 'App'),
|
||||
});
|
||||
|
||||
const a = 123;
|
||||
const drawerBottomLinks = [
|
||||
{
|
||||
Icon: ArrowBackIosNewIcon,
|
||||
@@ -117,7 +92,6 @@ export default function SettingsLayout({
|
||||
dataTest: 'go-back-drawer-link',
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<>
|
||||
<AppBar
|
Reference in New Issue
Block a user