Skip to content

Commit b9838c4

Browse files
committed
refactor(ui): drop SSH lock glyph, use native macOS "via X" subtitle pattern
1 parent c895c54 commit b9838c4

1 file changed

Lines changed: 9 additions & 22 deletions

File tree

TablePro/Views/Connection/WelcomeConnectionRow.swift

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@ struct WelcomeConnectionRow: View {
1515
return TagStorage.shared.tag(for: tagId)
1616
}
1717

18-
private var sshEnabled: Bool {
19-
connection.resolvedSSHConfig.enabled
20-
}
21-
2218
private var showsLocalOnly: Bool {
2319
connection.localOnly && !connection.isSample
2420
}
@@ -56,14 +52,6 @@ struct WelcomeConnectionRow: View {
5652
@ViewBuilder
5753
private var trailingAccessories: some View {
5854
HStack(spacing: 8) {
59-
if sshEnabled {
60-
Image(systemName: "lock.fill")
61-
.imageScale(.small)
62-
.foregroundStyle(.tertiary)
63-
.help(sshTunnelTooltip)
64-
.accessibilityLabel(String(localized: "SSH tunnel"))
65-
}
66-
6755
if showsLocalOnly {
6856
Image(systemName: "icloud.slash")
6957
.imageScale(.small)
@@ -90,6 +78,9 @@ struct WelcomeConnectionRow: View {
9078

9179
private var subtitleText: String {
9280
var components: [String] = [primaryEndpoint]
81+
if let viaText = sshViaText {
82+
components.append(viaText)
83+
}
9384
if connection.isSample {
9485
components.append(String(localized: "Sample"))
9586
}
@@ -114,16 +105,12 @@ struct WelcomeConnectionRow: View {
114105
return "\(connection.host):\(connection.port)"
115106
}
116107

117-
private var sshTunnelTooltip: String {
108+
/// Apple's semantic convention for routed/relayed connections is the
109+
/// "via X" suffix (AirDrop, Mail forwarded threads, Network preferences).
110+
/// Returns nil when SSH is not enabled or the bastion host is empty.
111+
private var sshViaText: String? {
118112
let ssh = connection.resolvedSSHConfig
119-
let userPrefix = ssh.username.isEmpty ? "" : "\(ssh.username)@"
120-
let portSuffix: String
121-
if let port = ssh.port, port != 22 {
122-
portSuffix = ":\(port)"
123-
} else {
124-
portSuffix = ""
125-
}
126-
let target = "\(userPrefix)\(ssh.host)\(portSuffix)"
127-
return String(format: String(localized: "Connects via SSH tunnel: %@"), target)
113+
guard ssh.enabled, !ssh.host.isEmpty else { return nil }
114+
return String(format: String(localized: "via %@"), ssh.host)
128115
}
129116
}

0 commit comments

Comments
 (0)