Skip to content

Commit bf0dc9d

Browse files
authored
Merge pull request #504 from huihuisang/main
Improve the layout of the sidebar
2 parents 6f432ee + 9a866ac commit bf0dc9d

File tree

10 files changed

+60
-26
lines changed

10 files changed

+60
-26
lines changed

Xcodes/Frontend/Common/NavigationSplitViewWrapper.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ struct NavigationSplitViewWrapper<Sidebar, Detail>: View where Sidebar: View, De
2626

2727
if #available(macOS 14, *) {
2828
sidebar
29-
.navigationSplitViewColumnWidth(min: 250, ideal: 300)
29+
.navigationSplitViewColumnWidth(min: 290, ideal: 290)
3030
} else {
3131
sidebar
3232
}
@@ -39,7 +39,7 @@ struct NavigationSplitViewWrapper<Sidebar, Detail>: View where Sidebar: View, De
3939
NavigationView {
4040
// The first column is the sidebar.
4141
sidebar
42-
.frame(minWidth: 250)
42+
.frame(minWidth: 300)
4343
detail
4444
}
4545
.navigationViewStyle(.columns)

Xcodes/Frontend/MainWindow.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ struct MainWindow: View {
1616
@AppStorage("isShowingInfoPane") private var isShowingInfoPane = false
1717
@AppStorage("xcodeListCategory") private var category: XcodeListCategory = .all
1818
@AppStorage("isInstalledOnly") private var isInstalledOnly = false
19-
19+
2020
var body: some View {
2121
NavigationSplitViewWrapper {
2222
XcodeListView(selectedXcodeID: $selectedXcodeID, searchText: searchText, category: category, isInstalledOnly: isInstalledOnly)

Xcodes/Frontend/XcodeList/MainToolbar.swift

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,24 @@ struct MainToolbarModifier: ViewModifier {
55
@Binding var category: XcodeListCategory
66
@Binding var isInstalledOnly: Bool
77
@Binding var isShowingInfoPane: Bool
8-
8+
99
func body(content: Content) -> some View {
1010
content
1111
.toolbar { toolbar }
1212
}
1313

1414
private var toolbar: some ToolbarContent {
1515
ToolbarItemGroup {
16-
1716
ProgressButton(
18-
isInProgress: appState.isUpdating,
17+
isInProgress: appState.isUpdating,
1918
action: appState.update
2019
) {
2120
Label("Refresh", systemImage: "arrow.clockwise")
2221
}
2322
.keyboardShortcut(KeyEquivalent("r"))
2423
.help("RefreshDescription")
2524
Spacer()
25+
2626
Button(action: {
2727
switch category {
2828
case .all: category = .release
@@ -56,7 +56,7 @@ struct MainToolbarModifier: ViewModifier {
5656
}
5757
}
5858
.help("FilterAvailableDescription")
59-
59+
6060
Button(action: {
6161
isInstalledOnly.toggle()
6262
}) {
@@ -65,11 +65,9 @@ struct MainToolbarModifier: ViewModifier {
6565
.foregroundColor(.accentColor)
6666
} else {
6767
Label("Filter", systemImage: "arrow.down.app")
68-
6968
}
7069
}
7170
.help("FilterInstalledDescription")
72-
7371
}
7472
}
7573
}
@@ -80,7 +78,7 @@ extension View {
8078
isInstalledOnly: Binding<Bool>,
8179
isShowingInfoPane: Binding<Bool>
8280
) -> some View {
83-
self.modifier(
81+
modifier(
8482
MainToolbarModifier(
8583
category: category,
8684
isInstalledOnly: isInstalledOnly,

Xcodes/Frontend/XcodeList/XcodeListView.swift

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ struct XcodeListView: View {
4545
.listStyle(.sidebar)
4646
.safeAreaInset(edge: .bottom, spacing: 0) {
4747
PlatformsPocket()
48-
.padding()
48+
.padding(.horizontal)
49+
.padding(.vertical, 8)
4950
}
5051
}
5152
}
@@ -54,19 +55,21 @@ struct PlatformsPocket: View {
5455
@SwiftUI.Environment(\.openWindow) private var openWindow
5556

5657
var body: some View {
57-
Button(action: {
58-
openWindow(id: "platforms") }
58+
Button(action: {
59+
openWindow(id: "platforms")
60+
}
5961
) {
60-
VStack(spacing: 5) {
62+
HStack(spacing: 5) {
6163
Image(systemName: "square.3.layers.3d")
62-
.font(.title)
63-
Text("Platforms")
64-
.font(.callout)
64+
.font(.title3.weight(.medium))
65+
Text("PlatformsDescription")
6566
}
66-
.frame(width: 70, height: 70)
67-
.background(.quaternary)
68-
.clipShape(RoundedRectangle(cornerRadius: 5, style: .continuous))
69-
67+
.font(.body.weight(.medium))
68+
.padding(.horizontal)
69+
.padding(.vertical, 12)
70+
.frame(maxWidth: .infinity, alignment: .leading)
71+
.background(.quaternary.opacity(0.75))
72+
.clipShape(RoundedRectangle(cornerRadius: 8, style: .continuous))
7073
}
7174
.buttonStyle(.plain)
7275
}

Xcodes/Frontend/XcodeList/XcodeListViewRow.swift

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,6 @@ struct XcodeListViewRow: View {
3030
Text(verbatim: path.string)
3131
.font(.caption)
3232
.foregroundColor(.secondary)
33-
} else {
34-
Text(verbatim: "")
35-
.font(.caption)
3633
}
3734
}
3835

@@ -42,6 +39,7 @@ struct XcodeListViewRow: View {
4239
.padding(.trailing, 16)
4340
installControl(for: xcode)
4441
}
42+
.padding(.vertical, 4)
4543
.contextMenu {
4644
switch xcode.installState {
4745
case .notInstalled:
@@ -75,9 +73,10 @@ struct XcodeListViewRow: View {
7573
if let icon = xcode.icon {
7674
Image(nsImage: icon)
7775
} else {
78-
Color.clear
76+
Image(xcode.version.isPrerelease ? "xcode-beta" : "xcode")
77+
.resizable()
7978
.frame(width: 32, height: 32)
80-
.foregroundColor(.secondary)
79+
.opacity(0.2)
8180
}
8281
}
8382

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"images" : [
3+
{
4+
"filename" : "Image.png",
5+
"idiom" : "universal"
6+
}
7+
],
8+
"info" : {
9+
"author" : "xcode",
10+
"version" : 1
11+
}
12+
}
82.4 KB
Loading
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"images" : [
3+
{
4+
"filename" : "xcode.png",
5+
"idiom" : "universal"
6+
}
7+
],
8+
"info" : {
9+
"author" : "xcode",
10+
"version" : 1
11+
}
12+
}
22.9 KB
Loading

Xcodes/Resources/Localizable.xcstrings

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15542,6 +15542,16 @@
1554215542
}
1554315543
}
1554415544
},
15545+
"PlatformsDescription" : {
15546+
"localizations" : {
15547+
"en" : {
15548+
"stringUnit" : {
15549+
"state" : "translated",
15550+
"value" : "Installed Platforms"
15551+
}
15552+
}
15553+
}
15554+
},
1554515555
"PlatformsList.Title" : {
1554615556
"extractionState" : "manual",
1554715557
"localizations" : {

0 commit comments

Comments
 (0)