Files
leocrm/frontend/src/components/layout/AppShell.tsx
T
Agent Zero 903d649a0f Phase 4: KI-UI-Steuerung — AI agent UI control via WebSocket
- New ai_ui_control plugin: WS endpoint /ws/ai-ui-control, REST API (POST /command, GET /command/{id}/status, GET /online-users)
- UI-Command-Protocol: 6 command types (navigate, filter, open_contact, modal, tab, settings) with Pydantic schemas
- WebSocket manager: per-user connections, command delivery, feedback storage, stale cleanup
- Frontend useAIUIControl hook: WS client with auto-reconnect, command dispatch, feedback sending
- aiUIControlStore: Zustand store for command state, active modal/tab, pending filter/settings
- AIUIControlIndicator: visual KI indication (Bot icon, toast, pulse animation)
- ContactDetail integration: syncs activeTab and personModalOpen from AI control store
- AppShell integration: useAIUIControl hook + AIUIControlIndicator
- i18n keys for DE/EN
- 18 Vitest tests: command protocol, store actions, feedback, visual indication
- TSC: 0 new errors (only 2 pre-existing Dms.tsx errors)
2026-07-23 20:13:39 +02:00

51 lines
1.7 KiB
TypeScript

import React from 'react';
import { Outlet, useLocation } from 'react-router-dom';
import { Sidebar } from './Sidebar';
import { TopBar } from './TopBar';
import { PluginToolbar } from './PluginToolbar';
import { MessageSidebar } from './MessageSidebar';
import { ToastContainer } from '@/components/ui/Toast';
import { useAIContext } from '@/hooks/useAIContext';
import { useAIUIControl } from '@/hooks/useAIUIControl';
import { PluginRegistry } from '@/components/plugins/PluginRegistry';
import { AIUIControlIndicator } from '@/components/ai-ui-control/AIUIControlIndicator';
export function AppShell() {
const location = useLocation();
// Track context for AI Proactive suggestions
useAIContext();
// AI UI Control — WebSocket-based UI control from AI agents (Phase 4)
useAIUIControl();
// Hide message sidebar on the AI Assistant page itself
const showMessageSidebar = !location.pathname.startsWith('/ai-assistant');
return (
<div className="flex h-screen overflow-hidden bg-secondary-50" data-testid="app-shell">
<PluginRegistry />
<Sidebar />
<div className="flex-1 flex flex-col overflow-hidden">
<TopBar />
<PluginToolbar />
<div className="flex-1 flex overflow-hidden">
<main
className="flex-1 overflow-y-auto focus:outline-none"
tabIndex={-1}
role="main"
id="main-content"
data-testid="content-area"
>
<Outlet />
</main>
</div>
</div>
{/* Message Sidebar — full height, right of TopBar and Toolbar */}
{showMessageSidebar && <MessageSidebar />}
<AIUIControlIndicator />
<ToastContainer />
</div>
);
}