Meshtastic-Apple/Meshtastic/Views/Helpers/NodeAnnotation.swift

42 lines
840 B
Swift
Raw Normal View History

2022-05-28 01:19:44 -07:00
import Foundation
import SwiftUI
struct NodeAnnotation: View {
let time: Date
let sixMonthsAgo = Calendar.current.date(byAdding: .month, value: -6, to: Date())
2022-05-28 01:19:44 -07:00
var body: some View {
if (time >= sixMonthsAgo!) {
VStack(spacing: 0) {
Text(time, style: .offset)
.font(.caption2).foregroundColor(.accentColor)
.padding(5)
.background(Color(.white))
.cornerRadius(10)
}
} else {
VStack(spacing: 0) {
2022-12-30 09:35:05 -08:00
Text("unknown.age")
.font(.caption2).foregroundColor(.accentColor)
.padding(5)
.background(Color(.white))
.cornerRadius(10)
}
}
2022-05-28 01:19:44 -07:00
Image(systemName: "mappin.circle.fill")
.font(.largeTitle)
.foregroundColor(.accentColor)
2022-05-28 01:19:44 -07:00
Image(systemName: "arrowtriangle.down.fill")
.font(.caption)
.foregroundColor(.accentColor)
2022-05-28 01:19:44 -07:00
.offset(x: 0, y: -5)
}
}