Uninstall Mac apps with every file they leave behind, and see why each belongs. Free up space, fine-tune macOS, and set up Terminal.
Swift cache-cleanercleanerclideveloper-toolsdisk-cleanupdisk-spaceduplicate-finderhomebrewliquid-glassmac-cleanermacosmacos-appmacos-golden-gatemacos-tahoemacos-tweaksswiftswiftuiterminal-themesuninstalluninstaller
List the usual places for projects under Build Artifacts' main button
Țugui Dragoșd38b0b7d56e3
diff --git a/Localization/Peel/Localizable.xcstrings b/Localization/Peel/Localizable.xcstringsindex 5498a585..db2c0341 100644--- a/Localization/Peel/Localizable.xcstrings+++ b/Localization/Peel/Localizable.xcstrings@@ -15564,6 +15564,112 @@}}},+ "Add" : {+ "localizations" : {+ "cs" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Přidat"+ }+ },+ "de" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Hinzufügen"+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Añadir"+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Ajouter"+ }+ },+ "it" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Aggiungi"+ }+ },+ "ja" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "追加"+ }+ },+ "ko" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "추가"+ }+ },+ "nl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Voeg toe"+ }+ },+ "pl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Dodaj"+ }+ },+ "pt" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Adicionar"+ }+ },+ "ro" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Adăugați"+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Добавить"+ }+ },+ "sv" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Lägg till"+ }+ },+ "tr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Ekle"+ }+ },+ "uk" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Додати"+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "添加"+ }+ },+ "zh-Hant" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "加入"+ }+ }+ }+ },"Add App…" : {"localizations" : {"cs" : {@@ -232233,6 +232339,112 @@}}},+ "Usual Places for Projects" : {+ "localizations" : {+ "cs" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Obvyklá místa pro projekty"+ }+ },+ "de" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Übliche Orte für Projekte"+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Lugares habituales para proyectos"+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Emplacements habituels pour les projets"+ }+ },+ "it" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Posizioni abituali per i progetti"+ }+ },+ "ja" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "プロジェクトによく使われる場所"+ }+ },+ "ko" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "프로젝트의 일반적인 위치"+ }+ },+ "nl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Gebruikelijke plaatsen voor projecten"+ }+ },+ "pl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Typowe miejsca na projekty"+ }+ },+ "pt" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Locais Comuns para Projetos"+ }+ },+ "ro" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Locuri obișnuite pentru proiecte"+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Обычные места для проектов"+ }+ },+ "sv" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Vanliga platser för projekt"+ }+ },+ "tr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Projeler İçin Sık Kullanılan Yerler"+ }+ },+ "uk" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Типові місця для проєктів"+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "项目的常用位置"+ }+ },+ "zh-Hant" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "計畫案的常用位置"+ }+ }+ }+ },"VMware Fusion" : {"comment" : "A product's name, never translated.","shouldTranslate" : falsediff --git a/Peel/Views/Projects/NoProjectFolders.swift b/Peel/Views/Projects/NoProjectFolders.swiftnew file mode 100644index 00000000..aba55c70--- /dev/null+++ b/Peel/Views/Projects/NoProjectFolders.swift@@ -0,0 +1,73 @@+import SwiftUI++/// What Build Artifacts shows before a folder is chosen: a button to choose one and, under it, the usual places for+/// projects on this Mac, a row each with its own Add.+struct NoProjectFolders: View {+ let suggested: [URL]+ let choose: () -> Void+ let add: (URL) -> Void++ var body: some View {+ VStack(spacing: 18) {+ ContentUnavailableView {+ Label("No Folders Yet", systemImage: "folder.badge.gearshape")+ } description: {+ Text("Choose where your projects live. Peel looks for what their builds left behind.")+ } actions: {+ Button("Choose a Folder…", action: choose)+ .buttonStyle(.borderedProminent)+ }+ .fixedSize(horizontal: false, vertical: true)+ if !suggested.isEmpty {+ UsualProjectPlaces(folders: suggested, add: add)+ }+ }+ .frame(maxWidth: .infinity, maxHeight: .infinity)+ }+}++/// The usual places for projects, in a list that scrolls once it holds more than the column has room for.+private struct UsualProjectPlaces: View {+ let folders: [URL]+ let add: (URL) -> Void++ var body: some View {+ VStack(alignment: .leading, spacing: 6) {+ Text("Usual Places for Projects")+ .font(.headline)+ .accessibilityAddTraits(.isHeader)+ .padding(.leading, 4)+ ViewThatFits(in: .vertical) {+ rows+ ScrollView { rows }+ }+ .background(.quaternary.opacity(0.5), in: .rect(cornerRadius: 8))+ }+ .padding(.horizontal, 16)+ }++ private var rows: some View {+ VStack(spacing: 0) {+ ForEach(Array(folders.enumerated()), id: \.element) { index, folder in+ HStack(spacing: 8) {+ Image(systemName: "folder")+ .foregroundStyle(.secondary)+ .accessibilityHidden(true)+ Text(verbatim: folder.abbreviatedPath)+ .lineLimit(1)+ .truncationMode(.middle)+ .help(folder.fullPath)+ Spacer(minLength: 8)+ Button("Add") { add(folder) }+ .accessibilityLabel(Text("Add “\(folder.lastPathComponent)”"))+ }+ .padding(.horizontal, 10)+ .padding(.vertical, 6)+ if index < folders.count - 1 {+ Divider()+ .padding(.leading, 36)+ }+ }+ }+ }+}diff --git a/Peel/Views/Projects/ProjectList.swift b/Peel/Views/Projects/ProjectList.swiftindex bcc5b091..f9eab23e 100644--- a/Peel/Views/Projects/ProjectList.swift+++ b/Peel/Views/Projects/ProjectList.swift@@ -215,27 +215,3 @@ private struct ProjectRow: View {}}}--/// What Build Artifacts shows before a folder is chosen: a button to choose one, and one for each usual place for-/// projects on this Mac.-struct NoProjectFolders: View {- let suggested: [URL]- let choose: () -> Void- let add: (URL) -> Void-- var body: some View {- ContentUnavailableView {- Label("No Folders Yet", systemImage: "folder.badge.gearshape")- } description: {- Text("Choose where your projects live. Peel looks for what their builds left behind.")- } actions: {- EmptyStateActions {- Button("Choose a Folder…", action: choose)- .buttonStyle(.borderedProminent)- ForEach(suggested, id: \.self) { folder in- Button("Add “\(folder.lastPathComponent)”") { add(folder) }- }- }- }- }-}diff --git a/PeelTests/NoProjectFoldersTests.swift b/PeelTests/NoProjectFoldersTests.swiftindex 13571488..59943542 100644--- a/PeelTests/NoProjectFoldersTests.swift+++ b/PeelTests/NoProjectFoldersTests.swift@@ -14,4 +14,38 @@ struct NoProjectFoldersTests {#expect(size.width <= column)}++ @Test func manyUsualPlacesScrollUnderTheMainButton() async {+ let suggested = (1...50).map { URL(filePath: "/Users/Shared/Place \($0)") }+ let column = CGSize(width: ListColumn.width, height: 700)+ let host = NSHostingView(+ rootView: NoProjectFolders(suggested: suggested, choose: {}, add: { _ in })+ .frame(width: column.width, height: column.height)+ )+ let window = NSWindow(+ contentRect: NSRect(origin: .zero, size: column), styleMask: [.titled], backing: .buffered, defer: true+ )+ window.contentView = host++ for _ in 0..<200 where Self.scrolling(in: host).isEmpty {+ window.layoutIfNeeded()+ try? await Task.sleep(for: .milliseconds(5))+ }++ let scrolling = Self.scrolling(in: host)+ #expect(!scrolling.isEmpty)+ for view in scrolling {+ let frame = view.convert(view.bounds, to: host)+ let fromTop = host.isFlipped ? frame.minY : host.bounds.height - frame.maxY+ #expect(host.bounds.contains(frame))+ #expect(fromTop >= column.height / 4)+ }+ }++ private static func scrolling(in view: NSView) -> [NSScrollView] {+ let own = (view as? NSScrollView).flatMap { scroll in+ (scroll.documentView?.frame.height ?? 0) > scroll.contentView.bounds.height + 1 ? [scroll] : nil+ } ?? []+ return own + view.subviews.flatMap(scrolling)+ }}