Merge pull request #504 from huihuisang/main

Improve the layout of the sidebar
This commit is contained in:
Matt Kiazyk 2024-03-15 11:23:00 -05:00 committed by GitHub
commit bf0dc9d855
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 60 additions and 26 deletions

View file

@ -26,7 +26,7 @@ struct NavigationSplitViewWrapper<Sidebar, Detail>: View where Sidebar: View, De
if #available(macOS 14, *) {
sidebar
.navigationSplitViewColumnWidth(min: 250, ideal: 300)
.navigationSplitViewColumnWidth(min: 290, ideal: 290)
} else {
sidebar
}
@ -39,7 +39,7 @@ struct NavigationSplitViewWrapper<Sidebar, Detail>: View where Sidebar: View, De
NavigationView {
// The first column is the sidebar.
sidebar
.frame(minWidth: 250)
.frame(minWidth: 300)
detail
}
.navigationViewStyle(.columns)

View file

@ -16,7 +16,7 @@ struct MainWindow: View {
@AppStorage("isShowingInfoPane") private var isShowingInfoPane = false
@AppStorage("xcodeListCategory") private var category: XcodeListCategory = .all
@AppStorage("isInstalledOnly") private var isInstalledOnly = false
var body: some View {
NavigationSplitViewWrapper {
XcodeListView(selectedXcodeID: $selectedXcodeID, searchText: searchText, category: category, isInstalledOnly: isInstalledOnly)

View file

@ -5,7 +5,7 @@ struct MainToolbarModifier: ViewModifier {
@Binding var category: XcodeListCategory
@Binding var isInstalledOnly: Bool
@Binding var isShowingInfoPane: Bool
func body(content: Content) -> some View {
content
.toolbar { toolbar }
@ -13,9 +13,8 @@ struct MainToolbarModifier: ViewModifier {
private var toolbar: some ToolbarContent {
ToolbarItemGroup {
ProgressButton(
isInProgress: appState.isUpdating,
isInProgress: appState.isUpdating,
action: appState.update
) {
Label("Refresh", systemImage: "arrow.clockwise")
@ -23,6 +22,7 @@ struct MainToolbarModifier: ViewModifier {
.keyboardShortcut(KeyEquivalent("r"))
.help("RefreshDescription")
Spacer()
Button(action: {
switch category {
case .all: category = .release
@ -56,7 +56,7 @@ struct MainToolbarModifier: ViewModifier {
}
}
.help("FilterAvailableDescription")
Button(action: {
isInstalledOnly.toggle()
}) {
@ -65,11 +65,9 @@ struct MainToolbarModifier: ViewModifier {
.foregroundColor(.accentColor)
} else {
Label("Filter", systemImage: "arrow.down.app")
}
}
.help("FilterInstalledDescription")
}
}
}
@ -80,7 +78,7 @@ extension View {
isInstalledOnly: Binding<Bool>,
isShowingInfoPane: Binding<Bool>
) -> some View {
self.modifier(
modifier(
MainToolbarModifier(
category: category,
isInstalledOnly: isInstalledOnly,

View file

@ -45,7 +45,8 @@ struct XcodeListView: View {
.listStyle(.sidebar)
.safeAreaInset(edge: .bottom, spacing: 0) {
PlatformsPocket()
.padding()
.padding(.horizontal)
.padding(.vertical, 8)
}
}
}
@ -54,19 +55,21 @@ struct PlatformsPocket: View {
@SwiftUI.Environment(\.openWindow) private var openWindow
var body: some View {
Button(action: {
openWindow(id: "platforms") }
Button(action: {
openWindow(id: "platforms")
}
) {
VStack(spacing: 5) {
HStack(spacing: 5) {
Image(systemName: "square.3.layers.3d")
.font(.title)
Text("Platforms")
.font(.callout)
.font(.title3.weight(.medium))
Text("PlatformsDescription")
}
.frame(width: 70, height: 70)
.background(.quaternary)
.clipShape(RoundedRectangle(cornerRadius: 5, style: .continuous))
.font(.body.weight(.medium))
.padding(.horizontal)
.padding(.vertical, 12)
.frame(maxWidth: .infinity, alignment: .leading)
.background(.quaternary.opacity(0.75))
.clipShape(RoundedRectangle(cornerRadius: 8, style: .continuous))
}
.buttonStyle(.plain)
}

View file

@ -30,9 +30,6 @@ struct XcodeListViewRow: View {
Text(verbatim: path.string)
.font(.caption)
.foregroundColor(.secondary)
} else {
Text(verbatim: "")
.font(.caption)
}
}
@ -42,6 +39,7 @@ struct XcodeListViewRow: View {
.padding(.trailing, 16)
installControl(for: xcode)
}
.padding(.vertical, 4)
.contextMenu {
switch xcode.installState {
case .notInstalled:
@ -75,9 +73,10 @@ struct XcodeListViewRow: View {
if let icon = xcode.icon {
Image(nsImage: icon)
} else {
Color.clear
Image(xcode.version.isPrerelease ? "xcode-beta" : "xcode")
.resizable()
.frame(width: 32, height: 32)
.foregroundColor(.secondary)
.opacity(0.2)
}
}

View file

@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "Image.png",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

View file

@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "xcode.png",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

View file

@ -15542,6 +15542,16 @@
}
}
},
"PlatformsDescription" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Installed Platforms"
}
}
}
},
"PlatformsList.Title" : {
"extractionState" : "manual",
"localizations" : {