Toolbar is in a much better shape.
This commit is contained in:
parent
122249d716
commit
f4d776688b
|
@ -29,33 +29,43 @@ struct MacPreferencesView: View {
|
||||||
}
|
}
|
||||||
.toolbar {
|
.toolbar {
|
||||||
ToolbarItem {
|
ToolbarItem {
|
||||||
|
HStack {
|
||||||
Button(action: {
|
Button(action: {
|
||||||
viewModel.currentPreferencePane = .general
|
viewModel.currentPreferencePane = .general
|
||||||
}, label: {
|
}, label: {
|
||||||
Image(systemName: "checkmark.rectangle")
|
VStack {
|
||||||
|
Image(systemName: "gearshape")
|
||||||
|
.font(.title2)
|
||||||
Text("General")
|
Text("General")
|
||||||
|
}.foregroundColor(
|
||||||
|
viewModel.currentPreferencePane == .general ? Color("AccentColor") : Color.gray
|
||||||
|
)
|
||||||
})
|
})
|
||||||
}
|
|
||||||
ToolbarItem {
|
|
||||||
Button(action: {
|
Button(action: {
|
||||||
viewModel.currentPreferencePane = .accounts
|
viewModel.currentPreferencePane = .accounts
|
||||||
}, label: {
|
}, label: {
|
||||||
Image(systemName: "network")
|
VStack {
|
||||||
|
Image(systemName: "at")
|
||||||
|
.font(.title2)
|
||||||
Text("Accounts")
|
Text("Accounts")
|
||||||
|
}.foregroundColor(
|
||||||
|
viewModel.currentPreferencePane == .accounts ? Color("AccentColor") : Color.gray
|
||||||
|
)
|
||||||
})
|
})
|
||||||
}
|
|
||||||
ToolbarItem {
|
|
||||||
Button(action: {
|
Button(action: {
|
||||||
viewModel.currentPreferencePane = .advanced
|
viewModel.currentPreferencePane = .advanced
|
||||||
}, label: {
|
}, label: {
|
||||||
Image(systemName: "gearshape.fill")
|
VStack {
|
||||||
|
Image(systemName: "scale.3d")
|
||||||
|
.font(.title2)
|
||||||
Text("Advanced")
|
Text("Advanced")
|
||||||
|
}.foregroundColor(
|
||||||
|
viewModel.currentPreferencePane == .advanced ? Color("AccentColor") : Color.gray
|
||||||
|
)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.presentedWindowToolbarStyle(UnifiedCompactWindowToolbarStyle())
|
}
|
||||||
.presentedWindowStyle(TitleBarWindowStyle())
|
|
||||||
.navigationTitle(Text(viewModel.currentPreferencePane.description))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,11 +14,7 @@ class AccountsPreferenceModel: ObservableObject {
|
||||||
|
|
||||||
|
|
||||||
@Published var sortedAccounts: [Account] = []
|
@Published var sortedAccounts: [Account] = []
|
||||||
|
|
||||||
// Configured Accounts
|
|
||||||
@Published var selectedConfiguredAccountID: String? = nil
|
@Published var selectedConfiguredAccountID: String? = nil
|
||||||
|
|
||||||
// Sheets
|
|
||||||
@Published var showAddAccountView: Bool = false
|
@Published var showAddAccountView: Bool = false
|
||||||
|
|
||||||
var selectedAccountIsDefault: Bool {
|
var selectedAccountIsDefault: Bool {
|
||||||
|
@ -32,19 +28,19 @@ class AccountsPreferenceModel: ObservableObject {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Subscriptions
|
// Subscriptions
|
||||||
var notifcationSubscriptions = Set<AnyCancellable>()
|
var notificationSubscriptions = Set<AnyCancellable>()
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
sortedAccounts = AccountManager.shared.sortedAccounts
|
sortedAccounts = AccountManager.shared.sortedAccounts
|
||||||
|
|
||||||
NotificationCenter.default.publisher(for: .UserDidAddAccount).sink(receiveValue: { _ in
|
NotificationCenter.default.publisher(for: .UserDidAddAccount).sink(receiveValue: { _ in
|
||||||
self.sortedAccounts = AccountManager.shared.sortedAccounts
|
self.sortedAccounts = AccountManager.shared.sortedAccounts
|
||||||
}).store(in: ¬ifcationSubscriptions)
|
}).store(in: ¬ificationSubscriptions)
|
||||||
|
|
||||||
NotificationCenter.default.publisher(for: .UserDidDeleteAccount).sink(receiveValue: { _ in
|
NotificationCenter.default.publisher(for: .UserDidDeleteAccount).sink(receiveValue: { _ in
|
||||||
self.selectedConfiguredAccountID = nil
|
self.selectedConfiguredAccountID = nil
|
||||||
self.sortedAccounts = AccountManager.shared.sortedAccounts
|
self.sortedAccounts = AccountManager.shared.sortedAccounts
|
||||||
}).store(in: ¬ifcationSubscriptions)
|
}).store(in: ¬ificationSubscriptions)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue