Skip to content
Snippets Groups Projects
Unverified Commit c1ccd0ef authored by Jean Brito's avatar Jean Brito Committed by GitHub
Browse files

Chore: Convert AdminSideBar to ts (#25372)

parent 5f2efe69
No related branches found
No related tags found
No related merge requests found
...@@ -27,7 +27,7 @@ export const SideNav = new (class extends Emitter<{ ...@@ -27,7 +27,7 @@ export const SideNav = new (class extends Emitter<{
private flexNav: JQuery<HTMLElement>; private flexNav: JQuery<HTMLElement>;
toggleFlex(status: 1 | -1, callback: () => void): void { toggleFlex(status: 1 | -1, callback?: () => void): void {
if (this.animating === true) { if (this.animating === true) {
return; return;
} }
......
import React, { useCallback, useMemo, useEffect, memo } from 'react'; import React, { useCallback, useMemo, useEffect, memo, FC } from 'react';
import { menu, SideNav } from '../../../../app/ui-utils/client'; import { menu, SideNav } from '../../../../app/ui-utils/client';
import PlanTag from '../../../components/PlanTag'; import PlanTag from '../../../components/PlanTag';
...@@ -11,7 +11,7 @@ import SettingsProvider from '../../../providers/SettingsProvider'; ...@@ -11,7 +11,7 @@ import SettingsProvider from '../../../providers/SettingsProvider';
import AdminSidebarPages from './AdminSidebarPages'; import AdminSidebarPages from './AdminSidebarPages';
import AdminSidebarSettings from './AdminSidebarSettings'; import AdminSidebarSettings from './AdminSidebarSettings';
function AdminSidebar() { const AdminSidebar: FC = () => {
const t = useTranslation(); const t = useTranslation();
const canViewSettings = useAtLeastOnePermission( const canViewSettings = useAtLeastOnePermission(
...@@ -28,7 +28,8 @@ function AdminSidebar() { ...@@ -28,7 +28,8 @@ function AdminSidebar() {
}, []); }, []);
const currentRoute = useCurrentRoute(); const currentRoute = useCurrentRoute();
const currentPath = useRoutePath(...currentRoute); const [currentRouteName, currentRouteParams, currentQueryStringParams] = currentRoute;
const currentPath = useRoutePath(currentRouteName || '', currentRouteParams, currentQueryStringParams);
const [, , , currentRouteGroupName] = currentRoute; const [, , , currentRouteGroupName] = currentRoute;
useEffect(() => { useEffect(() => {
...@@ -50,12 +51,12 @@ function AdminSidebar() { ...@@ -50,12 +51,12 @@ function AdminSidebar() {
} }
/> />
<Sidebar.Content> <Sidebar.Content>
<AdminSidebarPages currentPath={currentPath} /> <AdminSidebarPages currentPath={currentPath || ''} />
{canViewSettings && <AdminSidebarSettings currentPath={currentPath} />} {canViewSettings && <AdminSidebarSettings currentPath={currentPath || ''} />}
</Sidebar.Content> </Sidebar.Content>
</Sidebar> </Sidebar>
</SettingsProvider> </SettingsProvider>
); );
} };
export default memo(AdminSidebar); export default memo(AdminSidebar);
import { Box } from '@rocket.chat/fuselage'; import { Box } from '@rocket.chat/fuselage';
import React from 'react'; import React, { FC } from 'react';
const Field = ({ children }) => <Box mb='x16'>{children}</Box>; const Field: FC = ({ children }) => <Box mb='x16'>{children}</Box>;
export default Field; export default Field;
import { Box } from '@rocket.chat/fuselage';
import React from 'react';
const Label = (props) => <Box mbe='x8' fontScale='p2m' color='default' {...props} />;
export default Label;
import { Box } from '@rocket.chat/fuselage';
import React, { ComponentProps, FC } from 'react';
const Label: FC<ComponentProps<typeof Box>> = (props) => <Box mbe='x8' fontScale='p2m' color='default' {...props} />;
export default Label;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment