|
|
@@ -784,7 +784,7 @@ class ViewController: NSViewController {
|
|
784
|
784
|
let chromeHeader = NSView()
|
|
785
|
785
|
chromeHeader.wantsLayer = true
|
|
786
|
786
|
chromeHeader.layer?.backgroundColor = chromeUnifiedBackground.cgColor
|
|
787
|
|
- let sidebar = makeSidebar(items: ["Home", "Meetings", "Chat", "Scheduler", "Hub", "More"], selected: "Home", style: .home)
|
|
|
787
|
+ let sidebar = makeSidebar(items: ["Home", "Meetings", "Scheduler"], selected: "Home", style: .home)
|
|
788
|
788
|
let content = NSView()
|
|
789
|
789
|
content.wantsLayer = true
|
|
790
|
790
|
content.layer?.backgroundColor = NSColor.clear.cgColor
|
|
|
@@ -1161,19 +1161,76 @@ class ViewController: NSViewController {
|
|
1161
|
1161
|
row.layer?.cornerRadius = style == .home ? 12 : 10
|
|
1162
|
1162
|
row.widthAnchor.constraint(equalToConstant: style == .home ? 68 : 70).isActive = true
|
|
1163
|
1163
|
|
|
1164
|
|
- let icon = makeLabel(selectedRow ? "⌂" : "◻︎", size: style == .home ? 14 : 15, color: primaryText, weight: .regular, centered: true)
|
|
1165
|
|
- let label = makeLabel(item, size: style == .home ? 10 : 11, color: selectedRow ? primaryText : secondaryText, weight: .regular, centered: true)
|
|
1166
|
|
- [icon, label].forEach {
|
|
1167
|
|
- $0.translatesAutoresizingMaskIntoConstraints = false
|
|
1168
|
|
- row.addSubview($0)
|
|
|
1164
|
+ if style == .home {
|
|
|
1165
|
+ let iconContainer = NSView()
|
|
|
1166
|
+ iconContainer.translatesAutoresizingMaskIntoConstraints = false
|
|
|
1167
|
+ row.addSubview(iconContainer)
|
|
|
1168
|
+
|
|
|
1169
|
+ let iconView = NSImageView()
|
|
|
1170
|
+ iconView.translatesAutoresizingMaskIntoConstraints = false
|
|
|
1171
|
+ iconView.contentTintColor = primaryText
|
|
|
1172
|
+ iconView.imageScaling = .scaleProportionallyUpOrDown
|
|
|
1173
|
+ iconView.symbolConfiguration = NSImage.SymbolConfiguration(pointSize: 20, weight: .regular)
|
|
|
1174
|
+ iconView.image = NSImage(systemSymbolName: sidebarSymbolName(for: item), accessibilityDescription: item)
|
|
|
1175
|
+ iconContainer.addSubview(iconView)
|
|
|
1176
|
+
|
|
|
1177
|
+ let label = makeLabel(item, size: 10, color: selectedRow ? primaryText : secondaryText, weight: .regular, centered: true)
|
|
|
1178
|
+ label.translatesAutoresizingMaskIntoConstraints = false
|
|
|
1179
|
+ row.addSubview(label)
|
|
|
1180
|
+
|
|
|
1181
|
+ NSLayoutConstraint.activate([
|
|
|
1182
|
+ iconContainer.topAnchor.constraint(equalTo: row.topAnchor, constant: 9),
|
|
|
1183
|
+ iconContainer.centerXAnchor.constraint(equalTo: row.centerXAnchor),
|
|
|
1184
|
+ iconContainer.widthAnchor.constraint(equalToConstant: 26),
|
|
|
1185
|
+ iconContainer.heightAnchor.constraint(equalToConstant: 26),
|
|
|
1186
|
+
|
|
|
1187
|
+ iconView.centerXAnchor.constraint(equalTo: iconContainer.centerXAnchor),
|
|
|
1188
|
+ iconView.centerYAnchor.constraint(equalTo: iconContainer.centerYAnchor),
|
|
|
1189
|
+ iconView.widthAnchor.constraint(equalToConstant: 22),
|
|
|
1190
|
+ iconView.heightAnchor.constraint(equalToConstant: 22),
|
|
|
1191
|
+
|
|
|
1192
|
+ label.topAnchor.constraint(equalTo: iconContainer.bottomAnchor, constant: 6),
|
|
|
1193
|
+ label.centerXAnchor.constraint(equalTo: row.centerXAnchor),
|
|
|
1194
|
+ label.bottomAnchor.constraint(equalTo: row.bottomAnchor, constant: -8)
|
|
|
1195
|
+ ])
|
|
|
1196
|
+
|
|
|
1197
|
+ if item == "Hub" {
|
|
|
1198
|
+ let badge = makeSidebarBadge(text: "1")
|
|
|
1199
|
+ badge.translatesAutoresizingMaskIntoConstraints = false
|
|
|
1200
|
+ iconContainer.addSubview(badge)
|
|
|
1201
|
+ NSLayoutConstraint.activate([
|
|
|
1202
|
+ badge.centerXAnchor.constraint(equalTo: iconContainer.trailingAnchor, constant: -2),
|
|
|
1203
|
+ badge.centerYAnchor.constraint(equalTo: iconContainer.topAnchor, constant: 5)
|
|
|
1204
|
+ ])
|
|
|
1205
|
+ } else if item == "More" {
|
|
|
1206
|
+ let dot = NSView()
|
|
|
1207
|
+ dot.translatesAutoresizingMaskIntoConstraints = false
|
|
|
1208
|
+ dot.wantsLayer = true
|
|
|
1209
|
+ dot.layer?.backgroundColor = NSColor.systemRed.cgColor
|
|
|
1210
|
+ dot.layer?.cornerRadius = 4
|
|
|
1211
|
+ row.addSubview(dot)
|
|
|
1212
|
+ NSLayoutConstraint.activate([
|
|
|
1213
|
+ dot.widthAnchor.constraint(equalToConstant: 8),
|
|
|
1214
|
+ dot.heightAnchor.constraint(equalToConstant: 8),
|
|
|
1215
|
+ dot.centerXAnchor.constraint(equalTo: iconContainer.centerXAnchor),
|
|
|
1216
|
+ dot.bottomAnchor.constraint(equalTo: iconContainer.topAnchor, constant: -4)
|
|
|
1217
|
+ ])
|
|
|
1218
|
+ }
|
|
|
1219
|
+ } else {
|
|
|
1220
|
+ let icon = makeLabel(selectedRow ? "⌂" : "◻︎", size: 15, color: primaryText, weight: .regular, centered: true)
|
|
|
1221
|
+ let label = makeLabel(item, size: 11, color: selectedRow ? primaryText : secondaryText, weight: .regular, centered: true)
|
|
|
1222
|
+ [icon, label].forEach {
|
|
|
1223
|
+ $0.translatesAutoresizingMaskIntoConstraints = false
|
|
|
1224
|
+ row.addSubview($0)
|
|
|
1225
|
+ }
|
|
|
1226
|
+ NSLayoutConstraint.activate([
|
|
|
1227
|
+ icon.topAnchor.constraint(equalTo: row.topAnchor, constant: 10),
|
|
|
1228
|
+ icon.centerXAnchor.constraint(equalTo: row.centerXAnchor),
|
|
|
1229
|
+ label.topAnchor.constraint(equalTo: icon.bottomAnchor, constant: 5),
|
|
|
1230
|
+ label.centerXAnchor.constraint(equalTo: row.centerXAnchor),
|
|
|
1231
|
+ label.bottomAnchor.constraint(equalTo: row.bottomAnchor, constant: -8)
|
|
|
1232
|
+ ])
|
|
1169
|
1233
|
}
|
|
1170
|
|
- NSLayoutConstraint.activate([
|
|
1171
|
|
- icon.topAnchor.constraint(equalTo: row.topAnchor, constant: style == .home ? 8 : 10),
|
|
1172
|
|
- icon.centerXAnchor.constraint(equalTo: row.centerXAnchor),
|
|
1173
|
|
- label.topAnchor.constraint(equalTo: icon.bottomAnchor, constant: style == .home ? 4 : 5),
|
|
1174
|
|
- label.centerXAnchor.constraint(equalTo: row.centerXAnchor),
|
|
1175
|
|
- label.bottomAnchor.constraint(equalTo: row.bottomAnchor, constant: style == .home ? -7 : -8)
|
|
1176
|
|
- ])
|
|
1177
|
1234
|
stack.addArrangedSubview(row)
|
|
1178
|
1235
|
}
|
|
1179
|
1236
|
|
|
|
@@ -1185,17 +1242,23 @@ class ViewController: NSViewController {
|
|
1185
|
1242
|
|
|
1186
|
1243
|
let settingsBadge = NSView()
|
|
1187
|
1244
|
settingsBadge.wantsLayer = true
|
|
1188
|
|
- settingsBadge.layer?.backgroundColor = NSColor.white.withAlphaComponent(0.03).cgColor
|
|
|
1245
|
+ settingsBadge.layer?.backgroundColor = NSColor.clear.cgColor
|
|
1189
|
1246
|
settingsBadge.layer?.cornerRadius = 12
|
|
1190
|
1247
|
settingsBadge.translatesAutoresizingMaskIntoConstraints = false
|
|
1191
|
|
- settingsBadge.widthAnchor.constraint(equalToConstant: 40).isActive = true
|
|
1192
|
|
- settingsBadge.heightAnchor.constraint(equalToConstant: 40).isActive = true
|
|
1193
|
|
- let gear = makeLabel("⚙︎", size: 14, color: secondaryText, weight: .regular, centered: true)
|
|
1194
|
|
- gear.translatesAutoresizingMaskIntoConstraints = false
|
|
1195
|
|
- settingsBadge.addSubview(gear)
|
|
|
1248
|
+ settingsBadge.widthAnchor.constraint(equalToConstant: 32).isActive = true
|
|
|
1249
|
+ settingsBadge.heightAnchor.constraint(equalToConstant: 32).isActive = true
|
|
|
1250
|
+ let gearIcon = NSImageView()
|
|
|
1251
|
+ gearIcon.translatesAutoresizingMaskIntoConstraints = false
|
|
|
1252
|
+ gearIcon.image = NSImage(systemSymbolName: "gearshape", accessibilityDescription: "Settings")
|
|
|
1253
|
+ gearIcon.contentTintColor = primaryText
|
|
|
1254
|
+ gearIcon.symbolConfiguration = NSImage.SymbolConfiguration(pointSize: 20, weight: .regular)
|
|
|
1255
|
+ gearIcon.imageScaling = .scaleProportionallyUpOrDown
|
|
|
1256
|
+ settingsBadge.addSubview(gearIcon)
|
|
1196
|
1257
|
NSLayoutConstraint.activate([
|
|
1197
|
|
- gear.centerXAnchor.constraint(equalTo: settingsBadge.centerXAnchor),
|
|
1198
|
|
- gear.centerYAnchor.constraint(equalTo: settingsBadge.centerYAnchor)
|
|
|
1258
|
+ gearIcon.centerXAnchor.constraint(equalTo: settingsBadge.centerXAnchor),
|
|
|
1259
|
+ gearIcon.centerYAnchor.constraint(equalTo: settingsBadge.centerYAnchor),
|
|
|
1260
|
+ gearIcon.widthAnchor.constraint(equalToConstant: 22),
|
|
|
1261
|
+ gearIcon.heightAnchor.constraint(equalToConstant: 22)
|
|
1199
|
1262
|
])
|
|
1200
|
1263
|
stack.addArrangedSubview(settingsBadge)
|
|
1201
|
1264
|
}
|
|
|
@@ -1216,6 +1279,43 @@ class ViewController: NSViewController {
|
|
1216
|
1279
|
return sidebar
|
|
1217
|
1280
|
}
|
|
1218
|
1281
|
|
|
|
1282
|
+ private func sidebarSymbolName(for item: String) -> String {
|
|
|
1283
|
+ switch item {
|
|
|
1284
|
+ case "Home":
|
|
|
1285
|
+ return "house"
|
|
|
1286
|
+ case "Meetings":
|
|
|
1287
|
+ return "video"
|
|
|
1288
|
+ case "Chat":
|
|
|
1289
|
+ return "message"
|
|
|
1290
|
+ case "Scheduler":
|
|
|
1291
|
+ return "calendar.badge.clock"
|
|
|
1292
|
+ case "Hub":
|
|
|
1293
|
+ return "square.grid.3x3"
|
|
|
1294
|
+ case "More":
|
|
|
1295
|
+ return "ellipsis"
|
|
|
1296
|
+ default:
|
|
|
1297
|
+ return "circle"
|
|
|
1298
|
+ }
|
|
|
1299
|
+ }
|
|
|
1300
|
+
|
|
|
1301
|
+ private func makeSidebarBadge(text: String) -> NSView {
|
|
|
1302
|
+ let badge = NSView()
|
|
|
1303
|
+ badge.wantsLayer = true
|
|
|
1304
|
+ badge.layer?.backgroundColor = NSColor.systemRed.cgColor
|
|
|
1305
|
+ badge.layer?.cornerRadius = 12 / 2
|
|
|
1306
|
+ badge.widthAnchor.constraint(equalToConstant: 12).isActive = true
|
|
|
1307
|
+ badge.heightAnchor.constraint(equalToConstant: 12).isActive = true
|
|
|
1308
|
+
|
|
|
1309
|
+ let label = makeLabel(text, size: 8, color: .white, weight: .bold, centered: true)
|
|
|
1310
|
+ label.translatesAutoresizingMaskIntoConstraints = false
|
|
|
1311
|
+ badge.addSubview(label)
|
|
|
1312
|
+ NSLayoutConstraint.activate([
|
|
|
1313
|
+ label.centerXAnchor.constraint(equalTo: badge.centerXAnchor),
|
|
|
1314
|
+ label.centerYAnchor.constraint(equalTo: badge.centerYAnchor, constant: -0.3)
|
|
|
1315
|
+ ])
|
|
|
1316
|
+ return badge
|
|
|
1317
|
+ }
|
|
|
1318
|
+
|
|
1219
|
1319
|
@MainActor
|
|
1220
|
1320
|
private func alignNativeTrafficLights() {
|
|
1221
|
1321
|
guard let window = view.window else { return }
|