Clean up node details

This commit is contained in:
Garth Vander Houwen 2022-07-12 08:12:31 -07:00
parent f21a85d8e1
commit 5ed02c2e5e
3 changed files with 51 additions and 55 deletions

View file

@ -68,20 +68,19 @@ struct LocationHistory: View {
.foregroundColor(.gray)
.font(.caption)
}
HStack {
Image(systemName: "arrow.up.arrow.down.circle")
.font(.subheadline)
.foregroundColor(.accentColor)
.symbolRenderingMode(.hierarchical)
Text("Alt:")
.font(.caption)
Text("\(String(mappin.altitude))m")
.foregroundColor(.gray)
.font(.caption)
}
HStack {
Image(systemName: "clock.badge.checkmark.fill")
.font(.subheadline)
.foregroundColor(.accentColor)
@ -98,7 +97,6 @@ struct LocationHistory: View {
}
}
}
.padding()
.navigationTitle("Location History \(node.positions?.count ?? 0) Points")
.navigationBarTitleDisplayMode(.inline)
.navigationBarItems(trailing:

View file

@ -63,13 +63,9 @@ struct NodeDetail: View {
}
)
}
.ignoresSafeArea(.all, edges: [.leading, .trailing])
.frame(idealWidth: bounds.size.width, minHeight: bounds.size.height / 2)
}
}
} else {
@ -79,46 +75,9 @@ struct NodeDetail: View {
.cornerRadius(10)
.frame(width: bounds.size.width, height: bounds.size.height / 2)
}
List {
if (node.positions?.count ?? 0) > 0 {
NavigationLink {
LocationHistory(node: node)
} label: {
Image(systemName: "building.columns")
.symbolRenderingMode(.hierarchical)
.font(.title)
Text("Position History \(node.positions?.count ?? 0) Points")
.font(.title2)
}
.fixedSize(horizontal: false, vertical: true)
}
NavigationLink {
TelemetryLog(node: node)
} label: {
Image(systemName: "chart.xyaxis.line")
.symbolRenderingMode(.hierarchical)
.font(.title)
Text("Telemetry Log \(node.telemetries?.count ?? 0) Readings")
.font(.title2)
}
.fixedSize(horizontal: false, vertical: true)
}
.frame(height: 160)
ScrollView {
if self.bleManager.connectedPeripheral != nil && self.bleManager.connectedPeripheral.num == node.num && self.bleManager.connectedPeripheral.num == node.num {
HStack {
@ -263,12 +222,12 @@ struct NodeDetail: View {
}
.padding()
}
Divider()
}
.padding()
Divider()
HStack(alignment: .center) {
VStack {
HStack {
Image(systemName: "person")
@ -398,6 +357,8 @@ struct NodeDetail: View {
}
.padding(4)
Divider()
HStack(alignment: .center) {
VStack {
HStack {
@ -431,8 +392,42 @@ struct NodeDetail: View {
Text("MAC Address: ")
Text(String(node.user?.macaddr?.macAddressString ?? "not a valid mac address")).foregroundColor(.gray)
}
.padding()
}
List {
if (node.positions?.count ?? 0) > 0 {
NavigationLink {
LocationHistory(node: node)
} label: {
Image(systemName: "building.columns")
.symbolRenderingMode(.hierarchical)
.font(.title)
Text("Position History \(node.positions?.count ?? 0) Points")
.font(.title3)
}
.fixedSize(horizontal: false, vertical: true)
}
if (node.telemetries?.count ?? 0) > 0 {
NavigationLink {
TelemetryLog(node: node)
} label: {
Image(systemName: "chart.xyaxis.line")
.symbolRenderingMode(.hierarchical)
.font(.title)
Text("Telemetry Log \(node.telemetries?.count ?? 0) Readings")
.font(.title3)
}
.fixedSize(horizontal: false, vertical: true)
}
}
.listStyle(GroupedListStyle())
.frame(minHeight:170)
}
}
.edgesIgnoringSafeArea([.leading, .trailing])

View file

@ -177,10 +177,15 @@ struct TelemetryLog: View {
// Device Metrics
VStack {
HStack {
Spacer()
Text("Device Metrics")
.font(.title)
Spacer()
}
HStack {
BatteryIcon(batteryLevel: tel.batteryLevel, font: .callout, color: .accentColor)
@ -329,8 +334,6 @@ struct TelemetryLog: View {
}
}
}
.padding()
.navigationTitle("Telemetry Log \(node.telemetries?.count ?? 0) Readings")
.navigationBarTitleDisplayMode(.inline)
.navigationBarItems(trailing: