Problem
Four creation sheets share an identical structural pattern with ~40 lines of boilerplate each:
AgentCreationSheet.swift
PromptCreationSheet.swift
SwarmCreationSheet.swift
ScheduleCreationSheet.swift
The header is character-for-character identical across all four (only the title string differs):
HStack {
Text("New X").font(.system(size: 14, weight: .semibold))
Spacer()
}
.padding(.horizontal, 20)
.padding(.vertical, 12)
The footer is structurally identical (Cancel + Create buttons with keyboard shortcuts, same padding), differing only in the Create action body and the .disabled() condition.
The body layout is identical: VStack(spacing: 0) { header; Divider; form; Divider; footer }
Suggested approach
Extract a generic CreationSheet<Content> wrapper:
struct CreationSheet<FormContent: View>: View {
let title: String
let isValid: Bool
let onCreate: () -> Void
@ViewBuilder let form: () -> FormContent
}
Estimated ~160 lines of boilerplate eliminated.
Files
apps/purepoint-macos/purepoint-macos/Views/Agents/AgentCreationSheet.swift
apps/purepoint-macos/purepoint-macos/Views/Agents/PromptCreationSheet.swift
apps/purepoint-macos/purepoint-macos/Views/Agents/SwarmCreationSheet.swift
apps/purepoint-macos/purepoint-macos/Views/Schedule/ScheduleCreationSheet.swift
Problem
Four creation sheets share an identical structural pattern with ~40 lines of boilerplate each:
AgentCreationSheet.swiftPromptCreationSheet.swiftSwarmCreationSheet.swiftScheduleCreationSheet.swiftThe header is character-for-character identical across all four (only the title string differs):
The footer is structurally identical (Cancel + Create buttons with keyboard shortcuts, same padding), differing only in the Create action body and the
.disabled()condition.The body layout is identical:
VStack(spacing: 0) { header; Divider; form; Divider; footer }Suggested approach
Extract a generic
CreationSheet<Content>wrapper:Estimated ~160 lines of boilerplate eliminated.
Files
apps/purepoint-macos/purepoint-macos/Views/Agents/AgentCreationSheet.swiftapps/purepoint-macos/purepoint-macos/Views/Agents/PromptCreationSheet.swiftapps/purepoint-macos/purepoint-macos/Views/Agents/SwarmCreationSheet.swiftapps/purepoint-macos/purepoint-macos/Views/Schedule/ScheduleCreationSheet.swift