fix(#112): remove dead admin breadcrumb code, add logout aria-label
Review feedback: breadcrumb memo had an unused isAdminPage branch (TopBar no longer renders on admin pages). Added aria-label to icon-only logout button for screen readers. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -203,23 +203,6 @@ function LayoutContent() {
|
|||||||
|
|
||||||
const isAdminPage = location.pathname.startsWith('/admin');
|
const isAdminPage = location.pathname.startsWith('/admin');
|
||||||
const breadcrumb = useMemo(() => {
|
const breadcrumb = useMemo(() => {
|
||||||
if (isAdminPage) {
|
|
||||||
const LABELS: Record<string, string> = {
|
|
||||||
admin: 'Admin',
|
|
||||||
rbac: 'Users & Roles',
|
|
||||||
audit: 'Audit Log',
|
|
||||||
oidc: 'OIDC',
|
|
||||||
database: 'Database',
|
|
||||||
clickhouse: 'ClickHouse',
|
|
||||||
appconfig: 'App Config',
|
|
||||||
};
|
|
||||||
const parts = location.pathname.split('/').filter(Boolean);
|
|
||||||
return parts.map((part, i) => ({
|
|
||||||
label: LABELS[part] ?? part,
|
|
||||||
...(i < parts.length - 1 ? { href: '/' + parts.slice(0, i + 1).join('/') } : {}),
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
// Scope trail as breadcrumb items
|
|
||||||
const items: { label: string; href?: string }[] = [
|
const items: { label: string; href?: string }[] = [
|
||||||
{ label: 'All Applications', href: `/${scope.tab}` },
|
{ label: 'All Applications', href: `/${scope.tab}` },
|
||||||
];
|
];
|
||||||
@@ -234,7 +217,7 @@ function LayoutContent() {
|
|||||||
delete items[items.length - 1].href;
|
delete items[items.length - 1].href;
|
||||||
}
|
}
|
||||||
return items;
|
return items;
|
||||||
}, [location.pathname, isAdminPage, scope.tab, scope.appId, scope.routeId]);
|
}, [scope.tab, scope.appId, scope.routeId]);
|
||||||
|
|
||||||
const handleLogout = useCallback(() => {
|
const handleLogout = useCallback(() => {
|
||||||
logout();
|
logout();
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ export default function AdminLayout() {
|
|||||||
<span className={styles.title}>Admin</span>
|
<span className={styles.title}>Admin</span>
|
||||||
<div className={styles.userSection}>
|
<div className={styles.userSection}>
|
||||||
<span className={styles.username}>{username}</span>
|
<span className={styles.username}>{username}</span>
|
||||||
<button className={styles.logoutBtn} onClick={handleLogout}>
|
<button className={styles.logoutBtn} onClick={handleLogout} aria-label="Log out">
|
||||||
<LogOut size={14} />
|
<LogOut size={14} />
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user