Skip to content

Commit

Permalink
Merge pull request #540 from marlonjames71/InfoPaneTweaks
Browse files Browse the repository at this point in the history
InfoPane UI Tweaks
  • Loading branch information
MattKiazyk authored Mar 22, 2024
2 parents 9d73cd2 + b9d3705 commit 45626e2
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 31 deletions.
24 changes: 17 additions & 7 deletions Xcodes/Frontend/InfoPane/InfoPane.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -24,8 +34,7 @@ struct InfoPane: View {
InfoPaneControls(xcode: xcode)
}
.xcodesBackground()



VStack {
Text("Platforms")
.font(.title3)
Expand All @@ -34,6 +43,7 @@ struct InfoPane: View {
}
.xcodesBackground()
}
.frame(minWidth: 380)

VStack(alignment: .leading) {
ReleaseDateView(date: xcode.releaseDate, url: xcode.releaseNotesURL)
Expand Down Expand Up @@ -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 {
Expand All @@ -82,7 +92,7 @@ enum XcodePreviewName: String, CaseIterable, Identifiable {
case Populated_Uninstalled
case Basic_Installed
case Basic_Installing

var id: XcodePreviewName { self }
}

Expand Down Expand Up @@ -164,7 +174,7 @@ var downloadableRuntimes: [DownloadableRuntime] = {
$0.completedUnitCount = 848_444_920
$0.throughput = 9_211_681
}
)
)
)
runtimes[watchOSIndex] = runtime

Expand Down
46 changes: 23 additions & 23 deletions Xcodes/Frontend/InfoPane/PlatformsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
}
}

Expand Down
1 change: 0 additions & 1 deletion Xcodes/Frontend/MainWindow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ struct MainWindow: View {
UnselectedView()
}
}
.padding()
.toolbar {
ToolbarItemGroup {
Button(action: { appState.presentedSheet = .signIn }, label: {
Expand Down
Binary file modified screenshot_dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified screenshot_light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 45626e2

Please sign in to comment.