|
|
@@ -1248,34 +1248,53 @@ class ViewController: NSViewController {
|
|
1248
|
1248
|
if style == .home {
|
|
1249
|
1249
|
let spacer = NSView()
|
|
1250
|
1250
|
spacer.translatesAutoresizingMaskIntoConstraints = false
|
|
1251
|
|
- // Keep sidebar icons at the same vertical positions even when the window grows.
|
|
1252
|
|
- // A flexible spacer will expand with height and push icons away from their default placement.
|
|
|
1251
|
+ // Keep Settings in a stable position (no vertical shifting on resize).
|
|
1253
|
1252
|
spacer.heightAnchor.constraint(equalToConstant: 12).isActive = true
|
|
1254
|
1253
|
spacer.setContentHuggingPriority(.required, for: .vertical)
|
|
1255
|
1254
|
spacer.setContentCompressionResistancePriority(.required, for: .vertical)
|
|
1256
|
1255
|
stack.addArrangedSubview(spacer)
|
|
1257
|
1256
|
|
|
1258
|
|
- let settingsBadge = NSView()
|
|
1259
|
|
- settingsBadge.wantsLayer = true
|
|
1260
|
|
- settingsBadge.layer?.backgroundColor = NSColor.clear.cgColor
|
|
1261
|
|
- settingsBadge.layer?.cornerRadius = 12
|
|
1262
|
|
- settingsBadge.translatesAutoresizingMaskIntoConstraints = false
|
|
1263
|
|
- settingsBadge.widthAnchor.constraint(equalToConstant: 32).isActive = true
|
|
1264
|
|
- settingsBadge.heightAnchor.constraint(equalToConstant: 32).isActive = true
|
|
1265
|
|
- let gearIcon = NSImageView()
|
|
1266
|
|
- gearIcon.translatesAutoresizingMaskIntoConstraints = false
|
|
1267
|
|
- gearIcon.image = NSImage(systemSymbolName: "gearshape", accessibilityDescription: "Settings")
|
|
1268
|
|
- gearIcon.contentTintColor = primaryText
|
|
1269
|
|
- gearIcon.symbolConfiguration = NSImage.SymbolConfiguration(pointSize: 20, weight: .regular)
|
|
1270
|
|
- gearIcon.imageScaling = .scaleProportionallyUpOrDown
|
|
1271
|
|
- settingsBadge.addSubview(gearIcon)
|
|
|
1257
|
+ let settingsRow = NSView()
|
|
|
1258
|
+ settingsRow.translatesAutoresizingMaskIntoConstraints = false
|
|
|
1259
|
+ settingsRow.wantsLayer = true
|
|
|
1260
|
+ settingsRow.layer?.backgroundColor = NSColor.clear.cgColor
|
|
|
1261
|
+ settingsRow.layer?.cornerRadius = 12
|
|
|
1262
|
+ settingsRow.widthAnchor.constraint(equalToConstant: 68).isActive = true
|
|
|
1263
|
+ settingsRow.heightAnchor.constraint(equalToConstant: 66).isActive = true
|
|
|
1264
|
+
|
|
|
1265
|
+ let iconContainer = NSView()
|
|
|
1266
|
+ iconContainer.translatesAutoresizingMaskIntoConstraints = false
|
|
|
1267
|
+ settingsRow.addSubview(iconContainer)
|
|
|
1268
|
+
|
|
|
1269
|
+ let iconView = NSImageView()
|
|
|
1270
|
+ iconView.translatesAutoresizingMaskIntoConstraints = false
|
|
|
1271
|
+ iconView.contentTintColor = primaryText
|
|
|
1272
|
+ iconView.imageScaling = .scaleProportionallyUpOrDown
|
|
|
1273
|
+ iconView.symbolConfiguration = NSImage.SymbolConfiguration(pointSize: 20, weight: .regular)
|
|
|
1274
|
+ iconView.image = NSImage(systemSymbolName: "gearshape", accessibilityDescription: "Settings")
|
|
|
1275
|
+ iconContainer.addSubview(iconView)
|
|
|
1276
|
+
|
|
|
1277
|
+ let label = makeLabel("Settings", size: 10, color: secondaryText, weight: .regular, centered: true)
|
|
|
1278
|
+ label.translatesAutoresizingMaskIntoConstraints = false
|
|
|
1279
|
+ settingsRow.addSubview(label)
|
|
|
1280
|
+
|
|
1272
|
1281
|
NSLayoutConstraint.activate([
|
|
1273
|
|
- gearIcon.centerXAnchor.constraint(equalTo: settingsBadge.centerXAnchor),
|
|
1274
|
|
- gearIcon.centerYAnchor.constraint(equalTo: settingsBadge.centerYAnchor),
|
|
1275
|
|
- gearIcon.widthAnchor.constraint(equalToConstant: 22),
|
|
1276
|
|
- gearIcon.heightAnchor.constraint(equalToConstant: 22)
|
|
|
1282
|
+ iconContainer.topAnchor.constraint(equalTo: settingsRow.topAnchor, constant: 9),
|
|
|
1283
|
+ iconContainer.centerXAnchor.constraint(equalTo: settingsRow.centerXAnchor),
|
|
|
1284
|
+ iconContainer.widthAnchor.constraint(equalToConstant: 26),
|
|
|
1285
|
+ iconContainer.heightAnchor.constraint(equalToConstant: 26),
|
|
|
1286
|
+
|
|
|
1287
|
+ iconView.centerXAnchor.constraint(equalTo: iconContainer.centerXAnchor),
|
|
|
1288
|
+ iconView.centerYAnchor.constraint(equalTo: iconContainer.centerYAnchor),
|
|
|
1289
|
+ iconView.widthAnchor.constraint(equalToConstant: 22),
|
|
|
1290
|
+ iconView.heightAnchor.constraint(equalToConstant: 22),
|
|
|
1291
|
+
|
|
|
1292
|
+ label.topAnchor.constraint(equalTo: iconContainer.bottomAnchor, constant: 6),
|
|
|
1293
|
+ label.centerXAnchor.constraint(equalTo: settingsRow.centerXAnchor),
|
|
|
1294
|
+ label.bottomAnchor.constraint(equalTo: settingsRow.bottomAnchor, constant: -8)
|
|
1277
|
1295
|
])
|
|
1278
|
|
- stack.addArrangedSubview(settingsBadge)
|
|
|
1296
|
+
|
|
|
1297
|
+ stack.addArrangedSubview(settingsRow)
|
|
1279
|
1298
|
}
|
|
1280
|
1299
|
|
|
1281
|
1300
|
NSLayoutConstraint.activate([
|