setIsOpen(!isOpen)}
className="flex items-center gap-2 px-3 py-1.5 rounded-lg hover:bg-gray-100 transition-colors"
>
{user.avatarUrl ? (
) : (
{initials}
)}
{user.displayName}
{isOpen && (
<>
setIsOpen(false)}
/>
{user.displayName}
{user.emailAddress && (
{user.emailAddress}
)}
{authMethod === 'oauth' ? 'Jira OAuth' : 'Service Account'}
{authMethod === 'oauth' && (
{
setIsOpen(false);
logout();
}}
className="w-full px-4 py-2 text-left text-sm text-red-600 hover:bg-red-50 transition-colors"
>
Uitloggen
)}
>
)}
);
}
function AppContent() {
const location = useLocation();
// Navigation structure
const appComponentsDropdown: NavDropdown = {
label: 'Application Component',
basePath: '/application',
items: [
{ path: '/app-components', label: 'Dashboard', exact: true },
{ path: '/application/overview', label: 'Overzicht', exact: false },
{ path: '/application/fte-calculator', label: 'FTE Calculator', exact: true },
{ path: '/app-components/fte-config', label: 'FTE Config', exact: true },
],
};
const reportsDropdown: NavDropdown = {
label: 'Rapporten',
basePath: '/reports',
items: [
{ path: '/reports', label: 'Overzicht', exact: true },
{ path: '/reports/team-dashboard', label: 'Team-indeling', exact: true },
{ path: '/reports/governance-analysis', label: 'Analyse Regiemodel', exact: true },
{ path: '/reports/data-model', label: 'Datamodel', exact: true },
],
};
const isAppComponentsActive = location.pathname.startsWith('/app-components') || location.pathname.startsWith('/application');
const isReportsActive = location.pathname.startsWith('/reports');
const isDashboardActive = location.pathname === '/';
return (
{/* Header */}
Analyse Tool
Zuyderland CMDB
{/* Dashboard (Search) */}
Dashboard
{/* Application Component Dropdown */}
{/* Reports Dropdown */}
{/* Main content */}
{/* Main Dashboard (Search) */}
} />
{/* Application routes (new structure) */}
} />
} />
} />
} />
{/* Application Component routes */}
} />
} />
{/* Reports routes */}
} />
} />
} />
} />
{/* Legacy redirects for bookmarks - redirect old paths to new ones */}
} />
} />
} />
} />
} />
} />
);
}
function App() {
const { isAuthenticated, isLoading, checkAuth, fetchConfig, config } = useAuthStore();
useEffect(() => {
// Fetch auth config first, then check auth status
const init = async () => {
await fetchConfig();
await checkAuth();
};
init();
}, [fetchConfig, checkAuth]);
// Show loading state
if (isLoading) {
return (
);
}
// Show login if OAuth is enabled and not authenticated
if (config?.authMethod === 'oauth' && !isAuthenticated) {
return
;
}
// Show login if nothing is configured
if (config?.authMethod === 'none') {
return
;
}
// Show main app
return
;
}
export default App;