Skip to content

Commit 338c72c

Browse files
committed
feat(SideNav): add hideOnMobile property to NavItem and filter nav items based on mobile view
1 parent 072ccea commit 338c72c

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

web/src/layout/SideNav.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,10 @@ const SideNav = memo(function SideNav({
5959
return navGroups
6060
.map((group) => ({
6161
...group,
62-
children: group.children.filter((item) => !item.adminOnly || isAdmin),
62+
children: group.children.filter((item) => (!item.adminOnly || isAdmin) && !(mobile && item.hideOnMobile)),
6363
}))
6464
.filter((group) => group.children.length > 0);
65-
}, [user]);
65+
}, [mobile, user]);
6666

6767
useEffect(() => {
6868
getLatestVersion().then((resp) => {

web/src/layout/nav.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {
1515
} from '@ant-design/icons';
1616
import type { ReactNode } from 'react';
1717

18-
export interface NavItem { key: string; icon: ReactNode; label: string; adminOnly?: boolean; }
18+
export interface NavItem { key: string; icon: ReactNode; label: string; adminOnly?: boolean; hideOnMobile?: boolean; }
1919
export interface NavGroup { key: string; title?: string; children: NavItem[]; }
2020

2121
export const navGroups: NavGroup[] = [
@@ -30,7 +30,7 @@ export const navGroups: NavGroup[] = [
3030
key: 'manage',
3131
title: 'Manage',
3232
children: [
33-
{ key: 'processors', icon: React.createElement(CodeOutlined), label: 'Processors' },
33+
{ key: 'processors', icon: React.createElement(CodeOutlined), label: 'Processors', hideOnMobile: true },
3434
{ key: 'tasks', icon: React.createElement(RobotOutlined), label: 'Automation' },
3535
{ key: 'task-queue', icon: React.createElement(ClockCircleOutlined), label: 'Task Queue' },
3636
{ key: 'share', icon: React.createElement(ShareAltOutlined), label: 'My Shares' },
@@ -45,7 +45,7 @@ export const navGroups: NavGroup[] = [
4545
children: [
4646
{ key: 'users', icon: React.createElement(UserOutlined), label: 'User Management', adminOnly: true },
4747
{ key: 'settings', icon: React.createElement(SettingOutlined), label: 'System Settings', adminOnly: true },
48-
{ key: 'backup', icon: React.createElement(DatabaseOutlined), label: 'Backup & Restore' },
48+
{ key: 'backup', icon: React.createElement(DatabaseOutlined), label: 'Backup & Restore', hideOnMobile: true },
4949
{ key: 'audit', icon: React.createElement(BugOutlined), label: 'Audit Logs' }
5050
]
5151
}

0 commit comments

Comments
 (0)