From cb3e25d4cdf9335eaff2fc4eef37ccbcda644174 Mon Sep 17 00:00:00 2001 From: onevcat Date: Tue, 5 May 2026 15:24:10 +0900 Subject: [PATCH] Unify empty-state views on ContentUnavailableView Migrate the Repositories and Shelf empty states to ContentUnavailableView so they match the Archived Worktrees and Diff View placeholders. Removes two ad-hoc VStack layouts with mismatched icon sizes and spacing in favor of the platform component, which keeps typography and Dynamic Type consistent across all empty states. --- .../Repositories/Views/EmptyStateView.swift | 16 ++++------------ supacode/Features/Shelf/Views/ShelfView.swift | 16 +++++----------- 2 files changed, 9 insertions(+), 23 deletions(-) diff --git a/supacode/Features/Repositories/Views/EmptyStateView.swift b/supacode/Features/Repositories/Views/EmptyStateView.swift index fc6800e8..8d800bbf 100644 --- a/supacode/Features/Repositories/Views/EmptyStateView.swift +++ b/supacode/Features/Repositories/Views/EmptyStateView.swift @@ -7,20 +7,14 @@ struct EmptyStateView: View { var body: some View { let shortcutDisplay = AppShortcuts.display(for: AppShortcuts.CommandID.openRepository, in: resolvedKeybindings) - VStack(spacing: 16) { - Image(systemName: "tray") - .font(.title2) - .accessibilityHidden(true) - .padding(.bottom, 4) - Text("Open a repository or folder") - .font(.headline) + ContentUnavailableView { + Label("Open a repository or folder", systemImage: "tray") + } description: { Text(promptText(shortcutDisplay: shortcutDisplay)) - .font(.subheadline) - .foregroundStyle(.secondary) + } actions: { Button("Add Repository...") { store.send(.setOpenPanelPresented(true)) } - .padding(.top, 4) .modifier( KeyboardShortcutModifier( shortcut: resolvedKeybindings.keyboardShortcut(for: AppShortcuts.CommandID.openRepository) @@ -33,10 +27,8 @@ struct EmptyStateView: View { in: resolvedKeybindings )) } - .padding(24) .frame(maxWidth: .infinity, maxHeight: .infinity) .background(Color(nsColor: .windowBackgroundColor)) - .multilineTextAlignment(.center) } private func promptText(shortcutDisplay: String?) -> String { diff --git a/supacode/Features/Shelf/Views/ShelfView.swift b/supacode/Features/Shelf/Views/ShelfView.swift index 1aa07110..00d15fe4 100644 --- a/supacode/Features/Shelf/Views/ShelfView.swift +++ b/supacode/Features/Shelf/Views/ShelfView.swift @@ -166,17 +166,11 @@ struct ShelfView: View { @ViewBuilder private func emptyOpenArea() -> some View { - VStack(spacing: 10) { - Image(systemName: "books.vertical") - .font(.system(size: 40)) - .foregroundStyle(.secondary) - .accessibilityHidden(true) - Text("No worktree selected") - .font(.headline) - Text("Click a worktree to open it.") - .font(.callout) - .foregroundStyle(.secondary) - } + ContentUnavailableView( + "No worktree selected", + systemImage: "books.vertical", + description: Text("Click a worktree to open it.") + ) .frame(maxWidth: .infinity, maxHeight: .infinity) } -- 2.51.2