import React, { Suspense, lazy, useEffect, useMemo, useState } from 'react'; import { Activity, Bot, Braces, Code2, Database, GitBranch, Globe2, KeyRound, Network, ShieldCheck, Sparkles, TerminalSquare } from 'lucide-react'; import LandingTab from './LandingTab'; import SimulationPage from './SimulationPage'; import ChatPage from './ChatPage'; import PersonaBuilderTab from './PersonaBuilderTab'; import ContentCraftTab from './ContentCraftTab'; import BrowserAutomationTab from './BrowserAutomationTab'; import QaTestingTab from './QaTestingTab'; import DataExtractionTab from './DataExtractionTab'; import UiVerificationTab from './UiVerificationTab'; import DeploymentTab from './DeploymentTab'; // Lazy — pulls the heavy plotly chunk only when a graph view is opened. const RealNetworkGraph = lazy(() => import('./RealNetworkGraph')); import SubViewSlider, { SubView } from './SubViewSlider'; import { getApiSpec, publishTabEvent } from '../services/tabBus'; import MindwalkGraphView from './MindwalkGraphView'; import PersonaHubTab from './PersonaHubTab'; import UxMentorChain from './UxMentorChain'; import JourneyConsole from './JourneyConsole'; import RenderFlow from './RenderFlow'; import DevSteeringConsole from './DevSteeringConsole'; import SocialMirror from './SocialMirror'; import AnalysisGraph from './AnalysisGraph'; import AccountPanel from './AccountPanel'; import { TAB_PROMISES } from '../branding'; export type MainTabId = 'usersync' | 'nova-act' | 'datahub' | 'oasis' | 'graph' | 'dev'; interface MainTabViewsProps { tab: MainTabId; routeView?: string; onNavigate?: (tab: string, view?: string) => void; onOpenGuide: () => void; user: any; onLogin: () => void; onLogout: () => void; simulationResult: any; setSimulationResult: (result: any) => void; } const viewsByTab: Record = { usersync: [ { id: 'overview', label: 'Overview', description: 'Landing, use cases, pricing, and product proof.' }, { id: 'simulation', label: 'Simulation', description: 'Run audience sync and inspect results.' }, { id: 'personas', label: 'Personas', description: 'Sort and build focus-group personas.' }, { id: 'content', label: 'Content Craft', description: 'Generate and evaluate variants.' }, ], 'nova-act': [ { id: 'console', label: 'Nova Console', description: 'Run persona-steered journeys, watch steps and thinking live.' }, { id: 'studio', label: 'Nova Studio', description: 'Amazon Nova-inspired command surface.' }, { id: 'browser', label: 'Browser Act', description: 'Headful web action session.' }, { id: 'qa', label: 'QA Flows', description: 'Reusable SDK test paths.' }, { id: 'verify', label: 'UI Verify', description: 'MCP style visual and DOM checks.' }, { id: 'ux-chain', label: 'UX Chain', description: 'Screenshot + heatmap, problem, and re-rendered solution.' }, { id: 'mindwalk', label: 'Mindwalk + OmniParser', description: 'Use OmniParser for UI-to-LLM prompts and Mindwalk for navigation memory.' }, ], datahub: [ { id: 'render', label: 'Render Flow', description: 'Verify sources, render personas one by one, read their steering.' }, { id: 'extract', label: 'Extract', description: 'Collect structured records.' }, { id: 'warehouse', label: 'Warehouse', description: 'Saved artifacts and tab handoff.' }, { id: 'deploy', label: 'Deploy', description: 'Production export and integrations.' }, ], oasis: [ { id: 'mirror', label: 'Social Mirror', description: 'Living network of personas; scrub the animation.' }, { id: 'network', label: 'Oasis Network', description: 'Community, identity, and auth mesh.' }, { id: 'trust', label: 'Trust Layer', description: 'HF login is shared across every tab.' }, ], graph: [ { id: 'analysis', label: 'Action Trace', description: 'Similarity blend, decisions, and graph answers.' }, { id: 'live', label: 'Live Graph', description: 'Network topology view.' }, { id: 'signals', label: 'Signals', description: 'Sorted persona and datahub events.' }, { id: 'mindwalk', label: 'Mindwalk + OmniParser', description: 'Graph tabs while OmniParser describes UI controls for LLM action.' }, ], dev: [ { id: 'steering', label: 'Steering Console', description: 'Layers 1/2, derivation rulesets, and audited corrections.' }, { id: 'account', label: 'Account', description: 'Credits, capabilities, and jobs.' }, { id: 'api', label: 'API Docs', description: 'OpenAPI/Swagger-compatible documentation.' }, { id: 'events', label: 'Tab Bus', description: 'FastAPI-compatible tab communication contract.' }, { id: 'status', label: 'Status', description: 'Delivery checklist and runtime health.' }, ], }; const NovaStudio = () => (
Nova Act command plane

Act, reason, browse, and verify from one tab.

A Nova-inspired orchestration surface that bundles browser automation, QA, visual verification, content tools, and backend app actions behind one signed-in HF session.

{['/api/nova-act/session', '/api/omniparser/parse', '/api/nova-act/limitations', '/api/openapi.json'].map((endpoint) => (
{endpoint}
))}
{[ ['Multimodal actions', Bot], ['Browser runtime', Globe2], ['Shared auth', KeyRound], ['Verified delivery', ShieldCheck], ].map(([label, Icon]: any) =>
{label}
)}
); const SimplePanel = ({ title, icon: Icon, children }: { title: string; icon: any; children: React.ReactNode }) => (

{title}

{children}
); const GraphPanel = () =>
}>
; const DevApiDocs = () => { const [spec, setSpec] = useState(null); useEffect(() => { getApiSpec().then((result) => result.ok && setSpec(result.data)); }, []); return

FastAPI-compatible OpenAPI is exposed in-app so every tab can discover backend actions.

{JSON.stringify(spec || { loading: '/api/openapi.json' }, null, 2)}
; }; const DEFAULT_VIEW: Record = { usersync: 'overview', 'nova-act': 'console', datahub: 'render', oasis: 'mirror', graph: 'analysis', dev: 'steering', }; const MainTabViews: React.FC = (props) => { const tabViews = viewsByTab[props.tab]; // URL is the source of truth for the view; fall back to the tab default. const routed = props.routeView && tabViews.some((v) => v.id === props.routeView) ? props.routeView : DEFAULT_VIEW[props.tab]; const [activeView, setLocalView] = useState(routed); const [direction, setDirection] = useState<1 | -1>(1); // Sync from the URL when it changes (back/forward, deep link, tab switch). useEffect(() => { setLocalView(routed); }, [routed]); const setActiveView = (view: string) => { const from = tabViews.findIndex((v) => v.id === activeView); const to = tabViews.findIndex((v) => v.id === view); setDirection(to >= from ? 1 : -1); setLocalView(view); props.onNavigate?.(props.tab, view); // deep-linkable publishTabEvent({ source: 'frontend', target: props.tab, action: 'view.changed', payload: { view } }); }; const content = useMemo(() => { if (props.tab === 'usersync') { if (activeView === 'simulation') return setActiveView('overview')} onOpenChat={() => setActiveView('content')} onOpenGuide={props.onOpenGuide} user={props.user} onLogin={props.onLogin} onLogout={props.onLogout} simulationResult={props.simulationResult} setSimulationResult={props.setSimulationResult} />; if (activeView === 'personas') return <>; if (activeView === 'content') return <> setActiveView('simulation')} simulationResult={props.simulationResult} setSimulationResult={props.setSimulationResult} />; return setActiveView('simulation')} />; } if (props.tab === 'nova-act') return activeView === 'console' ? : activeView === 'studio' ? : activeView === 'browser' ? : activeView === 'qa' ? : activeView === 'ux-chain' ? : activeView === 'mindwalk' ? : ; if (props.tab === 'datahub') return activeView === 'render' ? : activeView === 'extract' ? : activeView === 'deploy' ? : Saved records, simulation outputs, and browser traces are sorted here before being published to downstream tabs over /api/tabs/events.; if (props.tab === 'oasis') return activeView === 'mirror' ? : One Hugging Face login cookie is valid across UserSync, Nova Act, DataHub, Oasis, Graph, and Dev. Backend routes resolve the same user with /api/user.; if (props.tab === 'graph') return activeView === 'analysis' ? : activeView === 'live' ? : activeView === 'mindwalk' ? : Subview events, persona cohorts, and DataHub artifacts are sorted by source tab and action type for graph exploration.; if (props.tab === 'dev') return activeView === 'steering' ? : activeView === 'account' ? : activeView === 'api' ? : activeView === 'events' ? Publish tab communication with POST /api/tabs/events. Read the queue with GET /api/tabs/events. The schema is visible in API docs. : Frontend build, Express compatibility API, and FastAPI reference backend are included for delivery.; }, [activeView, props]); return ( <> {/* Per-tab service promise (branding.ts). */} {TAB_PROMISES[props.tab] && (

{TAB_PROMISES[props.tab]}

)} {/* Keyed on tab:view so each switch re-mounts with a directional slide. */}
{content}
); }; export default MainTabViews;