From 22894e2d6dd9402b5424d01da7246fbc88af1b5b Mon Sep 17 00:00:00 2001 From: Brandon Evans Date: Thu, 18 Feb 2021 19:20:08 -0700 Subject: [PATCH] Move installation step beside cancel button in info pane --- Xcodes/Frontend/InfoPane/InfoPane.swift | 80 ++++++++++--------------- 1 file changed, 32 insertions(+), 48 deletions(-) diff --git a/Xcodes/Frontend/InfoPane/InfoPane.swift b/Xcodes/Frontend/InfoPane/InfoPane.swift index 0a8cf03..93b7627 100644 --- a/Xcodes/Frontend/InfoPane/InfoPane.swift +++ b/Xcodes/Frontend/InfoPane/InfoPane.swift @@ -13,44 +13,46 @@ struct InfoPane: View { var body: some View { if let xcode = appState.allXcodes.first(where: { $0.id == selectedXcodeID }) { ScrollView { - VStack(spacing: 16) { + VStack(alignment: .leading, spacing: 16) { icon(for: xcode) + .frame(maxWidth: .infinity, alignment: .center) + + Text(verbatim: "Xcode \(xcode.description) \(xcode.version.buildMetadataIdentifiersDisplay)") + .font(.title) - VStack(alignment: .leading) { - Text(verbatim: "Xcode \(xcode.description) \(xcode.version.buildMetadataIdentifiersDisplay)") - .font(.title) - .frame(maxWidth: .infinity, alignment: .leading) + switch xcode.installState { + case .notInstalled: + InstallButton(xcode: xcode) + downloadFileSize(for: xcode) + case .installing(let installationStep): + InstallationStepDetailView(installationStep: installationStep) + .fixedSize(horizontal: false, vertical: true) + CancelInstallButton(xcode: xcode) + case let .installed(path): + HStack { + Text(path.string) + Button(action: { appState.reveal(id: xcode.id) }) { + Image(systemName: "arrow.right.circle.fill") + } + .buttonStyle(PlainButtonStyle()) + .help("Reveal in Finder") + } - switch xcode.installState { - case .notInstalled: - InstallButton(xcode: xcode) - case .installing: - CancelInstallButton(xcode: xcode) - case let .installed(path): - HStack { - Text(path.string) - Button(action: { appState.reveal(id: xcode.id) }) { - Image(systemName: "arrow.right.circle.fill") - } - .buttonStyle(PlainButtonStyle()) - .help("Reveal in Finder") - } + HStack { + SelectButton(xcode: xcode) + .disabled(xcode.selected) + .help("Selected") - HStack { - SelectButton(xcode: xcode) - .disabled(xcode.selected) - .help("Selected") - - OpenButton(xcode: xcode) - .help("Open") - - Spacer() - UninstallButton(xcode: xcode) - } + OpenButton(xcode: xcode) + .help("Open") + + Spacer() + UninstallButton(xcode: xcode) } } Divider() + Group{ releaseNotes(for: xcode) identicalBuilds(for: xcode) @@ -58,10 +60,6 @@ struct InfoPane: View { sdks(for: xcode) compilers(for: xcode) } - Group { - downloadFileSize(for: xcode) - downloadStats(for: xcode) - } Spacer() } @@ -214,20 +212,6 @@ struct InfoPane: View { } } - @ViewBuilder - private func downloadStats(for xcode: Xcode) -> some View { - switch xcode.installState { - case let .installing(installationStep): - Divider() - InstallationStepDetailView( - installationStep: installationStep - ) - default: - EmptyView() - } - - } - @ViewBuilder private var empty: some View { Text("No Xcode Selected")