add RelayLog to the bottom of the RelayDetailView

Signed-off-by: Bryan Montz <bryanmontz@me.com>
Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
Bryan Montz
2023-07-09 08:45:36 -05:00
committed by William Casarin
parent a63ea1e22b
commit 91f02ccff5

View File

@@ -12,8 +12,18 @@ struct RelayDetailView: View {
let relay: String
let nip11: RelayMetadata
@ObservedObject var log: RelayLog
@Environment(\.dismiss) var dismiss
init(state: DamusState, relay: String, nip11: RelayMetadata) {
self.state = state
self.relay = relay
self.nip11 = nip11
log = state.relay_model_cache.model(with_relay_id: relay)?.log ?? RelayLog()
}
func check_connection() -> Bool {
for relay in state.pool.relays {
if relay.id == self.relay {
@@ -114,6 +124,15 @@ struct RelayDetailView: View {
Text(nipsList(nips: nips))
}
}
if let log_contents = log.contents {
Section("Log") {
Text(log_contents)
.font(.system(size: 13))
.lineLimit(nil)
.fixedSize(horizontal: false, vertical: true)
}
}
}
}
.onReceive(handle_notify(.switched_timeline)) { notif in