Skip to content

Commit 73e3f41

Browse files
authored
fix: welcome window UX polish (#450)
* fix: welcome window UX polish — Escape, focus, Cmd+A, Return hint, menu colors * fix: restore checkmark indicator for current group in Move to Group menu
1 parent efddc9c commit 73e3f41

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

TablePro/Views/Connection/WelcomeWindowView.swift

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ struct WelcomeWindowView: View {
115115
.frame(minWidth: 650, minHeight: 400)
116116
.onAppear {
117117
loadConnections()
118+
focus = .search
118119
}
119120
.confirmationDialog(
120121
connectionsToDelete.count == 1
@@ -241,6 +242,7 @@ struct WelcomeWindowView: View {
241242
// Footer hints
242243
HStack(spacing: 16) {
243244
SyncStatusIndicator()
245+
KeyboardHint(keys: "", label: "Connect")
244246
KeyboardHint(keys: "⌘N", label: "New")
245247
KeyboardHint(keys: "⌘,", label: "Settings")
246248
}
@@ -302,6 +304,13 @@ struct WelcomeWindowView: View {
302304
connectSelectedConnections()
303305
return .handled
304306
}
307+
.onKeyPress(.escape) {
308+
if !searchText.isEmpty {
309+
searchText = ""
310+
}
311+
focus = .connectionList
312+
return .handled
313+
}
305314
.onKeyPress(characters: .init(charactersIn: "\u{7F}\u{08}"), phases: .down) { keyPress in
306315
guard keyPress.modifiers.contains(.command) else { return .ignored }
307316
let toDelete = selectedConnections
@@ -418,6 +427,17 @@ struct WelcomeWindowView: View {
418427
showDeleteConfirmation = true
419428
return .handled
420429
}
430+
.onKeyPress(characters: .init(charactersIn: "a"), phases: .down) { keyPress in
431+
guard keyPress.modifiers.contains(.command) else { return .ignored }
432+
selectedConnectionIds = Set(flatVisibleConnections.map(\.id))
433+
return .handled
434+
}
435+
.onKeyPress(.escape) {
436+
if !selectedConnectionIds.isEmpty {
437+
selectedConnectionIds = []
438+
}
439+
return .handled
440+
}
421441
.onKeyPress(characters: .init(charactersIn: "jn"), phases: [.down, .repeat]) { keyPress in
422442
guard keyPress.modifiers.contains(.control) else { return .ignored }
423443
moveToNextConnection()
@@ -663,9 +683,8 @@ struct WelcomeWindowView: View {
663683
} label: {
664684
HStack {
665685
if !group.color.isDefault {
666-
Circle()
667-
.fill(group.color.color)
668-
.frame(width: 8, height: 8)
686+
Image(systemName: "circle.fill")
687+
.foregroundStyle(group.color.color)
669688
}
670689
Text(group.name)
671690
if currentGroupId == group.id {

0 commit comments

Comments
 (0)