Skip to content

Commit 45626e2

Browse files
authored
Merge pull request #540 from marlonjames71/InfoPaneTweaks
InfoPane UI Tweaks
2 parents 9d73cd2 + b9d3705 commit 45626e2

File tree

5 files changed

+40
-31
lines changed

5 files changed

+40
-31
lines changed

Xcodes/Frontend/InfoPane/InfoPane.swift

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,16 @@ import struct XCModel.SDKs
99
struct InfoPane: View {
1010
let xcode: Xcode
1111
var body: some View {
12+
if #available(macOS 14.0, *) {
13+
mainContent
14+
.contentMargins(10, for: .scrollContent)
15+
} else {
16+
mainContent
17+
.padding()
18+
}
19+
}
20+
21+
private var mainContent: some View {
1222
ScrollView(.vertical) {
1323
HStack(alignment: .top) {
1424
VStack {
@@ -24,8 +34,7 @@ struct InfoPane: View {
2434
InfoPaneControls(xcode: xcode)
2535
}
2636
.xcodesBackground()
27-
28-
37+
2938
VStack {
3039
Text("Platforms")
3140
.font(.title3)
@@ -34,6 +43,7 @@ struct InfoPane: View {
3443
}
3544
.xcodesBackground()
3645
}
46+
.frame(minWidth: 380)
3747

3848
VStack(alignment: .leading) {
3949
ReleaseDateView(date: xcode.releaseDate, url: xcode.releaseNotesURL)
@@ -67,13 +77,13 @@ struct InfoPane: View {
6777
#Preview(XcodePreviewName.allCases[4].rawValue) { makePreviewContent(for: 4) }
6878

6979
private func makePreviewContent(for index: Int) -> some View {
70-
let name = XcodePreviewName.allCases[index]
80+
let name = XcodePreviewName.allCases[index]
7181
return InfoPane(xcode: xcodeDict[name]!)
7282
.environmentObject(configure(AppState()) {
73-
$0.allXcodes = [xcodeDict[name]!]
83+
$0.allXcodes = [xcodeDict[name]!]
7484
})
7585
.frame(width: 300, height: 400)
76-
.padding()
86+
.padding()
7787
}
7888

7989
enum XcodePreviewName: String, CaseIterable, Identifiable {
@@ -82,7 +92,7 @@ enum XcodePreviewName: String, CaseIterable, Identifiable {
8292
case Populated_Uninstalled
8393
case Basic_Installed
8494
case Basic_Installing
85-
95+
8696
var id: XcodePreviewName { self }
8797
}
8898

@@ -164,7 +174,7 @@ var downloadableRuntimes: [DownloadableRuntime] = {
164174
$0.completedUnitCount = 848_444_920
165175
$0.throughput = 9_211_681
166176
}
167-
)
177+
)
168178
)
169179
runtimes[watchOSIndex] = runtime
170180

Xcodes/Frontend/InfoPane/PlatformsView.swift

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -40,33 +40,33 @@ struct PlatformsView: View {
4040
Text("\(runtime.visibleIdentifier)")
4141
.font(.headline)
4242
pathIfAvailable(xcode: xcode, runtime: runtime)
43+
44+
if runtime.installState == .notInstalled {
45+
// TODO: Update the downloadableRuntimes with the appropriate installState so we don't have to check path awkwardly
46+
if appState.runtimeInstallPath(xcode: xcode, runtime: runtime) != nil {
47+
EmptyView()
48+
} else {
49+
HStack {
50+
Spacer()
51+
DownloadRuntimeButton(runtime: runtime)
52+
}
53+
}
54+
}
55+
4356
Spacer()
4457
Text(runtime.downloadFileSizeString)
4558
.font(.subheadline)
59+
.frame(width: 70, alignment: .trailing)
4660
}
47-
switch runtime.installState {
48-
case .installed:
49-
EmptyView()
50-
case .notInstalled:
51-
// TODO: Update the downloadableRuntimes with the appropriate installState so we don't have to check path awkwardly
52-
if let path = appState.runtimeInstallPath(xcode: xcode, runtime: runtime) {
53-
EmptyView()
54-
} else {
55-
HStack {
56-
Spacer()
57-
DownloadRuntimeButton(runtime: runtime)
58-
}
59-
}
60-
61-
case .installing(let installationStep):
62-
HStack(alignment: .top, spacing: 5){
63-
RuntimeInstallationStepDetailView(installationStep: installationStep)
64-
.fixedSize(horizontal: false, vertical: true)
65-
Spacer()
66-
CancelRuntimeInstallButton(runtime: runtime)
67-
}
68-
69-
}
61+
62+
if case let .installing(installationStep) = runtime.installState {
63+
HStack(alignment: .top, spacing: 5){
64+
RuntimeInstallationStepDetailView(installationStep: installationStep)
65+
.fixedSize(horizontal: false, vertical: true)
66+
Spacer()
67+
CancelRuntimeInstallButton(runtime: runtime)
68+
}
69+
}
7070
}
7171
}
7272

Xcodes/Frontend/MainWindow.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ struct MainWindow: View {
4141
UnselectedView()
4242
}
4343
}
44-
.padding()
4544
.toolbar {
4645
ToolbarItemGroup {
4746
Button(action: { appState.presentedSheet = .signIn }, label: {

screenshot_dark.png

-38.7 KB
Loading

screenshot_light.png

-50.9 KB
Loading

0 commit comments

Comments
 (0)