Skip to content

Workspace Engine

The Workspace is the core interactive hub of SREDSimplify, located under src/components/workspace/WorkspaceFrame.tsx. It is designed to provide developers and tax consultants with a seamless context-to-generation pipeline.

3-Pane Layout Architecture

The workspace utilizes react-resizable-panels to offer a customizable three-pane layout. The WorkspaceFrame component acts as the orchestrator for these sub-panes.

  1. ContextManagerPane (Left)

    • Responsible for file selection, upload, and context definition.
    • Users check boxes next to uploaded files to feed them into the current session's AI context window.
    • Automatically polls for file indexing status via useProjectFiles React Query hook.
  2. CopilotChatPane (Center)

    • The primary conversational interface for interacting with the AI.
    • Users can brainstorm, ask for clarifications, and trigger specific SR&ED pipeline generations.
    • Handles the streaming UI states (e.g., loading spinners) while the backend executes complex prompt chains.
  3. ArtifactPane (Right)

    • Displays the final structured output of AI operations.
    • Dynamically renders different artifact sub-components found in src/components/workspace/artifacts/ based on the session type:
      • T661Artifact: Renders the multi-line CRA T661 form preview.
      • LogbookArtifact: Renders the extracted timesheet/logbook tables.
      • PrecheckArtifact: Renders the eligibility scores and feedback.

State Synchronization

The workspaceStore (Zustand) is heavily utilized here to synchronize state across these three separate React components without causing deep prop-drilling or excessive re-renders.

Event Flow Example:

  1. User selects a file checkbox in the ContextManagerPane.
  2. The workspaceStore updates its internal selectedContextFiles array.
  3. The user types a message and clicks "Send" in the CopilotChatPane.
  4. The Chat pane reads the selectedContextFiles from Zustand and appends their IDs to the outgoing API payload sent to the Spring Boot backend.
  5. Once the AI generation completes, the resulting JSON is saved to workspaceStore drafts, triggering the ArtifactPane to re-render and display the generated form.