From 73519f747f96d994af36cc96d2ee08565e55e2db Mon Sep 17 00:00:00 2001 From: ohaiibuzzle <23693150+ohaiibuzzle@users.noreply.github.com> Date: Thu, 15 Jun 2023 19:13:30 +0700 Subject: [PATCH] fix: some small UI tweaks (particularly in Brew installer and NSOpenPanels) --- .../GPKDownload/BrewInstallView.swift | 1 + .../GPKDownload/GPKFastInstallView.swift | 5 ++- .../GPKDownload/GPKSafeInstallView.swift | 3 +- .../GPKDownload/XCLIInstallView.swift | 1 + Harbor/Views/BottleManagementView.swift | 37 +++++++++---------- 5 files changed, 25 insertions(+), 22 deletions(-) diff --git a/Harbor/UIElements/GPKDownload/BrewInstallView.swift b/Harbor/UIElements/GPKDownload/BrewInstallView.swift index 9635709..ac01898 100644 --- a/Harbor/UIElements/GPKDownload/BrewInstallView.swift +++ b/Harbor/UIElements/GPKDownload/BrewInstallView.swift @@ -75,6 +75,7 @@ struct BrewInstallView: View { } } .padding() + .frame(minHeight: 300) } } diff --git a/Harbor/UIElements/GPKDownload/GPKFastInstallView.swift b/Harbor/UIElements/GPKDownload/GPKFastInstallView.swift index 064ba2f..dce3980 100644 --- a/Harbor/UIElements/GPKDownload/GPKFastInstallView.swift +++ b/Harbor/UIElements/GPKDownload/GPKFastInstallView.swift @@ -54,7 +54,7 @@ struct GPKFastInstallView: View { panel.canChooseFiles = true panel.canChooseDirectories = false panel.allowsMultipleSelection = false - panel.allowedFileTypes = ["gz"] + panel.allowedContentTypes = [.gzip] panel.begin { response in if response == .OK { let result = panel.url @@ -79,7 +79,7 @@ struct GPKFastInstallView: View { panel.canChooseFiles = true panel.canChooseDirectories = false panel.allowsMultipleSelection = false - panel.allowedFileTypes = ["dmg"] + panel.allowedContentTypes = [.diskImage] panel.begin { response in if response == .OK { let result = panel.url @@ -146,6 +146,7 @@ struct GPKFastInstallView: View { } } .padding() + .frame(minHeight: 300) } } diff --git a/Harbor/UIElements/GPKDownload/GPKSafeInstallView.swift b/Harbor/UIElements/GPKDownload/GPKSafeInstallView.swift index 27091dd..131d4ba 100644 --- a/Harbor/UIElements/GPKDownload/GPKSafeInstallView.swift +++ b/Harbor/UIElements/GPKDownload/GPKSafeInstallView.swift @@ -47,7 +47,7 @@ struct GPKSafeInstallView: View { panel.canChooseFiles = true panel.canChooseDirectories = false panel.allowsMultipleSelection = false - panel.allowedFileTypes = ["dmg"] + panel.allowedContentTypes = [.diskImage] panel.begin { response in if response == .OK { let result = panel.url @@ -108,6 +108,7 @@ struct GPKSafeInstallView: View { } } .padding() + .frame(minHeight: 300) } } diff --git a/Harbor/UIElements/GPKDownload/XCLIInstallView.swift b/Harbor/UIElements/GPKDownload/XCLIInstallView.swift index 5827349..1bdc779 100644 --- a/Harbor/UIElements/GPKDownload/XCLIInstallView.swift +++ b/Harbor/UIElements/GPKDownload/XCLIInstallView.swift @@ -75,6 +75,7 @@ struct XCLIInstallView: View { Spacer() } } + .frame(minHeight: 300) } } diff --git a/Harbor/Views/BottleManagementView.swift b/Harbor/Views/BottleManagementView.swift index d467d44..9ab70fa 100644 --- a/Harbor/Views/BottleManagementView.swift +++ b/Harbor/Views/BottleManagementView.swift @@ -19,24 +19,25 @@ struct BottleManagementView: View { @State private var sortOrder = [KeyPathComparator(\HarborBottle.name)] var body: some View { VStack { - Text("home.bottles.title") - .font(.title) - .padding() - - Text("home.bottles.subtitle") - .padding() - .multilineTextAlignment(.center) - } + VStack { + Text("home.bottles.title") + .font(.title) + .padding() + Text("home.bottles.subtitle") + .padding() + .multilineTextAlignment(.center) + } - Table(bottles, selection: $selectedBottle, sortOrder: $sortOrder) { - TableColumn("home.table.name", value: \.name) - TableColumn("home.table.path", value: \.path.relativeString) - TableColumn("home.table.primaryApp", value: \.primaryApplicationPath) - } - .padding() - .frame(minWidth: 500, minHeight: 200) - .onChange(of: sortOrder) { _, newOrder in - bottles.sort(using: newOrder) + Table(bottles, selection: $selectedBottle, sortOrder: $sortOrder) { + TableColumn("home.table.name", value: \.name) + TableColumn("home.table.path", value: \.path.relativeString) + TableColumn("home.table.primaryApp", value: \.primaryApplicationPath) + } + .padding() + .frame(minWidth: 500, minHeight: 200) + .onChange(of: sortOrder) { _, newOrder in + bottles.sort(using: newOrder) + } } .toolbar { ToolbarItem(placement: .automatic) { @@ -104,7 +105,6 @@ struct BottleManagementView: View { alert.accessoryView = checkbox alert.addButton(withTitle: String(localized: "btn.delete")) alert.addButton(withTitle: String(localized: "btn.cancel")) - if alert.runModal() == .alertFirstButtonReturn { // User clicked on "Delete" if let thisBottle = bottles.first(where: { $0.id == selectedBottle }) { @@ -123,7 +123,6 @@ struct BottleManagementView: View { .disabled(selectedBottle == nil) } } - .sheet(isPresented: $showNewBottleSheet) { NewBottleDropdown(isPresented: $showNewBottleSheet, bottle: HarborBottle(id: UUID(), name: "", path: URL(fileURLWithPath: "")))