mirror of
https://github.com/meshtastic/Meshtastic-Apple.git
synced 2026-04-20 22:13:56 +00:00
34 lines
1.1 KiB
Swift
34 lines
1.1 KiB
Swift
import SwiftUI
|
|
|
|
struct NodeRow: View {
|
|
var node: NodeInfoModel
|
|
var index: Int
|
|
|
|
var body: some View {
|
|
VStack (alignment: .leading) {
|
|
HStack() {
|
|
|
|
CircleText(text: node.user.shortName, color: Color.blue).offset(y: 1).padding(.trailing, 5)
|
|
Text(node.user.longName).font(.title)
|
|
}.padding(.bottom, 2)
|
|
HStack (alignment: .top){
|
|
|
|
Image(systemName: "clock").font(.subheadline).foregroundColor(.blue)
|
|
let lastHeard = Date(timeIntervalSince1970: node.lastHeard)
|
|
Text("Last Heard:").font(.subheadline).foregroundColor(.gray)
|
|
Text(lastHeard, style: .relative).font(.subheadline).foregroundColor(.gray)
|
|
}
|
|
}.padding([.leading, .top, .bottom])
|
|
}
|
|
}
|
|
|
|
struct NodeRow_Previews: PreviewProvider {
|
|
static var nodes = ModelData().nodes
|
|
|
|
static var previews: some View {
|
|
Group {
|
|
NodeRow(node: nodes[0], index: 0)
|
|
}
|
|
.previewLayout(.fixed(width: 300, height: 70))
|
|
}
|
|
}
|