The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/apps/meteor/client/views/account/AccountSidebar.tsx

34 lines
1.2 KiB

import { useRoutePath, useCurrentRoute, useTranslation, useLayout } from '@rocket.chat/ui-contexts';
import type { FC } from 'react';
import React, { memo } from 'react';
import { useSyncExternalStore } from 'use-sync-external-store/shim';
import Sidebar from '../../components/Sidebar';
import SettingsProvider from '../../providers/SettingsProvider';
import { getAccountSidebarItems, subscribeToAccountSidebarItems } from './sidebarItems';
const AccountSidebar: FC = () => {
const t = useTranslation();
const items = useSyncExternalStore(subscribeToAccountSidebarItems, getAccountSidebarItems);
const { sidebar } = useLayout();
const currentRoute = useCurrentRoute();
const [currentRouteName, currentRouteParams, currentQueryStringParams] = currentRoute;
const currentPath = useRoutePath(currentRouteName || '', currentRouteParams, currentQueryStringParams);
// TODO: uplift this provider
return (
<SettingsProvider privileged>
<Sidebar>
<Sidebar.Header onClose={sidebar.close} title={t('Account')} />
<Sidebar.Content>
<Sidebar.ItemsAssembler items={items} currentPath={currentPath} />
</Sidebar.Content>
</Sidebar>
</SettingsProvider>
);
};
export default memo(AccountSidebar);