diff --git a/Meshtastic/Views/Nodes/Helpers/NodeDetail.swift b/Meshtastic/Views/Nodes/Helpers/NodeDetail.swift index fee6fdbe..2637e81c 100644 --- a/Meshtastic/Views/Nodes/Helpers/NodeDetail.swift +++ b/Meshtastic/Views/Nodes/Helpers/NodeDetail.swift @@ -17,6 +17,7 @@ struct NodeDetail: View { @State private var showingRebootConfirm: Bool = false @ObservedObject var node: NodeInfoEntity + var columnVisibility = NavigationSplitViewVisibility.all var body: some View { @@ -146,12 +147,13 @@ struct NodeDetail: View { } .edgesIgnoringSafeArea([.leading, .trailing]) .navigationBarTitle(String(node.user?.longName ?? "unknown".localized), displayMode: .inline) - .navigationBarItems(trailing: + .navigationBarItems( + trailing: ZStack { - ConnectedDevice( - bluetoothOn: bleManager.isSwitchedOn, - deviceConnected: bleManager.connectedPeripheral != nil, - name: (bleManager.connectedPeripheral != nil) ? bleManager.connectedPeripheral.shortName : "?", phoneOnly: true) + ConnectedDevice( + bluetoothOn: bleManager.isSwitchedOn, + deviceConnected: bleManager.connectedPeripheral != nil, + name: (bleManager.connectedPeripheral != nil) ? bleManager.connectedPeripheral.shortName : "?", phoneOnly: true) }) } .padding(.bottom, 2) diff --git a/Meshtastic/Views/Nodes/Helpers/NodeMapControl.swift b/Meshtastic/Views/Nodes/Helpers/NodeMapControl.swift index de1e8eff..75a455b7 100644 --- a/Meshtastic/Views/Nodes/Helpers/NodeMapControl.swift +++ b/Meshtastic/Views/Nodes/Helpers/NodeMapControl.swift @@ -87,30 +87,31 @@ struct NodeMapControl: View { .pickerStyle(.menu) .padding(5) VStack { - Label(temperature?.formatted(.measurement(width: .narrow)) ?? "??", systemImage: symbolName) - .font(.caption) + VStack { + Label(temperature?.formatted(.measurement(width: .narrow)) ?? "??", systemImage: symbolName) + .font(.caption) + + Label("\(humidity ?? 0)%", systemImage: "humidity") + .font(.caption2) - Label("\(humidity ?? 0)%", systemImage: "humidity") - .font(.caption2) + AsyncImage(url: attributionLogo) { image in + image + .resizable() + .scaledToFit() + } placeholder: { + ProgressView() + .controlSize(.mini) + } + .frame(height: 10) + + Link("Other data sources", destination: attributionLink ?? URL(string: "https://weather-data.apple.com/legal-attribution.html")!) + .font(.caption2) + } + .padding(5) + } - .padding(10) .background(.thinMaterial, in: RoundedRectangle(cornerRadius: 12, style: .continuous)) .padding(5) - VStack { - AsyncImage(url: attributionLogo) { image in - image - .resizable() - .scaledToFit() - } placeholder: { - ProgressView() - .controlSize(.mini) - } - .frame(height: 15) - - Link("Other data sources", destination: attributionLink ?? URL(string: "https://weather-data.apple.com/legal-attribution.html")!) - } - .font(.footnote) - .padding(.bottom, 5) .task { do { if node.hasPositions { diff --git a/Meshtastic/Views/Nodes/NodeList.swift b/Meshtastic/Views/Nodes/NodeList.swift index 9a971ac0..2d916934 100644 --- a/Meshtastic/Views/Nodes/NodeList.swift +++ b/Meshtastic/Views/Nodes/NodeList.swift @@ -21,10 +21,6 @@ struct NodeList: View { @State private var columnVisibility = NavigationSplitViewVisibility.all @State private var selectedNode: NodeInfoEntity? - @State private var selectedDetail: SelectedDetail? - - @SceneStorage("selectedDetailView") var selectedDetailView: String? - @State private var searchText = "" var nodesQuery: Binding { Binding { @@ -69,20 +65,29 @@ struct NodeList: View { name: (bleManager.connectedPeripheral != nil) ? bleManager.connectedPeripheral.shortName : "?", phoneOnly: true) }) } content: { - if let node = selectedNode { - NodeDetail(node: node) - + NodeDetail(node: node, columnVisibility: columnVisibility) + VStack { + Button { + columnVisibility = .detailOnly + } label: { + Image(systemName: "rectangle") + } + } + .padding(.bottom, 5) } else { Text("select.node") } - } detail: { Text("Select something to view") } .navigationSplitViewStyle(.balanced) .onChange(of: selectedNode) { _ in - selectedDetail = nil + if selectedNode == nil { + columnVisibility = .all + } else { + columnVisibility = .doubleColumn + } } .onAppear { if self.bleManager.context == nil {