first round of review

This commit is contained in:
counterweight 2025-12-20 11:43:32 +01:00
parent 870804e7b9
commit 23049da55a
Signed by: counterweight
GPG key ID: 883EDBAA726BD96C
15 changed files with 325 additions and 182 deletions

View file

@ -43,37 +43,11 @@ export function Header({ currentPage }: HeaderProps) {
if (!user) return null;
// For admin pages, show admin navigation
if (isAdminUser && (currentPage === "audit" || currentPage === "admin-invites")) {
return (
<div style={sharedStyles.header}>
<div style={sharedStyles.nav}>
{ADMIN_NAV_ITEMS.map((item, index) => (
<span key={item.id}>
{index > 0 && <span style={sharedStyles.navDivider}></span>}
{item.id === currentPage ? (
<span style={sharedStyles.navCurrent}>{item.label}</span>
) : (
<a href={item.href} style={sharedStyles.navLink}>
{item.label}
</a>
)}
</span>
))}
</div>
<div style={sharedStyles.userInfo}>
<span style={sharedStyles.userEmail}>{user.email}</span>
<button onClick={handleLogout} style={sharedStyles.logoutBtn}>
Sign out
</button>
</div>
</div>
);
}
// For regular pages, build nav with links
const visibleItems = REGULAR_NAV_ITEMS.filter(
(item) => !item.regularOnly || isRegularUser
// Build nav items based on user role
// Admin users see admin nav items, regular users see regular nav items
const navItems = isAdminUser ? ADMIN_NAV_ITEMS : REGULAR_NAV_ITEMS;
const visibleItems = navItems.filter(
(item) => (!item.regularOnly || isRegularUser) && (!item.adminOnly || isAdminUser)
);
return (