Skip to content

Commit e520a96

Browse files
committed
Improve the layout of the sidebar
1 parent ab1ebe0 commit e520a96

File tree

7 files changed

+41
-40
lines changed

7 files changed

+41
-40
lines changed

Xcodes/Frontend/MainWindow.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ 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)
23-
.frame(minWidth: 250)
23+
.frame(minWidth: 260)
2424
.layoutPriority(1)
2525
.alert(item: $appState.xcodeBeingConfirmedForUninstallation) { xcode in
2626
Alert(title: Text(String(format: localizeString("Alert.Uninstall.Title"), xcode.description)),

Xcodes/Frontend/XcodeList/MainToolbar.swift

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,25 @@ struct MainToolbarModifier: ViewModifier {
55
@Binding var category: XcodeListCategory
66
@Binding var isInstalledOnly: Bool
77
@Binding var isShowingInfoPane: Bool
8-
8+
@SwiftUI.Environment(\.openWindow) private var openWindow
9+
910
func body(content: Content) -> some View {
1011
content
1112
.toolbar { toolbar }
1213
}
1314

1415
private var toolbar: some ToolbarContent {
1516
ToolbarItemGroup {
16-
1717
ProgressButton(
18-
isInProgress: appState.isUpdating,
18+
isInProgress: appState.isUpdating,
1919
action: appState.update
2020
) {
2121
Label("Refresh", systemImage: "arrow.clockwise")
2222
}
2323
.keyboardShortcut(KeyEquivalent("r"))
2424
.help("RefreshDescription")
2525
Spacer()
26+
2627
Button(action: {
2728
switch category {
2829
case .all: category = .release
@@ -56,7 +57,7 @@ struct MainToolbarModifier: ViewModifier {
5657
}
5758
}
5859
.help("FilterAvailableDescription")
59-
60+
6061
Button(action: {
6162
isInstalledOnly.toggle()
6263
}) {
@@ -65,11 +66,16 @@ struct MainToolbarModifier: ViewModifier {
6566
.foregroundColor(.accentColor)
6667
} else {
6768
Label("Filter", systemImage: "arrow.down.app")
68-
6969
}
7070
}
7171
.help("FilterInstalledDescription")
72-
72+
73+
Button(action: {
74+
openWindow(id: "platforms")
75+
}) {
76+
Label("Platforms", systemImage: "square.3.layers.3d")
77+
}
78+
.help("PlatformsDescription")
7379
}
7480
}
7581
}
@@ -80,7 +86,7 @@ extension View {
8086
isInstalledOnly: Binding<Bool>,
8187
isShowingInfoPane: Binding<Bool>
8288
) -> some View {
83-
self.modifier(
89+
modifier(
8490
MainToolbarModifier(
8591
category: category,
8692
isInstalledOnly: isInstalledOnly,

Xcodes/Frontend/XcodeList/XcodeListView.swift

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -43,32 +43,6 @@ struct XcodeListView: View {
4343
XcodeListViewRow(xcode: xcode, selected: selectedXcodeID == xcode.id, appState: appState)
4444
}
4545
.listStyle(.sidebar)
46-
.safeAreaInset(edge: .bottom, spacing: 0) {
47-
PlatformsPocket()
48-
.padding()
49-
}
50-
}
51-
}
52-
53-
struct PlatformsPocket: View {
54-
@SwiftUI.Environment(\.openWindow) private var openWindow
55-
56-
var body: some View {
57-
Button(action: {
58-
openWindow(id: "platforms") }
59-
) {
60-
VStack(spacing: 5) {
61-
Image(systemName: "square.3.layers.3d")
62-
.font(.title)
63-
Text("Platforms")
64-
.font(.callout)
65-
}
66-
.frame(width: 70, height: 70)
67-
.background(.quaternary)
68-
.clipShape(RoundedRectangle(cornerRadius: 5, style: .continuous))
69-
70-
}
71-
.buttonStyle(.plain)
7246
}
7347
}
7448

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")
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" : "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
@@ -14716,6 +14716,16 @@
1471614716
}
1471714717
}
1471814718
},
14719+
"PlatformsDescription" : {
14720+
"localizations" : {
14721+
"en" : {
14722+
"stringUnit" : {
14723+
"state" : "translated",
14724+
"value" : "Installed platforms"
14725+
}
14726+
}
14727+
}
14728+
},
1471914729
"PlatformsList.Title" : {
1472014730
"extractionState" : "manual",
1472114731
"localizations" : {

0 commit comments

Comments
 (0)