From 4cf3582d1dd6ab529a8099f11076f563abdb544f Mon Sep 17 00:00:00 2001 From: onevcat Date: Sat, 20 Jun 2026 20:52:53 +0900 Subject: [PATCH] Fix workspace sidebar: full-row click area and collapse/expand all - Replace Button(.plain) with onTapGesture + contentShape in WorkspaceChildRowsView so the entire row is clickable, matching the pattern used by WorktreeRowsView. - Include workspaces in expandableRepositoryIDs so the collapse/expand all toggle applies to them. --- .../Repositories/Views/SidebarListView.swift | 2 +- .../Views/WorkspaceChildRowsView.swift | 93 ++++++++----------- 2 files changed, 41 insertions(+), 54 deletions(-) diff --git a/supacode/Features/Repositories/Views/SidebarListView.swift b/supacode/Features/Repositories/Views/SidebarListView.swift index dd9f05c2..30c69c34 100644 --- a/supacode/Features/Repositories/Views/SidebarListView.swift +++ b/supacode/Features/Repositories/Views/SidebarListView.swift @@ -503,7 +503,7 @@ struct SidebarListView: View { ) -> Set where Repositories.Element == Repository { Set( repositories - .filter(\.capabilities.supportsWorktrees) + .filter { $0.capabilities.supportsWorktrees || $0.isWorkspace } .map(\.id) ) } diff --git a/supacode/Features/Repositories/Views/WorkspaceChildRowsView.swift b/supacode/Features/Repositories/Views/WorkspaceChildRowsView.swift index a37f9457..f815bb75 100644 --- a/supacode/Features/Repositories/Views/WorkspaceChildRowsView.swift +++ b/supacode/Features/Repositories/Views/WorkspaceChildRowsView.swift @@ -12,60 +12,47 @@ struct WorkspaceChildRowsView: View { var body: some View { ForEach(rows) { row in let isSelected = row.id == selectedID - WorkspaceChildRowButton(row: row, isSelected: isSelected, onSelect: onSelect) - .padding(.leading, 14) - .padding(.trailing, 8) - .background { - if isSelected { - RoundedRectangle(cornerRadius: 8) - .fill(Color.accentColor.opacity(0.18)) - .padding(.horizontal, 6) - } + WorktreeRow( + name: row.branchName ?? row.repositoryName, + worktreeName: row.branchName == nil ? "" : row.repositoryName, + info: row.info, + iconSystemName: nil, + showsPullRequestInfo: true, + isHovered: false, + isPinned: false, + isMainWorktree: false, + isLoading: false, + taskStatus: nil, + isRunScriptRunning: false, + showsNotificationIndicator: false, + notifications: [], + onFocusNotification: { _ in }, + shortcutHint: nil, + showsShortcutHint: false, + pinAction: nil, + isSelected: isSelected, + archiveAction: nil, + onDiffTap: nil, + onStopRunScript: nil, + ) + .padding(.leading, 14) + .padding(.trailing, 8) + .background { + if isSelected { + RoundedRectangle(cornerRadius: 8) + .fill(Color.accentColor.opacity(0.18)) + .padding(.horizontal, 6) } - .padding(.vertical, 2) - .id(row.id) + } + .padding(.vertical, 2) + .contentShape(.interaction, .rect) + .contentShape(.rect) + .onTapGesture { + onSelect(row.id) + } + .accessibilityAddTraits(.isButton) + .help("Focus Terminal in \(row.repositoryName)") + .id(row.id) } } } - -private struct WorkspaceChildRowButton: View { - let row: WorkspaceChildRowModel - let isSelected: Bool - let onSelect: (String) -> Void - - var body: some View { - Button { - onSelect(row.id) - } label: { - content - } - .buttonStyle(.plain) - .help("Focus Terminal in \(row.repositoryName)") - } - - private var content: some View { - WorktreeRow( - name: row.branchName ?? row.repositoryName, - worktreeName: row.branchName == nil ? "" : row.repositoryName, - info: row.info, - iconSystemName: nil, - showsPullRequestInfo: true, - isHovered: false, - isPinned: false, - isMainWorktree: false, - isLoading: false, - taskStatus: nil, - isRunScriptRunning: false, - showsNotificationIndicator: false, - notifications: [], - onFocusNotification: { _ in }, - shortcutHint: nil, - showsShortcutHint: false, - pinAction: nil, - isSelected: isSelected, - archiveAction: nil, - onDiffTap: nil, - onStopRunScript: nil, - ) - } -} -- 2.51.2