Merge pull request #540 from marlonjames71/InfoPaneTweaks

InfoPane UI Tweaks
This commit is contained in:
Matt Kiazyk 2024-03-22 09:57:20 -05:00 committed by GitHub
commit 45626e2789
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 40 additions and 31 deletions

View file

@ -9,6 +9,16 @@ import struct XCModel.SDKs
struct InfoPane: View {
let xcode: Xcode
var body: some View {
if #available(macOS 14.0, *) {
mainContent
.contentMargins(10, for: .scrollContent)
} else {
mainContent
.padding()
}
}
private var mainContent: some View {
ScrollView(.vertical) {
HStack(alignment: .top) {
VStack {
@ -24,8 +34,7 @@ struct InfoPane: View {
InfoPaneControls(xcode: xcode)
}
.xcodesBackground()
VStack {
Text("Platforms")
.font(.title3)
@ -34,6 +43,7 @@ struct InfoPane: View {
}
.xcodesBackground()
}
.frame(minWidth: 380)
VStack(alignment: .leading) {
ReleaseDateView(date: xcode.releaseDate, url: xcode.releaseNotesURL)
@ -67,13 +77,13 @@ struct InfoPane: View {
#Preview(XcodePreviewName.allCases[4].rawValue) { makePreviewContent(for: 4) }
private func makePreviewContent(for index: Int) -> some View {
let name = XcodePreviewName.allCases[index]
let name = XcodePreviewName.allCases[index]
return InfoPane(xcode: xcodeDict[name]!)
.environmentObject(configure(AppState()) {
$0.allXcodes = [xcodeDict[name]!]
$0.allXcodes = [xcodeDict[name]!]
})
.frame(width: 300, height: 400)
.padding()
.padding()
}
enum XcodePreviewName: String, CaseIterable, Identifiable {
@ -82,7 +92,7 @@ enum XcodePreviewName: String, CaseIterable, Identifiable {
case Populated_Uninstalled
case Basic_Installed
case Basic_Installing
var id: XcodePreviewName { self }
}
@ -164,7 +174,7 @@ var downloadableRuntimes: [DownloadableRuntime] = {
$0.completedUnitCount = 848_444_920
$0.throughput = 9_211_681
}
)
)
)
runtimes[watchOSIndex] = runtime

View file

@ -40,33 +40,33 @@ struct PlatformsView: View {
Text("\(runtime.visibleIdentifier)")
.font(.headline)
pathIfAvailable(xcode: xcode, runtime: runtime)
if runtime.installState == .notInstalled {
// TODO: Update the downloadableRuntimes with the appropriate installState so we don't have to check path awkwardly
if appState.runtimeInstallPath(xcode: xcode, runtime: runtime) != nil {
EmptyView()
} else {
HStack {
Spacer()
DownloadRuntimeButton(runtime: runtime)
}
}
}
Spacer()
Text(runtime.downloadFileSizeString)
.font(.subheadline)
.frame(width: 70, alignment: .trailing)
}
switch runtime.installState {
case .installed:
EmptyView()
case .notInstalled:
// TODO: Update the downloadableRuntimes with the appropriate installState so we don't have to check path awkwardly
if let path = appState.runtimeInstallPath(xcode: xcode, runtime: runtime) {
EmptyView()
} else {
HStack {
Spacer()
DownloadRuntimeButton(runtime: runtime)
}
}
case .installing(let installationStep):
HStack(alignment: .top, spacing: 5){
RuntimeInstallationStepDetailView(installationStep: installationStep)
.fixedSize(horizontal: false, vertical: true)
Spacer()
CancelRuntimeInstallButton(runtime: runtime)
}
}
if case let .installing(installationStep) = runtime.installState {
HStack(alignment: .top, spacing: 5){
RuntimeInstallationStepDetailView(installationStep: installationStep)
.fixedSize(horizontal: false, vertical: true)
Spacer()
CancelRuntimeInstallButton(runtime: runtime)
}
}
}
}

View file

@ -41,7 +41,6 @@ struct MainWindow: View {
UnselectedView()
}
}
.padding()
.toolbar {
ToolbarItemGroup {
Button(action: { appState.presentedSheet = .signIn }, label: {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 263 KiB

After

Width:  |  Height:  |  Size: 224 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 244 KiB

After

Width:  |  Height:  |  Size: 193 KiB