Move to just two panes on mac for now

This commit is contained in:
Jackson Harper
2023-05-31 13:49:31 +08:00
parent b482e20d0a
commit dfc3a890e7
4 changed files with 35 additions and 11 deletions

View File

@ -9,10 +9,11 @@ import Views
)
@AppStorage(UserDefaultKey.preferredWebLineSpacing.rawValue) var storedLineSpacing = 150
@AppStorage(UserDefaultKey.preferredWebMaxWidthPercentage.rawValue) var storedMaxWidthPercentage = 100
@AppStorage(UserDefaultKey.enableHighlightOnRelease.rawValue) var enableHighlightOnRelease = false
@Binding var preferredFont: String
@Binding var prefersHighContrastText: Bool
@Binding var justifyText: Bool
@Binding var currentThemeName: String
public var fontSizeButtons: some View {
Group {
@ -85,10 +86,14 @@ import Views
public init(
preferredFont: Binding<String>,
prefersHighContrastText: Binding<Bool>
prefersHighContrastText: Binding<Bool>,
justifyText: Binding<Bool>,
currentThemeName: Binding<String>
) {
self._preferredFont = preferredFont
self._prefersHighContrastText = prefersHighContrastText
self._justifyText = justifyText
self._currentThemeName = currentThemeName
}
public var body: some Commands {
@ -111,14 +116,22 @@ import Views
}
}
Picker(selection: $currentThemeName, label: Text("Theme")) {
ForEach(Theme.allCases, id: \.self) { theme in
Text(theme.rawValue).tag(theme.rawValue).tag(theme.rawValue)
}
}.onChange(of: currentThemeName) { _ in
NSNotification.readerSettingsChanged()
}
Toggle(
isOn: $prefersHighContrastText,
label: { Text(LocalText.genericHighContrastText) }
)
Toggle(
isOn: $enableHighlightOnRelease,
label: { Text(LocalText.genericHighContrastText) }
isOn: $justifyText,
label: { Text(LocalText.enableJustifyText) }
)
}
}

View File

@ -35,6 +35,8 @@ import Views
}
}
List {
Spacer(minLength: 10)
ForEach(viewModel.items) { item in
MacFeedCardNavigationLink(
item: item,

View File

@ -1,4 +1,6 @@
import SwiftUI
import Utils
import Views
struct HomeView: View {
@StateObject private var viewModel = HomeFeedViewModel()
@ -22,6 +24,20 @@ struct HomeView: View {
}
#elseif os(macOS)
HomeFeedView(viewModel: viewModel)
.frame(minWidth: 320)
.toolbar {
ToolbarItem {
Button(
action: {
NSApp.keyWindow?.firstResponder?.tryToPerform(
#selector(NSSplitViewController.toggleSidebar(_:)), with: nil
)
},
label: { Label(LocalText.navigationSelectSidebarToggle, systemImage: "sidebar.left") }
)
}
}
#endif
}
}

View File

@ -24,14 +24,7 @@ public struct PrimaryContentView: View {
#if os(macOS)
private var splitView: some View {
NavigationView {
// The first column is the sidebar.
PrimaryContentSidebar(categories: categories)
.navigationTitle("Categories")
// Second column is the Primary Nav Stack
PrimaryContentCategory.feed.destinationView
// Third column is the detail view
Text(LocalText.navigationSelectLink)
}
.accentColor(.appGrayTextContrast)