// Copyright (c) 2026 PowerOn AG // All rights reserved. /** * Dashboard Page * * System-Übersicht für den User. * Zeigt alle verfügbaren Feature-Instanzen pro Mandant als Karten an. * Daten kommen vom Backend via GET /api/navigation. */ import React from 'react'; import { Link } from 'react-router-dom'; import useNavigation from '../hooks/useNavigation'; import type { NavigationMandate, MandateFeature, FeatureInstance as NavFeatureInstance } from '../hooks/useNavigation'; import { getPageIcon } from '../config/pageRegistry'; import { FaArrowRight, FaBuilding } from 'react-icons/fa'; import OnboardingAssistant from '../components/OnboardingAssistant'; import { StackLayout } from '../components/Layout/StackLayout'; import { Panel } from '../components/Layout/Panel'; import styles from './Dashboard.module.css'; import { useLanguage } from '../providers/language/LanguageContext'; interface InstanceCardProps { instance: NavFeatureInstance; feature: MandateFeature; } const InstanceCard: React.FC = ({ instance, feature }) => { const targetPath = instance.views.length > 0 ? instance.views[0].uiPath : undefined; if (!targetPath) return null; return (
{getPageIcon(feature.uiComponent)}
{feature.uiLabel}

{instance.uiLabel}

); }; export const DashboardPage: React.FC = () => { const { t } = useLanguage(); const { dynamicBlock, loading } = useNavigation(); const mandates: NavigationMandate[] = dynamicBlock?.mandates || []; let totalInstances = 0; const totalMandates = mandates.length; mandates.forEach(m => m.features.forEach(f => { totalInstances += f.instances.length; })); const mandateSections = mandates .filter(mandate => mandate.features.some(f => f.instances.length > 0)) .map(mandate => { const mandateInstances: { instance: NavFeatureInstance; feature: MandateFeature }[] = []; for (const feature of mandate.features) { for (const instance of feature.instances) { mandateInstances.push({ instance, feature }); } } return { mandate, mandateInstances }; }); if (loading) { return (

{t('Übersicht')}

{t('Lade')}

); } return (

{t('Übersicht')}

{totalInstances > 0 && (

{t('{instanceCount} Feature-Instanzen in {mandateCount} Mandanten', { instanceCount: String(totalInstances), mandateCount: String(totalMandates), })}

)}
{mandateSections.map(({ mandate, mandateInstances }) => ( {mandate.uiLabel} )} >
{mandateInstances.map(({ instance, feature }) => ( ))}
))}
); }; export default DashboardPage;