@@ -199,6 +199,7 @@ struct SidebarView: View {
200struct ConnectionStatusView: View {
200struct ConnectionStatusView: View {
201 @Environment(AppState.self) private var appState
201 @Environment(AppState.self) private var appState
202+ static let addConnectionID = UUID(uuidString: "00000000-0000-0000-0000-000000000000")!
203 var body: some View {
204 var body: some View {
204 VStack(alignment: .leading, spacing: 4) {
205 VStack(alignment: .leading, spacing: 4) {
@@ -211,38 +212,26 @@ struct ConnectionStatusView: View {
211 Picker("Connection", selection: Binding<UUID>(
212 Picker("Connection", selection: Binding<UUID>(
212 get: { connection.id },
213 get: { connection.id },
213 set: { newID in
214 set: { newID in
215+ if newID == ConnectionStatusView.addConnectionID {
216+ appState.editingConnection = nil
217+ appState.showConnectionSheet = true
214− if let conn = appState.connections.first(where: { $0.id == newID }) {
218+ } else if let conn = appState.connections.first(where: { $0.id == newID }) {
215 Task { await appState.connect(to: conn) }
219 Task { await appState.connect(to: conn) }
219− ForEach(appState.connections) { conn in
224+ ForEach(appState.connections) { conn in
220− Text(conn.name).tag(conn.id)
225+ Text(conn.name).tag(conn.id)
229+ Text("Add Connection...").tag(ConnectionStatusView.addConnectionID)
223 .labelsHidden()
232 .labelsHidden()
224 .pickerStyle(.menu)
233 .pickerStyle(.menu)
225 .accessibilityLabel("Connection selector")
234 .accessibilityLabel("Connection selector")
228− Button("Add Connection...") {
229− appState.editingConnection = nil
230− appState.showConnectionSheet = true
232− Button("Edit Connection...") {
233− appState.editingConnection = connection
234− appState.showConnectionSheet = true
237− Button("Disconnect") {
238− appState.disconnect()
241− Image(systemName: "gear")
243− .menuStyle(.borderlessButton)
245− .accessibilityLabel("Connection options")
247 } else if appState.isConnecting {
236 } else if appState.isConnecting {