diff --git a/ShhShell/Host/SymbolPreview.swift b/ShhShell/Host/SymbolPreview.swift index f545a21..a5312db 100644 --- a/ShhShell/Host/SymbolPreview.swift +++ b/ShhShell/Host/SymbolPreview.swift @@ -8,29 +8,28 @@ import SwiftUI struct SymbolPreview: View { - @State var symbol: Symbol - @State var label: String + @State var host: Host var body: some View { ZStack(alignment: .center) { - if symbol.isCustom { - Image(symbol.sf) + if host.symbol.isCustom { + Image(host.symbol.sf) .resizable().scaledToFit() .symbolRenderingMode(.monochrome) .padding(5) } else { - Image(systemName: symbol.sf) + Image(systemName: host.symbol.sf) .resizable().scaledToFit() .symbolRenderingMode(.monochrome) .padding(5) } - Text(label) + Text(host.label) .font(.headline) - .offset(symbol.offset) + .offset(host.symbol.offset) } } } #Preview { - SymbolPreview(symbol: Symbol.desktopcomputer, label: "lo0") + SymbolPreview(host: Host.debug) } diff --git a/ShhShell/Views/Hosts/ConnectionView.swift b/ShhShell/Views/Hosts/ConnectionView.swift index 705925b..8c0bda9 100644 --- a/ShhShell/Views/Hosts/ConnectionView.swift +++ b/ShhShell/Views/Hosts/ConnectionView.swift @@ -25,19 +25,31 @@ struct ConnectionView: View { NavigationStack { List { Section { - HStack { - Picker("", selection: $handler.host.symbol) { - ForEach(Symbol.allCases, id: \.self) { symbol in - SymbolPreview(symbol: symbol, label: handler.host.label) - .tag(symbol) - .frame(width: 60, height: 60) + HStack { + Picker("", selection: $handler.host.symbol) { + ForEach(Symbol.allCases, id: \.self) { symbol in + Group { + if symbol.isCustom { + Image(symbol.sf) + .resizable().scaledToFit() + } else { + Image(systemName: symbol.sf) + .resizable().scaledToFit() + } } + .padding(5) + .tag(symbol) } - .pickerStyle(SegmentedPickerStyle()) } - .scrollIndicators(.hidden) + .controlSize(.large) + .pickerStyle(SegmentedPickerStyle()) + + SymbolPreview(host: handler.host) + .frame(width: 60, height: 60) + TextField("label", text: $handler.host.label) .textFieldStyle(.roundedBorder) + } } Section { HStack { diff --git a/ShhShell/Views/Hosts/HostsView.swift b/ShhShell/Views/Hosts/HostsView.swift index b49719d..d2f7ca5 100644 --- a/ShhShell/Views/Hosts/HostsView.swift +++ b/ShhShell/Views/Hosts/HostsView.swift @@ -44,8 +44,9 @@ struct HostsView: View { keyManager: keyManager ) } label: { - SymbolPreview(symbol: host.symbol, label: host.label) - .frame(width: 30, height: 30) + SymbolPreview(host: host) + .frame(width: 40, height: 40) + Text(hostsManager.makeLabel(forHost: host)) } .animation(.default, value: host) .swipeActions(edge: .trailing) {