mirror of
https://github.com/XcodesOrg/XcodesApp.git
synced 2026-03-25 08:55:46 +00:00
Improve the layout of the sidebar
This commit is contained in:
parent
ab1ebe016f
commit
e520a96021
7 changed files with 41 additions and 40 deletions
|
|
@ -16,11 +16,11 @@ 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)
|
||||
.frame(minWidth: 250)
|
||||
.frame(minWidth: 260)
|
||||
.layoutPriority(1)
|
||||
.alert(item: $appState.xcodeBeingConfirmedForUninstallation) { xcode in
|
||||
Alert(title: Text(String(format: localizeString("Alert.Uninstall.Title"), xcode.description)),
|
||||
|
|
|
|||
|
|
@ -5,7 +5,8 @@ struct MainToolbarModifier: ViewModifier {
|
|||
@Binding var category: XcodeListCategory
|
||||
@Binding var isInstalledOnly: Bool
|
||||
@Binding var isShowingInfoPane: Bool
|
||||
|
||||
@SwiftUI.Environment(\.openWindow) private var openWindow
|
||||
|
||||
func body(content: Content) -> some View {
|
||||
content
|
||||
.toolbar { toolbar }
|
||||
|
|
@ -13,9 +14,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 +23,7 @@ struct MainToolbarModifier: ViewModifier {
|
|||
.keyboardShortcut(KeyEquivalent("r"))
|
||||
.help("RefreshDescription")
|
||||
Spacer()
|
||||
|
||||
Button(action: {
|
||||
switch category {
|
||||
case .all: category = .release
|
||||
|
|
@ -56,7 +57,7 @@ struct MainToolbarModifier: ViewModifier {
|
|||
}
|
||||
}
|
||||
.help("FilterAvailableDescription")
|
||||
|
||||
|
||||
Button(action: {
|
||||
isInstalledOnly.toggle()
|
||||
}) {
|
||||
|
|
@ -65,11 +66,16 @@ struct MainToolbarModifier: ViewModifier {
|
|||
.foregroundColor(.accentColor)
|
||||
} else {
|
||||
Label("Filter", systemImage: "arrow.down.app")
|
||||
|
||||
}
|
||||
}
|
||||
.help("FilterInstalledDescription")
|
||||
|
||||
|
||||
Button(action: {
|
||||
openWindow(id: "platforms")
|
||||
}) {
|
||||
Label("Platforms", systemImage: "square.3.layers.3d")
|
||||
}
|
||||
.help("PlatformsDescription")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -80,7 +86,7 @@ extension View {
|
|||
isInstalledOnly: Binding<Bool>,
|
||||
isShowingInfoPane: Binding<Bool>
|
||||
) -> some View {
|
||||
self.modifier(
|
||||
modifier(
|
||||
MainToolbarModifier(
|
||||
category: category,
|
||||
isInstalledOnly: isInstalledOnly,
|
||||
|
|
|
|||
|
|
@ -43,32 +43,6 @@ struct XcodeListView: View {
|
|||
XcodeListViewRow(xcode: xcode, selected: selectedXcodeID == xcode.id, appState: appState)
|
||||
}
|
||||
.listStyle(.sidebar)
|
||||
.safeAreaInset(edge: .bottom, spacing: 0) {
|
||||
PlatformsPocket()
|
||||
.padding()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct PlatformsPocket: View {
|
||||
@SwiftUI.Environment(\.openWindow) private var openWindow
|
||||
|
||||
var body: some View {
|
||||
Button(action: {
|
||||
openWindow(id: "platforms") }
|
||||
) {
|
||||
VStack(spacing: 5) {
|
||||
Image(systemName: "square.3.layers.3d")
|
||||
.font(.title)
|
||||
Text("Platforms")
|
||||
.font(.callout)
|
||||
}
|
||||
.frame(width: 70, height: 70)
|
||||
.background(.quaternary)
|
||||
.clipShape(RoundedRectangle(cornerRadius: 5, style: .continuous))
|
||||
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
.resizable()
|
||||
.frame(width: 32, height: 32)
|
||||
.foregroundColor(.secondary)
|
||||
.opacity(0.2)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
12
Xcodes/Resources/Assets.xcassets/xcode.imageset/Contents.json
vendored
Normal file
12
Xcodes/Resources/Assets.xcassets/xcode.imageset/Contents.json
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "xcode.png",
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
BIN
Xcodes/Resources/Assets.xcassets/xcode.imageset/xcode.png
vendored
Normal file
BIN
Xcodes/Resources/Assets.xcassets/xcode.imageset/xcode.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 23 KiB |
|
|
@ -14716,6 +14716,16 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"PlatformsDescription" : {
|
||||
"localizations" : {
|
||||
"en" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "Installed platforms"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"PlatformsList.Title" : {
|
||||
"extractionState" : "manual",
|
||||
"localizations" : {
|
||||
|
|
|
|||
Loading…
Reference in a new issue