From f4d776688b0574f75c1b5a99684512d8f682cc7a Mon Sep 17 00:00:00 2001 From: Stuart Breckenridge Date: Mon, 13 Jul 2020 22:29:33 +0800 Subject: [PATCH] Toolbar is in a much better shape. --- .../Preferences/MacPreferencesView.swift | 60 +++++++++++-------- .../Accounts/AccountsPreferenceModel.swift | 10 +--- 2 files changed, 38 insertions(+), 32 deletions(-) diff --git a/Multiplatform/macOS/Preferences/MacPreferencesView.swift b/Multiplatform/macOS/Preferences/MacPreferencesView.swift index ceb8bcdd3..0e1ce4b15 100644 --- a/Multiplatform/macOS/Preferences/MacPreferencesView.swift +++ b/Multiplatform/macOS/Preferences/MacPreferencesView.swift @@ -29,33 +29,43 @@ struct MacPreferencesView: View { } .toolbar { ToolbarItem { - Button(action: { - viewModel.currentPreferencePane = .general - }, label: { - Image(systemName: "checkmark.rectangle") - Text("General") - }) - } - ToolbarItem { - Button(action: { - viewModel.currentPreferencePane = .accounts - }, label: { - Image(systemName: "network") - Text("Accounts") - }) - } - ToolbarItem { - Button(action: { - viewModel.currentPreferencePane = .advanced - }, label: { - Image(systemName: "gearshape.fill") - Text("Advanced") - }) + HStack { + Button(action: { + viewModel.currentPreferencePane = .general + }, label: { + VStack { + Image(systemName: "gearshape") + .font(.title2) + Text("General") + }.foregroundColor( + viewModel.currentPreferencePane == .general ? Color("AccentColor") : Color.gray + ) + }) + Button(action: { + viewModel.currentPreferencePane = .accounts + }, label: { + VStack { + Image(systemName: "at") + .font(.title2) + Text("Accounts") + }.foregroundColor( + viewModel.currentPreferencePane == .accounts ? Color("AccentColor") : Color.gray + ) + }) + Button(action: { + viewModel.currentPreferencePane = .advanced + }, label: { + VStack { + Image(systemName: "scale.3d") + .font(.title2) + Text("Advanced") + }.foregroundColor( + viewModel.currentPreferencePane == .advanced ? Color("AccentColor") : Color.gray + ) + }) + } } } - .presentedWindowToolbarStyle(UnifiedCompactWindowToolbarStyle()) - .presentedWindowStyle(TitleBarWindowStyle()) - .navigationTitle(Text(viewModel.currentPreferencePane.description)) } } diff --git a/Multiplatform/macOS/Preferences/Preference Panes/Accounts/AccountsPreferenceModel.swift b/Multiplatform/macOS/Preferences/Preference Panes/Accounts/AccountsPreferenceModel.swift index 79b751be3..31167cb53 100644 --- a/Multiplatform/macOS/Preferences/Preference Panes/Accounts/AccountsPreferenceModel.swift +++ b/Multiplatform/macOS/Preferences/Preference Panes/Accounts/AccountsPreferenceModel.swift @@ -14,11 +14,7 @@ class AccountsPreferenceModel: ObservableObject { @Published var sortedAccounts: [Account] = [] - - // Configured Accounts @Published var selectedConfiguredAccountID: String? = nil - - // Sheets @Published var showAddAccountView: Bool = false var selectedAccountIsDefault: Bool { @@ -32,19 +28,19 @@ class AccountsPreferenceModel: ObservableObject { } // Subscriptions - var notifcationSubscriptions = Set() + var notificationSubscriptions = Set() init() { sortedAccounts = AccountManager.shared.sortedAccounts NotificationCenter.default.publisher(for: .UserDidAddAccount).sink(receiveValue: { _ in self.sortedAccounts = AccountManager.shared.sortedAccounts - }).store(in: ¬ifcationSubscriptions) + }).store(in: ¬ificationSubscriptions) NotificationCenter.default.publisher(for: .UserDidDeleteAccount).sink(receiveValue: { _ in self.selectedConfiguredAccountID = nil self.sortedAccounts = AccountManager.shared.sortedAccounts - }).store(in: ¬ifcationSubscriptions) + }).store(in: ¬ificationSubscriptions) } }