Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions client/admin/sidebar/AdminSidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { useReactiveValue } from '../../hooks/useReactiveValue';
import { useSettings } from '../../contexts/SettingsContext';
import { useTranslation } from '../../contexts/TranslationContext';
import { useRoutePath, useCurrentRoute } from '../../contexts/RouterContext';
import { useAbsoluteUrl } from '../../contexts/ServerContext';
import { useAtLeastOnePermission } from '../../contexts/AuthorizationContext';
import SettingsProvider from '../../providers/SettingsProvider';
import { sidebarItems } from '../sidebarItems';
Expand Down Expand Up @@ -175,12 +176,14 @@ export default React.memo(function AdminSidebar() {

const currentRoute = useCurrentRoute();
const currentPath = useRoutePath(...currentRoute);
const absoluteUrl = useAbsoluteUrl();

useEffect(() => {
if (!currentPath.startsWith('/admin/')) {
const { pathname: adminPath } = new URL(absoluteUrl('admin/'));
if (!currentPath.startsWith(adminPath)) {
SideNav.closeFlex();
}
}, [currentRoute, currentPath]);
}, [absoluteUrl, currentPath]);

// TODO: uplift this provider
return <SettingsProvider privileged>
Expand Down