Add padding to node list items.

This commit is contained in:
Garth Vander Houwen 2022-11-20 15:55:46 -08:00
parent 537ad1bf73
commit ddf981b4d0
3 changed files with 37 additions and 47 deletions

View file

@ -17,7 +17,7 @@ struct InvalidVersion: View {
VStack {
Text("Firmware Update Required")
Text("Update Firmware")
.font(.largeTitle)
.foregroundColor(.orange)
@ -34,21 +34,16 @@ struct InvalidVersion: View {
.padding()
}
.padding()
Divider()
.padding(.top)
VStack{
Text("🦕 End of life Version 🦖 ☄️")
.font(.title3)
.foregroundColor(.orange)
.padding(.bottom)
Text("Version \(minimumVersion) includes breaking changes to devices and the client apps. Only nodes version \(minimumVersion) and above are supported.")
.font(.callout)
.padding([.leading, .trailing, .bottom])
Link("Version 1.2 End of life (EOL) Info", destination: URL(string: "https://meshtastic.org/docs/1.2-End-of-life/")!)
.font(.callout)

View file

@ -39,55 +39,52 @@ struct Contacts: View {
let lastMessageTime = Date(timeIntervalSince1970: TimeInterval(Int64((mostRecent?.messageTimestamp ?? 0 ))))
let lastMessageDay = Calendar.current.dateComponents([.day], from: lastMessageTime).day ?? 0
let currentDay = Calendar.current.dateComponents([.day], from: Date()).day ?? 0
//HStack {
VStack(alignment: .leading) {
HStack {
CircleText(text: String(channel.index), color: .gray, circleSize: 52, fontSize: 40)
.padding(.trailing, 5)
VStack {
HStack {
Text(String(channel.name ?? "Channel \(channel.index)").camelCaseToWords()).font(.headline)
Spacer()
if channel.allPrivateMessages.count > 0 {
VStack (alignment: .trailing) {
if lastMessageDay == currentDay {
Text(lastMessageTime, style: .time )
.font(.subheadline)
} else if lastMessageDay == (currentDay - 1) {
Text("Yesterday")
.font(.subheadline)
} else if lastMessageDay < (currentDay - 1) && lastMessageDay > (currentDay - 5) {
Text(lastMessageTime.formattedDate(format: "MM/dd/yy"))
.font(.subheadline)
} else if lastMessageDay < (currentDay - 1800) {
Text(lastMessageTime.formattedDate(format: "MM/dd/yy"))
.font(.subheadline)
}
}
.brightness(-0.20)
}
}
VStack(alignment: .leading) {
HStack {
CircleText(text: String(channel.index), color: .gray, circleSize: 52, fontSize: 40)
.padding(.trailing, 5)
VStack {
HStack {
Text(String(channel.name ?? "Channel \(channel.index)").camelCaseToWords()).font(.headline)
Spacer()
if channel.allPrivateMessages.count > 0 {
HStack(alignment: .top) {
Text("\(mostRecent != nil ? mostRecent!.messagePayload! : " ")")
.truncationMode(.tail)
.frame(maxWidth: .infinity, alignment: .leading)
.brightness(-0.20)
.font(.body)
VStack (alignment: .trailing) {
if lastMessageDay == currentDay {
Text(lastMessageTime, style: .time )
.font(.subheadline)
} else if lastMessageDay == (currentDay - 1) {
Text("Yesterday")
.font(.subheadline)
} else if lastMessageDay < (currentDay - 1) && lastMessageDay > (currentDay - 5) {
Text(lastMessageTime.formattedDate(format: "MM/dd/yy"))
.font(.subheadline)
} else if lastMessageDay < (currentDay - 1800) {
Text(lastMessageTime.formattedDate(format: "MM/dd/yy"))
.font(.subheadline)
}
}
.brightness(-0.20)
}
}
if channel.allPrivateMessages.count > 0 {
HStack(alignment: .top) {
Text("\(mostRecent != nil ? mostRecent!.messagePayload! : " ")")
.truncationMode(.tail)
.frame(maxWidth: .infinity, alignment: .leading)
.brightness(-0.20)
.font(.body)
}
}
.frame(maxWidth: .infinity, alignment: .leading)
}
.frame(maxWidth: .infinity, alignment: .leading)
}
// }
}
}
}
.frame(maxWidth: .infinity, maxHeight: 80, alignment: .leading)
}
}
.padding(.top, 10)
.padding(.bottom, 10)
.padding([.top, .bottom])
}
}
Section(header: Text("Direct Messages")) {

View file

@ -46,7 +46,6 @@ struct NodeList: View {
.padding(.trailing, 5)
VStack(alignment: .leading) {
Text(node.user?.longName ?? "Unknown").font(.headline)
.padding(.bottom, 2)
if connected {
HStack(alignment: .bottom) {
Image(systemName: "repeat.circle.fill")
@ -54,7 +53,6 @@ struct NodeList: View {
.symbolRenderingMode(.hierarchical)
Text("Currently Connected").font(.callout)
}
.padding(.bottom, 2)
}
if node.positions?.count ?? 0 > 0 && (bleManager.connectedPeripheral != nil && bleManager.connectedPeripheral.num != node.num) {
HStack(alignment: .bottom) {
@ -70,7 +68,6 @@ struct NodeList: View {
DistanceText(meters: metersAway).font(.subheadline)
}
}
.padding(.bottom, 2)
}
HStack(alignment: .bottom) {
Image(systemName: "clock.badge.checkmark.fill")
@ -84,6 +81,7 @@ struct NodeList: View {
}
}
}
.padding([.top, .bottom])
}
}
.navigationTitle("All Nodes")