diff --git a/frontend/src/components/NavSidebar.tsx b/frontend/src/components/NavSidebar.tsx index c3ef325..0800b6a 100644 --- a/frontend/src/components/NavSidebar.tsx +++ b/frontend/src/components/NavSidebar.tsx @@ -171,6 +171,21 @@ export default function NavSidebar({ const rowBase = "w-full flex items-center gap-3 rounded-lg px-2.5 py-2 text-sm transition"; const name = me.display_name ?? me.email.split("@")[0]; + // Role shown next to the name (expanded) / as an avatar dot (collapsed). Demo isn't a real + // role (it's a flag on a `user` row), so surface it first. + const roleKey: "admin" | "user" | "demo" = me.is_demo + ? "demo" + : me.role === "admin" + ? "admin" + : "user"; + const roleChipCls = + roleKey === "admin" + ? "bg-accent/15 text-accent" + : roleKey === "demo" + ? "bg-amber-500/20 text-amber-500" + : "bg-muted/15 text-muted"; + const roleDotCls = + roleKey === "admin" ? "bg-accent" : roleKey === "demo" ? "bg-amber-500" : "bg-muted"; const renderItem = ({ page: p, icon: Icon, label, badge }: NavItem) => { const active = page === p; @@ -247,9 +262,19 @@ export default function NavSidebar({
{userItems.map(renderItem)} - {systemItems.length > 0 && ( -
- )} + {systemItems.length > 0 && + (collapsed ? ( + // Collapsed rail: a short, thicker centred rule is the clearest "new section" cue + // when there's no room for a label. +
+ ) : ( +
+ + {t("nav.adminSection")} + + +
+ ))} {systemItems.map(renderItem)}
@@ -290,12 +315,27 @@ export default function NavSidebar({ title={collapsed ? name : undefined} className={`${rowBase} ${collapsed ? "justify-center px-0" : ""} text-muted hover:text-fg hover:bg-card`} > - + + + {collapsed && ( + + )} + {!collapsed && {name}} + {!collapsed && ( + + {t(`nav.role.${roleKey}`)} + + )} {acctOpen && diff --git a/frontend/src/i18n/locales/de/nav.json b/frontend/src/i18n/locales/de/nav.json index 5892e3f..c3135ba 100644 --- a/frontend/src/i18n/locales/de/nav.json +++ b/frontend/src/i18n/locales/de/nav.json @@ -1,5 +1,11 @@ { "primary": "Hauptnavigation", "collapse": "Seitenleiste einklappen", - "expand": "Seitenleiste ausklappen" + "expand": "Seitenleiste ausklappen", + "adminSection": "Admin", + "role": { + "admin": "Admin", + "user": "Benutzer", + "demo": "Demo" + } } diff --git a/frontend/src/i18n/locales/en/nav.json b/frontend/src/i18n/locales/en/nav.json index 621159b..5437cf7 100644 --- a/frontend/src/i18n/locales/en/nav.json +++ b/frontend/src/i18n/locales/en/nav.json @@ -1,5 +1,11 @@ { "primary": "Primary navigation", "collapse": "Collapse sidebar", - "expand": "Expand sidebar" + "expand": "Expand sidebar", + "adminSection": "Admin", + "role": { + "admin": "Admin", + "user": "User", + "demo": "Demo" + } } diff --git a/frontend/src/i18n/locales/hu/nav.json b/frontend/src/i18n/locales/hu/nav.json index 5c18135..be53d87 100644 --- a/frontend/src/i18n/locales/hu/nav.json +++ b/frontend/src/i18n/locales/hu/nav.json @@ -1,5 +1,11 @@ { "primary": "Fő navigáció", "collapse": "Oldalsáv összecsukása", - "expand": "Oldalsáv kinyitása" + "expand": "Oldalsáv kinyitása", + "adminSection": "Admin", + "role": { + "admin": "Admin", + "user": "Felhasználó", + "demo": "Demó" + } }