native macOS codings agent orchestrator
5
fork

Configure Feed

Select the types of activity you want to include in your feed.

Refactor sidebar to display worktrees under collapsible repo section

khoi ce271c95 6d2b1097

+49 -25
+49 -25
supacode/ContentView.swift
··· 8 8 import SwiftUI 9 9 10 10 struct ContentView: View { 11 - @State private var filter = "" 12 - 13 11 var body: some View { 14 12 NavigationSplitView { 15 - SidebarView(filter: $filter) 13 + SidebarView() 16 14 } detail: { 17 15 EmptyStateView() 18 16 .navigationTitle("Supacode") ··· 35 33 } 36 34 37 35 private struct SidebarView: View { 38 - @Binding var filter: String 36 + @State private var isRepoExpanded = true 37 + private let worktrees: [Worktree] = [ 38 + Worktree(name: "khoi/tashkent", detail: "tashkent • 1h ago"), 39 + Worktree(name: "khoi/karachi", detail: "karachi • 1h ago") 40 + ] 39 41 40 42 var body: some View { 41 - VStack(spacing: 0) { 42 - List { 43 - Section("Projects") { 44 - ProjectRow(name: "suparepo", detail: "main") 43 + List { 44 + DisclosureGroup(isExpanded: $isRepoExpanded) { 45 + ForEach(worktrees) { worktree in 46 + WorktreeRow(name: worktree.name, detail: worktree.detail) 45 47 } 46 - } 47 - .listStyle(.sidebar) 48 - Divider() 49 - HStack(spacing: 8) { 50 - Button(action: {}) { 51 - Image(systemName: "plus") 52 - } 53 - .buttonStyle(.borderless) 54 - TextField("Filter", text: $filter) 55 - .textFieldStyle(.roundedBorder) 48 + } label: { 49 + RepoHeaderRow(name: "supacode", initials: "S") 56 50 } 57 - .padding(8) 58 - .background(Color(nsColor: .windowBackgroundColor)) 59 51 } 52 + .listStyle(.sidebar) 60 53 .frame(minWidth: 220) 61 54 } 62 55 } 63 56 64 - private struct ProjectRow: View { 57 + private struct RepoHeaderRow: View { 65 58 let name: String 66 - let detail: String 59 + let initials: String 67 60 68 61 var body: some View { 69 - VStack(alignment: .leading, spacing: 2) { 62 + HStack(spacing: 10) { 63 + ZStack { 64 + Circle() 65 + .fill(.secondary.opacity(0.2)) 66 + Text(initials) 67 + .font(.caption) 68 + .foregroundStyle(.secondary) 69 + } 70 + .frame(width: 24, height: 24) 70 71 Text(name) 71 - Text(detail) 72 + .font(.headline) 73 + } 74 + } 75 + } 76 + 77 + private struct WorktreeRow: View { 78 + let name: String 79 + let detail: String 80 + 81 + var body: some View { 82 + HStack(alignment: .top, spacing: 8) { 83 + Image(systemName: "arrow.triangle.branch") 72 84 .font(.caption) 73 85 .foregroundStyle(.secondary) 86 + .padding(.top, 2) 87 + VStack(alignment: .leading, spacing: 2) { 88 + Text(name) 89 + Text(detail) 90 + .font(.caption) 91 + .foregroundStyle(.secondary) 92 + } 74 93 } 75 - .padding(.vertical, 4) 76 94 } 95 + } 96 + 97 + private struct Worktree: Identifiable { 98 + let id = UUID() 99 + let name: String 100 + let detail: String 77 101 } 78 102 79 103 private struct EmptyStateView: View {