Skip to content

Commit 05e2e58

Browse files
committed
fix(ui): remove pro labels from sidebar
1 parent 1104588 commit 05e2e58

2 files changed

Lines changed: 25 additions & 5 deletions

File tree

ui/src/__tests__/menu.test.tsx

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -511,4 +511,27 @@ describe('sidebar menu', () => {
511511
expect(screen.getByRole('link', { name: /memory/i })).toBeVisible();
512512
expect(screen.getByRole('link', { name: /souls/i })).toBeVisible();
513513
});
514+
515+
it('does not append Pro labels to unavailable sidebar features', () => {
516+
useHasFeatureMock.mockReturnValue(false);
517+
518+
renderMenu();
519+
520+
fireEvent.click(
521+
screen.getByRole('button', { name: 'Toggle Monitor section' })
522+
);
523+
expect(screen.getByRole('link', { name: 'Audit Logs' })).toBeVisible();
524+
expect(
525+
screen.queryByRole('link', { name: 'Audit Logs (Pro)' })
526+
).not.toBeInTheDocument();
527+
528+
fireEvent.click(
529+
screen.getByRole('button', { name: 'Toggle Administration section' })
530+
);
531+
fireEvent.click(screen.getByRole('button', { name: 'Access section' }));
532+
expect(screen.getByRole('link', { name: 'Users' })).toBeVisible();
533+
expect(
534+
screen.queryByRole('link', { name: 'Users (Pro)' })
535+
).not.toBeInTheDocument();
536+
});
514537
});

ui/src/menu.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import {
1616
useIsAdmin,
1717
} from '@/contexts/AuthContext';
1818
import { useConfig } from '@/contexts/ConfigContext';
19-
import { useHasFeature } from '@/hooks/useLicense';
2019
import { cn } from '@/lib/utils';
2120
import { getResponsiveTitleClass } from '@/lib/text-utils';
2221
import { roleAtLeast } from '@/lib/workspaceAccess';
@@ -462,8 +461,6 @@ export const mainListItems = React.forwardRef<
462461
const config = useConfig();
463462
const isAdmin = useIsAdmin();
464463
const { user } = useAuth();
465-
const hasRbac = useHasFeature('rbac');
466-
const hasAudit = useHasFeature('audit');
467464
const canWrite =
468465
config.authMode !== 'builtin'
469466
? config.permissions.writeDags
@@ -732,7 +729,7 @@ export const mainListItems = React.forwardRef<
732729
{canViewAuditLogs && (
733730
<NavItem
734731
to="/audit-logs"
735-
text={hasAudit ? 'Audit Logs' : 'Audit Logs (Pro)'}
732+
text="Audit Logs"
736733
isOpen={isOpen}
737734
onClick={onNavItemClick}
738735
customColor={customColor}
@@ -879,7 +876,7 @@ export const mainListItems = React.forwardRef<
879876
>
880877
<NavItem
881878
to="/users"
882-
text={hasRbac ? 'Users' : 'Users (Pro)'}
879+
text="Users"
883880
isOpen={isOpen}
884881
onClick={onNavItemClick}
885882
customColor={customColor}

0 commit comments

Comments
 (0)