Skip to content

Decompose AgentsHubView (785 lines) into smaller views #60

@2witstudios

Description

@2witstudios

Problem

AgentsHubView.swift is 785 lines containing:

  • The main AgentsHubView struct (~630 lines)
  • AgentsHubTab enum
  • CommandHintBar, PromptListRow, AgentListRow, SwarmListRow, SwarmDiagramView

The main struct has deeply nested computed properties:

  • promptsContent alone is ~127 lines of nested view code with an inline prompt editor
  • Three nearly identical list panels (promptListPanel, agentListPanel, swarmListPanel) that could be a generic ListPanel<Item, Row>
  • Three list row types with identical selection card styling that should be a shared ViewModifier

Suggested approach

  1. Extract promptsContentPromptEditorView (own file)
  2. Extract agentsContentAgentDetailView (own file)
  3. Extract swarmsContentSwarmDetailView (own file)
  4. Create a generic ListPanel<Item, Row> to replace the three identical list panel implementations (~60 lines saved)
  5. Create a SelectableCardStyle ViewModifier for the repeated selection styling pattern:
    .padding(12)
    .frame(maxWidth: .infinity, alignment: .leading)
    .background(isSelected ? Color.accentColor.opacity(0.12) : Color.primary.opacity(0.03))
    .clipShape(RoundedRectangle(cornerRadius: 10))

Files

  • apps/purepoint-macos/purepoint-macos/Views/Agents/AgentsHubView.swift

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions