|
@@ -4652,7 +4652,7 @@ class ViewController: NSViewController {
|
|
|
homeSidebarRowViews = [:]
|
|
homeSidebarRowViews = [:]
|
|
|
homeSidebarIconViews = [:]
|
|
homeSidebarIconViews = [:]
|
|
|
homeSidebarLabels = [:]
|
|
homeSidebarLabels = [:]
|
|
|
- let sidebar = makeSidebar(items: ["Home", "Meetings", "Scheduler"], selected: selectedHomeSidebarItem, style: .home)
|
|
|
|
|
|
|
+ let sidebar = makeSidebar(items: ["Home", "Meetings", "Scheduler", "Settings"], selected: selectedHomeSidebarItem, style: .home)
|
|
|
let content = NSView()
|
|
let content = NSView()
|
|
|
content.wantsLayer = true
|
|
content.wantsLayer = true
|
|
|
content.layer?.backgroundColor = NSColor.clear.cgColor
|
|
content.layer?.backgroundColor = NSColor.clear.cgColor
|
|
@@ -5777,7 +5777,10 @@ class ViewController: NSViewController {
|
|
|
iconView.contentTintColor = selectedRow ? primaryText : secondaryText
|
|
iconView.contentTintColor = selectedRow ? primaryText : secondaryText
|
|
|
iconView.imageScaling = .scaleProportionallyUpOrDown
|
|
iconView.imageScaling = .scaleProportionallyUpOrDown
|
|
|
iconView.symbolConfiguration = NSImage.SymbolConfiguration(pointSize: 20, weight: .regular)
|
|
iconView.symbolConfiguration = NSImage.SymbolConfiguration(pointSize: 20, weight: .regular)
|
|
|
- iconView.image = NSImage(systemSymbolName: sidebarSymbolName(for: item, filled: selectedRow), accessibilityDescription: item)
|
|
|
|
|
|
|
+ let preferredSymbol = sidebarSymbolName(for: item, filled: selectedRow)
|
|
|
|
|
+ let fallbackSymbol = sidebarSymbolName(for: item, filled: false)
|
|
|
|
|
+ iconView.image = NSImage(systemSymbolName: preferredSymbol, accessibilityDescription: item)
|
|
|
|
|
+ ?? NSImage(systemSymbolName: fallbackSymbol, accessibilityDescription: item)
|
|
|
iconContainer.addSubview(iconView)
|
|
iconContainer.addSubview(iconView)
|
|
|
|
|
|
|
|
let label = makeLabel(item, size: 10, color: selectedRow ? primaryText : secondaryText, weight: .regular, centered: true)
|
|
let label = makeLabel(item, size: 10, color: selectedRow ? primaryText : secondaryText, weight: .regular, centered: true)
|
|
@@ -5856,78 +5859,6 @@ class ViewController: NSViewController {
|
|
|
}
|
|
}
|
|
|
stack.addArrangedSubview(row)
|
|
stack.addArrangedSubview(row)
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- if style == .home {
|
|
|
|
|
- let spacer = NSView()
|
|
|
|
|
- spacer.translatesAutoresizingMaskIntoConstraints = false
|
|
|
|
|
- // Keep Settings in a stable position (no vertical shifting on resize).
|
|
|
|
|
- spacer.heightAnchor.constraint(equalToConstant: 12).isActive = true
|
|
|
|
|
- spacer.setContentHuggingPriority(.required, for: .vertical)
|
|
|
|
|
- spacer.setContentCompressionResistancePriority(.required, for: .vertical)
|
|
|
|
|
- stack.addArrangedSubview(spacer)
|
|
|
|
|
-
|
|
|
|
|
- let settingsRow = NSView()
|
|
|
|
|
- settingsRow.translatesAutoresizingMaskIntoConstraints = false
|
|
|
|
|
- settingsRow.wantsLayer = true
|
|
|
|
|
- let settingsSelected = selected == "Settings"
|
|
|
|
|
- settingsRow.layer?.backgroundColor = settingsSelected ? sidebarActiveBackground.withAlphaComponent(0.95).cgColor : NSColor.clear.cgColor
|
|
|
|
|
- settingsRow.layer?.cornerRadius = 12
|
|
|
|
|
- settingsRow.widthAnchor.constraint(equalToConstant: 68).isActive = true
|
|
|
|
|
- settingsRow.heightAnchor.constraint(equalToConstant: 66).isActive = true
|
|
|
|
|
-
|
|
|
|
|
- let iconContainer = NSView()
|
|
|
|
|
- iconContainer.translatesAutoresizingMaskIntoConstraints = false
|
|
|
|
|
- settingsRow.addSubview(iconContainer)
|
|
|
|
|
-
|
|
|
|
|
- let iconView = NSImageView()
|
|
|
|
|
- iconView.translatesAutoresizingMaskIntoConstraints = false
|
|
|
|
|
- iconView.contentTintColor = settingsSelected ? primaryText : secondaryText
|
|
|
|
|
- iconView.imageScaling = .scaleProportionallyUpOrDown
|
|
|
|
|
- iconView.symbolConfiguration = NSImage.SymbolConfiguration(pointSize: 20, weight: .regular)
|
|
|
|
|
- let settingsSymbolPreferred = settingsSelected ? "gearshape.fill" : "gearshape"
|
|
|
|
|
- iconView.image = NSImage(systemSymbolName: settingsSymbolPreferred, accessibilityDescription: "Settings")
|
|
|
|
|
- ?? NSImage(systemSymbolName: "gearshape", accessibilityDescription: "Settings")
|
|
|
|
|
- iconContainer.addSubview(iconView)
|
|
|
|
|
-
|
|
|
|
|
- let label = makeLabel("Settings", size: 10, color: settingsSelected ? primaryText : secondaryText, weight: .regular, centered: true)
|
|
|
|
|
- label.translatesAutoresizingMaskIntoConstraints = false
|
|
|
|
|
- settingsRow.addSubview(label)
|
|
|
|
|
-
|
|
|
|
|
- let hit = NSButton(title: "", target: self, action: #selector(homeSidebarItemTapped(_:)))
|
|
|
|
|
- hit.identifier = NSUserInterfaceItemIdentifier("Settings")
|
|
|
|
|
- hit.isBordered = false
|
|
|
|
|
- hit.bezelStyle = .shadowlessSquare
|
|
|
|
|
- hit.focusRingType = .none
|
|
|
|
|
- hit.translatesAutoresizingMaskIntoConstraints = false
|
|
|
|
|
- settingsRow.addSubview(hit, positioned: .above, relativeTo: nil)
|
|
|
|
|
-
|
|
|
|
|
- NSLayoutConstraint.activate([
|
|
|
|
|
- iconContainer.topAnchor.constraint(equalTo: settingsRow.topAnchor, constant: 9),
|
|
|
|
|
- iconContainer.centerXAnchor.constraint(equalTo: settingsRow.centerXAnchor),
|
|
|
|
|
- iconContainer.widthAnchor.constraint(equalToConstant: 26),
|
|
|
|
|
- iconContainer.heightAnchor.constraint(equalToConstant: 26),
|
|
|
|
|
-
|
|
|
|
|
- iconView.centerXAnchor.constraint(equalTo: iconContainer.centerXAnchor),
|
|
|
|
|
- iconView.centerYAnchor.constraint(equalTo: iconContainer.centerYAnchor),
|
|
|
|
|
- iconView.widthAnchor.constraint(equalToConstant: 22),
|
|
|
|
|
- iconView.heightAnchor.constraint(equalToConstant: 22),
|
|
|
|
|
-
|
|
|
|
|
- label.topAnchor.constraint(equalTo: iconContainer.bottomAnchor, constant: 6),
|
|
|
|
|
- label.centerXAnchor.constraint(equalTo: settingsRow.centerXAnchor),
|
|
|
|
|
- label.bottomAnchor.constraint(equalTo: settingsRow.bottomAnchor, constant: -8),
|
|
|
|
|
-
|
|
|
|
|
- hit.leadingAnchor.constraint(equalTo: settingsRow.leadingAnchor),
|
|
|
|
|
- hit.trailingAnchor.constraint(equalTo: settingsRow.trailingAnchor),
|
|
|
|
|
- hit.topAnchor.constraint(equalTo: settingsRow.topAnchor),
|
|
|
|
|
- hit.bottomAnchor.constraint(equalTo: settingsRow.bottomAnchor)
|
|
|
|
|
- ])
|
|
|
|
|
-
|
|
|
|
|
- homeSidebarRowViews["Settings"] = settingsRow
|
|
|
|
|
- homeSidebarIconViews["Settings"] = iconView
|
|
|
|
|
- homeSidebarLabels["Settings"] = label
|
|
|
|
|
-
|
|
|
|
|
- stack.addArrangedSubview(settingsRow)
|
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
NSLayoutConstraint.activate([
|
|
NSLayoutConstraint.activate([
|
|
|
stack.leadingAnchor.constraint(equalTo: sidebar.leadingAnchor, constant: 4),
|
|
stack.leadingAnchor.constraint(equalTo: sidebar.leadingAnchor, constant: 4),
|
|
@@ -5998,8 +5929,10 @@ class ViewController: NSViewController {
|
|
|
row.layer?.backgroundColor = selected ? sidebarActiveBackground.withAlphaComponent(0.95).cgColor : NSColor.clear.cgColor
|
|
row.layer?.backgroundColor = selected ? sidebarActiveBackground.withAlphaComponent(0.95).cgColor : NSColor.clear.cgColor
|
|
|
homeSidebarLabels[item]?.textColor = selected ? primaryText : secondaryText
|
|
homeSidebarLabels[item]?.textColor = selected ? primaryText : secondaryText
|
|
|
homeSidebarIconViews[item]?.contentTintColor = selected ? primaryText : secondaryText
|
|
homeSidebarIconViews[item]?.contentTintColor = selected ? primaryText : secondaryText
|
|
|
- let symbolName = sidebarSymbolName(for: item, filled: selected)
|
|
|
|
|
- if let image = NSImage(systemSymbolName: symbolName, accessibilityDescription: item) {
|
|
|
|
|
|
|
+ let preferredSymbol = sidebarSymbolName(for: item, filled: selected)
|
|
|
|
|
+ let fallbackSymbol = sidebarSymbolName(for: item, filled: false)
|
|
|
|
|
+ if let image = NSImage(systemSymbolName: preferredSymbol, accessibilityDescription: item)
|
|
|
|
|
+ ?? NSImage(systemSymbolName: fallbackSymbol, accessibilityDescription: item) {
|
|
|
homeSidebarIconViews[item]?.image = image
|
|
homeSidebarIconViews[item]?.image = image
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|