/** * FeatureView Page * * Generische Feature-View-Komponente. * Rendert den entsprechenden Content basierend auf Feature-Code und View. */ import React from 'react'; import { useCurrentInstance } from '../hooks/useCurrentInstance'; import { useCanViewFeatureView } from '../hooks/useInstancePermissions'; import { getLabel, FEATURE_REGISTRY } from '../types/mandate'; // Trustee Views // Note: TrusteeOrganisationsView and TrusteeContractsView removed - Feature-Instanz = Organisation import { TrusteeDocumentsView } from './views/trustee/TrusteeDocumentsView'; import { TrusteePositionsView } from './views/trustee/TrusteePositionsView'; import { TrusteePositionDocumentsView } from './views/trustee/TrusteePositionDocumentsView'; import { TrusteeDashboardView } from './views/trustee/TrusteeDashboardView'; import { TrusteeInstanceRolesView } from './views/trustee/TrusteeInstanceRolesView'; import { TrusteeExpenseImportView } from './views/trustee/TrusteeExpenseImportView'; import styles from './FeatureView.module.css'; // ============================================================================= // PLACEHOLDER VIEWS (für nicht implementierte Features) // ============================================================================= const PlaceholderView: React.FC<{ title: string; description: string }> = ({ title, description }) => (

{title}

{description}

); // Chatworkflow Views const ChatworkflowDashboard: React.FC = () => ( ); const ChatworkflowRuns: React.FC = () => ( ); const ChatworkflowFiles: React.FC = () => ( ); // Chatbot Views const ChatbotConversations: React.FC = () => ( ); const ChatbotSettings: React.FC = () => ( ); // Generic/Fallback const NotFound: React.FC = () => (

Seite nicht gefunden

Diese View existiert nicht oder wurde noch nicht implementiert.

); const AccessDenied: React.FC = () => (

Zugriff verweigert

Du hast keine Berechtigung für diese Ansicht.

); // ============================================================================= // VIEW REGISTRY // ============================================================================= type ViewComponent = React.FC; const VIEW_COMPONENTS: Record> = { trustee: { dashboard: TrusteeDashboardView, documents: TrusteeDocumentsView, positions: TrusteePositionsView, 'position-documents': TrusteePositionDocumentsView, 'instance-roles': TrusteeInstanceRolesView, 'expense-import': TrusteeExpenseImportView, }, chatworkflow: { dashboard: ChatworkflowDashboard, runs: ChatworkflowRuns, files: ChatworkflowFiles, }, chatbot: { conversations: ChatbotConversations, settings: ChatbotSettings, }, }; // ============================================================================= // FEATURE VIEW PAGE // ============================================================================= interface FeatureViewPageProps { view: string; } export const FeatureViewPage: React.FC = ({ view }) => { const { instance, featureCode, isValid } = useCurrentInstance(); // Berechtigungs-Check const viewCode = `${featureCode}-${view}`; const canView = useCanViewFeatureView(viewCode); // Nicht valider Kontext if (!isValid || !featureCode || !instance) { return ; } // Keine Berechtigung if (!canView && view !== 'not-found') { return ; } // View-Komponente finden const featureViews = VIEW_COMPONENTS[featureCode]; if (!featureViews) { return ; } const ViewComponent = featureViews[view]; if (!ViewComponent) { return ; } // View-Info aus Registry const featureConfig = FEATURE_REGISTRY[featureCode]; const viewConfig = featureConfig?.views?.find(v => v.code === view); const viewLabel = viewConfig ? getLabel(viewConfig.label) : view; return (

{viewLabel}

); }; export default FeatureViewPage;