mirror of
https://github.com/XcodesOrg/XcodesApp.git
synced 2026-04-26 14:57:37 +00:00
Merge pull request #504 from huihuisang/main
Improve the layout of the sidebar
This commit is contained in:
commit
bf0dc9d855
10 changed files with 60 additions and 26 deletions
|
|
@ -26,7 +26,7 @@ struct NavigationSplitViewWrapper<Sidebar, Detail>: View where Sidebar: View, De
|
||||||
|
|
||||||
if #available(macOS 14, *) {
|
if #available(macOS 14, *) {
|
||||||
sidebar
|
sidebar
|
||||||
.navigationSplitViewColumnWidth(min: 250, ideal: 300)
|
.navigationSplitViewColumnWidth(min: 290, ideal: 290)
|
||||||
} else {
|
} else {
|
||||||
sidebar
|
sidebar
|
||||||
}
|
}
|
||||||
|
|
@ -39,7 +39,7 @@ struct NavigationSplitViewWrapper<Sidebar, Detail>: View where Sidebar: View, De
|
||||||
NavigationView {
|
NavigationView {
|
||||||
// The first column is the sidebar.
|
// The first column is the sidebar.
|
||||||
sidebar
|
sidebar
|
||||||
.frame(minWidth: 250)
|
.frame(minWidth: 300)
|
||||||
detail
|
detail
|
||||||
}
|
}
|
||||||
.navigationViewStyle(.columns)
|
.navigationViewStyle(.columns)
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ struct MainWindow: View {
|
||||||
@AppStorage("isShowingInfoPane") private var isShowingInfoPane = false
|
@AppStorage("isShowingInfoPane") private var isShowingInfoPane = false
|
||||||
@AppStorage("xcodeListCategory") private var category: XcodeListCategory = .all
|
@AppStorage("xcodeListCategory") private var category: XcodeListCategory = .all
|
||||||
@AppStorage("isInstalledOnly") private var isInstalledOnly = false
|
@AppStorage("isInstalledOnly") private var isInstalledOnly = false
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
NavigationSplitViewWrapper {
|
NavigationSplitViewWrapper {
|
||||||
XcodeListView(selectedXcodeID: $selectedXcodeID, searchText: searchText, category: category, isInstalledOnly: isInstalledOnly)
|
XcodeListView(selectedXcodeID: $selectedXcodeID, searchText: searchText, category: category, isInstalledOnly: isInstalledOnly)
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ struct MainToolbarModifier: ViewModifier {
|
||||||
@Binding var category: XcodeListCategory
|
@Binding var category: XcodeListCategory
|
||||||
@Binding var isInstalledOnly: Bool
|
@Binding var isInstalledOnly: Bool
|
||||||
@Binding var isShowingInfoPane: Bool
|
@Binding var isShowingInfoPane: Bool
|
||||||
|
|
||||||
func body(content: Content) -> some View {
|
func body(content: Content) -> some View {
|
||||||
content
|
content
|
||||||
.toolbar { toolbar }
|
.toolbar { toolbar }
|
||||||
|
|
@ -13,9 +13,8 @@ struct MainToolbarModifier: ViewModifier {
|
||||||
|
|
||||||
private var toolbar: some ToolbarContent {
|
private var toolbar: some ToolbarContent {
|
||||||
ToolbarItemGroup {
|
ToolbarItemGroup {
|
||||||
|
|
||||||
ProgressButton(
|
ProgressButton(
|
||||||
isInProgress: appState.isUpdating,
|
isInProgress: appState.isUpdating,
|
||||||
action: appState.update
|
action: appState.update
|
||||||
) {
|
) {
|
||||||
Label("Refresh", systemImage: "arrow.clockwise")
|
Label("Refresh", systemImage: "arrow.clockwise")
|
||||||
|
|
@ -23,6 +22,7 @@ struct MainToolbarModifier: ViewModifier {
|
||||||
.keyboardShortcut(KeyEquivalent("r"))
|
.keyboardShortcut(KeyEquivalent("r"))
|
||||||
.help("RefreshDescription")
|
.help("RefreshDescription")
|
||||||
Spacer()
|
Spacer()
|
||||||
|
|
||||||
Button(action: {
|
Button(action: {
|
||||||
switch category {
|
switch category {
|
||||||
case .all: category = .release
|
case .all: category = .release
|
||||||
|
|
@ -56,7 +56,7 @@ struct MainToolbarModifier: ViewModifier {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.help("FilterAvailableDescription")
|
.help("FilterAvailableDescription")
|
||||||
|
|
||||||
Button(action: {
|
Button(action: {
|
||||||
isInstalledOnly.toggle()
|
isInstalledOnly.toggle()
|
||||||
}) {
|
}) {
|
||||||
|
|
@ -65,11 +65,9 @@ struct MainToolbarModifier: ViewModifier {
|
||||||
.foregroundColor(.accentColor)
|
.foregroundColor(.accentColor)
|
||||||
} else {
|
} else {
|
||||||
Label("Filter", systemImage: "arrow.down.app")
|
Label("Filter", systemImage: "arrow.down.app")
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.help("FilterInstalledDescription")
|
.help("FilterInstalledDescription")
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -80,7 +78,7 @@ extension View {
|
||||||
isInstalledOnly: Binding<Bool>,
|
isInstalledOnly: Binding<Bool>,
|
||||||
isShowingInfoPane: Binding<Bool>
|
isShowingInfoPane: Binding<Bool>
|
||||||
) -> some View {
|
) -> some View {
|
||||||
self.modifier(
|
modifier(
|
||||||
MainToolbarModifier(
|
MainToolbarModifier(
|
||||||
category: category,
|
category: category,
|
||||||
isInstalledOnly: isInstalledOnly,
|
isInstalledOnly: isInstalledOnly,
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,8 @@ struct XcodeListView: View {
|
||||||
.listStyle(.sidebar)
|
.listStyle(.sidebar)
|
||||||
.safeAreaInset(edge: .bottom, spacing: 0) {
|
.safeAreaInset(edge: .bottom, spacing: 0) {
|
||||||
PlatformsPocket()
|
PlatformsPocket()
|
||||||
.padding()
|
.padding(.horizontal)
|
||||||
|
.padding(.vertical, 8)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -54,19 +55,21 @@ struct PlatformsPocket: View {
|
||||||
@SwiftUI.Environment(\.openWindow) private var openWindow
|
@SwiftUI.Environment(\.openWindow) private var openWindow
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
Button(action: {
|
Button(action: {
|
||||||
openWindow(id: "platforms") }
|
openWindow(id: "platforms")
|
||||||
|
}
|
||||||
) {
|
) {
|
||||||
VStack(spacing: 5) {
|
HStack(spacing: 5) {
|
||||||
Image(systemName: "square.3.layers.3d")
|
Image(systemName: "square.3.layers.3d")
|
||||||
.font(.title)
|
.font(.title3.weight(.medium))
|
||||||
Text("Platforms")
|
Text("PlatformsDescription")
|
||||||
.font(.callout)
|
|
||||||
}
|
}
|
||||||
.frame(width: 70, height: 70)
|
.font(.body.weight(.medium))
|
||||||
.background(.quaternary)
|
.padding(.horizontal)
|
||||||
.clipShape(RoundedRectangle(cornerRadius: 5, style: .continuous))
|
.padding(.vertical, 12)
|
||||||
|
.frame(maxWidth: .infinity, alignment: .leading)
|
||||||
|
.background(.quaternary.opacity(0.75))
|
||||||
|
.clipShape(RoundedRectangle(cornerRadius: 8, style: .continuous))
|
||||||
}
|
}
|
||||||
.buttonStyle(.plain)
|
.buttonStyle(.plain)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,9 +30,6 @@ struct XcodeListViewRow: View {
|
||||||
Text(verbatim: path.string)
|
Text(verbatim: path.string)
|
||||||
.font(.caption)
|
.font(.caption)
|
||||||
.foregroundColor(.secondary)
|
.foregroundColor(.secondary)
|
||||||
} else {
|
|
||||||
Text(verbatim: "")
|
|
||||||
.font(.caption)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -42,6 +39,7 @@ struct XcodeListViewRow: View {
|
||||||
.padding(.trailing, 16)
|
.padding(.trailing, 16)
|
||||||
installControl(for: xcode)
|
installControl(for: xcode)
|
||||||
}
|
}
|
||||||
|
.padding(.vertical, 4)
|
||||||
.contextMenu {
|
.contextMenu {
|
||||||
switch xcode.installState {
|
switch xcode.installState {
|
||||||
case .notInstalled:
|
case .notInstalled:
|
||||||
|
|
@ -75,9 +73,10 @@ struct XcodeListViewRow: View {
|
||||||
if let icon = xcode.icon {
|
if let icon = xcode.icon {
|
||||||
Image(nsImage: icon)
|
Image(nsImage: icon)
|
||||||
} else {
|
} else {
|
||||||
Color.clear
|
Image(xcode.version.isPrerelease ? "xcode-beta" : "xcode")
|
||||||
|
.resizable()
|
||||||
.frame(width: 32, height: 32)
|
.frame(width: 32, height: 32)
|
||||||
.foregroundColor(.secondary)
|
.opacity(0.2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
12
Xcodes/Resources/Assets.xcassets/xcode-beta.imageset/Contents.json
vendored
Normal file
12
Xcodes/Resources/Assets.xcassets/xcode-beta.imageset/Contents.json
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
{
|
||||||
|
"images" : [
|
||||||
|
{
|
||||||
|
"filename" : "Image.png",
|
||||||
|
"idiom" : "universal"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info" : {
|
||||||
|
"author" : "xcode",
|
||||||
|
"version" : 1
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
Xcodes/Resources/Assets.xcassets/xcode-beta.imageset/Image.png
vendored
Normal file
BIN
Xcodes/Resources/Assets.xcassets/xcode-beta.imageset/Image.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 82 KiB |
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 |
|
|
@ -15542,6 +15542,16 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"PlatformsDescription" : {
|
||||||
|
"localizations" : {
|
||||||
|
"en" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "translated",
|
||||||
|
"value" : "Installed Platforms"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"PlatformsList.Title" : {
|
"PlatformsList.Title" : {
|
||||||
"extractionState" : "manual",
|
"extractionState" : "manual",
|
||||||
"localizations" : {
|
"localizations" : {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue