Revert "fix(#112): remove dead admin breadcrumb code, add logout aria-label"
This reverts commit d5028193c0.
This commit is contained in:
@@ -203,6 +203,23 @@ 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}` },
|
||||||
];
|
];
|
||||||
@@ -217,7 +234,7 @@ function LayoutContent() {
|
|||||||
delete items[items.length - 1].href;
|
delete items[items.length - 1].href;
|
||||||
}
|
}
|
||||||
return items;
|
return items;
|
||||||
}, [scope.tab, scope.appId, scope.routeId]);
|
}, [location.pathname, isAdminPage, 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} aria-label="Log out">
|
<button className={styles.logoutBtn} onClick={handleLogout}>
|
||||||
<LogOut size={14} />
|
<LogOut size={14} />
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user